Lines Matching refs:zSql

927   char *zSql;  in shellFakeSchema()  local
933 zSql = sqlite3_mprintf("PRAGMA \"%w\".table_info=%Q;", in shellFakeSchema()
935 sqlite3_prepare_v2(db, zSql, -1, &pStmt, 0); in shellFakeSchema()
936 sqlite3_free(zSql); in shellFakeSchema()
2011 const char *zSql = (const char*)sqlite3_value_text(argv[0]); in sha3QueryFunc() local
2031 if( zSql==0 ) return; in sha3QueryFunc()
2033 while( zSql[0] ){ in sha3QueryFunc()
2034 rc = sqlite3_prepare_v2(db, zSql, -1, &pStmt, &zSql); in sha3QueryFunc()
2037 zSql, sqlite3_errmsg(db)); in sha3QueryFunc()
3405 char *zSql = 0; in completionNext() local
3410 zSql = sqlite3_mprintf( in completionNext()
3413 zSql, zSep, zDb in completionNext()
3415 if( zSql==0 ) return SQLITE_NOMEM; in completionNext()
3419 sqlite3_prepare_v2(pCur->db, zSql, -1, &pCur->pStmt, 0); in completionNext()
3420 sqlite3_free(zSql); in completionNext()
3429 char *zSql = 0; in completionNext() local
3434 zSql = sqlite3_mprintf( in completionNext()
3439 zSql, zSep, zDb, zDb in completionNext()
3441 if( zSql==0 ) return SQLITE_NOMEM; in completionNext()
3445 sqlite3_prepare_v2(pCur->db, zSql, -1, &pCur->pStmt, 0); in completionNext()
3446 sqlite3_free(zSql); in completionNext()
9158 const char *zSql, /* SQL statement(s) to add */
9364 char *zSql; /* SQL statement */ member
9572 const char *zSql /* SQL statement to compile */ in idxPrepareStmt() argument
9574 int rc = sqlite3_prepare_v2(db, zSql, -1, ppStmt, 0); in idxPrepareStmt()
9594 char *zSql; in idxPrintfPrepareStmt() local
9596 zSql = sqlite3_vmprintf(zFmt, ap); in idxPrintfPrepareStmt()
9597 if( zSql==0 ){ in idxPrintfPrepareStmt()
9600 rc = idxPrepareStmt(db, ppStmt, pzErrmsg, zSql); in idxPrintfPrepareStmt()
9601 sqlite3_free(zSql); in idxPrintfPrepareStmt()
10431 "EXPLAIN QUERY PLAN %s", pStmt->zSql in idxFindIndexes()
10454 const char *zSql; in idxFindIndexes() local
10459 zSql = idxHashSearch(&p->hIdx, zIdx, nIdx); in idxFindIndexes()
10460 if( zSql ){ in idxFindIndexes()
10461 idxHashAdd(&rc, &hIdx, zSql, 0); in idxFindIndexes()
10532 const char *zSql = in idxProcessOneTrigger() local
10541 rc = idxPrintfPrepareStmt(p->db, &pSelect, pzErr, zSql, zTab, zTab); in idxProcessOneTrigger()
10644 const char *zSql = (const char*)sqlite3_column_text(pSchema, 2); in idxCreateVtabSchema() local
10647 rc = sqlite3_exec(p->dbv, zSql, 0, 0, pzErrmsg); in idxCreateVtabSchema()
10926 char *zSql; in idxBuildSampleTable() local
10931 zSql = sqlite3_mprintf( in idxBuildSampleTable()
10934 if( zSql==0 ) return SQLITE_NOMEM; in idxBuildSampleTable()
10935 rc = sqlite3_exec(p->dbv, zSql, 0, 0, 0); in idxBuildSampleTable()
10936 sqlite3_free(zSql); in idxBuildSampleTable()
11080 const char *zSql = (const char*)sqlite3_column_text(pSql, 0); in sqlite3_expert_new() local
11081 rc = sqlite3_exec(pNew->dbm, zSql, 0, 0, pzErrmsg); in sqlite3_expert_new()
11134 const char *zSql, /* SQL statement to add */ in sqlite3_expert_sql() argument
11140 const char *zStmt = zSql; in sqlite3_expert_sql()
11154 pNew->zSql = (char*)&pNew[1]; in sqlite3_expert_sql()
11155 memcpy(pNew->zSql, z, n+1); in sqlite3_expert_sql()
11239 if( pStmt ) zRet = pStmt->zSql; in sqlite3_expert_report()
11947 char *zSql = 0; in dbdataDbsize() local
11951 zSql = sqlite3_mprintf("PRAGMA %Q.page_count", zSchema); in dbdataDbsize()
11952 if( zSql==0 ) return SQLITE_NOMEM; in dbdataDbsize()
11953 rc = sqlite3_prepare_v2(pTab->db, zSql, -1, &pStmt, 0); in dbdataDbsize()
11954 sqlite3_free(zSql); in dbdataDbsize()
13958 const char *zSql; /* The text of the SQL statement */ in explain_data_prepare() local
13975 zSql = sqlite3_sql(pSql); in explain_data_prepare()
13976 if( zSql==0 ) return; in explain_data_prepare()
13977 for(z=zSql; *z==' ' || *z=='\t' || *z=='\n' || *z=='\f' || *z=='\r'; z++); in explain_data_prepare()
14441 const char *zSql, in expertHandleSQL() argument
14446 return sqlite3_expert_sql(pState->expert.pExpert, zSql, pzErr); in expertHandleSQL()
14483 const char *zSql = sqlite3_expert_report(p, i, EXPERT_REPORT_SQL); in expertFinish() local
14489 raw_printf(out, "%s\n\n", zSql); in expertFinish()
14570 const char *zSql, /* SQL to be evaluated */ in shell_exec() argument
14585 rc = expertHandleSQL(pArg, zSql, pzErrMsg); in shell_exec()
14590 while( zSql[0] && (SQLITE_OK == rc) ){ in shell_exec()
14592 rc = sqlite3_prepare_v2(db, zSql, -1, &pStmt, &zLeftover); in shell_exec()
14600 zSql = zLeftover; in shell_exec()
14601 while( IsSpace(zSql[0]) ) zSql++; in shell_exec()
14616 utf8_printf(pArg->out, "%s\n", zStmtSql ? zStmtSql : zSql); in shell_exec()
14661 sqlite3_prepare_v2(db, zSql, -1, &pStmt, 0); in shell_exec()
14706 zSql = zLeftover; in shell_exec()
14707 while( IsSpace(zSql[0]) ) zSql++; in shell_exec()
14750 char *zSql; in tableColumnList() local
14758 zSql = sqlite3_mprintf("PRAGMA table_info=%Q", zTab); in tableColumnList()
14759 rc = sqlite3_prepare_v2(p->db, zSql, -1, &pStmt, 0); in tableColumnList()
14760 sqlite3_free(zSql); in tableColumnList()
14800 zSql = sqlite3_mprintf("SELECT 1 FROM pragma_index_list(%Q)" in tableColumnList()
14802 rc = sqlite3_prepare_v2(p->db, zSql, -1, &pStmt, 0); in tableColumnList()
14803 sqlite3_free(zSql); in tableColumnList()
14862 const char *zSql; in dump_callback() local
14871 zSql = azArg[2]; in dump_callback()
14883 }else if( strncmp(zSql, "CREATE VIRTUAL TABLE", 20)==0 ){ in dump_callback()
14892 zTable, zTable, zSql); in dump_callback()
14897 printSchemaLine(p->out, zSql, ";\n"); in dump_callback()
15813 char *zSql = sqlite3_mprintf( in open_db() local
15815 sqlite3_exec(p->db, zSql, 0, 0, 0); in open_db()
15816 sqlite3_free(zSql); in open_db()
15868 char *zSql; in readline_completion_generator() local
15870 zSql = sqlite3_mprintf("SELECT DISTINCT candidate COLLATE nocase" in readline_completion_generator()
15872 sqlite3_prepare_v2(globalDb, zSql, -1, &pStmt, 0); in readline_completion_generator()
15873 sqlite3_free(zSql); in readline_completion_generator()
15897 char *zSql; in linenoise_completion() local
15906 zSql = sqlite3_mprintf("SELECT DISTINCT candidate COLLATE nocase" in linenoise_completion()
15909 sqlite3_prepare_v2(globalDb, zSql, -1, &pStmt, 0); in linenoise_completion()
15910 sqlite3_free(zSql); in linenoise_completion()
16059 const char *zSql; in sql_trace_callback() local
16067 zSql = (const char*)pX; in sql_trace_callback()
16072 zSql = sqlite3_expanded_sql(pStmt); in sql_trace_callback()
16077 zSql = sqlite3_normalized_sql(pStmt); in sql_trace_callback()
16082 zSql = sqlite3_sql(pStmt); in sql_trace_callback()
16087 if( zSql==0 ) return 0; in sql_trace_callback()
16088 nSql = strlen30(zSql); in sql_trace_callback()
16089 while( nSql>0 && zSql[nSql-1]==';' ){ nSql--; } in sql_trace_callback()
16093 utf8_printf(p->traceOut, "%.*s;\n", nSql, zSql); in sql_trace_callback()
16098 utf8_printf(p->traceOut, "%.*s; -- %lld ns\n", nSql, zSql, nNanosec); in sql_trace_callback()
16405 const unsigned char *zSql; in tryToCloneSchema() local
16419 zSql = sqlite3_column_text(pQuery, 1); in tryToCloneSchema()
16421 sqlite3_exec(newDb, (const char*)zSql, 0, 0, &zErrMsg); in tryToCloneSchema()
16423 utf8_printf(stderr, "Error: %s\nSQL: [%s]\n", zErrMsg, zSql); in tryToCloneSchema()
16446 zSql = sqlite3_column_text(pQuery, 1); in tryToCloneSchema()
16448 sqlite3_exec(newDb, (const char*)zSql, 0, 0, &zErrMsg); in tryToCloneSchema()
16450 utf8_printf(stderr, "Error: %s\nSQL: [%s]\n", zErrMsg, zSql); in tryToCloneSchema()
16539 static int db_int(ShellState *p, const char *zSql){ in db_int() argument
16542 sqlite3_prepare_v2(p->db, zSql, -1, &pStmt, 0); in db_int()
16580 static const struct { const char *zName; const char *zSql; } aQuery[] = { in shell_dbinfo_command() member
16646 char *zSql = sqlite3_mprintf(aQuery[i].zSql, zSchemaTab); in shell_dbinfo_command() local
16647 int val = db_int(p, zSql); in shell_dbinfo_command()
16648 sqlite3_free(zSql); in shell_dbinfo_command()
16942 const char *zSql = in lintFkeyIndexes() local
16995 rc = sqlite3_prepare_v2(db, zSql, -1, &pSql, 0); in lintFkeyIndexes()
17090 const char *zSql, in shellPrepare() argument
17095 int rc = sqlite3_prepare_v2(db, zSql, -1, ppStmt, 0); in shellPrepare()
17522 const char *zSql = "SELECT %s FROM %s WHERE %s"; in arListCommand() local
17535 shellPreparePrintf(pAr->db, &rc, &pSql, zSql, azCols[pAr->bVerbose], in arListCommand()
17564 char *zSql = 0; in arRemoveCommand() local
17574 zSql = sqlite3_mprintf("DELETE FROM %s WHERE %s;", in arRemoveCommand()
17577 utf8_printf(pAr->p->out, "%s\n", zSql); in arRemoveCommand()
17582 rc = sqlite3_exec(pAr->db, zSql, 0, 0, &zErr); in arRemoveCommand()
17596 sqlite3_free(zSql); in arRemoveCommand()
17675 static int arExecSql(ArCommand *pAr, const char *zSql){ in arExecSql() argument
17678 utf8_printf(pAr->p->out, "%s\n", zSql); in arExecSql()
17682 rc = sqlite3_exec(pAr->db, zSql, 0, 0, &zErr); in arExecSql()
17750 char *zSql; in arCreateOrUpdateCommand() local
17765 zSql = sqlite3_mprintf( in arCreateOrUpdateCommand()
17769 rc = arExecSql(pAr, zSql); in arCreateOrUpdateCommand()
17770 sqlite3_free(zSql); in arCreateOrUpdateCommand()
17807 zSql = sqlite3_mprintf("DROP TABLE %s", zTemp); in arCreateOrUpdateCommand()
17808 arExecSql(pAr, zSql); in arCreateOrUpdateCommand()
17809 sqlite3_free(zSql); in arCreateOrUpdateCommand()
17937 static void shellExec(sqlite3 *db, int *pRc, const char *zSql){ in shellExec() argument
17941 rc = sqlite3_exec(db, zSql, 0, 0, &zErr); in shellExec()
18054 const char *zSql, /* CREATE TABLE statement */ in recoverNewTable() argument
18077 rc = sqlite3_exec(dbtmp, zSql, 0, 0, 0); in recoverNewTable()
18194 const char *zSql = 0; in recoverFindTable() local
18209 zSql = (const char*)sqlite3_column_text(pStmt, 2); in recoverFindTable()
18210 pRet = recoverNewTable(pRc, zName, zSql, bIntkey, nCol); in recoverFindTable()
18581 const char *zSql = (const char*)sqlite3_column_text(pStmt, 0); in recoverDatabaseCmd() local
18582 if( sqlite3_strnicmp(zSql, "create virt", 11)==0 ){ in recoverDatabaseCmd()
18586 zName, zName, zSql in recoverDatabaseCmd()
18591 raw_printf(pState->out, "%s;\n", zSql); in recoverDatabaseCmd()
18981 char *zSql; in do_meta_command() local
19058 zSql = sqlite3_mprintf( in do_meta_command()
19065 run_schema_dump_query(p,zSql); in do_meta_command()
19066 sqlite3_free(zSql); in do_meta_command()
19068 zSql = sqlite3_mprintf( in do_meta_command()
19074 run_table_dump_query(p, zSql); in do_meta_command()
19075 sqlite3_free(zSql); in do_meta_command()
19391 char *zSql; /* An SQL statement */ in do_meta_command() local
19531 zSql = sqlite3_mprintf("SELECT * FROM \"%w\"", zTable); in do_meta_command()
19532 if( zSql==0 ){ in do_meta_command()
19536 nByte = strlen30(zSql); in do_meta_command()
19537 rc = sqlite3_prepare_v2(p->db, zSql, -1, &pStmt, 0); in do_meta_command()
19567 rc = sqlite3_prepare_v2(p->db, zSql, -1, &pStmt, 0); in do_meta_command()
19569 sqlite3_free(zSql); in do_meta_command()
19581 zSql = sqlite3_malloc64( nByte*2 + 20 + nCol*2 ); in do_meta_command()
19582 if( zSql==0 ){ in do_meta_command()
19586 sqlite3_snprintf(nByte+20, zSql, "INSERT INTO \"%w\" VALUES(?", zTable); in do_meta_command()
19587 j = strlen30(zSql); in do_meta_command()
19589 zSql[j++] = ','; in do_meta_command()
19590 zSql[j++] = '?'; in do_meta_command()
19592 zSql[j++] = ')'; in do_meta_command()
19593 zSql[j] = 0; in do_meta_command()
19595 utf8_printf(p->out, "Insert using: %s\n", zSql); in do_meta_command()
19597 rc = sqlite3_prepare_v2(p->db, zSql, -1, &pStmt, 0); in do_meta_command()
19598 sqlite3_free(zSql); in do_meta_command()
19666 char *zSql; in do_meta_command() local
19691 zSql = sqlite3_mprintf( in do_meta_command()
19700 sqlite3_prepare_v2(p->db, zSql, -1, &pStmt, 0); in do_meta_command()
19701 sqlite3_free(zSql); in do_meta_command()
19707 zSql = sqlite3_mprintf("PRAGMA index_xinfo='%q'", azArg[1]); in do_meta_command()
19708 rc = sqlite3_prepare_v2(p->db, zSql, -1, &pStmt, 0); in do_meta_command()
19709 sqlite3_free(zSql); in do_meta_command()
19740 zSql = sqlite3_mprintf( in do_meta_command()
19746 rc = sqlite3_exec(p->db, zSql, 0, 0, 0); in do_meta_command()
19749 utf8_printf(stderr, "Error in [%s]: %s\n", zSql, sqlite3_errmsg(p->db)); in do_meta_command()
19751 utf8_printf(stdout, "%s;\n", zSql); in do_meta_command()
19761 sqlite3_free(zSql); in do_meta_command()
20242 char *zSql; in do_meta_command() local
20247 zSql = sqlite3_mprintf( in do_meta_command()
20250 if( zSql==0 ) shell_out_of_memory(); in do_meta_command()
20252 rx = sqlite3_prepare_v2(p->db, zSql, -1, &pStmt, 0); in do_meta_command()
20253 sqlite3_free(zSql); in do_meta_command()
20257 zSql = sqlite3_mprintf( in do_meta_command()
20260 if( zSql==0 ) shell_out_of_memory(); in do_meta_command()
20261 rx = sqlite3_prepare_v2(p->db, zSql, -1, &pStmt, 0); in do_meta_command()
20262 sqlite3_free(zSql); in do_meta_command()
20279 char *zSql = sqlite3_mprintf( in do_meta_command() local
20281 if( zSql==0 ) shell_out_of_memory(); in do_meta_command()
20282 sqlite3_exec(p->db, zSql, 0, 0, 0); in do_meta_command()
20283 sqlite3_free(zSql); in do_meta_command()
20884 const char *zSql = (const char*)sqlite3_column_text(pStmt, 2); in do_meta_command() local
20889 char *zQuote = sqlite3_mprintf("%q", zSql); in do_meta_command()
20890 printf("%d: %s %s\n", tno, zOp, zSql); in do_meta_command()
20894 utf8_printf(p->out, "%s\n", zSql); in do_meta_command()
20900 rc = sqlite3_exec(p->db, zSql, captureOutputCallback, &str, &zErrMsg); in do_meta_command()
20953 char *zSql; /* SQL to be run */ in do_meta_command() local
20992 zSql = "SELECT lower(name) FROM sqlite_schema" in do_meta_command()
20997 zSql = "SELECT lower(name) FROM sqlite_schema" in do_meta_command()
21002 sqlite3_prepare_v2(p->db, zSql, -1, &pStmt, 0); in do_meta_command()
21037 zSql = sqlite3_mprintf( in do_meta_command()
21043 zSql = sqlite3_mprintf( in do_meta_command()
21052 utf8_printf(p->out, "%s\n", zSql); in do_meta_command()
21054 shell_exec(p, zSql, 0); in do_meta_command()
21056 sqlite3_free(zSql); in do_meta_command()
21870 static int line_is_complete(char *zSql, int nSql){ in line_is_complete() argument
21872 if( zSql==0 ) return 1; in line_is_complete()
21873 zSql[nSql] = ';'; in line_is_complete()
21874 zSql[nSql+1] = 0; in line_is_complete()
21875 rc = sqlite3_complete(zSql); in line_is_complete()
21876 zSql[nSql] = 0; in line_is_complete()
21883 static int runOneSqlLine(ShellState *p, char *zSql, FILE *in, int startline){ in runOneSqlLine() argument
21888 if( ShellHasFlag(p,SHFLG_Backslash) ) resolve_backslashes(zSql); in runOneSqlLine()
21891 rc = shell_exec(p, zSql, &zErrMsg); in runOneSqlLine()
21931 char *zSql = 0; /* Accumulated SQL text */ in process_input() local
21956 && line_is_complete(zSql, nSql) ){ in process_input()
21985 zSql = realloc(zSql, nAlloc); in process_input()
21986 if( zSql==0 ) shell_out_of_memory(); in process_input()
21991 assert( nAlloc>0 && zSql!=0 ); in process_input()
21992 memcpy(zSql, zLine+i, nLine+1-i); in process_input()
21996 zSql[nSql++] = '\n'; in process_input()
21997 memcpy(zSql+nSql, zLine, nLine+1); in process_input()
22000 if( nSql && QSS_SEMITERM(qss) && sqlite3_complete(zSql) ){ in process_input()
22001 errCnt += runOneSqlLine(p, zSql, p->in, startline); in process_input()
22012 if( ShellHasFlag(p, SHFLG_Echo) ) printf("%s\n", zSql); in process_input()
22018 errCnt += runOneSqlLine(p, zSql, p->in, startline); in process_input()
22020 free(zSql); in process_input()