diff --git a/manifest b/manifest index 61a11a09d5..7c0280811c 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Change\sthe\snames\sof\sexternal\ssymbols\sfrom\ssqlite_XXX\sto\ssqlite3_XXX.\s(CVS\s1337) -D 2004-05-10T10:34:34 +C Change\sthe\snames\sof\sexternal\ssymbols\sfrom\ssqlite_XXX\sto\ssqlite3_XXX.\s(CVS\s1338) +D 2004-05-10T10:34:52 F Makefile.in ab7b0d5118e2da97bac66be8684a1034e3500f5a F Makefile.linux-gcc b86a99c493a5bfb402d1d9178dcdc4bd4b32f906 F README f1de682fbbd94899d50aca13d387d1b3fd3be2dd @@ -37,33 +37,33 @@ F src/hash.c 440c2f8cb373ee1b4e13a0988489c7cd95d55b6f F src/hash.h 762d95f1e567664d1eafc1687de755626be962fb F src/insert.c 2d082257784a8613b1b50cd5bbf42b9466646a0e F src/main.c 45f0dc84265d18b0e99500dced4975df8a041481 -F src/md5.c 01d2f55b06316d242749759b6a37186439ef7fe3 -F src/os.c 4092dcc87e66f49ed660fae1519569a0cee34da0 +F src/md5.c 8e39fdae6d8776b87558e91dcc94740c9b635a9c +F src/os.c ddcda92f7fd71b4513c57c1ec797917f206d504e F src/os.h fbb2f6595fc34fa351830d88fe1c6b85118f0383 -F src/pager.c 350f5cd153b248c67058cafc75c3f1b7d28c2b0b +F src/pager.c 43556f37b80efdccb853dbf86b3d09470d791d0d F src/pager.h 0c95b18f2785b58bfbb2b6f6a221f23caf378687 F src/parse.y d0258aa3cc8b0c5742b07b699d10fa98f3caea7d F src/pragma.c d9f8332a1a87bc4058113ee9686e0c14286d69fd -F src/printf.c 43d546542880fde9a3343f285516d74e70e63de1 +F src/printf.c 8aa5d88509f46f064f57d0a8419e7b5f3b9fd559 F src/random.c eff68e3f257e05e81eae6c4d50a51eb88beb4ff3 -F src/select.c d3868613e70ac09cf2fb4ddd211f088351d1fe51 -F src/shell.c 9a242ad03c8726823f182bff81c5e12ef2882f93 -F src/sqlite.h.in 532e08163a8df8b71faf7be4e69ba208938eb312 -F src/sqliteInt.h ad857ab418724bcecad9041de1c4cf3be10c6f55 -F src/table.c 882b0ae9524c67758157540dd6467c9a5de52335 -F src/tclsqlite.c 21147148e7b57a0bb7409cff5878c60470df9acc -F src/test1.c 67a72fa1f5f6d41c838fa97f324f8dbfb4051413 -F src/test2.c 8dab493c7eccd2c7bb93a8e31f7db60f14e61b7b +F src/select.c 9290439282fdc787fdf34d8600dec3a360275c92 +F src/shell.c 255b8b9023cb5274f56d87df437e8ce6ef810b91 +F src/sqlite.h.in cfdb920ed7b68692720263f8b662f276fe15f33c +F src/sqliteInt.h 3151a1c14fc07f96169e904913d28c7ab173d8ca +F src/table.c af14284fa36c8d41f6829e3f2819dce07d3e2de2 +F src/tclsqlite.c a38bf2263a097fcc9603e818c291151de1782c11 +F src/test1.c 79956f70dddd1a28f8577bbd61c8cf28e5875eb8 +F src/test2.c 6195a1ca2c8d0d2d93644e86da3289b403486872 F src/test3.c d6d9d943de0926688fed4c4f5f5b345afda1ba73 -F src/test4.c 92d2a10380a65d61e5527a556f604bfde16411e8 +F src/test4.c b3fab9aea7a8940a8a7386ce1c7e2157b09bd296 F src/test5.c eb39aac8fed61bd930b92613cd705c145244074a -F src/tokenize.c 256a3cf0ff938cd79774d7f95173d74281912df9 -F src/trigger.c 8b07ff87b39f24997e5f737340ebbb5ce09ca481 -F src/update.c 475465fc0582160dadf5455b05235cb13c9e21f9 +F src/tokenize.c e7536dd31205d5afb76c1bdc832dea009c7a3847 +F src/trigger.c 8df308e09113410bb895e88a2db65b55490268db +F src/update.c 6ca82fc4a0fb4d7f134e961921c906f6f3c8bc74 F src/utf.c fc799748d43fe1982d157b871e3e420a19c85d4f -F src/util.c 06f472823240ec2012586c55fee33a523d32d07b -F src/vacuum.c 91ba5a23eca2d9a8a11191cef577d417f9318976 -F src/vdbe.c 3d90858d784c4353a6e5ee45a0e4d82b9ba2aa5c +F src/util.c 74ee316594f68c41aed1884d737ab4085d479455 +F src/vacuum.c c134702e023db8778e6be59ac0ea7b02315b5476 +F src/vdbe.c 5cd18c8a3ab826f02ef1ce88a5798ec744337b30 F src/vdbe.h 2dc4d1161b64f5684faa6a2d292e318a185ecb2e F src/vdbeInt.h e4ab46c223bac43754335cdd14c9c6a95885b9a8 F src/vdbeaux.c 0256d8b9a355a90f24f992dd7b6f0d2373e3e957 @@ -187,7 +187,7 @@ F www/sqlite.tcl 3c83b08cf9f18aa2d69453ff441a36c40e431604 F www/tclsqlite.tcl b9271d44dcf147a93c98f8ecf28c927307abd6da F www/vdbe.tcl 9b9095d4495f37697fd1935d10e14c6015e80aa1 F www/whentouse.tcl a8335bce47cc2fddb07f19052cb0cb4d9129a8e4 -P 05434497ba5d9971d23144eb4b9d709c233f6546 -R 61565b7b4d0b0c747dc3c710b9222d1e +P ba2ba24263a9e4d1b65b441295504a5da6380f33 +R 34c539e427e74e63b45af740d6fe4c8f U danielk1977 -Z cdb3555cc5ea64d3d31c0c0c46963b23 +Z b146f9071529ddd4538b8fe328a13018 diff --git a/manifest.uuid b/manifest.uuid index e9dbfd63a5..c4312a55aa 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -ba2ba24263a9e4d1b65b441295504a5da6380f33 \ No newline at end of file +2242423e31a5e81e89ffcc99e62307c5cc0120d5 \ No newline at end of file diff --git a/src/md5.c b/src/md5.c index 0c4ead755b..f716dd8dde 100644 --- a/src/md5.c +++ b/src/md5.c @@ -360,9 +360,9 @@ static void md5step(sqlite_func *context, int argc, const char **argv){ MD5Context *p; int i; if( argc<1 ) return; - p = sqlite_aggregate_context(context, sizeof(*p)); + p = sqlite3_aggregate_context(context, sizeof(*p)); if( p==0 ) return; - if( sqlite_aggregate_count(context)==1 ){ + if( sqlite3_aggregate_count(context)==1 ){ MD5Init(p); } for(i=0; icolNamesSet || v==0 || sqlite_malloc_failed ) return; + if( pParse->colNamesSet || v==0 || sqlite3_malloc_failed ) return; pParse->colNamesSet = 1; fullNames = (db->flags & SQLITE_FullColNames)!=0; shortNames = (db->flags & SQLITE_ShortColNames)!=0; @@ -2007,7 +2007,7 @@ int sqlite3Select( int distinct; /* Table to use for the distinct set */ int rc = 1; /* Value to return from this function */ - if( sqlite_malloc_failed || pParse->nErr || p==0 ) return 1; + if( sqlite3_malloc_failed || pParse->nErr || p==0 ) return 1; if( sqlite3AuthCheck(pParse, SQLITE_SELECT, 0, 0, 0) ) return 1; /* If there is are a sequence of queries, do the earlier ones first. diff --git a/src/shell.c b/src/shell.c index 08ba508df7..648a9bbec8 100644 --- a/src/shell.c +++ b/src/shell.c @@ -12,7 +12,7 @@ ** This file contains code to implement the "sqlite" command line ** utility for accessing SQLite databases. ** -** $Id: shell.c,v 1.94 2004/05/08 08:23:32 danielk1977 Exp $ +** $Id: shell.c,v 1.95 2004/05/10 10:34:52 danielk1977 Exp $ */ #include #include @@ -271,7 +271,7 @@ static void output_html_string(FILE *out, const char *z){ */ static void interrupt_handler(int NotUsed){ seenInterrupt = 1; - if( db ) sqlite_interrupt(db); + if( db ) sqlite3_interrupt(db); } /* @@ -460,7 +460,7 @@ static int dump_callback(void *pArg, int nArg, char **azArg, char **azCol){ d2.mode = MODE_Insert; d2.zDestTable = 0; set_table_name(&d2, azArg[0]); - sqlite_exec_printf(p->db, + sqlite3_exec_printf(p->db, "SELECT * FROM '%q'", callback, &d2, 0, azArg[0] ); @@ -513,9 +513,9 @@ static void open_db(struct callback_data *p){ char *zErrMsg = 0; #ifdef SQLITE_HAS_CODEC int n = p->zKey ? strlen(p->zKey) : 0; - db = p->db = sqlite_open_encrypted(p->zDbFilename, p->zKey, n, 0, &zErrMsg); + db = p->db = sqlite3_open_encrypted(p->zDbFilename, p->zKey, n, 0, &zErrMsg); #else - db = p->db = sqlite_open(p->zDbFilename, 0, &zErrMsg); + db = p->db = sqlite3_open(p->zDbFilename, 0, &zErrMsg); #endif if( p->db==0 ){ if( zErrMsg ){ @@ -576,10 +576,10 @@ static int do_meta_command(char *zLine, struct callback_data *p){ data.colWidth[0] = 3; data.colWidth[1] = 15; data.colWidth[2] = 58; - sqlite_exec(p->db, "PRAGMA database_list; ", callback, &data, &zErrMsg); + sqlite3_exec(p->db, "PRAGMA database_list; ", callback, &data, &zErrMsg); if( zErrMsg ){ fprintf(stderr,"Error: %s\n", zErrMsg); - sqlite_freemem(zErrMsg); + sqlite3_freemem(zErrMsg); } }else @@ -588,7 +588,7 @@ static int do_meta_command(char *zLine, struct callback_data *p){ open_db(p); fprintf(p->out, "BEGIN TRANSACTION;\n"); if( nArg==1 ){ - sqlite_exec(p->db, + sqlite3_exec(p->db, "SELECT name, type, sql FROM sqlite_master " "WHERE type!='meta' AND sql NOT NULL " "ORDER BY substr(type,2,1), name", @@ -597,7 +597,7 @@ static int do_meta_command(char *zLine, struct callback_data *p){ }else{ int i; for(i=1; idb, + sqlite3_exec_printf(p->db, "SELECT name, type, sql FROM sqlite_master " "WHERE tbl_name LIKE '%q' AND type!='meta' AND sql NOT NULL " "ORDER BY substr(type,2,1), name", @@ -607,7 +607,7 @@ static int do_meta_command(char *zLine, struct callback_data *p){ } if( zErrMsg ){ fprintf(stderr,"Error: %s\n", zErrMsg); - sqlite_freemem(zErrMsg); + sqlite3_freemem(zErrMsg); }else{ fprintf(p->out, "COMMIT;\n"); } @@ -702,7 +702,7 @@ static int do_meta_command(char *zLine, struct callback_data *p){ memcpy(&data, p, sizeof(data)); data.showHeader = 0; data.mode = MODE_List; - sqlite_exec_printf(p->db, + sqlite3_exec_printf(p->db, "SELECT name FROM sqlite_master " "WHERE type='index' AND tbl_name LIKE '%q' " "UNION ALL " @@ -713,7 +713,7 @@ static int do_meta_command(char *zLine, struct callback_data *p){ ); if( zErrMsg ){ fprintf(stderr,"Error: %s\n", zErrMsg); - sqlite_freemem(zErrMsg); + sqlite3_freemem(zErrMsg); } }else @@ -797,8 +797,8 @@ static int do_meta_command(char *zLine, struct callback_data *p){ }else if( strcmp(azArg[2], azArg[3]) ){ fprintf(stderr,"2nd copy of new key does not match the 1st\n"); }else{ - sqlite_freemem(p->zKey); - p->zKey = sqlite_mprintf("%s", azArg[2]); + sqlite3_freemem(p->zKey); + p->zKey = sqlite3_mprintf("%s", azArg[2]); sqlite_rekey(p->db, p->zKey, strlen(p->zKey)); } }else @@ -840,7 +840,7 @@ static int do_meta_command(char *zLine, struct callback_data *p){ new_colv[1] = 0; callback(&data, 1, new_argv, new_colv); }else{ - sqlite_exec_printf(p->db, + sqlite3_exec_printf(p->db, "SELECT sql FROM " " (SELECT * FROM sqlite_master UNION ALL" " SELECT * FROM sqlite_temp_master) " @@ -849,7 +849,7 @@ static int do_meta_command(char *zLine, struct callback_data *p){ callback, &data, &zErrMsg, azArg[1]); } }else{ - sqlite_exec(p->db, + sqlite3_exec(p->db, "SELECT sql FROM " " (SELECT * FROM sqlite_master UNION ALL" " SELECT * FROM sqlite_temp_master) " @@ -860,7 +860,7 @@ static int do_meta_command(char *zLine, struct callback_data *p){ } if( zErrMsg ){ fprintf(stderr,"Error: %s\n", zErrMsg); - sqlite_freemem(zErrMsg); + sqlite3_freemem(zErrMsg); } }else @@ -891,7 +891,7 @@ static int do_meta_command(char *zLine, struct callback_data *p){ char *zErrMsg; open_db(p); if( nArg==1 ){ - rc = sqlite_get_table(p->db, + rc = sqlite3_get_table(p->db, "SELECT name FROM sqlite_master " "WHERE type IN ('table','view') " "UNION ALL " @@ -901,7 +901,7 @@ static int do_meta_command(char *zLine, struct callback_data *p){ &azResult, &nRow, 0, &zErrMsg ); }else{ - rc = sqlite_get_table_printf(p->db, + rc = sqlite3_get_table_printf(p->db, "SELECT name FROM sqlite_master " "WHERE type IN ('table','view') AND name LIKE '%%%q%%' " "UNION ALL " @@ -913,7 +913,7 @@ static int do_meta_command(char *zLine, struct callback_data *p){ } if( zErrMsg ){ fprintf(stderr,"Error: %s\n", zErrMsg); - sqlite_freemem(zErrMsg); + sqlite3_freemem(zErrMsg); } if( rc==SQLITE_OK ){ int len, maxlen = 0; @@ -935,12 +935,12 @@ static int do_meta_command(char *zLine, struct callback_data *p){ printf("\n"); } } - sqlite_free_table(azResult); + sqlite3_free_table(azResult); }else if( c=='t' && n>1 && strncmp(azArg[0], "timeout", n)==0 && nArg>=2 ){ open_db(p); - sqlite_busy_timeout(p->db, atoi(azArg[1])); + sqlite3_busy_timeout(p->db, atoi(azArg[1])); }else if( c=='w' && strncmp(azArg[0], "width", n)==0 ){ @@ -1055,18 +1055,18 @@ static void process_input(struct callback_data *p, FILE *in){ nSql += len; } free(zLine); - if( zSql && _ends_with_semicolon(zSql, nSql) && sqlite_complete(zSql) ){ + if( zSql && _ends_with_semicolon(zSql, nSql) && sqlite3_complete(zSql) ){ p->cnt = 0; open_db(p); - rc = sqlite_exec(p->db, zSql, callback, p, &zErrMsg); + rc = sqlite3_exec(p->db, zSql, callback, p, &zErrMsg); if( rc || zErrMsg ){ if( in!=0 && !p->echoOn ) printf("%s\n",zSql); if( zErrMsg!=0 ){ printf("SQL error: %s\n", zErrMsg); - sqlite_freemem(zErrMsg); + sqlite3_freemem(zErrMsg); zErrMsg = 0; }else{ - printf("SQL error: %s\n", sqlite_error_string(rc)); + printf("SQL error: %s\n", sqlite3_error_string(rc)); } } free(zSql); @@ -1239,7 +1239,7 @@ int main(int argc, char **argv){ zInitFile = argv[i]; }else if( strcmp(argv[i],"-key")==0 ){ i++; - data.zKey = sqlite_mprintf("%s",argv[i]); + data.zKey = sqlite3_mprintf("%s",argv[i]); } } if( inColumn!=nCol ){ sqlite3SetString(&p->zErrMsg, - "sqlite_get_table() called with two or more incompatible queries", + "sqlite3_get_table() called with two or more incompatible queries", (char*)0); p->rc = SQLITE_ERROR; return 1; @@ -119,10 +119,10 @@ static int sqlite_get_table_cb(void *pArg, int nCol, char **argv, char **colv){ ** ** The result that is written to ***pazResult is held in memory obtained ** from malloc(). But the caller cannot free this memory directly. -** Instead, the entire table should be passed to sqlite_free_table() when +** Instead, the entire table should be passed to sqlite3_free_table() when ** the calling procedure is finished using it. */ -int sqlite_get_table( +int sqlite3_get_table( sqlite *db, /* The database on which the SQL executes */ const char *zSql, /* The SQL to be executed */ char ***pazResult, /* Write the result table here */ @@ -148,12 +148,12 @@ int sqlite_get_table( return SQLITE_NOMEM; } res.azResult[0] = 0; - rc = sqlite_exec(db, zSql, sqlite_get_table_cb, &res, pzErrMsg); + rc = sqlite3_exec(db, zSql, sqlite3_get_table_cb, &res, pzErrMsg); if( res.azResult ){ res.azResult[0] = (char*)res.nData; } if( rc==SQLITE_ABORT ){ - sqlite_free_table(&res.azResult[1]); + sqlite3_free_table(&res.azResult[1]); if( res.zErrMsg ){ if( pzErrMsg ){ free(*pzErrMsg); @@ -167,14 +167,14 @@ int sqlite_get_table( } sqliteFree(res.zErrMsg); if( rc!=SQLITE_OK ){ - sqlite_free_table(&res.azResult[1]); + sqlite3_free_table(&res.azResult[1]); return rc; } if( res.nAlloc>res.nData ){ char **azNew; azNew = realloc( res.azResult, sizeof(char*)*(res.nData+1) ); if( azNew==0 ){ - sqlite_free_table(&res.azResult[1]); + sqlite3_free_table(&res.azResult[1]); return SQLITE_NOMEM; } res.nAlloc = res.nData+1; @@ -187,10 +187,10 @@ int sqlite_get_table( } /* -** This routine frees the space the sqlite_get_table() malloced. +** This routine frees the space the sqlite3_get_table() malloced. */ -void sqlite_free_table( - char **azResult /* Result returned from from sqlite_get_table() */ +void sqlite3_free_table( + char **azResult /* Result returned from from sqlite3_get_table() */ ){ if( azResult ){ int i, n; diff --git a/src/tclsqlite.c b/src/tclsqlite.c index 474a72b84f..2c3b9211d4 100644 --- a/src/tclsqlite.c +++ b/src/tclsqlite.c @@ -11,7 +11,7 @@ ************************************************************************* ** A TCL Interface to SQLite ** -** $Id: tclsqlite.c,v 1.63 2004/05/08 08:23:37 danielk1977 Exp $ +** $Id: tclsqlite.c,v 1.64 2004/05/10 10:34:53 danielk1977 Exp $ */ #ifndef NO_TCL /* Omit this whole file if TCL is unavailable */ @@ -56,7 +56,7 @@ struct SqliteDb { char *zProgress; /* The progress callback routine */ char *zAuth; /* The authorization callback routine */ SqlFunc *pFunc; /* List of SQL functions */ - int rc; /* Return code of most recent sqlite_exec() */ + int rc; /* Return code of most recent sqlite3_exec() */ }; /* @@ -185,10 +185,10 @@ static int DbEvalCallback( Tcl_SetVar2(cbData->interp, cbData->zArray, "*", azN[i], TCL_LIST_ELEMENT|TCL_APPEND_VALUE); if( azN[nCol] ){ - char *z = sqlite_mprintf("typeof:%s", azN[i]); + char *z = sqlite3_mprintf("typeof:%s", azN[i]); Tcl_SetVar2(cbData->interp, cbData->zArray, z, azN[i+nCol], TCL_LIST_ELEMENT|TCL_APPEND_VALUE); - sqlite_freemem(z); + sqlite3_freemem(z); } } cbData->once = 0; @@ -284,7 +284,7 @@ static int DbEvalCallback3( */ static void DbDeleteCmd(void *db){ SqliteDb *pDb = (SqliteDb*)db; - sqlite_close(pDb->db); + sqlite3_close(pDb->db); while( pDb->pFunc ){ SqlFunc *pFunc = pDb->pFunc; pDb->pFunc = pFunc->pNext; @@ -380,7 +380,7 @@ static int DbCommitHandler(void *cd){ ** using TCL script. */ static void tclSqlFunc(sqlite_func *context, int argc, const char **argv){ - SqlFunc *p = sqlite_user_data(context); + SqlFunc *p = sqlite3_user_data(context); Tcl_DString cmd; int i; int rc; @@ -392,9 +392,9 @@ static void tclSqlFunc(sqlite_func *context, int argc, const char **argv){ } rc = Tcl_Eval(p->interp, Tcl_DStringValue(&cmd)); if( rc ){ - sqlite_set_result_error(context, Tcl_GetStringResult(p->interp), -1); + sqlite3_set_result_error(context, Tcl_GetStringResult(p->interp), -1); }else{ - sqlite_set_result_string(context, Tcl_GetStringResult(p->interp), -1); + sqlite3_set_result_string(context, Tcl_GetStringResult(p->interp), -1); } } #ifndef SQLITE_OMIT_AUTHORIZATION @@ -556,9 +556,9 @@ static int DbObjCmd(void *cd, Tcl_Interp *interp, int objc,Tcl_Obj *const*objv){ #ifndef SQLITE_OMIT_AUTHORIZATION if( pDb->zAuth ){ pDb->interp = interp; - sqlite_set_authorizer(pDb->db, auth_callback, pDb); + sqlite3_set_authorizer(pDb->db, auth_callback, pDb); }else{ - sqlite_set_authorizer(pDb->db, 0, 0); + sqlite3_set_authorizer(pDb->db, 0, 0); } #endif } @@ -593,9 +593,9 @@ static int DbObjCmd(void *cd, Tcl_Interp *interp, int objc,Tcl_Obj *const*objv){ } if( pDb->zBusy ){ pDb->interp = interp; - sqlite_busy_handler(pDb->db, DbBusyHandler, pDb); + sqlite3_busy_handler(pDb->db, DbBusyHandler, pDb); }else{ - sqlite_busy_handler(pDb->db, 0, 0); + sqlite3_busy_handler(pDb->db, 0, 0); } } break; @@ -631,9 +631,9 @@ static int DbObjCmd(void *cd, Tcl_Interp *interp, int objc,Tcl_Obj *const*objv){ #ifndef SQLITE_OMIT_PROGRESS_CALLBACK if( pDb->zProgress ){ pDb->interp = interp; - sqlite_progress_handler(pDb->db, N, DbProgressHandler, pDb); + sqlite3_progress_handler(pDb->db, N, DbProgressHandler, pDb); }else{ - sqlite_progress_handler(pDb->db, 0, 0, 0); + sqlite3_progress_handler(pDb->db, 0, 0, 0); } #endif }else{ @@ -656,7 +656,7 @@ static int DbObjCmd(void *cd, Tcl_Interp *interp, int objc,Tcl_Obj *const*objv){ Tcl_WrongNumArgs(interp, 2, objv, ""); return TCL_ERROR; } - nChange = sqlite_changes(pDb->db); + nChange = sqlite3_changes(pDb->db); pResult = Tcl_GetObjResult(interp); Tcl_SetIntObj(pResult, nChange); break; @@ -676,7 +676,7 @@ static int DbObjCmd(void *cd, Tcl_Interp *interp, int objc,Tcl_Obj *const*objv){ Tcl_WrongNumArgs(interp, 2, objv, ""); return TCL_ERROR; } - lsChange = sqlite_last_statement_changes(pDb->db); + lsChange = sqlite3_last_statement_changes(pDb->db); pResult = Tcl_GetObjResult(interp); Tcl_SetIntObj(pResult, lsChange); break; @@ -720,9 +720,9 @@ static int DbObjCmd(void *cd, Tcl_Interp *interp, int objc,Tcl_Obj *const*objv){ } if( pDb->zCommit ){ pDb->interp = interp; - sqlite_commit_hook(pDb->db, DbCommitHandler, pDb); + sqlite3_commit_hook(pDb->db, DbCommitHandler, pDb); }else{ - sqlite_commit_hook(pDb->db, 0, 0); + sqlite3_commit_hook(pDb->db, 0, 0); } } break; @@ -741,7 +741,7 @@ static int DbObjCmd(void *cd, Tcl_Interp *interp, int objc,Tcl_Obj *const*objv){ Tcl_WrongNumArgs(interp, 2, objv, "SQL"); return TCL_ERROR; } - isComplete = sqlite_complete( Tcl_GetStringFromObj(objv[2], 0) ); + isComplete = sqlite3_complete( Tcl_GetStringFromObj(objv[2], 0) ); pResult = Tcl_GetObjResult(interp); Tcl_SetBooleanObj(pResult, isComplete); break; @@ -751,7 +751,7 @@ static int DbObjCmd(void *cd, Tcl_Interp *interp, int objc,Tcl_Obj *const*objv){ ** $db errorcode ** ** Return the numeric error code that was returned by the most recent - ** call to sqlite_exec(). + ** call to sqlite3_exec(). */ case DB_ERRORCODE: { Tcl_SetObjResult(interp, Tcl_NewIntObj(pDb->rc)); @@ -799,14 +799,14 @@ static int DbObjCmd(void *cd, Tcl_Interp *interp, int objc,Tcl_Obj *const*objv){ zErrMsg = 0; Tcl_IncrRefCount(objv[3]); Tcl_IncrRefCount(objv[4]); - rc = sqlite_exec(pDb->db, zSql, DbEvalCallback, &cbData, &zErrMsg); + rc = sqlite3_exec(pDb->db, zSql, DbEvalCallback, &cbData, &zErrMsg); Tcl_DecrRefCount(objv[4]); Tcl_DecrRefCount(objv[3]); if( cbData.tcl_rc==TCL_BREAK ){ cbData.tcl_rc = TCL_OK; } }else{ Tcl_Obj *pList = Tcl_NewObj(); cbData.tcl_rc = TCL_OK; - rc = sqlite_exec(pDb->db, zSql, DbEvalCallback2, pList, &zErrMsg); + rc = sqlite3_exec(pDb->db, zSql, DbEvalCallback2, pList, &zErrMsg); Tcl_SetObjResult(interp, pList); } pDb->rc = rc; @@ -818,7 +818,7 @@ static int DbObjCmd(void *cd, Tcl_Interp *interp, int objc,Tcl_Obj *const*objv){ free(zErrMsg); rc = TCL_ERROR; }else if( rc!=SQLITE_OK ){ - Tcl_AppendResult(interp, sqlite_error_string(rc), 0); + Tcl_AppendResult(interp, sqlite3_error_string(rc), 0); rc = TCL_ERROR; }else{ } @@ -859,8 +859,8 @@ static int DbObjCmd(void *cd, Tcl_Interp *interp, int objc,Tcl_Obj *const*objv){ pFunc->pNext = pDb->pFunc; pFunc->zScript = (char*)&pFunc[1]; strcpy(pFunc->zScript, zScript); - sqlite_create_function(pDb->db, zName, -1, tclSqlFunc, pFunc); - sqlite_function_type(pDb->db, zName, SQLITE_NUMERIC); + sqlite3_create_function(pDb->db, zName, -1, tclSqlFunc, pFunc); + sqlite3_function_type(pDb->db, zName, SQLITE_NUMERIC); break; } @@ -876,7 +876,7 @@ static int DbObjCmd(void *cd, Tcl_Interp *interp, int objc,Tcl_Obj *const*objv){ Tcl_WrongNumArgs(interp, 2, objv, ""); return TCL_ERROR; } - rowid = sqlite_last_insert_rowid(pDb->db); + rowid = sqlite3_last_insert_rowid(pDb->db); pResult = Tcl_GetObjResult(interp); Tcl_SetIntObj(pResult, rowid); break; @@ -895,7 +895,7 @@ static int DbObjCmd(void *cd, Tcl_Interp *interp, int objc,Tcl_Obj *const*objv){ return TCL_ERROR; } zSql = Tcl_GetStringFromObj(objv[2], 0); - rc = sqlite_exec(pDb->db, zSql, DbEvalCallback3, interp, &zErrMsg); + rc = sqlite3_exec(pDb->db, zSql, DbEvalCallback3, interp, &zErrMsg); if( rc==SQLITE_ABORT ){ rc = SQLITE_OK; }else if( zErrMsg ){ @@ -903,7 +903,7 @@ static int DbObjCmd(void *cd, Tcl_Interp *interp, int objc,Tcl_Obj *const*objv){ free(zErrMsg); rc = TCL_ERROR; }else if( rc!=SQLITE_OK ){ - Tcl_AppendResult(interp, sqlite_error_string(rc), 0); + Tcl_AppendResult(interp, sqlite3_error_string(rc), 0); rc = TCL_ERROR; } break; @@ -925,7 +925,7 @@ static int DbObjCmd(void *cd, Tcl_Interp *interp, int objc,Tcl_Obj *const*objv){ #ifdef SQLITE_HAS_CODEC rc = sqlite_rekey(pDb->db, pKey, nKey); if( rc ){ - Tcl_AppendResult(interp, sqlite_error_string(rc), 0); + Tcl_AppendResult(interp, sqlite3_error_string(rc), 0); rc = TCL_ERROR; } #endif @@ -944,7 +944,7 @@ static int DbObjCmd(void *cd, Tcl_Interp *interp, int objc,Tcl_Obj *const*objv){ return TCL_ERROR; } if( Tcl_GetIntFromObj(interp, objv[2], &ms) ) return TCL_ERROR; - sqlite_busy_timeout(pDb->db, ms); + sqlite3_busy_timeout(pDb->db, ms); break; } @@ -976,9 +976,9 @@ static int DbObjCmd(void *cd, Tcl_Interp *interp, int objc,Tcl_Obj *const*objv){ } if( pDb->zTrace ){ pDb->interp = interp; - sqlite_trace(pDb->db, DbTraceHandler, pDb); + sqlite3_trace(pDb->db, DbTraceHandler, pDb); }else{ - sqlite_trace(pDb->db, 0, 0); + sqlite3_trace(pDb->db, 0, 0); } } break; @@ -1031,11 +1031,11 @@ static int DbMain(void *cd, Tcl_Interp *interp, int objc,Tcl_Obj *const*objv){ if( objc==2 ){ zArg = Tcl_GetStringFromObj(objv[1], 0); if( strcmp(zArg,"-encoding")==0 ){ - Tcl_AppendResult(interp,sqlite_encoding,0); + Tcl_AppendResult(interp,sqlite3_encoding,0); return TCL_OK; } if( strcmp(zArg,"-version")==0 ){ - Tcl_AppendResult(interp,sqlite_version,0); + Tcl_AppendResult(interp,sqlite3_version,0); return TCL_OK; } if( strcmp(zArg,"-has-codec")==0 ){ @@ -1086,9 +1086,9 @@ static int DbMain(void *cd, Tcl_Interp *interp, int objc,Tcl_Obj *const*objv){ memset(p, 0, sizeof(*p)); zFile = Tcl_GetStringFromObj(objv[2], 0); #ifdef SQLITE_HAS_CODEC - p->db = sqlite_open_encrypted(zFile, pKey, nKey, 0, &zErrMsg); + p->db = sqlite3_open_encrypted(zFile, pKey, nKey, 0, &zErrMsg); #else - p->db = sqlite_open(zFile, mode, &zErrMsg); + p->db = sqlite3_open(zFile, mode, &zErrMsg); #endif if( p->db==0 ){ Tcl_SetResult(interp, zErrMsg, TCL_VOLATILE); diff --git a/src/test1.c b/src/test1.c index 3436bc75c1..109beb9790 100644 --- a/src/test1.c +++ b/src/test1.c @@ -13,7 +13,7 @@ ** is not included in the SQLite library. It is used for automated ** testing of the SQLite library. ** -** $Id: test1.c,v 1.37 2004/05/08 08:23:39 danielk1977 Exp $ +** $Id: test1.c,v 1.38 2004/05/10 10:34:53 danielk1977 Exp $ */ #include "sqliteInt.h" #include "tcl.h" @@ -82,7 +82,7 @@ static int makePointerStr(Tcl_Interp *interp, char *zPtr, void *p){ } /* -** Usage: sqlite_open filename +** Usage: sqlite3_open filename ** ** Returns: The name of an open database. */ @@ -100,7 +100,7 @@ static int sqlite_test_open( " FILENAME\"", 0); return TCL_ERROR; } - db = sqlite_open(argv[1], 0666, &zErr); + db = sqlite3_open(argv[1], 0666, &zErr); if( db==0 ){ Tcl_AppendResult(interp, zErr, 0); free(zErr); @@ -112,7 +112,7 @@ static int sqlite_test_open( } /* -** The callback routine for sqlite_exec_printf(). +** The callback routine for sqlite3_exec_printf(). */ static int exec_printf_cb(void *pArg, int argc, char **argv, char **name){ Tcl_DString *str = (Tcl_DString*)pArg; @@ -130,9 +130,9 @@ static int exec_printf_cb(void *pArg, int argc, char **argv, char **name){ } /* -** Usage: sqlite_exec_printf DB FORMAT STRING +** Usage: sqlite3_exec_printf DB FORMAT STRING ** -** Invoke the sqlite_exec_printf() interface using the open database +** Invoke the sqlite3_exec_printf() interface using the open database ** DB. The SQL is the string FORMAT. The format string should contain ** one %s or %q. STRING is the value inserted into %s or %q. */ @@ -154,7 +154,7 @@ static int test_exec_printf( } if( getDbPointer(interp, argv[1], &db) ) return TCL_ERROR; Tcl_DStringInit(&str); - rc = sqlite_exec_printf(db, argv[2], exec_printf_cb, &str, &zErr, argv[3]); + rc = sqlite3_exec_printf(db, argv[2], exec_printf_cb, &str, &zErr, argv[3]); sprintf(zBuf, "%d", rc); Tcl_AppendElement(interp, zBuf); Tcl_AppendElement(interp, rc==SQLITE_OK ? Tcl_DStringValue(&str) : zErr); @@ -164,7 +164,7 @@ static int test_exec_printf( } /* -** Usage: sqlite_mprintf_z_test SEPARATOR ARG0 ARG1 ... +** Usage: sqlite3_mprintf_z_test SEPARATOR ARG0 ARG1 ... ** ** Test the %z format of mprintf(). Use multiple mprintf() calls to ** concatenate arg0 through argn using separator as the separator. @@ -188,9 +188,9 @@ static int test_mprintf_z( } /* -** Usage: sqlite_get_table_printf DB FORMAT STRING +** Usage: sqlite3_get_table_printf DB FORMAT STRING ** -** Invoke the sqlite_get_table_printf() interface using the open database +** Invoke the sqlite3_get_table_printf() interface using the open database ** DB. The SQL is the string FORMAT. The format string should contain ** one %s or %q. STRING is the value inserted into %s or %q. */ @@ -215,7 +215,7 @@ static int test_get_table_printf( } if( getDbPointer(interp, argv[1], &db) ) return TCL_ERROR; Tcl_DStringInit(&str); - rc = sqlite_get_table_printf(db, argv[2], &aResult, &nRow, &nCol, + rc = sqlite3_get_table_printf(db, argv[2], &aResult, &nRow, &nCol, &zErr, argv[3]); sprintf(zBuf, "%d", rc); Tcl_AppendElement(interp, zBuf); @@ -230,14 +230,14 @@ static int test_get_table_printf( }else{ Tcl_AppendElement(interp, zErr); } - sqlite_free_table(aResult); + sqlite3_free_table(aResult); if( zErr ) free(zErr); return TCL_OK; } /* -** Usage: sqlite_last_insert_rowid DB +** Usage: sqlite3_last_insert_rowid DB ** ** Returns the integer ROWID of the most recent insert. */ @@ -255,15 +255,15 @@ static int test_last_rowid( return TCL_ERROR; } if( getDbPointer(interp, argv[1], &db) ) return TCL_ERROR; - sprintf(zBuf, "%d", sqlite_last_insert_rowid(db)); + sprintf(zBuf, "%d", sqlite3_last_insert_rowid(db)); Tcl_AppendResult(interp, zBuf, 0); return SQLITE_OK; } /* -** Usage: sqlite_close DB +** Usage: sqlite3_close DB ** -** Closes the database opened by sqlite_open. +** Closes the database opened by sqlite3_open. */ static int sqlite_test_close( void *NotUsed, @@ -278,7 +278,7 @@ static int sqlite_test_close( return TCL_ERROR; } if( getDbPointer(interp, argv[1], &db) ) return TCL_ERROR; - sqlite_close(db); + sqlite3_close(db); return TCL_OK; } @@ -290,7 +290,7 @@ static void ifnullFunc(sqlite_func *context, int argc, const char **argv){ int i; for(i=0; in++; } } static void countFinalize(sqlite_func *context){ CountCtx *p; - p = sqlite_aggregate_context(context, sizeof(*p)); - sqlite_set_result_int(context, p ? p->n : 0); + p = sqlite3_aggregate_context(context, sizeof(*p)); + sqlite3_set_result_int(context, p ? p->n : 0); } /* ** Usage: sqlite_test_create_aggregate DB ** -** Call the sqlite_create_function API on the given database in order +** Call the sqlite3_create_function API on the given database in order ** to create a function named "x_count". This function does the same thing ** as the "md5sum" function. ** ** The original motivation for this routine was to be able to call the -** sqlite_create_aggregate function while a query is in progress in order +** sqlite3_create_aggregate function while a query is in progress in order ** to test the SQLITE_MISUSE detection logic. */ static int test_create_aggregate( @@ -442,19 +442,19 @@ static int test_create_aggregate( return TCL_ERROR; } if( getDbPointer(interp, argv[1], &db) ) return TCL_ERROR; - sqlite_create_aggregate(db, "x_count", 0, countStep, countFinalize, 0); - sqlite_create_aggregate(db, "x_count", 1, countStep, countFinalize, 0); + sqlite3_create_aggregate(db, "x_count", 0, countStep, countFinalize, 0); + sqlite3_create_aggregate(db, "x_count", 1, countStep, countFinalize, 0); return TCL_OK; } /* -** Usage: sqlite_mprintf_int FORMAT INTEGER INTEGER INTEGER +** Usage: sqlite3_mprintf_int FORMAT INTEGER INTEGER INTEGER ** ** Call mprintf with three integer arguments */ -static int sqlite_mprintf_int( +static int sqlite3_mprintf_int( void *NotUsed, Tcl_Interp *interp, /* The TCL interpreter that invoked this command */ int argc, /* Number of arguments */ @@ -470,18 +470,18 @@ static int sqlite_mprintf_int( for(i=2; i<5; i++){ if( Tcl_GetInt(interp, argv[i], &a[i-2]) ) return TCL_ERROR; } - z = sqlite_mprintf(argv[1], a[0], a[1], a[2]); + z = sqlite3_mprintf(argv[1], a[0], a[1], a[2]); Tcl_AppendResult(interp, z, 0); - sqlite_freemem(z); + sqlite3_freemem(z); return TCL_OK; } /* -** Usage: sqlite_mprintf_str FORMAT INTEGER INTEGER STRING +** Usage: sqlite3_mprintf_str FORMAT INTEGER INTEGER STRING ** ** Call mprintf with two integer arguments and one string argument */ -static int sqlite_mprintf_str( +static int sqlite3_mprintf_str( void *NotUsed, Tcl_Interp *interp, /* The TCL interpreter that invoked this command */ int argc, /* Number of arguments */ @@ -497,18 +497,18 @@ static int sqlite_mprintf_str( for(i=2; i<4; i++){ if( Tcl_GetInt(interp, argv[i], &a[i-2]) ) return TCL_ERROR; } - z = sqlite_mprintf(argv[1], a[0], a[1], argc>4 ? argv[4] : NULL); + z = sqlite3_mprintf(argv[1], a[0], a[1], argc>4 ? argv[4] : NULL); Tcl_AppendResult(interp, z, 0); - sqlite_freemem(z); + sqlite3_freemem(z); return TCL_OK; } /* -** Usage: sqlite_mprintf_str FORMAT INTEGER INTEGER DOUBLE +** Usage: sqlite3_mprintf_str FORMAT INTEGER INTEGER DOUBLE ** ** Call mprintf with two integer arguments and one double argument */ -static int sqlite_mprintf_double( +static int sqlite3_mprintf_double( void *NotUsed, Tcl_Interp *interp, /* The TCL interpreter that invoked this command */ int argc, /* Number of arguments */ @@ -526,20 +526,20 @@ static int sqlite_mprintf_double( if( Tcl_GetInt(interp, argv[i], &a[i-2]) ) return TCL_ERROR; } if( Tcl_GetDouble(interp, argv[4], &r) ) return TCL_ERROR; - z = sqlite_mprintf(argv[1], a[0], a[1], r); + z = sqlite3_mprintf(argv[1], a[0], a[1], r); Tcl_AppendResult(interp, z, 0); - sqlite_freemem(z); + sqlite3_freemem(z); return TCL_OK; } /* -** Usage: sqlite_mprintf_str FORMAT DOUBLE DOUBLE +** Usage: sqlite3_mprintf_str FORMAT DOUBLE DOUBLE ** ** Call mprintf with a single double argument which is the product of the ** two arguments given above. This is used to generate overflow and underflow ** doubles to test that they are converted properly. */ -static int sqlite_mprintf_scaled( +static int sqlite3_mprintf_scaled( void *NotUsed, Tcl_Interp *interp, /* The TCL interpreter that invoked this command */ int argc, /* Number of arguments */ @@ -556,9 +556,9 @@ static int sqlite_mprintf_scaled( for(i=2; i<4; i++){ if( Tcl_GetDouble(interp, argv[i], &r[i-2]) ) return TCL_ERROR; } - z = sqlite_mprintf(argv[1], r[0]*r[1]); + z = sqlite3_mprintf(argv[1], r[0]*r[1]); Tcl_AppendResult(interp, z, 0); - sqlite_freemem(z); + sqlite3_freemem(z); return TCL_OK; } @@ -566,7 +566,7 @@ static int sqlite_mprintf_scaled( ** Usage: sqlite_malloc_fail N ** ** Rig sqliteMalloc() to fail on the N-th call. Turn off this mechanism -** and reset the sqlite_malloc_failed variable is N==0. +** and reset the sqlite3_malloc_failed variable is N==0. */ #ifdef MEMORY_DEBUG static int sqlite_malloc_fail( @@ -581,8 +581,8 @@ static int sqlite_malloc_fail( return TCL_ERROR; } if( Tcl_GetInt(interp, argv[1], &n) ) return TCL_ERROR; - sqlite_iMallocFail = n; - sqlite_malloc_failed = 0; + sqlite3_iMallocFail = n; + sqlite3_malloc_failed = 0; return TCL_OK; } #endif @@ -600,7 +600,7 @@ static int sqlite_malloc_stat( char **argv /* Text of each argument */ ){ char zBuf[200]; - sprintf(zBuf, "%d %d %d", sqlite_nMalloc, sqlite_nFree, sqlite_iMallocFail); + sprintf(zBuf, "%d %d %d", sqlite3_nMalloc, sqlite3_nFree, sqlite3_iMallocFail); Tcl_AppendResult(interp, zBuf, 0); return TCL_OK; } @@ -630,19 +630,19 @@ static int sqlite_abort( static void testFunc(sqlite_func *context, int argc, const char **argv){ while( argc>=2 ){ if( argv[0]==0 ){ - sqlite_set_result_error(context, "first argument to test function " + sqlite3_set_result_error(context, "first argument to test function " "may not be NULL", -1); }else if( sqlite3StrICmp(argv[0],"string")==0 ){ - sqlite_set_result_string(context, argv[1], -1); + sqlite3_set_result_string(context, argv[1], -1); }else if( argv[1]==0 ){ - sqlite_set_result_error(context, "2nd argument may not be NULL if the " + sqlite3_set_result_error(context, "2nd argument may not be NULL if the " "first argument is not \"string\"", -1); }else if( sqlite3StrICmp(argv[0],"int")==0 ){ - sqlite_set_result_int(context, atoi(argv[1])); + sqlite3_set_result_int(context, atoi(argv[1])); }else if( sqlite3StrICmp(argv[0],"double")==0 ){ - sqlite_set_result_double(context, sqlite3AtoF(argv[1], 0)); + sqlite3_set_result_double(context, sqlite3AtoF(argv[1], 0)); }else{ - sqlite_set_result_error(context,"first argument should be one of: " + sqlite3_set_result_error(context,"first argument should be one of: " "string int double", -1); } argc -= 2; @@ -669,9 +669,9 @@ static int test_register_func( return TCL_ERROR; } if( getDbPointer(interp, argv[1], &db) ) return TCL_ERROR; - rc = sqlite_create_function(db, argv[2], -1, testFunc, 0); + rc = sqlite3_create_function(db, argv[2], -1, testFunc, 0); if( rc!=0 ){ - Tcl_AppendResult(interp, sqlite_error_string(rc), 0); + Tcl_AppendResult(interp, sqlite3_error_string(rc), 0); return TCL_ERROR; } return TCL_OK; @@ -722,16 +722,16 @@ static int sqlite_datatypes( return TCL_ERROR; } if( getDbPointer(interp, argv[1], &db) ) return TCL_ERROR; - rc = sqlite_exec(db, argv[2], rememberDataTypes, interp, 0); + rc = sqlite3_exec(db, argv[2], rememberDataTypes, interp, 0); if( rc!=0 && rc!=SQLITE_ABORT ){ - Tcl_AppendResult(interp, sqlite_error_string(rc), 0); + Tcl_AppendResult(interp, sqlite3_error_string(rc), 0); return TCL_ERROR; } return TCL_OK; } /* -** Usage: sqlite_compile DB SQL ?TAILVAR? +** Usage: sqlite3_compile DB SQL ?TAILVAR? ** ** Attempt to compile an SQL statement. Return a pointer to the virtual ** machine used to execute that statement. Unprocessed SQL is written @@ -755,13 +755,13 @@ static int test_compile( return TCL_ERROR; } if( getDbPointer(interp, argv[1], &db) ) return TCL_ERROR; - rc = sqlite_compile(db, argv[2], argc==4 ? &zTail : 0, &vm, &zErr); + rc = sqlite3_compile(db, argv[2], argc==4 ? &zTail : 0, &vm, &zErr); if( argc==4 ) Tcl_SetVar(interp, argv[3], zTail, 0); if( rc ){ assert( vm==0 ); sprintf(zBuf, "(%d) ", rc); Tcl_AppendResult(interp, zBuf, zErr, 0); - sqlite_freemem(zErr); + sqlite3_freemem(zErr); return TCL_ERROR; } if( vm ){ @@ -772,7 +772,7 @@ static int test_compile( } /* -** Usage: sqlite_step VM ?NVAR? ?VALUEVAR? ?COLNAMEVAR? +** Usage: sqlite3_step VM ?NVAR? ?VALUEVAR? ?COLNAMEVAR? ** ** Step a virtual machine. Return a the result code as a string. ** Column results are written into three variables. @@ -796,7 +796,7 @@ static int test_step( return TCL_ERROR; } if( getVmPointer(interp, argv[1], &vm) ) return TCL_ERROR; - rc = sqlite_step(vm, argc>=3?&N:0, argc>=4?&azValue:0, argc==5?&azColName:0); + rc = sqlite3_step(vm, argc>=3?&N:0, argc>=4?&azValue:0, argc==5?&azColName:0); if( argc>=3 ){ sprintf(zBuf, "%d", N); Tcl_SetVar(interp, argv[2], zBuf, 0); @@ -832,7 +832,7 @@ static int test_step( } /* -** Usage: sqlite_finalize VM +** Usage: sqlite3_finalize VM ** ** Shutdown a virtual machine. */ @@ -851,19 +851,19 @@ static int test_finalize( return TCL_ERROR; } if( getVmPointer(interp, argv[1], &vm) ) return TCL_ERROR; - rc = sqlite_finalize(vm, &zErrMsg); + rc = sqlite3_finalize(vm, &zErrMsg); if( rc ){ char zBuf[50]; sprintf(zBuf, "(%d) ", rc); Tcl_AppendResult(interp, zBuf, zErrMsg, 0); - sqlite_freemem(zErrMsg); + sqlite3_freemem(zErrMsg); return TCL_ERROR; } return TCL_OK; } /* -** Usage: sqlite_reset VM +** Usage: sqlite3_reset VM ** ** Reset a virtual machine and prepare it to be run again. */ @@ -882,12 +882,12 @@ static int test_reset( return TCL_ERROR; } if( getVmPointer(interp, argv[1], &vm) ) return TCL_ERROR; - rc = sqlite_reset(vm, &zErrMsg); + rc = sqlite3_reset(vm, &zErrMsg); if( rc ){ char zBuf[50]; sprintf(zBuf, "(%d) ", rc); Tcl_AppendResult(interp, zBuf, zErrMsg, 0); - sqlite_freemem(zErrMsg); + sqlite3_freemem(zErrMsg); return TCL_ERROR; } return TCL_OK; @@ -895,12 +895,12 @@ static int test_reset( /* ** This is the "static_bind_value" that variables are bound to when -** the FLAG option of sqlite_bind is "static" +** the FLAG option of sqlite3_bind is "static" */ static char *sqlite_static_bind_value = 0; /* -** Usage: sqlite_bind VM IDX VALUE FLAGS +** Usage: sqlite3_bind VM IDX VALUE FLAGS ** ** Sets the value of the IDX-th occurance of "?" in the original SQL ** string. VALUE is the new value. If FLAGS=="null" then VALUE is @@ -926,11 +926,11 @@ static int test_bind( if( getVmPointer(interp, argv[1], &vm) ) return TCL_ERROR; if( Tcl_GetInt(interp, argv[2], &idx) ) return TCL_ERROR; if( strcmp(argv[4],"null")==0 ){ - rc = sqlite_bind(vm, idx, 0, 0, 0); + rc = sqlite3_bind(vm, idx, 0, 0, 0); }else if( strcmp(argv[4],"static")==0 ){ - rc = sqlite_bind(vm, idx, sqlite_static_bind_value, -1, 0); + rc = sqlite3_bind(vm, idx, sqlite_static_bind_value, -1, 0); }else if( strcmp(argv[4],"normal")==0 ){ - rc = sqlite_bind(vm, idx, argv[3], -1, 1); + rc = sqlite3_bind(vm, idx, argv[3], -1, 1); }else{ Tcl_AppendResult(interp, "4th argument should be " "\"null\" or \"static\" or \"normal\"", 0); @@ -939,7 +939,7 @@ static int test_bind( if( rc ){ char zBuf[50]; sprintf(zBuf, "(%d) ", rc); - Tcl_AppendResult(interp, zBuf, sqlite_error_string(rc), 0); + Tcl_AppendResult(interp, zBuf, sqlite3_error_string(rc), 0); return TCL_ERROR; } return TCL_OK; @@ -971,26 +971,26 @@ static int test_breakpoint( ** Register commands with the TCL interpreter. */ int Sqlitetest1_Init(Tcl_Interp *interp){ - extern int sqlite_search_count; - extern int sqlite_interrupt_count; - extern int sqlite_open_file_count; - extern int sqlite_current_time; + extern int sqlite3_search_count; + extern int sqlite3_interrupt_count; + extern int sqlite3_open_file_count; + extern int sqlite3_current_time; static struct { char *zName; Tcl_CmdProc *xProc; } aCmd[] = { - { "sqlite_mprintf_int", (Tcl_CmdProc*)sqlite_mprintf_int }, - { "sqlite_mprintf_str", (Tcl_CmdProc*)sqlite_mprintf_str }, - { "sqlite_mprintf_double", (Tcl_CmdProc*)sqlite_mprintf_double }, - { "sqlite_mprintf_scaled", (Tcl_CmdProc*)sqlite_mprintf_scaled }, - { "sqlite_mprintf_z_test", (Tcl_CmdProc*)test_mprintf_z }, - { "sqlite_open", (Tcl_CmdProc*)sqlite_test_open }, - { "sqlite_last_insert_rowid", (Tcl_CmdProc*)test_last_rowid }, - { "sqlite_exec_printf", (Tcl_CmdProc*)test_exec_printf }, - { "sqlite_get_table_printf", (Tcl_CmdProc*)test_get_table_printf }, - { "sqlite_close", (Tcl_CmdProc*)sqlite_test_close }, - { "sqlite_create_function", (Tcl_CmdProc*)test_create_function }, - { "sqlite_create_aggregate", (Tcl_CmdProc*)test_create_aggregate }, + { "sqlite3_mprintf_int", (Tcl_CmdProc*)sqlite3_mprintf_int }, + { "sqlite3_mprintf_str", (Tcl_CmdProc*)sqlite3_mprintf_str }, + { "sqlite3_mprintf_double", (Tcl_CmdProc*)sqlite3_mprintf_double }, + { "sqlite3_mprintf_scaled", (Tcl_CmdProc*)sqlite3_mprintf_scaled }, + { "sqlite3_mprintf_z_test", (Tcl_CmdProc*)test_mprintf_z }, + { "sqlite3_open", (Tcl_CmdProc*)sqlite_test_open }, + { "sqlite3_last_insert_rowid", (Tcl_CmdProc*)test_last_rowid }, + { "sqlite3_exec_printf", (Tcl_CmdProc*)test_exec_printf }, + { "sqlite3_get_table_printf", (Tcl_CmdProc*)test_get_table_printf }, + { "sqlite3_close", (Tcl_CmdProc*)sqlite_test_close }, + { "sqlite3_create_function", (Tcl_CmdProc*)test_create_function }, + { "sqlite3_create_aggregate", (Tcl_CmdProc*)test_create_aggregate }, { "sqlite_register_test_function", (Tcl_CmdProc*)test_register_func }, { "sqlite_abort", (Tcl_CmdProc*)sqlite_abort }, { "sqlite_datatypes", (Tcl_CmdProc*)sqlite_datatypes }, @@ -998,11 +998,11 @@ int Sqlitetest1_Init(Tcl_Interp *interp){ { "sqlite_malloc_fail", (Tcl_CmdProc*)sqlite_malloc_fail }, { "sqlite_malloc_stat", (Tcl_CmdProc*)sqlite_malloc_stat }, #endif - { "sqlite_compile", (Tcl_CmdProc*)test_compile }, - { "sqlite_step", (Tcl_CmdProc*)test_step }, - { "sqlite_finalize", (Tcl_CmdProc*)test_finalize }, - { "sqlite_bind", (Tcl_CmdProc*)test_bind }, - { "sqlite_reset", (Tcl_CmdProc*)test_reset }, + { "sqlite3_compile", (Tcl_CmdProc*)test_compile }, + { "sqlite3_step", (Tcl_CmdProc*)test_step }, + { "sqlite3_finalize", (Tcl_CmdProc*)test_finalize }, + { "sqlite3_bind", (Tcl_CmdProc*)test_bind }, + { "sqlite3_reset", (Tcl_CmdProc*)test_reset }, { "breakpoint", (Tcl_CmdProc*)test_breakpoint }, }; int i; @@ -1010,14 +1010,14 @@ int Sqlitetest1_Init(Tcl_Interp *interp){ for(i=0; idb ){ - sqlite_close(p->db); + sqlite3_close(p->db); } - p->db = sqlite_open(p->zFilename, 0, &p->zErr); + p->db = sqlite3_open(p->zFilename, 0, &p->zErr); p->vm = 0; p->completed = 1; while( p->opnum<=p->completed ) sched_yield(); while( p->xOp ){ if( p->zErr && p->zErr!=p->zStaticErr ){ - sqlite_freemem(p->zErr); + sqlite3_freemem(p->zErr); p->zErr = 0; } (*p->xOp)(p); @@ -79,15 +79,15 @@ static void *thread_main(void *pArg){ while( p->opnum<=p->completed ) sched_yield(); } if( p->vm ){ - sqlite_finalize(p->vm, 0); + sqlite3_finalize(p->vm, 0); p->vm = 0; } if( p->db ){ - sqlite_close(p->db); + sqlite3_close(p->db); p->db = 0; } if( p->zErr && p->zErr!=p->zStaticErr ){ - sqlite_freemem(p->zErr); + sqlite3_freemem(p->zErr); p->zErr = 0; } p->completed++; @@ -441,10 +441,10 @@ static void do_compile(Thread *p){ return; } if( p->vm ){ - sqlite_finalize(p->vm, 0); + sqlite3_finalize(p->vm, 0); p->vm = 0; } - p->rc = sqlite_compile(p->db, p->zArg, 0, &p->vm, &p->zErr); + p->rc = sqlite3_compile(p->db, p->zArg, 0, &p->vm, &p->zErr); } /* @@ -487,7 +487,7 @@ static void do_step(Thread *p){ p->rc = SQLITE_ERROR; return; } - p->rc = sqlite_step(p->vm, &p->argc, &p->argv, &p->colv); + p->rc = sqlite3_step(p->vm, &p->argc, &p->argv, &p->colv); } /* @@ -528,7 +528,7 @@ static void do_finalize(Thread *p){ p->rc = SQLITE_ERROR; return; } - p->rc = sqlite_finalize(p->vm, &p->zErr); + p->rc = sqlite3_finalize(p->vm, &p->zErr); p->vm = 0; } diff --git a/src/tokenize.c b/src/tokenize.c index 065d1b4082..4ccc98f652 100644 --- a/src/tokenize.c +++ b/src/tokenize.c @@ -15,7 +15,7 @@ ** individual tokens and sends those tokens one-by-one over to the ** parser for analysis. ** -** $Id: tokenize.c,v 1.69 2004/05/08 08:23:39 danielk1977 Exp $ +** $Id: tokenize.c,v 1.70 2004/05/10 10:34:53 danielk1977 Exp $ */ #include "sqliteInt.h" #include "os.h" @@ -416,7 +416,7 @@ int sqlite3RunParser(Parse *pParse, const char *zSql, char **pzErrMsg){ } pParse->sLastToken.dyn = 0; pParse->zTail = zSql; - while( sqlite_malloc_failed==0 && zSql[i]!=0 ){ + while( sqlite3_malloc_failed==0 && zSql[i]!=0 ){ assert( i>=0 ); pParse->sLastToken.z = &zSql[i]; assert( pParse->sLastToken.dyn==0 ); @@ -462,7 +462,7 @@ abort_parse: } sqlite3ParserFree(pEngine, free); if( pParse->rc!=SQLITE_OK && pParse->rc!=SQLITE_DONE && pParse->zErrMsg==0 ){ - sqlite3SetString(&pParse->zErrMsg, sqlite_error_string(pParse->rc), + sqlite3SetString(&pParse->zErrMsg, sqlite3_error_string(pParse->rc), (char*)0); } if( pParse->zErrMsg ){ @@ -493,7 +493,7 @@ abort_parse: } /* -** Token types used by the sqlite_complete() routine. See the header +** Token types used by the sqlite3_complete() routine. See the header ** comments on that procedure for additional information. */ #define tkEXPLAIN 0 @@ -551,7 +551,7 @@ abort_parse: ** ** Whitespace never causes a state transition and is always ignored. */ -int sqlite_complete(const char *zSql){ +int sqlite3_complete(const char *zSql){ u8 state = 0; /* Current state, using numbers defined in header comment */ u8 token; /* Value of the next token */ diff --git a/src/trigger.c b/src/trigger.c index d152255836..985b0b43cf 100644 --- a/src/trigger.c +++ b/src/trigger.c @@ -63,7 +63,7 @@ void sqlite3BeginTrigger( ** 4. That we are not trying to create an INSTEAD OF trigger on a table. ** 5. That we are not trying to create a BEFORE or AFTER trigger on a view. */ - if( sqlite_malloc_failed ) goto trigger_cleanup; + if( sqlite3_malloc_failed ) goto trigger_cleanup; assert( pTableName->nSrc==1 ); if( db->init.busy && sqlite3FixInit(&sFix, pParse, db->init.iDb, "trigger", pName) @@ -133,7 +133,7 @@ void sqlite3BeginTrigger( nt->name = zName; zName = 0; nt->table = sqliteStrDup(pTableName->a[0].zName); - if( sqlite_malloc_failed ) goto trigger_cleanup; + if( sqlite3_malloc_failed ) goto trigger_cleanup; nt->iDb = iDb; nt->iTabDb = tab->iDb; nt->op = op; @@ -234,10 +234,10 @@ triggerfinish_cleanup: ** the effect of copying all Expr.token.z values into memory obtained ** from sqliteMalloc(). As initially created, the Expr.token.z values ** all point to the input string that was fed to the parser. But that -** string is ephemeral - it will go away as soon as the sqlite_exec() +** string is ephemeral - it will go away as soon as the sqlite3_exec() ** call that started the parser exits. This routine makes a persistent ** copy of all the Expr.token.z strings so that the TriggerStep structure -** will be valid even after the sqlite_exec() call returns. +** will be valid even after the sqlite3_exec() call returns. */ static void sqlitePersistTriggerStep(TriggerStep *p){ if( p->target.z ){ @@ -393,7 +393,7 @@ void sqlite3DropTrigger(Parse *pParse, SrcList *pName){ int nName; sqlite *db = pParse->db; - if( sqlite_malloc_failed ) goto drop_trigger_cleanup; + if( sqlite3_malloc_failed ) goto drop_trigger_cleanup; assert( pName->nSrc==1 ); zDb = pName->a[0].zDatabase; zName = pName->a[0].zName; diff --git a/src/update.c b/src/update.c index 128b6ed4dc..71d8938995 100644 --- a/src/update.c +++ b/src/update.c @@ -12,7 +12,7 @@ ** This file contains C code routines that are called by the parser ** to handle UPDATE statements. ** -** $Id: update.c,v 1.71 2004/05/08 08:23:40 danielk1977 Exp $ +** $Id: update.c,v 1.72 2004/05/10 10:35:00 danielk1977 Exp $ */ #include "sqliteInt.h" @@ -59,7 +59,7 @@ void sqlite3Update( int oldIdx = -1; /* index of trigger "old" temp table */ sContext.pParse = 0; - if( pParse->nErr || sqlite_malloc_failed ) goto update_cleanup; + if( pParse->nErr || sqlite3_malloc_failed ) goto update_cleanup; db = pParse->db; assert( pTabList->nSrc==1 ); diff --git a/src/util.c b/src/util.c index 420a7c2072..3052116bbc 100644 --- a/src/util.c +++ b/src/util.c @@ -14,7 +14,7 @@ ** This file contains functions for allocating memory, comparing ** strings, and stuff like that. ** -** $Id: util.c,v 1.78 2004/05/10 10:05:54 danielk1977 Exp $ +** $Id: util.c,v 1.79 2004/05/10 10:35:00 danielk1977 Exp $ */ #include "sqliteInt.h" #include @@ -24,7 +24,7 @@ ** If malloc() ever fails, this global variable gets set to 1. ** This causes the library to abort and never again function. */ -int sqlite_malloc_failed = 0; +int sqlite3_malloc_failed = 0; /* ** If MEMORY_DEBUG is defined, then use versions of malloc() and @@ -36,9 +36,9 @@ int sqlite_malloc_failed = 0; ** For keeping track of the number of mallocs and frees. This ** is used to check for memory leaks. */ -int sqlite_nMalloc; /* Number of sqliteMalloc() calls */ -int sqlite_nFree; /* Number of sqliteFree() calls */ -int sqlite_iMallocFail; /* Fail sqliteMalloc() after this many calls */ +int sqlite3_nMalloc; /* Number of sqliteMalloc() calls */ +int sqlite3_nFree; /* Number of sqliteFree() calls */ +int sqlite3_iMallocFail; /* Fail sqliteMalloc() after this many calls */ #if MEMORY_DEBUG>1 static int memcnt = 0; #endif @@ -56,15 +56,15 @@ void *sqlite3Malloc_(int n, int bZero, char *zFile, int line){ void *p; int *pi; int i, k; - if( sqlite_iMallocFail>=0 ){ - sqlite_iMallocFail--; - if( sqlite_iMallocFail==0 ){ - sqlite_malloc_failed++; + if( sqlite3_iMallocFail>=0 ){ + sqlite3_iMallocFail--; + if( sqlite3_iMallocFail==0 ){ + sqlite3_malloc_failed++; #if MEMORY_DEBUG>1 fprintf(stderr,"**** failed to allocate %d bytes at %s:%d\n", n, zFile,line); #endif - sqlite_iMallocFail--; + sqlite3_iMallocFail--; return 0; } } @@ -72,10 +72,10 @@ void *sqlite3Malloc_(int n, int bZero, char *zFile, int line){ k = (n+sizeof(int)-1)/sizeof(int); pi = malloc( (N_GUARD*2+1+k)*sizeof(int)); if( pi==0 ){ - sqlite_malloc_failed++; + sqlite3_malloc_failed++; return 0; } - sqlite_nMalloc++; + sqlite3_nMalloc++; for(i=0; i0 ) sqlite_malloc_failed++; + if( n>0 ) sqlite3_malloc_failed++; }else{ memset(p, 0, n); } @@ -266,7 +266,7 @@ void *sqliteMalloc(int n){ void *sqliteMallocRaw(int n){ void *p; if( (p = malloc(n))==0 ){ - if( n>0 ) sqlite_malloc_failed++; + if( n>0 ) sqlite3_malloc_failed++; } return p; } @@ -296,7 +296,7 @@ void *sqliteRealloc(void *p, int n){ } p2 = realloc(p, n); if( p2==0 ){ - sqlite_malloc_failed++; + sqlite3_malloc_failed++; } return p2; } @@ -1085,7 +1085,7 @@ sqlite3LikeCompare(const unsigned char *zPattern, const unsigned char *zString){ ** Ticket #202: If db->magic is not a valid open value, take care not ** to modify the db structure at all. It could be that db is a stale ** pointer. In other words, it could be that there has been a prior -** call to sqlite_close(db) and db has been deallocated. And we do +** call to sqlite3_close(db) and db has been deallocated. And we do ** not want to write into deallocated memory. */ int sqlite3SafetyOn(sqlite *db){ @@ -1118,8 +1118,8 @@ int sqlite3SafetyOff(sqlite *db){ } /* -** Check to make sure we are not currently executing an sqlite_exec(). -** If we are currently in an sqlite_exec(), return true and set +** Check to make sure we are not currently executing an sqlite3_exec(). +** If we are currently in an sqlite3_exec(), return true and set ** sqlite.magic to SQLITE_MAGIC_ERROR. This will cause a complete ** shutdown of the database. ** diff --git a/src/vacuum.c b/src/vacuum.c index 0822ac344f..52ca39b09a 100644 --- a/src/vacuum.c +++ b/src/vacuum.c @@ -14,7 +14,7 @@ ** Most of the code in this file may be omitted by defining the ** SQLITE_OMIT_VACUUM macro. ** -** $Id: vacuum.c,v 1.14 2004/05/08 08:23:40 danielk1977 Exp $ +** $Id: vacuum.c,v 1.15 2004/05/10 10:35:00 danielk1977 Exp $ */ #include "sqliteInt.h" #include "os.h" @@ -93,10 +93,10 @@ static int execsql(char **pzErrMsg, sqlite *db, const char *zSql){ int rc; /* printf("***** executing *****\n%s\n", zSql); */ - rc = sqlite_exec(db, zSql, 0, 0, &zErrMsg); + rc = sqlite3_exec(db, zSql, 0, 0, &zErrMsg); if( zErrMsg ){ sqlite3SetString(pzErrMsg, zErrMsg, (char*)0); - sqlite_freemem(zErrMsg); + sqlite3_freemem(zErrMsg); } return rc; } @@ -153,10 +153,10 @@ static int vacuumCallback1(void *pArg, int argc, char **argv, char **NotUsed){ appendText(&p->s1, "SELECT * FROM ", -1); appendQuoted(&p->s1, argv[1]); p->zTable = argv[1]; - rc = sqlite_exec(p->dbOld, p->s1.z, vacuumCallback2, p, &zErrMsg); + rc = sqlite3_exec(p->dbOld, p->s1.z, vacuumCallback2, p, &zErrMsg); if( zErrMsg ){ sqlite3SetString(p->pzErrMsg, zErrMsg, (char*)0); - sqlite_freemem(zErrMsg); + sqlite3_freemem(zErrMsg); } } if( rc!=SQLITE_ABORT ) p->rc = rc; @@ -266,7 +266,7 @@ int sqlite3RunVacuum(char **pzErrMsg, sqlite *db){ } - dbNew = sqlite_open(zTemp, 0, &zErrMsg); + dbNew = sqlite3_open(zTemp, 0, &zErrMsg); if( dbNew==0 ){ sqlite3SetString(pzErrMsg, "unable to open a temporary database at ", zTemp, " - ", zErrMsg, (char*)0); @@ -285,10 +285,10 @@ int sqlite3RunVacuum(char **pzErrMsg, sqlite *db){ assert( strlen(zPragma[i])<100 ); sprintf(zBuf, "PRAGMA %s;", zPragma[i]); sVac.zPragma = zPragma[i]; - rc = sqlite_exec(db, zBuf, vacuumCallback3, &sVac, &zErrMsg); + rc = sqlite3_exec(db, zBuf, vacuumCallback3, &sVac, &zErrMsg); } if( rc==SQLITE_OK ){ - rc = sqlite_exec(db, + rc = sqlite3_exec(db, "SELECT type, name, sql FROM sqlite_master " "WHERE sql NOT NULL AND type!='view' " "UNION ALL " @@ -298,7 +298,7 @@ int sqlite3RunVacuum(char **pzErrMsg, sqlite *db){ } if( rc==SQLITE_OK ){ rc = sqlite3BtreeCopyFile(db->aDb[0].pBt, dbNew->aDb[0].pBt); - sqlite_exec(db, "COMMIT", 0, 0, 0); + sqlite3_exec(db, "COMMIT", 0, 0, 0); sqlite3ResetInternalSchema(db, 0); } @@ -307,13 +307,13 @@ end_of_vacuum: sqlite3SetString(pzErrMsg, "unable to vacuum database - ", zErrMsg, (char*)0); } - sqlite_exec(db, "ROLLBACK", 0, 0, 0); - if( dbNew ) sqlite_close(dbNew); + sqlite3_exec(db, "ROLLBACK", 0, 0, 0); + if( dbNew ) sqlite3_close(dbNew); sqlite3OsDelete(zTemp); sqliteFree(zTemp); sqliteFree(sVac.s1.z); sqliteFree(sVac.s2.z); - if( zErrMsg ) sqlite_freemem(zErrMsg); + if( zErrMsg ) sqlite3_freemem(zErrMsg); if( rc==SQLITE_ABORT ) sVac.rc = SQLITE_ERROR; return sVac.rc; #endif diff --git a/src/vdbe.c b/src/vdbe.c index b9b558d9f1..4193a9bc21 100644 --- a/src/vdbe.c +++ b/src/vdbe.c @@ -43,7 +43,7 @@ ** in this file for details. If in doubt, do not deviate from existing ** commenting and indentation practices when changing or adding code. ** -** $Id: vdbe.c,v 1.272 2004/05/10 07:17:32 danielk1977 Exp $ +** $Id: vdbe.c,v 1.273 2004/05/10 10:35:00 danielk1977 Exp $ */ #include "sqliteInt.h" #include "os.h" @@ -57,7 +57,7 @@ ** working correctly. This variable has no function other than to ** help verify the correct operation of the library. */ -int sqlite_search_count = 0; +int sqlite3_search_count = 0; /* ** When this global variable is positive, it gets decremented once before @@ -67,7 +67,7 @@ int sqlite_search_count = 0; ** This facility is used for testing purposes only. It does not function ** in an ordinary build. */ -int sqlite_interrupt_count = 0; +int sqlite3_interrupt_count = 0; /* ** Advance the virtual machine to the next output row. @@ -77,11 +77,11 @@ int sqlite_interrupt_count = 0; ** ** SQLITE_BUSY means that the virtual machine attempted to open ** a locked database and there is no busy callback registered. -** Call sqlite_step() again to retry the open. *pN is set to 0 +** Call sqlite3_step() again to retry the open. *pN is set to 0 ** and *pazColName and *pazValue are both set to NULL. ** ** SQLITE_DONE means that the virtual machine has finished -** executing. sqlite_step() should not be called again on this +** executing. sqlite3_step() should not be called again on this ** virtual machine. *pN and *pazColName are set appropriately ** but *pazValue is set to NULL. ** @@ -95,7 +95,7 @@ int sqlite_interrupt_count = 0; ** ** SQLITE_ERROR means that a run-time error (such as a constraint ** violation) has occurred. The details of the error will be returned -** by the next call to sqlite_finalize(). sqlite_step() should not +** by the next call to sqlite3_finalize(). sqlite3_step() should not ** be called again on the VM. ** ** SQLITE_MISUSE means that the this routine was called inappropriately. @@ -104,7 +104,7 @@ int sqlite_interrupt_count = 0; ** SQLITE_DONE. Or it could be the case the the same database connection ** is being used simulataneously by two or more threads. */ -int sqlite_step( +int sqlite3_step( sqlite_vm *pVm, /* The virtual machine to execute */ int *pN, /* OUT: Number of columns in result */ const char ***pazValue, /* OUT: Column data */ @@ -197,9 +197,9 @@ static AggElem *_AggInFocus(Agg *p){ static int hardStringify(Mem *pStack){ int fg = pStack->flags; if( fg & MEM_Real ){ - sqlite_snprintf(sizeof(pStack->zShort),pStack->zShort,"%.15g",pStack->r); + sqlite3_snprintf(sizeof(pStack->zShort),pStack->zShort,"%.15g",pStack->r); }else if( fg & MEM_Int ){ - sqlite_snprintf(sizeof(pStack->zShort),pStack->zShort,"%d",pStack->i); + sqlite3_snprintf(sizeof(pStack->zShort),pStack->zShort,"%d",pStack->i); }else{ pStack->zShort[0] = 0; } @@ -439,7 +439,7 @@ __inline__ unsigned long long int hwtime(void){ /* ** The CHECK_FOR_INTERRUPT macro defined here looks to see if the -** sqlite_interrupt() routine has been called. If it has been, then +** sqlite3_interrupt() routine has been called. If it has been, then ** processing of the VDBE program is interrupted. ** ** This macro added to every instruction that does a jump in order to @@ -504,7 +504,7 @@ int sqlite3VdbeExec( assert( p->rc==SQLITE_OK || p->rc==SQLITE_BUSY ); p->rc = SQLITE_OK; assert( p->explain==0 ); - if( sqlite_malloc_failed ) goto no_mem; + if( sqlite3_malloc_failed ) goto no_mem; pTos = p->pTos; if( p->popStack ){ popStack(&pTos, p->popStack); @@ -532,10 +532,10 @@ int sqlite3VdbeExec( ** if we have a special test build. */ #ifdef SQLITE_TEST - if( sqlite_interrupt_count>0 ){ - sqlite_interrupt_count--; - if( sqlite_interrupt_count==0 ){ - sqlite_interrupt(db); + if( sqlite3_interrupt_count>0 ){ + sqlite3_interrupt_count--; + if( sqlite3_interrupt_count==0 ){ + sqlite3_interrupt(db); } } #endif @@ -645,7 +645,7 @@ case OP_Return: { ** Exit immediately. All open cursors, Lists, Sorts, etc are closed ** automatically. ** -** P1 is the result code returned by sqlite_exec(). For a normal +** P1 is the result code returned by sqlite3_exec(). For a normal ** halt, this should be SQLITE_OK (0). For errors, it can be some ** other value. If P1!=0 then P2 will determine whether or not to ** rollback the current transaction. Do not rollback if P2==OE_Fail. @@ -711,11 +711,11 @@ case OP_String: { /* Opcode: Variable P1 * * ** ** Push the value of variable P1 onto the stack. A variable is -** an unknown in the original SQL string as handed to sqlite_compile(). +** an unknown in the original SQL string as handed to sqlite3_compile(). ** Any occurance of the '?' character in the original SQL is considered ** a variable. Variables in the SQL string are number from left to ** right beginning with 1. The values of variables are set using the -** sqlite_bind() API. +** sqlite3_bind() API. */ case OP_Variable: { int j = pOp->p1 - 1; @@ -770,7 +770,7 @@ case OP_Dup: { pTos->z = pTos->zShort; }else if( (pTos->flags & MEM_Static)==0 ){ pTos->z = sqliteMallocRaw(pFrom->n); - if( sqlite_malloc_failed ) goto no_mem; + if( sqlite3_malloc_failed ) goto no_mem; memcpy(pTos->z, pFrom->z, pFrom->n); pTos->flags &= ~(MEM_Static|MEM_Ephem|MEM_Short); pTos->flags |= MEM_Dyn; @@ -2441,7 +2441,7 @@ case OP_Transaction: { p->pTos = pTos; return SQLITE_BUSY; }else if( (*db->xBusyCallback)(db->pBusyArg, "", busy++)==0 ){ - sqlite3SetString(&p->zErrMsg, sqlite_error_string(rc), (char*)0); + sqlite3SetString(&p->zErrMsg, sqlite3_error_string(rc), (char*)0); busy = 0; } break; @@ -2701,7 +2701,7 @@ case OP_OpenWrite: { p->pTos = &pTos[1 + (pOp->p2<=0)]; /* Operands must remain on stack */ return SQLITE_BUSY; }else if( (*db->xBusyCallback)(db->pBusyArg, pOp->p3, ++busy)==0 ){ - sqlite3SetString(&p->zErrMsg, sqlite_error_string(rc), (char*)0); + sqlite3SetString(&p->zErrMsg, sqlite3_error_string(rc), (char*)0); busy = 0; } break; @@ -2855,7 +2855,7 @@ case OP_MoveTo: { pC->recnoIsValid = 0; } pC->deferredMoveto = 0; - sqlite_search_count++; + sqlite3_search_count++; oc = pOp->opcode; if( oc==OP_MoveTo && res<0 ){ sqlite3BtreeNext(pC->pCursor, &res); @@ -3187,7 +3187,7 @@ case OP_NewRecno: { ** incremented (otherwise not). If the OPFLAG_CSCHANGE flag is set, ** then the current statement change count is incremented (otherwise not). ** If the OPFLAG_LASTROWID flag of P2 is set, then rowid is -** stored for subsequent return by the sqlite_last_insert_rowid() function +** stored for subsequent return by the sqlite3_last_insert_rowid() function ** (otherwise it's unmodified). */ /* Opcode: PutStrKey P1 * * @@ -3694,7 +3694,7 @@ case OP_Next: { } if( res==0 ){ pc = pOp->p2 - 1; - sqlite_search_count++; + sqlite3_search_count++; } }else{ pC->nullRow = 1; @@ -4780,7 +4780,7 @@ case OP_AggFocus: { pc = pOp->p2 - 1; }else{ AggInsert(&p->agg, zKey, nKey); - if( sqlite_malloc_failed ) goto no_mem; + if( sqlite3_malloc_failed ) goto no_mem; } Release(pTos); pTos--; @@ -4913,7 +4913,7 @@ case OP_SetInsert: { Release(pTos); pTos--; } - if( sqlite_malloc_failed ) goto no_mem; + if( sqlite3_malloc_failed ) goto no_mem; break; } @@ -5013,7 +5013,7 @@ case OP_Vacuum: { /* An other opcode is illegal... */ default: { - sqlite_snprintf(sizeof(zBuf),zBuf,"%d",pOp->opcode); + sqlite3_snprintf(sizeof(zBuf),zBuf,"%d",pOp->opcode); sqlite3SetString(&p->zErrMsg, "unknown opcode ", zBuf, (char*)0); rc = SQLITE_INTERNAL; break; @@ -5151,12 +5151,12 @@ abort_due_to_misuse: */ abort_due_to_error: if( p->zErrMsg==0 ){ - if( sqlite_malloc_failed ) rc = SQLITE_NOMEM; - sqlite3SetString(&p->zErrMsg, sqlite_error_string(rc), (char*)0); + if( sqlite3_malloc_failed ) rc = SQLITE_NOMEM; + sqlite3SetString(&p->zErrMsg, sqlite3_error_string(rc), (char*)0); } goto vdbe_halt; - /* Jump to here if the sqlite_interrupt() API sets the interrupt + /* Jump to here if the sqlite3_interrupt() API sets the interrupt ** flag. */ abort_due_to_interrupt: @@ -5167,6 +5167,6 @@ abort_due_to_interrupt: }else{ rc = SQLITE_INTERRUPT; } - sqlite3SetString(&p->zErrMsg, sqlite_error_string(rc), (char*)0); + sqlite3SetString(&p->zErrMsg, sqlite3_error_string(rc), (char*)0); goto vdbe_halt; }