Lines Matching refs:pStmt
742 sqlite3_stmt *pStmt, /* SQL statement to run */
929 sqlite3_stmt *pStmt; /* The statement whose output is to be rendered */
1240 sqlite3_stmt *pS = p->pStmt;
1340 int rc = sqlite3_reset(p->pStmt);
1870 ** The current iCol-th column of p->pStmt is known to be a BLOB. Check
1884 nByte = sqlite3_column_bytes(p->pStmt, iCol);
1885 pBlob = sqlite3_column_blob(p->pStmt, iCol);
1972 pVal = sqlite3_value_dup(sqlite3_column_value(p->pStmt,iCol));
1981 switch( sqlite3_column_type(p->pStmt,iCol) ){
1983 sqlite3_str_appendf(pOut, "%lld", sqlite3_column_int64(p->pStmt,iCol));
1987 const char *zTxt = (const char*)sqlite3_column_text(p->pStmt,iCol);
2009 int nBlob = sqlite3_column_bytes(p->pStmt,iCol);
2012 pStmt,iCol);
2034 int nBlob = sqlite3_column_bytes(p->pStmt,iCol);
2037 const unsigned char *a = sqlite3_column_blob(p->pStmt,iCol);
2065 int nBlob = sqlite3_column_bytes(p->pStmt,iCol);
2070 const char *zTxt = (const char*)sqlite3_column_text(p->pStmt,iCol);
2081 const char *zTxt = (const char*)sqlite3_column_text(p->pStmt,iCol);
2814 rc = sqlite3_step(p->pStmt);
2838 const char *z = (const char*)sqlite3_column_name(p->pStmt,i);
2868 int eType = sqlite3_column_type(p->pStmt,i);
2881 }while( sqlite3_step(p->pStmt)==SQLITE_ROW && p->iErr==SQLITE_OK );
3208 assert( sqlite3_column_count(p->pStmt)>=4 );
3209 assert( 0==sqlite3_stricmp( sqlite3_column_name(p->pStmt, 0), "addr" ) );
3210 assert( 0==sqlite3_stricmp( sqlite3_column_name(p->pStmt, 1), "opcode" ) );
3211 assert( 0==sqlite3_stricmp( sqlite3_column_name(p->pStmt, 2), "p1" ) );
3212 assert( 0==sqlite3_stricmp( sqlite3_column_name(p->pStmt, 3), "p2" ) );
3214 for(iOp=0; SQLITE_ROW==sqlite3_step(p->pStmt) && !p->iErr; iOp++){
3215 int iAddr = sqlite3_column_int(p->pStmt, 0);
3216 const char *zOp = (const char*)sqlite3_column_text(p->pStmt, 1);
3217 int p1 = sqlite3_column_int(p->pStmt, 2);
3218 int p2 = sqlite3_column_int(p->pStmt, 3);
3252 sqlite3_reset(p->pStmt);
3271 for(iOp=0; sqlite3_step(p->pStmt)==SQLITE_ROW && !p->iErr; iOp++){
3275 const char *zCol = sqlite3_column_name(p->pStmt, aMap[i]);
3296 const char *zVal = (const char*)sqlite3_column_text(p->pStmt, aMap[i]);
3323 ** Do a "scanstatus vm" style EXPLAIN listing on p->pStmt.
3325 ** p->pStmt is probably not an EXPLAIN query. Instead, construct a
3326 ** new query that is a bytecode() rendering of p->pStmt with extra
3331 sqlite3_stmt *pOrigStmt = p->pStmt;
3351 p->pStmt = pExplain;
3355 p->pStmt = pOrigStmt;
3387 zCName = sqlite3_column_name(p->pStmt, i);
3432 const char *zCName = sqlite3_column_name(p->pStmt, i);
3462 const char *zCName = sqlite3_column_name(p->pStmt, i);
3505 const char *zCName = sqlite3_column_name(p->pStmt, i);
3551 const char *zEqpLine = (const char*)sqlite3_column_text(p->pStmt,3);
3552 int iEqpId = sqlite3_column_int(p->pStmt, 0);
3553 int iParentId = sqlite3_column_int(p->pStmt, 1);
3564 const char *zCName = sqlite3_column_name(p->pStmt, i);
3589 sqlite3_stmt *pStmt, /* Query whose output to be formatted */
3602 p->pStmt = pStmt;
3603 p->db = sqlite3_db_handle(pStmt);
3610 p->nCol = sqlite3_column_count(p->pStmt);
3627 switch( sqlite3_stmt_isexplain(pStmt) ){
3681 int expMode = sqlite3_stmt_isexplain(p->pStmt);
3683 sqlite3_stmt_explain(p->pStmt, 2);
3689 int expMode = sqlite3_stmt_isexplain(p->pStmt);
3691 sqlite3_stmt_explain(p->pStmt, 1);
3787 sqlite3_stmt_scanstatus_v2(p->pStmt, -1, SQLITE_SCANSTAT_NCYCLE,
3823 sqlite3_stmt_explain(p->pStmt, p->expMode-1);
3836 ** Run the prepared statement pStmt and format the results according
3842 sqlite3_stmt *pStmt, /* Statement to evaluate */
3848 if( pStmt==0 ) return SQLITE_OK; /* No-op */
3850 qrfInitialize(&qrf, pStmt, pSpec, pzErr);
3877 while( qrf.iErr==SQLITE_OK && sqlite3_step(pStmt)==SQLITE_ROW ){
5087 sqlite3_stmt *pStmt = 0;
5109 rc = sqlite3_prepare_v2(db, zSql, -1, &pStmt, &zSql);
5113 sqlite3_finalize(pStmt);
5118 if( !sqlite3_stmt_readonly(pStmt) ){
5119 char *zMsg = sqlite3_mprintf("non-query: [%s]", sqlite3_sql(pStmt));
5120 sqlite3_finalize(pStmt);
5125 nCol = sqlite3_column_count(pStmt);
5126 z = sqlite3_sql(pStmt);
5134 while( SQLITE_ROW==sqlite3_step(pStmt) ){
5137 sha3UpdateFromValue(&cx, sqlite3_column_value(pStmt,i));
5140 sqlite3_finalize(pStmt);
5522 sqlite3_stmt *pStmt = 0;
5535 rc = sqlite3_prepare_v2(db, zSql, -1, &pStmt, &zSql);
5539 sqlite3_finalize(pStmt);
5544 if( !sqlite3_stmt_readonly(pStmt) ){
5545 char *zMsg = sqlite3_mprintf("non-query: [%s]", sqlite3_sql(pStmt));
5546 sqlite3_finalize(pStmt);
5551 nCol = sqlite3_column_count(pStmt);
5552 z = sqlite3_sql(pStmt);
5559 while( SQLITE_ROW==sqlite3_step(pStmt) ){
5562 switch( sqlite3_column_type(pStmt,i) ){
5571 sqlite3_int64 v = sqlite3_column_int64(pStmt,i);
5585 double r = sqlite3_column_double(pStmt,i);
5596 int n2 = sqlite3_column_bytes(pStmt, i);
5597 const unsigned char *z2 = sqlite3_column_text(pStmt, i);
5603 int n2 = sqlite3_column_bytes(pStmt, i);
5604 const unsigned char *z2 = sqlite3_column_blob(pStmt, i);
5612 sqlite3_finalize(pStmt);
10999 sqlite3_stmt *pStmt; /* Current statement */
11099 sqlite3_finalize(pCur->pStmt); pCur->pStmt = 0;
11115 ** The ->ePhase, ->j, and ->pStmt fields of the completion_cursor object
11129 int iCol = -1; /* If >=0, step pCur->pStmt and use the i-th column */
11145 if( pCur->pStmt==0 ){
11147 &pCur->pStmt, 0);
11154 if( pCur->pStmt==0 ){
11173 sqlite3_prepare_v2(pCur->db, zSql, -1, &pCur->pStmt, 0);
11183 if( pCur->pStmt==0 ){
11204 sqlite3_prepare_v2(pCur->db, zSql, -1, &pCur->pStmt, 0);
11218 if( sqlite3_step(pCur->pStmt)==SQLITE_ROW ){
11220 pCur->zCurrentRow = (const char*)sqlite3_column_text(pCur->pStmt, iCol);
11221 pCur->szRow = sqlite3_column_bytes(pCur->pStmt, iCol);
11224 rc = sqlite3_finalize(pCur->pStmt);
11225 pCur->pStmt = 0;
15402 ** Finalize SQL statement pStmt. If (*pRc) is SQLITE_OK when this function
15406 static void idxFinalize(int *pRc, sqlite3_stmt *pStmt){
15407 int rc = sqlite3_finalize(pStmt);
15919 IdxStatement *pStmt;
15926 for(pStmt=p->pStatement; rc==SQLITE_OK && pStmt; pStmt=pStmt->pNext){
15931 "EXPLAIN QUERY PLAN %s", pStmt->zSql
15969 pStmt->zEQP = idxAppendText(&rc, pStmt->zEQP, "%s\n", zDetail);
15974 pStmt->zIdx = idxAppendText(&rc, pStmt->zIdx, "%s;\n", pEntry->zKey);
16670 sqlite3_stmt *pStmt;
16674 "WHERE builtin==0", -1, &pStmt, 0);
16676 while( SQLITE_ROW==(rc = sqlite3_step(pStmt)) ){
16677 int nargs = sqlite3_column_int(pStmt,3);
16678 int flags = sqlite3_column_int(pStmt,4);
16679 const char *name = (char*)sqlite3_column_text(pStmt,0);
16680 const char *type = (char*)sqlite3_column_text(pStmt,1);
16681 const char *enc = (char*)sqlite3_column_text(pStmt,2);
16706 sqlite3_finalize(pStmt);
16834 sqlite3_stmt *pStmt = 0;
16836 rc = idxPrepareStmt(p->db, &pStmt, pzErr, zStmt);
16838 sqlite3_finalize(pStmt);
16839 rc = sqlite3_prepare_v2(p->dbv, zStmt, -1, &pStmt, &zStmt);
16841 if( pStmt ){
16843 const char *z = sqlite3_sql(pStmt);
16853 sqlite3_finalize(pStmt);
16926 IdxStatement *pStmt;
16929 for(pStmt=p->pStatement; pStmt && pStmt->iId!=iStmt; pStmt=pStmt->pNext);
16932 if( pStmt ) zRet = pStmt->zSql;
16935 if( pStmt ) zRet = pStmt->zIdx;
16938 if( pStmt ) zRet = pStmt->zEQP;
17256 ** Finalize SQL statement pStmt. If an error occurs and the handle passed
17260 static void intckFinalize(sqlite3_intck *p, sqlite3_stmt *pStmt){
17261 int rc = sqlite3_finalize(pStmt);
17271 static int intckStep(sqlite3_intck *p, sqlite3_stmt *pStmt){
17273 return sqlite3_step(pStmt);
17282 sqlite3_stmt *pStmt = 0;
17283 pStmt = intckPrepare(p, zSql);
17284 intckStep(p, pStmt);
17285 intckFinalize(p, pStmt);
17317 sqlite3_stmt *pStmt = 0;
17394 pStmt = intckPrepare(p, zSql);
17397 sqlite3_bind_value(pStmt, ii+1, sqlite3_column_value(p->pCheck, ii+1));
17399 if( SQLITE_ROW==sqlite3_step(pStmt) ){
17400 p->zKey = intckMprintf(p,"%s",(const char*)sqlite3_column_text(pStmt, 0));
17402 intckFinalize(p, pStmt);
17415 sqlite3_stmt *pStmt = 0;
17422 pStmt = intckPrepareFmt(p,
17436 sqlite3_bind_text(pStmt, 1, zPrev, -1, SQLITE_TRANSIENT);
17437 if( sqlite3_step(pStmt)==SQLITE_ROW ){
17438 p->zObj = intckMprintf(p,"%s",(const char*)sqlite3_column_text(pStmt, 0));
17441 intckFinalize(p, pStmt);
17614 sqlite3_stmt *pStmt = 0;
17615 pStmt = intckPrepare(p, "PRAGMA automatic_index");
17616 if( SQLITE_ROW==intckStep(p, pStmt) ){
17617 bRet = sqlite3_column_int(pStmt, 0);
17619 intckFinalize(p, pStmt);
17628 sqlite3_stmt *pStmt = 0;
17629 pStmt = intckPrepareFmt(p,
17633 if( p->rc==SQLITE_OK && SQLITE_ROW==sqlite3_step(pStmt) ){
17636 intckFinalize(p, pStmt);
17657 sqlite3_stmt *pStmt = 0;
17774 pStmt = intckPrepareFmt(p,
17828 pStmt = intckPrepareFmt(p,
17908 while( p->rc==SQLITE_OK && SQLITE_ROW==sqlite3_step(pStmt) ){
17909 zRet = intckMprintf(p, "%s", (const char*)sqlite3_column_text(pStmt, 0));
17911 *pnKeyVal = sqlite3_column_int(pStmt, 1);
17914 intckFinalize(p, pStmt);
19764 sqlite3_stmt *pStmt; /* For fetching database pages */
19791 sqlite3_stmt *pStmt; /* For fetching database pages */
19885 sqlite3_finalize(pTab->pStmt);
19975 if( pTab->pStmt==0 ){
19976 pTab->pStmt = pCsr->pStmt;
19978 sqlite3_finalize(pCsr->pStmt);
19980 pCsr->pStmt = 0;
20032 sqlite3_stmt *pStmt = pCsr->pStmt;
20037 sqlite3_bind_int64(pStmt, 2, pgno);
20038 if( SQLITE_ROW==sqlite3_step(pStmt) ){
20039 int nCopy = sqlite3_column_bytes(pStmt, 0);
20046 const u8 *pCopy = sqlite3_column_blob(pStmt, 0);
20054 rc2 = sqlite3_reset(pStmt);
20458 sqlite3_stmt *pStmt = 0;
20467 rc = sqlite3_prepare_v2(pTab->db, zSql, -1, &pStmt, 0);
20469 if( rc==SQLITE_OK && sqlite3_step(pStmt)==SQLITE_ROW ){
20470 pCsr->szDb = sqlite3_column_int(pStmt, 0);
20472 rc2 = sqlite3_finalize(pStmt);
20525 if( pTab->pStmt ){
20526 pCsr->pStmt = pTab->pStmt;
20527 pTab->pStmt = 0;
20533 rc = sqlite3_prepare_v2(pTab->db, zSql, -1, &pCsr->pStmt, 0);
20539 &pCsr->pStmt, 0
20544 rc = sqlite3_bind_text(pCsr->pStmt, 1, zSchema, -1, SQLITE_TRANSIENT);
21148 sqlite3_stmt *pStmt = 0;
21150 if( sqlite3_prepare_v2(db, zSql, -1, &pStmt, 0) ){
21154 return pStmt;
21173 sqlite3_stmt *pStmt = 0;
21183 pStmt = recoverPrepare(p, db, z);
21187 return pStmt;
21191 ** Reset SQLite statement handle pStmt. If the call to sqlite3_reset()
21199 static sqlite3_stmt *recoverReset(sqlite3_recover *p, sqlite3_stmt *pStmt){
21200 int rc = sqlite3_reset(pStmt);
21202 recoverDbError(p, sqlite3_db_handle(pStmt));
21204 return pStmt;
21208 ** Finalize SQLite statement handle pStmt. If the call to sqlite3_reset()
21213 static void recoverFinalize(sqlite3_recover *p, sqlite3_stmt *pStmt){
21214 sqlite3 *db = sqlite3_db_handle(pStmt);
21215 int rc = sqlite3_finalize(pStmt);
21241 ** Bind the value pVal to parameter iBind of statement pStmt. Leave an
21247 sqlite3_stmt *pStmt,
21252 int rc = sqlite3_bind_value(pStmt, iBind, pVal);
21298 sqlite3_stmt *pStmt = 0;
21299 pStmt = recoverPreparePrintf(p, p->dbIn, "PRAGMA %Q.page_count", p->zDb);
21300 if( pStmt ){
21301 sqlite3_step(pStmt);
21302 nPg = sqlite3_column_int64(pStmt, 0);
21304 recoverFinalize(p, pStmt);
21385 sqlite3_stmt *pStmt = 0;
21394 pStmt = p->pGetPage = recoverPreparePrintf(
21398 pStmt = p->pGetPage;
21401 if( pStmt ){
21402 sqlite3_bind_int64(pStmt, 1, pgno);
21403 if( SQLITE_ROW==sqlite3_step(pStmt) ){
21407 aPg = sqlite3_column_blob(pStmt, 0);
21408 nPg = sqlite3_column_bytes(pStmt, 0);
21414 recoverReset(p, pStmt);
21741 sqlite3_stmt *pStmt = recoverPreparePrintf(p, p->dbOut,
21745 if( pStmt ){
21752 while( sqlite3_step(pStmt)==SQLITE_ROW ){
21754 nByte += (sqlite3_column_bytes(pStmt, 1)+1);
21757 recoverReset(p, pStmt);
21771 for(i=0; sqlite3_step(pStmt)==SQLITE_ROW; i++){
21772 int iPKF = sqlite3_column_int(pStmt, 5);
21773 int n = sqlite3_column_bytes(pStmt, 1);
21774 const char *z = (const char*)sqlite3_column_text(pStmt, 1);
21775 const char *zType = (const char*)sqlite3_column_text(pStmt, 2);
21776 int eHidden = sqlite3_column_int(pStmt, 6);
21801 recoverFinalize(p, pStmt);
21803 pStmt = recoverPreparePrintf(p, p->dbOut, "PRAGMA index_xinfo(%Q)", zName);
21804 while( pStmt && sqlite3_step(pStmt)==SQLITE_ROW ){
21805 int iField = sqlite3_column_int(pStmt, 0);
21806 int iCol = sqlite3_column_int(pStmt, 1);
21814 recoverFinalize(p, pStmt);
22548 sqlite3_stmt *pStmt = 0;
22558 pStmt = recoverPrepare(
22588 if( pStmt ) sqlite3_bind_int(pStmt, 1, p->bFreelistCorrupt);
22589 pLaf->pUsedPages = pStmt;
23679 sqlite3_stmt *pStmt; /* Current statement if any. */
24516 sqlite3_stmt *pStmt = 0;
24526 sqlite3_prepare_v2(db, zSql, -1, &pStmt, 0);
24537 while( sqlite3_step(pStmt)==SQLITE_ROW ){
24538 const char *zCol = (const char*)sqlite3_column_text(pStmt, 1);
24547 sqlite3_finalize(pStmt);
26071 if( pArg->pStmt && pArg->statsOn==2 ){
26073 sqlite3_stmt *pStmt = pArg->pStmt;
26075 nCol = sqlite3_column_count(pStmt);
26079 cli_printf(out, "%-36s %s\n", z, sqlite3_column_name(pStmt,i));
26082 cli_printf(out, "%-36s %s\n", z, sqlite3_column_decltype(pStmt, i));
26087 sqlite3_column_database_name(pStmt,i));
26089 cli_printf(out, "%-36s %s\n", z, sqlite3_column_table_name(pStmt,i));
26091 cli_printf(out, "%-36s %s\n", z,sqlite3_column_origin_name(pStmt,i));
26097 if( pArg->pStmt ){
26098 iCur = sqlite3_stmt_status(pArg->pStmt, SQLITE_STMTSTATUS_VM_STEP,bReset);
26180 if( pArg->pStmt ){
26182 iCur = sqlite3_stmt_status(pArg->pStmt, SQLITE_STMTSTATUS_FULLSCAN_STEP,
26186 iCur = sqlite3_stmt_status(pArg->pStmt, SQLITE_STMTSTATUS_SORT, bReset);
26189 iCur = sqlite3_stmt_status(pArg->pStmt, SQLITE_STMTSTATUS_AUTOINDEX,bReset);
26192 iHit = sqlite3_stmt_status(pArg->pStmt, SQLITE_STMTSTATUS_FILTER_HIT,
26194 iMiss = sqlite3_stmt_status(pArg->pStmt, SQLITE_STMTSTATUS_FILTER_MISS,
26200 iCur = sqlite3_stmt_status(pArg->pStmt, SQLITE_STMTSTATUS_VM_STEP, bReset);
26203 iCur = sqlite3_stmt_status(pArg->pStmt, SQLITE_STMTSTATUS_REPREPARE,bReset);
26206 iCur = sqlite3_stmt_status(pArg->pStmt, SQLITE_STMTSTATUS_RUN, bReset);
26209 iCur = sqlite3_stmt_status(pArg->pStmt, SQLITE_STMTSTATUS_MEMUSED, bReset);
26270 static void bind_prepared_stmt(ShellState *pArg, sqlite3_stmt *pStmt){
26276 nVar = sqlite3_bind_parameter_count(pStmt);
26289 const char *zVar = sqlite3_bind_parameter_name(pStmt, i);
26296 sqlite3_bind_value(pStmt, i, sqlite3_column_value(pQ, 0));
26299 sqlite3_bind_double(pStmt, i, NAN);
26303 sqlite3_bind_double(pStmt, i, INFINITY);
26306 sqlite3_bind_int(pStmt, i, atoi(&zVar[5]));
26312 sqlite3_bind_text64(pStmt, i, zBuf, szVar-6, sqlite3_free, SQLITE_UTF8);
26315 sqlite3_bind_double(pStmt, i, pArg->prevTimer);
26333 sqlite3_carray_bind(pStmt,i,azColorNames,26,SQLITE_CARRAY_TEXT,0);
26335 sqlite3_carray_bind(pStmt,i,aPrimes,26,SQLITE_CARRAY_INT32,0);
26338 sqlite3_bind_pointer(pStmt,i,azColorNames,"carray",0);
26341 sqlite3_bind_pointer(pStmt,i,aPrimes,"carray",0);
26343 sqlite3_bind_null(pStmt, i);
26347 sqlite3_bind_null(pStmt, i);
26511 sqlite3_stmt *pStmt = NULL; /* Statement to execute. */
26553 rc = sqlite3_prepare_v2(db, zSql, -1, &pStmt, &zLeftover);
26560 if( !pStmt ){
26566 zStmtSql = sqlite3_sql(pStmt);
26572 pArg->pStmt = pStmt;
26576 isExplain = sqlite3_stmt_isexplain(pStmt);
26586 sqlite3_reset(pStmt);
26588 sqlite3_stmt_explain(pStmt, 2);
26589 sqlite3_format_query_result(pStmt, &spec, 0);
26591 sqlite3_reset(pStmt);
26592 sqlite3_stmt_explain(pStmt, 1);
26593 sqlite3_format_query_result(pStmt, &spec, 0);
26599 sqlite3_reset(pStmt);
26600 sqlite3_stmt_explain(pStmt, 0);
26605 bind_prepared_stmt(pArg, pStmt);
26608 sqlite3_format_query_result(pStmt, &spec, pzErrMsg);
26614 sqlite3_format_query_result(pStmt, &spec, pzErrMsg);
26620 sqlite3_format_query_result(pStmt, &spec, pzErrMsg);
26636 sqlite3_reset(pStmt);
26637 rc = sqlite3_format_query_result(pStmt, &spec, &zErr);
26647 rc2 = sqlite3_finalize(pStmt);
26658 pArg->pStmt = NULL;
26693 sqlite3_stmt *pStmt;
26704 rc = sqlite3_prepare_v2(p->db, zSql, -1, &pStmt, 0);
26707 while( sqlite3_step(pStmt)==SQLITE_ROW ){
26713 azCol[++nCol] = sqlite3_mprintf("%s", sqlite3_column_text(pStmt, 1));
26715 if( sqlite3_column_int(pStmt, 5) ){
26718 && sqlite3_stricmp((const char*)sqlite3_column_text(pStmt,2),
26727 sqlite3_finalize(pStmt);
26749 rc = sqlite3_prepare_v2(p->db, zSql, -1, &pStmt, 0);
26755 rc = sqlite3_step(pStmt);
26756 sqlite3_finalize(pStmt);
26786 sqlite3_stmt *pStmt = 0;
26789 sqlite3_prepare_v2(db, "PRAGMA reverse_unordered_selects", -1, &pStmt, 0);
26790 if( sqlite3_step(pStmt)==SQLITE_ROW ){
26791 iSetting = sqlite3_column_int(pStmt, 0);
26793 sqlite3_finalize(pStmt);
27681 sqlite3_stmt *pStmt = 0;
27686 && sqlite3_prepare_v2(db,"SELECT count(*) FROM sqlite_schema",-1,&pStmt,0)
27688 && sqlite3_step(pStmt)==SQLITE_ROW
27694 sqlite3_finalize(pStmt);
28137 static sqlite3_stmt *pStmt = 0;
28141 sqlite3_finalize(pStmt);
28145 sqlite3_prepare_v2(globalDb, zSql, -1, &pStmt, 0);
28148 if( sqlite3_step(pStmt)==SQLITE_ROW ){
28149 const char *z = (const char*)sqlite3_column_text(pStmt,0);
28152 sqlite3_finalize(pStmt);
28153 pStmt = 0;
28179 sqlite3_stmt *pStmt = 0;
28196 sqlite3_prepare_v2(globalDb, zSql, -1, &pStmt, 0);
28199 while( sqlite3_step(pStmt)==SQLITE_ROW ){
28200 const char *zCompletion = (const char*)sqlite3_column_text(pStmt, 0);
28201 int nCompletion = sqlite3_column_bytes(pStmt, 0);
28207 sqlite3_finalize(pStmt);
28355 sqlite3_stmt *pStmt;
28366 pStmt = (sqlite3_stmt*)pP;
28369 zSql = sqlite3_expanded_sql(pStmt);
28374 zSql = sqlite3_normalized_sql(pStmt);
28379 zSql = sqlite3_sql(pStmt);
28912 sqlite3_stmt *pStmt;
28919 sqlite3_prepare_v2(db, z, -1, &pStmt, 0);
28920 if( pStmt && sqlite3_step(pStmt)==SQLITE_ROW ){
28921 res = sqlite3_column_int(pStmt,0);
28923 sqlite3_finalize(pStmt);
28978 sqlite3_stmt *pStmt = 0;
28984 -1, &pStmt, 0);
28987 sqlite3_finalize(pStmt);
28990 sqlite3_bind_text(pStmt, 1, zDb, -1, SQLITE_STATIC);
28991 if( sqlite3_step(pStmt)==SQLITE_ROW
28992 && sqlite3_column_bytes(pStmt,0)>100
28994 const u8 *pb = sqlite3_column_blob(pStmt,0);
28997 sqlite3_finalize(pStmt);
29000 sqlite3_finalize(pStmt);
29046 sqlite3_stmt *pStmt = 0;
29060 rc = sqlite3_prepare_v2(p->db, "PRAGMA page_size", -1, &pStmt, 0);
29063 if( sqlite3_step(pStmt)!=SQLITE_ROW ) goto dbtotxt_error;
29064 pgSz = sqlite3_column_int(pStmt, 0);
29065 sqlite3_finalize(pStmt);
29066 pStmt = 0;
29068 rc = sqlite3_prepare_v2(p->db, "PRAGMA page_count", -1, &pStmt, 0);
29071 if( sqlite3_step(pStmt)!=SQLITE_ROW ) goto dbtotxt_error;
29072 nPage = sqlite3_column_int64(pStmt, 0);
29073 sqlite3_finalize(pStmt);
29074 pStmt = 0;
29076 rc = sqlite3_prepare_v2(p->db, "PRAGMA database_list", -1, &pStmt, 0);
29078 if( sqlite3_step(pStmt)!=SQLITE_ROW ){
29081 const char *zFilename = (const char*)sqlite3_column_text(pStmt, 2);
29097 sqlite3_finalize(pStmt);
29098 pStmt = 0;
29100 "SELECT pgno, data FROM sqlite_dbpage ORDER BY pgno", -1, &pStmt, 0);
29102 while( sqlite3_step(pStmt)==SQLITE_ROW ){
29103 sqlite3_int64 pgno = sqlite3_column_int64(pStmt, 0);
29104 const u8 *aData = sqlite3_column_blob(pStmt, 1);
29124 sqlite3_finalize(pStmt);
29133 sqlite3_finalize(pStmt);
29658 sqlite3_stmt *pStmt
29660 if( pStmt ){
29661 sqlite3 *db = sqlite3_db_handle(pStmt);
29662 int rc = sqlite3_finalize(pStmt);
29681 sqlite3_stmt *pStmt
29683 int rc = sqlite3_reset(pStmt);
29686 sqlite3 *db = sqlite3_db_handle(pStmt);
30731 sqlite3_stmt *pStmt = 0;
30747 rc = sqlite3_prepare_v2(*pDb, zTabFill, -1, &pStmt, 0);
30749 rc = sqlite3_bind_text(pStmt, 1, zColNew, -1, 0);
30751 rc = sqlite3_step(pStmt);
30753 sqlite3_finalize(pStmt);
30769 rc = sqlite3_prepare_v2(*pDb, zRenameRank, -1, &pStmt, 0);
30771 sqlite3_bind_int(pStmt, 1, nDigits);
30772 rc = sqlite3_step(pStmt);
30773 sqlite3_finalize(pStmt);
30777 rc = sqlite3_prepare_v2(*pDb, zCollectVar, -1, &pStmt, 0);
30779 rc = sqlite3_step(pStmt);
30781 zColsSpec = sqlite3_mprintf("%s", sqlite3_column_text(pStmt, 0));
30788 sqlite3_finalize(pStmt);
30789 if( SQLITE_OK==sqlite3_prepare_v2(*pDb, zRenamesDone, -1, &pStmt, 0)
30790 && SQLITE_ROW==sqlite3_step(pStmt) ){
30791 *pzRenamed = sqlite3_mprintf("%s", sqlite3_column_text(pStmt, 0));
30796 sqlite3_finalize(pStmt);
30813 sqlite3_stmt *pStmt = 0;
30814 shellPreparePrintf(p->db, &rc, &pStmt,
30818 if( rc==SQLITE_OK && sqlite3_step(pStmt)==SQLITE_ROW ){
30824 shellFinalize(&rc, pStmt);
30950 sqlite3_stmt *pStmt = NULL; /* A statement */
31187 rc = sqlite3_prepare_v2(p->db, zSql, -1, &pStmt, 0);
31191 if (pStmt) sqlite3_finalize(pStmt);
31196 if( sqlite3_step(pStmt)==SQLITE_ROW ){
31197 nCol = sqlite3_column_int(pStmt, 0);
31201 sqlite3_finalize(pStmt);
31202 pStmt = 0;
31231 rc = sqlite3_prepare_v2(p->db, zSql, -1, &pStmt, 0);
31236 if (pStmt) sqlite3_finalize(pStmt);
31265 sqlite3_bind_text(pStmt, i+1, z, -1, SQLITE_TRANSIENT);
31275 while( i<=nCol ){ sqlite3_bind_null(pStmt, i); i++; }
31288 sqlite3_step(pStmt);
31289 rc = sqlite3_reset(pStmt);
31302 sqlite3_finalize(pStmt);
32707 sqlite3_stmt *pStmt;
32710 rc = sqlite3_prepare_v2(p->db, "PRAGMA database_list", -1, &pStmt, 0);
32715 while( sqlite3_step(pStmt)==SQLITE_ROW ){
32716 const char *zSchema = (const char *)sqlite3_column_text(pStmt,1);
32717 const char *zFile = (const char*)sqlite3_column_text(pStmt,2);
32726 sqlite3_finalize(pStmt);
33181 sqlite3_stmt *pStmt;
33186 -1, &pStmt, 0);
33188 while( sqlite3_step(pStmt)==SQLITE_ROW ){
33189 int k = sqlite3_column_int(pStmt,0);
33195 sqlite3_finalize(pStmt);
33246 sqlite3_stmt *pStmt;
33278 sqlite3_prepare_v2(p->db, zSql, -1, &pStmt, 0);
33280 if( sqlite3_step(pStmt)==SQLITE_ROW ){
33281 tnum = sqlite3_column_int(pStmt, 0);
33282 isWO = sqlite3_column_int(pStmt, 1);
33284 sqlite3_finalize(pStmt);
33286 rc = sqlite3_prepare_v2(p->db, zSql, -1, &pStmt, 0);
33289 while( rc==SQLITE_OK && sqlite3_step(pStmt)==SQLITE_ROW ){
33291 const char *zCol = (const char*)sqlite3_column_text(pStmt,2);
33294 if( sqlite3_column_int(pStmt,1)==-1 ){
33301 if( isWO && lenPK==0 && sqlite3_column_int(pStmt,5)==0 && zCollist ){
33310 sqlite3_finalize(pStmt);
33742 sqlite3_stmt *pStmt = 0;
33747 "FROM temp.sqlite_parameters;", -1, &pStmt, 0);
33748 if( rx==SQLITE_OK && sqlite3_step(pStmt)==SQLITE_ROW ){
33749 len = sqlite3_column_int(pStmt, 0);
33752 sqlite3_finalize(pStmt);
33753 pStmt = 0;
33757 "FROM temp.sqlite_parameters;", -1, &pStmt, 0);
33758 while( rx==SQLITE_OK && sqlite3_step(pStmt)==SQLITE_ROW ){
33760 "%-*s %s\n", len, sqlite3_column_text(pStmt,0),
33761 sqlite3_column_text(pStmt,1));
33763 sqlite3_finalize(pStmt);
33784 sqlite3_stmt *pStmt;
33792 pStmt = 0;
33793 rx = sqlite3_prepare_v2(p->db, zSql, -1, &pStmt, 0);
33796 sqlite3_finalize(pStmt);
33797 pStmt = 0;
33802 rx = sqlite3_prepare_v2(p->db, zSql, -1, &pStmt, 0);
33806 sqlite3_finalize(pStmt);
33807 pStmt = 0;
33811 bind_prepared_stmt(p, pStmt);
33812 sqlite3_step(pStmt);
33813 sqlite3_finalize(pStmt);
34048 sqlite3_stmt *pStmt = 0;
34094 rc = sqlite3_prepare_v2(p->db, "PRAGMA database_list", -1, &pStmt, 0);
34097 sqlite3_finalize(pStmt);
34105 while( sqlite3_step(pStmt)==SQLITE_ROW ){
34106 const char *zDb = (const char*)sqlite3_column_text(pStmt, 1);
34125 sqlite3_finalize(pStmt);
34414 sqlite3_stmt *pStmt = 0; /* Query against the SELFTEST table */
34450 -1, &pStmt, 0);
34455 -1, &pStmt, 0);
34460 sqlite3_finalize(pStmt);
34463 for(i=1; sqlite3_step(pStmt)==SQLITE_ROW; i++){
34464 int tno = sqlite3_column_int(pStmt, 0);
34465 const char *zOp = (const char*)sqlite3_column_text(pStmt, 1);
34466 const char *zSql = (const char*)sqlite3_column_text(pStmt, 2);
34467 const char *zAns = (const char*)sqlite3_column_text(pStmt, 3);
34507 sqlite3_finalize(pStmt);
34533 sqlite3_stmt *pStmt; /* For querying tables names */
34583 sqlite3_prepare_v2(p->db, zSql, -1, &pStmt, 0);
34588 while( SQLITE_ROW==sqlite3_step(pStmt) ){
34589 const char *zTab = (const char*)sqlite3_column_text(pStmt,0);
34617 sqlite3_finalize(pStmt);
34666 lrc = sqlite3_prepare_v2(p->db, zRevText, -1, &pStmt, 0);
34672 if( zLike ) sqlite3_bind_text(pStmt,1,zLike,-1,SQLITE_STATIC);
34673 lrc = SQLITE_ROW==sqlite3_step(pStmt);
34675 const char *zGenQuery = (char*)sqlite3_column_text(pStmt,0);
34693 sqlite3_finalize(pStmt);
34804 sqlite3_stmt *pStmt;
34809 rc = sqlite3_prepare_v2(p->db, "PRAGMA database_list", -1, &pStmt, 0);
34811 sqlite3_finalize(pStmt);
34816 while( sqlite3_step(pStmt)==SQLITE_ROW ){
34817 const char *zDbName = (const char*)sqlite3_column_text(pStmt, 1);
34836 rc = sqlite3_finalize(pStmt);
35721 sqlite3_stmt *pStmt = 0;
35724 shellPrepare(p->db, &rc, zQuery, &pStmt);
35725 if( rc==SQLITE_OK && sqlite3_step(pStmt)==SQLITE_ROW ){
35728 shellFinalize(&rc, pStmt);