diff options
author | danielk1977 <danielk1977@noemail.net> | 2004-05-10 10:34:34 +0000 |
---|---|---|
committer | danielk1977 <danielk1977@noemail.net> | 2004-05-10 10:34:34 +0000 |
commit | 24b03fd055b993519961b0cffb2a79a4942fb3c7 (patch) | |
tree | fe97fcea70b1e6a6a20262ea6c2e6b96a0df063c /src | |
parent | 90e4d95d14d5fa11d4cd535be2ae0d8ee0365044 (diff) | |
download | sqlite-24b03fd055b993519961b0cffb2a79a4942fb3c7.tar.gz sqlite-24b03fd055b993519961b0cffb2a79a4942fb3c7.zip |
Change the names of external symbols from sqlite_XXX to sqlite3_XXX. (CVS 1337)
FossilOrigin-Name: ba2ba24263a9e4d1b65b441295504a5da6380f33
Diffstat (limited to 'src')
-rw-r--r-- | src/auth.c | 8 | ||||
-rw-r--r-- | src/btree.c | 4 | ||||
-rw-r--r-- | src/btree_rb.c | 18 | ||||
-rw-r--r-- | src/build.c | 20 | ||||
-rw-r--r-- | src/copy.c | 4 | ||||
-rw-r--r-- | src/date.c | 16 | ||||
-rw-r--r-- | src/delete.c | 4 | ||||
-rw-r--r-- | src/expr.c | 6 | ||||
-rw-r--r-- | src/func.c | 104 | ||||
-rw-r--r-- | src/insert.c | 10 | ||||
-rw-r--r-- | src/main.c | 146 |
11 files changed, 170 insertions, 170 deletions
diff --git a/src/auth.c b/src/auth.c index c3546aed6..6984a1d5e 100644 --- a/src/auth.c +++ b/src/auth.c @@ -9,12 +9,12 @@ ** May you share freely, never taking more than you give. ** ************************************************************************* -** This file contains code used to implement the sqlite_set_authorizer() +** This file contains code used to implement the sqlite3_set_authorizer() ** API. This facility is an optional feature of the library. Embedded ** systems that do not need this facility may omit it by recompiling ** the library with -DSQLITE_OMIT_AUTHORIZATION=1 ** -** $Id: auth.c,v 1.13 2004/05/08 08:23:21 danielk1977 Exp $ +** $Id: auth.c,v 1.14 2004/05/10 10:34:34 danielk1977 Exp $ */ #include "sqliteInt.h" @@ -62,7 +62,7 @@ ** the table and the column that are being accessed. The auth function ** should return either SQLITE_OK, SQLITE_DENY, or SQLITE_IGNORE. If ** SQLITE_OK is returned, it means that access is allowed. SQLITE_DENY -** means that the SQL statement will never-run - the sqlite_exec() call +** means that the SQL statement will never-run - the sqlite3_exec() call ** will return with an error. SQLITE_IGNORE means that the SQL statement ** should run but attempts to read the specified column will return NULL ** and attempts to write the column will be ignored. @@ -70,7 +70,7 @@ ** Setting the auth function to NULL disables this hook. The default ** setting of the auth function is NULL. */ -int sqlite_set_authorizer( +int sqlite3_set_authorizer( sqlite *db, int (*xAuth)(void*,int,const char*,const char*,const char*,const char*), void *pArg diff --git a/src/btree.c b/src/btree.c index f52525fb9..c5b270bdd 100644 --- a/src/btree.c +++ b/src/btree.c @@ -9,7 +9,7 @@ ** May you share freely, never taking more than you give. ** ************************************************************************* -** $Id: btree.c,v 1.120 2004/05/09 20:40:11 drh Exp $ +** $Id: btree.c,v 1.121 2004/05/10 10:34:34 danielk1977 Exp $ ** ** This file implements a external (disk-based) database using BTrees. ** For a detailed discussion of BTrees, refer to @@ -643,7 +643,7 @@ static void freeSpace(MemPage *pPage, int start, int size){ static int resizeCellArray(MemPage *pPage, int nNewSz){ if( pPage->nCellAlloc<nNewSz ){ pPage->aCell = sqliteRealloc(pPage->aCell, nNewSz*sizeof(pPage->aCell[0]) ); - if( sqlite_malloc_failed ) return SQLITE_NOMEM; + if( sqlite3_malloc_failed ) return SQLITE_NOMEM; pPage->nCellAlloc = nNewSz; } return SQLITE_OK; diff --git a/src/btree_rb.c b/src/btree_rb.c index 9ebbb08c1..34a05094d 100644 --- a/src/btree_rb.c +++ b/src/btree_rb.c @@ -9,7 +9,7 @@ ** May you share freely, never taking more than you give. ** ************************************************************************* -** $Id: btree_rb.c,v 1.25 2004/05/08 08:23:23 danielk1977 Exp $ +** $Id: btree_rb.c,v 1.26 2004/05/10 10:34:35 danielk1977 Exp $ ** ** This file implements an in-core database using Red-Black balanced ** binary trees. @@ -617,12 +617,12 @@ int sqliteRbtreeOpen( ){ Rbtree **ppRbtree = (Rbtree**)ppBtree; *ppRbtree = (Rbtree *)sqliteMalloc(sizeof(Rbtree)); - if( sqlite_malloc_failed ) goto open_no_mem; + if( sqlite3_malloc_failed ) goto open_no_mem; sqlite3HashInit(&(*ppRbtree)->tblHash, SQLITE_HASH_INT, 0); /* Create a binary tree for the SQLITE_MASTER table at location 2 */ btreeCreateTable(*ppRbtree, 2); - if( sqlite_malloc_failed ) goto open_no_mem; + if( sqlite3_malloc_failed ) goto open_no_mem; (*ppRbtree)->next_idx = 3; (*ppRbtree)->pOps = &sqliteRbtreeOps; /* Set file type to 4; this is so that "attach ':memory:' as ...." does not @@ -647,7 +647,7 @@ static int memRbtreeCreateTable(Rbtree* tree, int* n) *n = tree->next_idx++; btreeCreateTable(tree, *n); - if( sqlite_malloc_failed ) return SQLITE_NOMEM; + if( sqlite3_malloc_failed ) return SQLITE_NOMEM; /* Set up the rollback structure (if we are not doing this as part of a * rollback) */ @@ -720,7 +720,7 @@ static int memRbtreeCursor( RbtCursor *pCur; assert(tree); pCur = *ppCur = sqliteMalloc(sizeof(RbtCursor)); - if( sqlite_malloc_failed ) return SQLITE_NOMEM; + if( sqlite3_malloc_failed ) return SQLITE_NOMEM; pCur->pTree = sqlite3HashFind(&tree->tblHash, 0, iTable); assert( pCur->pTree ); pCur->pRbtree = tree; @@ -764,7 +764,7 @@ static int memRbtreeInsert( /* Take a copy of the input data now, in case we need it for the * replace case */ pData = sqliteMallocRaw(nData); - if( sqlite_malloc_failed ) return SQLITE_NOMEM; + if( sqlite3_malloc_failed ) return SQLITE_NOMEM; memcpy(pData, pDataInput, nData); /* Move the cursor to a node near the key to be inserted. If the key already @@ -784,7 +784,7 @@ static int memRbtreeInsert( if( pNode==0 ) return SQLITE_NOMEM; pNode->nKey = nKey; pNode->pKey = sqliteMallocRaw(nKey); - if( sqlite_malloc_failed ) return SQLITE_NOMEM; + if( sqlite3_malloc_failed ) return SQLITE_NOMEM; memcpy(pNode->pKey, pKey, nKey); pNode->nData = nData; pNode->pData = pData; @@ -821,7 +821,7 @@ static int memRbtreeInsert( pOp->iTab = pCur->iTree; pOp->nKey = pNode->nKey; pOp->pKey = sqliteMallocRaw( pOp->nKey ); - if( sqlite_malloc_failed ) return SQLITE_NOMEM; + if( sqlite3_malloc_failed ) return SQLITE_NOMEM; memcpy( pOp->pKey, pNode->pKey, pOp->nKey ); btreeLogRollbackOp(pCur->pRbtree, pOp); } @@ -837,7 +837,7 @@ static int memRbtreeInsert( pOp->iTab = pCur->iTree; pOp->nKey = pCur->pNode->nKey; pOp->pKey = sqliteMallocRaw( pOp->nKey ); - if( sqlite_malloc_failed ) return SQLITE_NOMEM; + if( sqlite3_malloc_failed ) return SQLITE_NOMEM; memcpy( pOp->pKey, pCur->pNode->pKey, pOp->nKey ); pOp->nData = pCur->pNode->nData; pOp->pData = pCur->pNode->pData; diff --git a/src/build.c b/src/build.c index d3174831b..63164ed35 100644 --- a/src/build.c +++ b/src/build.c @@ -23,7 +23,7 @@ ** ROLLBACK ** PRAGMA ** -** $Id: build.c,v 1.178 2004/05/10 01:17:37 danielk1977 Exp $ +** $Id: build.c,v 1.179 2004/05/10 10:34:35 danielk1977 Exp $ */ #include "sqliteInt.h" #include <ctype.h> @@ -71,7 +71,7 @@ void sqlite3Exec(Parse *pParse){ if( v==0 && (v = sqlite3GetVdbe(pParse))!=0 ){ sqlite3VdbeAddOp(v, OP_Halt, 0, 0); } - if( sqlite_malloc_failed ) return; + if( sqlite3_malloc_failed ) return; if( v && pParse->nErr==0 ){ FILE *trace = (db->flags & SQLITE_VdbeTrace)!=0 ? stdout : 0; sqlite3VdbeTrace(v, trace); @@ -884,7 +884,7 @@ void sqlite3EndTable(Parse *pParse, Token *pEnd, Select *pSelect){ Table *p; sqlite *db = pParse->db; - if( (pEnd==0 && pSelect==0) || pParse->nErr || sqlite_malloc_failed ) return; + if( (pEnd==0 && pSelect==0) || pParse->nErr || sqlite3_malloc_failed ) return; p = pParse->pNewTable; if( p==0 ) return; @@ -1018,7 +1018,7 @@ void sqlite3CreateView( /* Make a copy of the entire SELECT statement that defines the view. ** This will force all the Expr.token.z values to be dynamically ** allocated rather than point to the input string - which means that - ** they will persist after the current sqlite_exec() call returns. + ** they will persist after the current sqlite3_exec() call returns. */ p->pSelect = sqlite3SelectDup(pSelect); sqlite3SelectDelete(pSelect); @@ -1179,7 +1179,7 @@ void sqlite3DropTable(Parse *pParse, Token *pName, int isView){ sqlite *db = pParse->db; int iDb; - if( pParse->nErr || sqlite_malloc_failed ) return; + if( pParse->nErr || sqlite3_malloc_failed ) return; pTable = sqlite3TableFromToken(pParse, pName); if( pTable==0 ) return; iDb = pTable->iDb; @@ -1487,7 +1487,7 @@ void sqlite3CreateIndex( int isTemp; /* True for a temporary index */ sqlite *db = pParse->db; - if( pParse->nErr || sqlite_malloc_failed ) goto exit_create_index; + if( pParse->nErr || sqlite3_malloc_failed ) goto exit_create_index; if( db->init.busy && sqlite3FixInit(&sFix, pParse, db->init.iDb, "index", pName) && sqlite3FixSrcList(&sFix, pTable) @@ -1759,7 +1759,7 @@ void sqlite3DropIndex(Parse *pParse, SrcList *pName){ Vdbe *v; sqlite *db = pParse->db; - if( pParse->nErr || sqlite_malloc_failed ) return; + if( pParse->nErr || sqlite3_malloc_failed ) return; assert( pName->nSrc==1 ); pIndex = sqlite3FindIndex(db, pName->a[0].zName, pName->a[0].zDatabase); if( pIndex==0 ){ @@ -2020,7 +2020,7 @@ void sqlite3BeginTransaction(Parse *pParse, int onError){ sqlite *db; if( pParse==0 || (db=pParse->db)==0 || db->aDb[0].pBt==0 ) return; - if( pParse->nErr || sqlite_malloc_failed ) return; + if( pParse->nErr || sqlite3_malloc_failed ) return; if( sqlite3AuthCheck(pParse, SQLITE_TRANSACTION, "BEGIN", 0, 0) ) return; if( db->flags & SQLITE_InTrans ){ sqlite3ErrorMsg(pParse, "cannot start a transaction within a transaction"); @@ -2040,7 +2040,7 @@ void sqlite3CommitTransaction(Parse *pParse){ sqlite *db; if( pParse==0 || (db=pParse->db)==0 || db->aDb[0].pBt==0 ) return; - if( pParse->nErr || sqlite_malloc_failed ) return; + if( pParse->nErr || sqlite3_malloc_failed ) return; if( sqlite3AuthCheck(pParse, SQLITE_TRANSACTION, "COMMIT", 0, 0) ) return; if( (db->flags & SQLITE_InTrans)==0 ){ sqlite3ErrorMsg(pParse, "cannot commit - no transaction is active"); @@ -2063,7 +2063,7 @@ void sqlite3RollbackTransaction(Parse *pParse){ Vdbe *v; if( pParse==0 || (db=pParse->db)==0 || db->aDb[0].pBt==0 ) return; - if( pParse->nErr || sqlite_malloc_failed ) return; + if( pParse->nErr || sqlite3_malloc_failed ) return; if( sqlite3AuthCheck(pParse, SQLITE_TRANSACTION, "ROLLBACK", 0, 0) ) return; if( (db->flags & SQLITE_InTrans)==0 ){ sqlite3ErrorMsg(pParse, "cannot rollback - no transaction is active"); diff --git a/src/copy.c b/src/copy.c index 9d6888b39..3bfd2b647 100644 --- a/src/copy.c +++ b/src/copy.c @@ -11,7 +11,7 @@ ************************************************************************* ** This file contains code used to implement the COPY command. ** -** $Id: copy.c,v 1.10 2004/05/08 08:23:24 danielk1977 Exp $ +** $Id: copy.c,v 1.11 2004/05/10 10:34:35 danielk1977 Exp $ */ #include "sqliteInt.h" @@ -42,7 +42,7 @@ void sqlite3Copy( sqlite *db = pParse->db; - if( sqlite_malloc_failed ) goto copy_cleanup; + if( sqlite3_malloc_failed ) goto copy_cleanup; assert( pTableName->nSrc==1 ); pTab = sqlite3SrcListLookup(pParse, pTableName); if( pTab==0 || sqlite3IsReadOnly(pParse, pTab, 0) ) goto copy_cleanup; diff --git a/src/date.c b/src/date.c index 897d11999..0c332abe5 100644 --- a/src/date.c +++ b/src/date.c @@ -16,7 +16,7 @@ ** sqlite3RegisterDateTimeFunctions() found at the bottom of the file. ** All other code has file scope. ** -** $Id: date.c,v 1.17 2004/05/08 08:23:24 danielk1977 Exp $ +** $Id: date.c,v 1.18 2004/05/10 10:34:35 danielk1977 Exp $ ** ** NOTES: ** @@ -666,7 +666,7 @@ static void juliandayFunc(sqlite_func *context, int argc, const char **argv){ DateTime x; if( isDate(argc, argv, &x)==0 ){ computeJD(&x); - sqlite_set_result_double(context, x.rJD); + sqlite3_set_result_double(context, x.rJD); } } @@ -682,7 +682,7 @@ static void datetimeFunc(sqlite_func *context, int argc, const char **argv){ computeYMD_HMS(&x); sprintf(zBuf, "%04d-%02d-%02d %02d:%02d:%02d",x.Y, x.M, x.D, x.h, x.m, (int)(x.s)); - sqlite_set_result_string(context, zBuf, -1); + sqlite3_set_result_string(context, zBuf, -1); } } @@ -697,7 +697,7 @@ static void timeFunc(sqlite_func *context, int argc, const char **argv){ char zBuf[100]; computeHMS(&x); sprintf(zBuf, "%02d:%02d:%02d", x.h, x.m, (int)x.s); - sqlite_set_result_string(context, zBuf, -1); + sqlite3_set_result_string(context, zBuf, -1); } } @@ -712,7 +712,7 @@ static void dateFunc(sqlite_func *context, int argc, const char **argv){ char zBuf[100]; computeYMD(&x); sprintf(zBuf, "%04d-%02d-%02d", x.Y, x.M, x.D); - sqlite_set_result_string(context, zBuf, -1); + sqlite3_set_result_string(context, zBuf, -1); } } @@ -832,7 +832,7 @@ static void strftimeFunc(sqlite_func *context, int argc, const char **argv){ } } z[j] = 0; - sqlite_set_result_string(context, z, -1); + sqlite3_set_result_string(context, z, -1); if( z!=zBuf ){ sqliteFree(z); } @@ -864,10 +864,10 @@ void sqlite3RegisterDateTimeFunctions(sqlite *db){ int i; for(i=0; i<sizeof(aFuncs)/sizeof(aFuncs[0]); i++){ - sqlite_create_function(db, aFuncs[i].zName, + sqlite3_create_function(db, aFuncs[i].zName, aFuncs[i].nArg, aFuncs[i].xFunc, 0); if( aFuncs[i].xFunc ){ - sqlite_function_type(db, aFuncs[i].zName, aFuncs[i].dataType); + sqlite3_function_type(db, aFuncs[i].zName, aFuncs[i].dataType); } } } diff --git a/src/delete.c b/src/delete.c index e8de27456..3ee8b56d9 100644 --- a/src/delete.c +++ b/src/delete.c @@ -12,7 +12,7 @@ ** This file contains C code routines that are called by the parser ** to handle DELETE FROM statements. ** -** $Id: delete.c,v 1.62 2004/05/08 08:23:24 danielk1977 Exp $ +** $Id: delete.c,v 1.63 2004/05/10 10:34:35 danielk1977 Exp $ */ #include "sqliteInt.h" @@ -76,7 +76,7 @@ void sqlite3DeleteFrom( int oldIdx = -1; /* Cursor for the OLD table of AFTER triggers */ sContext.pParse = 0; - if( pParse->nErr || sqlite_malloc_failed ){ + if( pParse->nErr || sqlite3_malloc_failed ){ pTabList = 0; goto delete_from_cleanup; } diff --git a/src/expr.c b/src/expr.c index ed464ebf8..5d167fe6d 100644 --- a/src/expr.c +++ b/src/expr.c @@ -12,7 +12,7 @@ ** This file contains routines used for analyzing expressions and ** for generating VDBE code that evaluates expressions in SQLite. ** -** $Id: expr.c,v 1.115 2004/05/08 08:23:24 danielk1977 Exp $ +** $Id: expr.c,v 1.116 2004/05/10 10:34:37 danielk1977 Exp $ */ #include "sqliteInt.h" #include <ctype.h> @@ -166,7 +166,7 @@ ExprList *sqlite3ExprListDup(ExprList *p){ sqlite3TokenCopy(&pNewExpr->span, &pOldExpr->span); } assert( pNewExpr==0 || pNewExpr->span.z!=0 - || pOldExpr->span.z==0 || sqlite_malloc_failed ); + || pOldExpr->span.z==0 || sqlite3_malloc_failed ); pItem->zName = sqliteStrDup(p->a[i].zName); pItem->sortOrder = p->a[i].sortOrder; pItem->isAgg = p->a[i].isAgg; @@ -436,7 +436,7 @@ static int lookupName( } zCol = sqliteStrNDup(pColumnToken->z, pColumnToken->n); sqlite3Dequote(zCol); - if( sqlite_malloc_failed ){ + if( sqlite3_malloc_failed ){ return 1; /* Leak memory (zDb and zTab) if malloc fails */ } assert( zTab==0 || pEList==0 ); diff --git a/src/func.c b/src/func.c index a2350d84b..c93dd7d29 100644 --- a/src/func.c +++ b/src/func.c @@ -16,7 +16,7 @@ ** sqliteRegisterBuildinFunctions() found at the bottom of the file. ** All other code has file scope. ** -** $Id: func.c,v 1.44 2004/05/08 08:23:25 danielk1977 Exp $ +** $Id: func.c,v 1.45 2004/05/10 10:34:38 danielk1977 Exp $ */ #include <ctype.h> #include <math.h> @@ -35,7 +35,7 @@ static void minmaxFunc(sqlite_func *context, int argc, const char **argv){ int mask; /* 0 for min() or 0xffffffff for max() */ if( argc==0 ) return; - mask = (int)sqlite_user_data(context); + mask = (int)sqlite3_user_data(context); zBest = argv[0]; if( zBest==0 ) return; if( argv[1][0]=='n' ){ @@ -49,7 +49,7 @@ static void minmaxFunc(sqlite_func *context, int argc, const char **argv){ zBest = argv[i]; } } - sqlite_set_result_string(context, zBest, -1); + sqlite3_set_result_string(context, zBest, -1); } /* @@ -57,7 +57,7 @@ static void minmaxFunc(sqlite_func *context, int argc, const char **argv){ */ static void typeofFunc(sqlite_func *context, int argc, const char **argv){ assert( argc==2 ); - sqlite_set_result_string(context, argv[1], -1); + sqlite3_set_result_string(context, argv[1], -1); } /* @@ -75,7 +75,7 @@ static void lengthFunc(sqlite_func *context, int argc, const char **argv){ #else len = strlen(z); #endif - sqlite_set_result_int(context, len); + sqlite3_set_result_int(context, len); } /* @@ -87,7 +87,7 @@ static void absFunc(sqlite_func *context, int argc, const char **argv){ z = argv[0]; if( z==0 ) return; if( z[0]=='-' && isdigit(z[1]) ) z++; - sqlite_set_result_string(context, z, -1); + sqlite3_set_result_string(context, z, -1); } /* @@ -133,7 +133,7 @@ static void substrFunc(sqlite_func *context, int argc, const char **argv){ while( z[i] && (z[i]&0xc0)==0x80 ){ i++; p2++; } #endif if( p2<0 ) p2 = 0; - sqlite_set_result_string(context, &z[p1], p2); + sqlite3_set_result_string(context, &z[p1], p2); } /* @@ -150,7 +150,7 @@ static void roundFunc(sqlite_func *context, int argc, const char **argv){ if( n<0 ) n = 0; r = sqlite3AtoF(argv[0], 0); sprintf(zBuf,"%.*f",n,r); - sqlite_set_result_string(context, zBuf, -1); + sqlite3_set_result_string(context, zBuf, -1); } /* @@ -160,7 +160,7 @@ static void upperFunc(sqlite_func *context, int argc, const char **argv){ char *z; int i; if( argc<1 || argv[0]==0 ) return; - z = sqlite_set_result_string(context, argv[0], -1); + z = sqlite3_set_result_string(context, argv[0], -1); if( z==0 ) return; for(i=0; z[i]; i++){ if( islower(z[i]) ) z[i] = toupper(z[i]); @@ -170,7 +170,7 @@ static void lowerFunc(sqlite_func *context, int argc, const char **argv){ char *z; int i; if( argc<1 || argv[0]==0 ) return; - z = sqlite_set_result_string(context, argv[0], -1); + z = sqlite3_set_result_string(context, argv[0], -1); if( z==0 ) return; for(i=0; z[i]; i++){ if( isupper(z[i]) ) z[i] = tolower(z[i]); @@ -186,7 +186,7 @@ static void ifnullFunc(sqlite_func *context, int argc, const char **argv){ int i; for(i=0; i<argc; i++){ if( argv[i] ){ - sqlite_set_result_string(context, argv[i], -1); + sqlite3_set_result_string(context, argv[i], -1); break; } } @@ -198,35 +198,35 @@ static void ifnullFunc(sqlite_func *context, int argc, const char **argv){ static void randomFunc(sqlite_func *context, int argc, const char **argv){ int r; sqlite3Randomness(sizeof(r), &r); - sqlite_set_result_int(context, r); + sqlite3_set_result_int(context, r); } /* ** Implementation of the last_insert_rowid() SQL function. The return -** value is the same as the sqlite_last_insert_rowid() API function. +** value is the same as the sqlite3_last_insert_rowid() API function. */ static void last_insert_rowid(sqlite_func *context, int arg, const char **argv){ - sqlite *db = sqlite_user_data(context); - sqlite_set_result_int(context, sqlite_last_insert_rowid(db)); + sqlite *db = sqlite3_user_data(context); + sqlite3_set_result_int(context, sqlite3_last_insert_rowid(db)); } /* ** Implementation of the change_count() SQL function. The return -** value is the same as the sqlite_changes() API function. +** value is the same as the sqlite3_changes() API function. */ static void change_count(sqlite_func *context, int arg, const char **argv){ - sqlite *db = sqlite_user_data(context); - sqlite_set_result_int(context, sqlite_changes(db)); + sqlite *db = sqlite3_user_data(context); + sqlite3_set_result_int(context, sqlite3_changes(db)); } /* ** Implementation of the last_statement_change_count() SQL function. The -** return value is the same as the sqlite_last_statement_changes() API function. +** return value is the same as the sqlite3_last_statement_changes() API function. */ static void last_statement_change_count(sqlite_func *context, int arg, const char **argv){ - sqlite *db = sqlite_user_data(context); - sqlite_set_result_int(context, sqlite_last_statement_changes(db)); + sqlite *db = sqlite3_user_data(context); + sqlite3_set_result_int(context, sqlite3_last_statement_changes(db)); } /* @@ -240,7 +240,7 @@ static void last_statement_change_count(sqlite_func *context, int arg, */ static void likeFunc(sqlite_func *context, int arg, const char **argv){ if( argv[0]==0 || argv[1]==0 ) return; - sqlite_set_result_int(context, + sqlite3_set_result_int(context, sqlite3LikeCompare((const unsigned char*)argv[0], (const unsigned char*)argv[1])); } @@ -256,7 +256,7 @@ static void likeFunc(sqlite_func *context, int arg, const char **argv){ */ static void globFunc(sqlite_func *context, int arg, const char **argv){ if( argv[0]==0 || argv[1]==0 ) return; - sqlite_set_result_int(context, + sqlite3_set_result_int(context, sqlite3GlobCompare((const unsigned char*)argv[0], (const unsigned char*)argv[1])); } @@ -268,7 +268,7 @@ static void globFunc(sqlite_func *context, int arg, const char **argv){ */ static void nullifFunc(sqlite_func *context, int argc, const char **argv){ if( argv[0]!=0 && sqlite3Compare(argv[0],argv[1])!=0 ){ - sqlite_set_result_string(context, argv[0], -1); + sqlite3_set_result_string(context, argv[0], -1); } } @@ -277,7 +277,7 @@ static void nullifFunc(sqlite_func *context, int argc, const char **argv){ ** of the SQLite library that is running. */ static void versionFunc(sqlite_func *context, int argc, const char **argv){ - sqlite_set_result_string(context, sqlite_version, -1); + sqlite3_set_result_string(context, sqlite3_version, -1); } /* @@ -294,9 +294,9 @@ static void versionFunc(sqlite_func *context, int argc, const char **argv){ static void quoteFunc(sqlite_func *context, int argc, const char **argv){ if( argc<1 ) return; if( argv[0]==0 ){ - sqlite_set_result_string(context, "NULL", 4); + sqlite3_set_result_string(context, "NULL", 4); }else if( sqlite3IsNumber(argv[0]) ){ - sqlite_set_result_string(context, argv[0], -1); + sqlite3_set_result_string(context, argv[0], -1); }else{ int i,j,n; char *z; @@ -312,7 +312,7 @@ static void quoteFunc(sqlite_func *context, int argc, const char **argv){ } z[j++] = '\''; z[j] = 0; - sqlite_set_result_string(context, z, j); + sqlite3_set_result_string(context, z, j); sqliteFree(z); } } @@ -350,9 +350,9 @@ static void soundexFunc(sqlite_func *context, int argc, const char **argv){ zResult[j++] = '0'; } zResult[j] = 0; - sqlite_set_result_string(context, zResult, 4); + sqlite3_set_result_string(context, zResult, 4); }else{ - sqlite_set_result_string(context, "?000", 4); + sqlite3_set_result_string(context, "?000", 4); } } #endif @@ -396,7 +396,7 @@ static void randStr(sqlite_func *context, int argc, const char **argv){ zBuf[i] = zSrc[zBuf[i]%(sizeof(zSrc)-1)]; } zBuf[n] = 0; - sqlite_set_result_string(context, zBuf, n); + sqlite3_set_result_string(context, zBuf, n); } #endif @@ -416,7 +416,7 @@ struct SumCtx { static void sumStep(sqlite_func *context, int argc, const char **argv){ SumCtx *p; if( argc<1 ) return; - p = sqlite_aggregate_context(context, sizeof(*p)); + p = sqlite3_aggregate_context(context, sizeof(*p)); if( p && argv[0] ){ p->sum += sqlite3AtoF(argv[0], 0); p->cnt++; @@ -424,14 +424,14 @@ static void sumStep(sqlite_func *context, int argc, const char **argv){ } static void sumFinalize(sqlite_func *context){ SumCtx *p; - p = sqlite_aggregate_context(context, sizeof(*p)); - sqlite_set_result_double(context, p ? p->sum : 0.0); + p = sqlite3_aggregate_context(context, sizeof(*p)); + sqlite3_set_result_double(context, p ? p->sum : 0.0); } static void avgFinalize(sqlite_func *context){ SumCtx *p; - p = sqlite_aggregate_context(context, sizeof(*p)); + p = sqlite3_aggregate_context(context, sizeof(*p)); if( p && p->cnt>0 ){ - sqlite_set_result_double(context, p->sum/(double)p->cnt); + sqlite3_set_result_double(context, p->sum/(double)p->cnt); } } @@ -454,7 +454,7 @@ static void stdDevStep(sqlite_func *context, int argc, const char **argv){ StdDevCtx *p; double x; if( argc<1 ) return; - p = sqlite_aggregate_context(context, sizeof(*p)); + p = sqlite3_aggregate_context(context, sizeof(*p)); if( p && argv[0] ){ x = sqlite3AtoF(argv[0], 0); p->sum += x; @@ -463,11 +463,11 @@ static void stdDevStep(sqlite_func *context, int argc, const char **argv){ } } static void stdDevFinalize(sqlite_func *context){ - double rN = sqlite_aggregate_count(context); - StdDevCtx *p = sqlite_aggregate_context(context, sizeof(*p)); + double rN = sqlite3_aggregate_count(context); + StdDevCtx *p = sqlite3_aggregate_context(context, sizeof(*p)); if( p && p->cnt>1 ){ double rCnt = cnt; - sqlite_set_result_double(context, + sqlite3_set_result_double(context, sqrt((p->sum2 - p->sum*p->sum/rCnt)/(rCnt-1.0))); } } @@ -487,15 +487,15 @@ struct CountCtx { */ static void countStep(sqlite_func *context, int argc, const char **argv){ CountCtx *p; - p = sqlite_aggregate_context(context, sizeof(*p)); + p = sqlite3_aggregate_context(context, sizeof(*p)); if( (argc==0 || argv[0]) && p ){ p->n++; } } 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); } /* @@ -522,8 +522,8 @@ static void minmaxStep(sqlite_func *context, int argc, const char **argv){ }else{ xCompare = strcmp; } - mask = (int)sqlite_user_data(context); - p = sqlite_aggregate_context(context, sizeof(*p)); + mask = (int)sqlite3_user_data(context); + p = sqlite3_aggregate_context(context, sizeof(*p)); if( p==0 || argc<1 || argv[0]==0 ) return; if( p->z==0 || (xCompare(argv[0],p->z)^mask)<0 ){ int len; @@ -544,9 +544,9 @@ static void minmaxStep(sqlite_func *context, int argc, const char **argv){ } static void minMaxFinalize(sqlite_func *context){ MinMaxCtx *p; - p = sqlite_aggregate_context(context, sizeof(*p)); + p = sqlite3_aggregate_context(context, sizeof(*p)); if( p && p->z ){ - sqlite_set_result_string(context, p->z, strlen(p->z)); + sqlite3_set_result_string(context, p->z, strlen(p->z)); } if( p && !p->zBuf[0] ){ sqliteFree(p->z); @@ -586,7 +586,7 @@ void sqlite3RegisterBuiltinFunctions(sqlite *db){ { "like", 2, SQLITE_NUMERIC, 0, likeFunc }, { "glob", 2, SQLITE_NUMERIC, 0, globFunc }, { "nullif", 2, SQLITE_ARGS, 0, nullifFunc }, - { "sqlite_version",0,SQLITE_TEXT, 0, versionFunc}, + { "sqlite3_version",0,SQLITE_TEXT, 0, versionFunc}, { "quote", 1, SQLITE_ARGS, 0, quoteFunc }, { "last_insert_rowid", 0, SQLITE_NUMERIC, 1, last_insert_rowid }, { "change_count", 0, SQLITE_NUMERIC, 1, change_count }, @@ -622,17 +622,17 @@ void sqlite3RegisterBuiltinFunctions(sqlite *db){ for(i=0; i<sizeof(aFuncs)/sizeof(aFuncs[0]); i++){ void *pArg = aFuncs[i].argType==2 ? (void*)(-1) : db; - sqlite_create_function(db, aFuncs[i].zName, + sqlite3_create_function(db, aFuncs[i].zName, aFuncs[i].nArg, aFuncs[i].xFunc, pArg); if( aFuncs[i].xFunc ){ - sqlite_function_type(db, aFuncs[i].zName, aFuncs[i].dataType); + sqlite3_function_type(db, aFuncs[i].zName, aFuncs[i].dataType); } } for(i=0; i<sizeof(aAggs)/sizeof(aAggs[0]); i++){ void *pArg = aAggs[i].argType==2 ? (void*)(-1) : db; - sqlite_create_aggregate(db, aAggs[i].zName, + sqlite3_create_aggregate(db, aAggs[i].zName, aAggs[i].nArg, aAggs[i].xStep, aAggs[i].xFinalize, pArg); - sqlite_function_type(db, aAggs[i].zName, aAggs[i].dataType); + sqlite3_function_type(db, aAggs[i].zName, aAggs[i].dataType); } for(i=0; i<sizeof(azTypeFuncs)/sizeof(azTypeFuncs[0]); i++){ int n = strlen(azTypeFuncs[i]); diff --git a/src/insert.c b/src/insert.c index d642be141..c8a13ff7b 100644 --- a/src/insert.c +++ b/src/insert.c @@ -12,7 +12,7 @@ ** This file contains C code routines that are called by the parser ** to handle INSERT statements in SQLite. ** -** $Id: insert.c,v 1.95 2004/05/08 08:23:25 danielk1977 Exp $ +** $Id: insert.c,v 1.96 2004/05/10 10:34:40 danielk1977 Exp $ */ #include "sqliteInt.h" @@ -116,7 +116,7 @@ void sqlite3Insert( int after_triggers; /* True if there are AFTER triggers */ int newIdx = -1; /* Cursor for the NEW table */ - if( pParse->nErr || sqlite_malloc_failed ) goto insert_cleanup; + if( pParse->nErr || sqlite3_malloc_failed ) goto insert_cleanup; db = pParse->db; /* Locate the table into which we will be inserting new information. @@ -182,7 +182,7 @@ void sqlite3Insert( iSelectLoop = sqlite3VdbeCurrentAddr(v); iInsertBlock = sqlite3VdbeMakeLabel(v); rc = sqlite3Select(pParse, pSelect, SRT_Subroutine, iInsertBlock, 0,0,0); - if( rc || pParse->nErr || sqlite_malloc_failed ) goto insert_cleanup; + if( rc || pParse->nErr || sqlite3_malloc_failed ) goto insert_cleanup; iCleanup = sqlite3VdbeMakeLabel(v); sqlite3VdbeAddOp(v, OP_Goto, 0, iCleanup); assert( pSelect->pEList ); @@ -574,12 +574,12 @@ insert_cleanup: ** Constraint type Action What Happens ** --------------- ---------- ---------------------------------------- ** any ROLLBACK The current transaction is rolled back and -** sqlite_exec() returns immediately with a +** sqlite3_exec() returns immediately with a ** return code of SQLITE_CONSTRAINT. ** ** any ABORT Back out changes from the current command ** only (do not do a complete rollback) then -** cause sqlite_exec() to return immediately +** cause sqlite3_exec() to return immediately ** with SQLITE_CONSTRAINT. ** ** any FAIL Sqlite_exec() returns immediately with a diff --git a/src/main.c b/src/main.c index 6c98985db..7355428a1 100644 --- a/src/main.c +++ b/src/main.c @@ -14,7 +14,7 @@ ** other files are for internal use by SQLite and should not be ** accessed by users of the library. ** -** $Id: main.c,v 1.167 2004/05/10 01:17:37 danielk1977 Exp $ +** $Id: main.c,v 1.168 2004/05/10 10:34:43 danielk1977 Exp $ */ #include "sqliteInt.h" #include "os.h" @@ -83,9 +83,9 @@ int sqlite3InitCallback(void *pInit, int argc, char **argv, char **azColName){ db->init.iDb = atoi(argv[4]); assert( db->init.iDb>=0 && db->init.iDb<db->nDb ); db->init.newTnum = atoi(argv[2]); - if( sqlite_exec(db, argv[3], 0, 0, &zErr) ){ + if( sqlite3_exec(db, argv[3], 0, 0, &zErr) ){ corruptSchema(pData, zErr); - sqlite_freemem(zErr); + sqlite3_freemem(zErr); } db->init.iDb = 0; }else{ @@ -150,14 +150,14 @@ int upgrade_3_callback(void *pInit, int argc, char **argv, char **NotUsed){ pTrig = pTab->pTrigger; pTab->pTrigger = 0; /* Disable all triggers before rebuilding the table */ } - rc = sqlite_exec_printf(pData->db, + rc = sqlite3_exec_printf(pData->db, "CREATE TEMP TABLE sqlite_x AS SELECT * FROM '%q'; " "DELETE FROM '%q'; " "INSERT INTO '%q' SELECT * FROM sqlite_x; " "DROP TABLE sqlite_x;", 0, 0, &zErr, argv[0], argv[0], argv[0]); if( zErr ){ - if( *pData->pzErrMsg ) sqlite_freemem(*pData->pzErrMsg); + if( *pData->pzErrMsg ) sqlite3_freemem(*pData->pzErrMsg); *pData->pzErrMsg = zErr; } @@ -282,7 +282,7 @@ static int sqlite3InitOne(sqlite *db, int iDb, char **pzErrMsg){ if( db->aDb[iDb].pBt==0 ) return SQLITE_OK; rc = sqlite3BtreeCursor(db->aDb[iDb].pBt, MASTER_ROOT, 0, 0, 0, &curMain); if( rc ){ - sqlite3SetString(pzErrMsg, sqlite_error_string(rc), (char*)0); + sqlite3SetString(pzErrMsg, sqlite3_error_string(rc), (char*)0); return rc; } @@ -295,7 +295,7 @@ static int sqlite3InitOne(sqlite *db, int iDb, char **pzErrMsg){ } } if( rc ){ - sqlite3SetString(pzErrMsg, sqlite_error_string(rc), (char*)0); + sqlite3SetString(pzErrMsg, sqlite3_error_string(rc), (char*)0); sqlite3BtreeCloseCursor(curMain); return rc; } @@ -348,7 +348,7 @@ static int sqlite3InitOne(sqlite *db, int iDb, char **pzErrMsg){ assert( db->init.busy ); sqlite3SafetyOff(db); if( iDb==0 ){ - rc = sqlite_exec(db, + rc = sqlite3_exec(db, db->file_format>=2 ? init_script : older_init_script, sqlite3InitCallback, &initData, 0); }else{ @@ -356,12 +356,12 @@ static int sqlite3InitOne(sqlite *db, int iDb, char **pzErrMsg){ sqlite3SetString(&zSql, "SELECT type, name, rootpage, sql, ", zDbNum, " FROM \"", db->aDb[iDb].zName, "\".sqlite_master", (char*)0); - rc = sqlite_exec(db, zSql, sqlite3InitCallback, &initData, 0); + rc = sqlite3_exec(db, zSql, sqlite3InitCallback, &initData, 0); sqliteFree(zSql); } sqlite3SafetyOn(db); sqlite3BtreeCloseCursor(curMain); - if( sqlite_malloc_failed ){ + if( sqlite3_malloc_failed ){ sqlite3SetString(pzErrMsg, "out of memory", (char*)0); rc = SQLITE_NOMEM; sqlite3ResetInternalSchema(db, 0); @@ -425,7 +425,7 @@ int sqlite3Init(sqlite *db, char **pzErrMsg){ initData.db = db; initData.pzErrMsg = &zErr; db->file_format = 3; - rc = sqlite_exec(db, + rc = sqlite3_exec(db, "BEGIN; SELECT name FROM sqlite_master WHERE type='table';", upgrade_3_callback, &initData, @@ -439,14 +439,14 @@ int sqlite3Init(sqlite *db, char **pzErrMsg){ for(ii=0; rc==SQLITE_OK && ii<SQLITE_N_BTREE_META; ii++){ rc = sqlite3BtreeUpdateMeta(db->aDb[0].pBt, ii+1, meta[ii]); } - sqlite_exec(db, "COMMIT", 0, 0, 0); + sqlite3_exec(db, "COMMIT", 0, 0, 0); } if( rc!=SQLITE_OK ){ sqlite3SetString(pzErrMsg, "unable to upgrade database to the version 2.6 format", zErr ? ": " : 0, zErr, (char*)0); } - sqlite_freemem(zErr); + sqlite3_freemem(zErr); } if( rc!=SQLITE_OK ){ @@ -459,16 +459,16 @@ int sqlite3Init(sqlite *db, char **pzErrMsg){ ** The version of the library */ const char rcsid[] = "@(#) \044Id: SQLite version " SQLITE_VERSION " $"; -const char sqlite_version[] = SQLITE_VERSION; +const char sqlite3_version[] = SQLITE_VERSION; /* ** Does the library expect data to be encoded as UTF-8 or iso8859? The ** following global constant always lets us know. */ #ifdef SQLITE_UTF8 -const char sqlite_encoding[] = "UTF-8"; +const char sqlite3_encoding[] = "UTF-8"; #else -const char sqlite_encoding[] = "iso8859"; +const char sqlite3_encoding[] = "iso8859"; #endif /* @@ -478,9 +478,9 @@ const char sqlite_encoding[] = "iso8859"; ** An attempt is made to initialize the in-memory data structures that ** hold the database schema. But if this fails (because the schema file ** is locked) then that step is deferred until the first call to -** sqlite_exec(). +** sqlite3_exec(). */ -sqlite *sqlite_open(const char *zFilename, int mode, char **pzErrMsg){ +sqlite *sqlite3_open(const char *zFilename, int mode, char **pzErrMsg){ sqlite *db; int rc, i; @@ -525,11 +525,11 @@ sqlite *sqlite_open(const char *zFilename, int mode, char **pzErrMsg){ sqlite3RegisterBuiltinFunctions(db); rc = sqlite3Init(db, pzErrMsg); db->magic = SQLITE_MAGIC_OPEN; - if( sqlite_malloc_failed ){ - sqlite_close(db); + if( sqlite3_malloc_failed ){ + sqlite3_close(db); goto no_mem_on_open; }else if( rc!=SQLITE_OK && rc!=SQLITE_BUSY ){ - sqlite_close(db); + sqlite3_close(db); sqlite3StrRealloc(pzErrMsg); return 0; }else if( pzErrMsg ){ @@ -549,14 +549,14 @@ no_mem_on_open: /* ** Return the ROWID of the most recent insert */ -int sqlite_last_insert_rowid(sqlite *db){ +int sqlite3_last_insert_rowid(sqlite *db){ return db->lastRowid; } /* -** Return the number of changes in the most recent call to sqlite_exec(). +** Return the number of changes in the most recent call to sqlite3_exec(). */ -int sqlite_changes(sqlite *db){ +int sqlite3_changes(sqlite *db){ return db->nChange; } @@ -566,14 +566,14 @@ int sqlite_changes(sqlite *db){ ** changes due to SQL statements executed in trigger programs that were ** triggered by that statement */ -int sqlite_last_statement_changes(sqlite *db){ +int sqlite3_last_statement_changes(sqlite *db){ return db->lsChange; } /* ** Close an existing SQLite database */ -void sqlite_close(sqlite *db){ +void sqlite3_close(sqlite *db){ HashElem *i; int j; db->want_to_close = 1; @@ -628,7 +628,7 @@ void sqlite3RollbackAll(sqlite *db){ ** argument to xCallback(). If xCallback=NULL then no callback ** is invoked, even for queries. */ -int sqlite_exec( +int sqlite3_exec( sqlite *db, /* The database on which the SQL executes */ const char *zSql, /* The SQL to be executed */ sqlite_callback xCallback, /* Invoke this callback routine */ @@ -645,9 +645,9 @@ int sqlite_exec( if( zSql==0 ) return SQLITE_OK; while( rc==SQLITE_OK && zSql[0] ){ pVm = 0; - rc = sqlite_compile(db, zSql, &zLeftover, &pVm, pzErrMsg); + rc = sqlite3_compile(db, zSql, &zLeftover, &pVm, pzErrMsg); if( rc!=SQLITE_OK ){ - assert( pVm==0 || sqlite_malloc_failed ); + assert( pVm==0 || sqlite3_malloc_failed ); return rc; } if( pVm==0 ){ @@ -659,10 +659,10 @@ int sqlite_exec( while(1){ int nArg; char **azArg, **azCol; - rc = sqlite_step(pVm, &nArg, (const char***)&azArg,(const char***)&azCol); + rc = sqlite3_step(pVm, &nArg, (const char***)&azArg,(const char***)&azCol); if( rc==SQLITE_ROW ){ if( xCallback!=0 && xCallback(pArg, nArg, azArg, azCol) ){ - sqlite_finalize(pVm, 0); + sqlite3_finalize(pVm, 0); return SQLITE_ABORT; } nCallback++; @@ -671,7 +671,7 @@ int sqlite_exec( && (db->flags & SQLITE_NullCallback)!=0 && xCallback!=0 ){ xCallback(pArg, nArg, azArg, azCol); } - rc = sqlite_finalize(pVm, pzErrMsg); + rc = sqlite3_finalize(pVm, pzErrMsg); if( rc==SQLITE_SCHEMA && nRetry<2 ){ nRetry++; rc = SQLITE_OK; @@ -696,7 +696,7 @@ int sqlite_exec( ** of the SQLITE_ success/failure codes. Also write an error message into ** memory obtained from malloc() and make *pzErrMsg point to that message. */ -int sqlite_compile( +int sqlite3_compile( sqlite *db, /* The database on which the SQL executes */ const char *zSql, /* The SQL to be executed */ const char **pzTail, /* OUT: Next statement after the first */ @@ -749,7 +749,7 @@ int sqlite_compile( }else{ /* If a memory error occurred during the copy, ** trace entire SQL string and fall through to the - ** sqlite_malloc_failed test to report the error. + ** sqlite3_malloc_failed test to report the error. */ db->xTrace(db->pTraceArg, zSql); } @@ -757,7 +757,7 @@ int sqlite_compile( db->xTrace(db->pTraceArg, zSql); } } - if( sqlite_malloc_failed ){ + if( sqlite3_malloc_failed ){ sqlite3SetString(pzErrMsg, "out of memory", (char*)0); sParse.rc = SQLITE_NOMEM; sqlite3RollbackAll(db); @@ -766,7 +766,7 @@ int sqlite_compile( } if( sParse.rc==SQLITE_DONE ) sParse.rc = SQLITE_OK; if( sParse.rc!=SQLITE_OK && pzErrMsg && *pzErrMsg==0 ){ - sqlite3SetString(pzErrMsg, sqlite_error_string(sParse.rc), (char*)0); + sqlite3SetString(pzErrMsg, sqlite3_error_string(sParse.rc), (char*)0); } sqlite3StrRealloc(pzErrMsg); if( sParse.rc==SQLITE_SCHEMA ){ @@ -781,7 +781,7 @@ int sqlite_compile( exec_misuse: if( pzErrMsg ){ *pzErrMsg = 0; - sqlite3SetString(pzErrMsg, sqlite_error_string(SQLITE_MISUSE), (char*)0); + sqlite3SetString(pzErrMsg, sqlite3_error_string(SQLITE_MISUSE), (char*)0); sqlite3StrRealloc(pzErrMsg); } return SQLITE_MISUSE; @@ -790,16 +790,16 @@ exec_misuse: /* ** The following routine destroys a virtual machine that is created by -** the sqlite_compile() routine. +** the sqlite3_compile() routine. ** ** The integer returned is an SQLITE_ success/failure code that describes ** the result of executing the virtual machine. An error message is ** written into memory obtained from malloc and *pzErrMsg is made to ** point to that error if pzErrMsg is not NULL. The calling routine -** should use sqlite_freemem() to delete the message when it has finished +** should use sqlite3_freemem() to delete the message when it has finished ** with it. */ -int sqlite_finalize( +int sqlite3_finalize( sqlite_vm *pVm, /* The virtual machine to be destroyed */ char **pzErrMsg /* OUT: Write error messages here */ ){ @@ -815,7 +815,7 @@ int sqlite_finalize( ** is written into *pzErrMsg. A success code from the prior execution ** is returned. */ -int sqlite_reset( +int sqlite3_reset( sqlite_vm *pVm, /* The virtual machine to be destroyed */ char **pzErrMsg /* OUT: Write error messages here */ ){ @@ -829,7 +829,7 @@ int sqlite_reset( ** Return a static string that describes the kind of error specified in the ** argument. */ -const char *sqlite_error_string(int rc){ +const char *sqlite3_error_string(int rc){ const char *z; switch( rc ){ case SQLITE_OK: z = "not an error"; break; @@ -911,7 +911,7 @@ static int sqliteDefaultBusyCallback( ** This routine sets the busy callback for an Sqlite database to the ** given callback function with the given argument. */ -void sqlite_busy_handler( +void sqlite3_busy_handler( sqlite *db, int (*xBusy)(void*,const char*,int), void *pArg @@ -926,7 +926,7 @@ void sqlite_busy_handler( ** given callback function with the given argument. The progress callback will ** be invoked every nOps opcodes. */ -void sqlite_progress_handler( +void sqlite3_progress_handler( sqlite *db, int nOps, int (*xProgress)(void*), @@ -949,24 +949,24 @@ void sqlite_progress_handler( ** This routine installs a default busy handler that waits for the ** specified number of milliseconds before returning 0. */ -void sqlite_busy_timeout(sqlite *db, int ms){ +void sqlite3_busy_timeout(sqlite *db, int ms){ if( ms>0 ){ - sqlite_busy_handler(db, sqliteDefaultBusyCallback, (void*)ms); + sqlite3_busy_handler(db, sqliteDefaultBusyCallback, (void*)ms); }else{ - sqlite_busy_handler(db, 0, 0); + sqlite3_busy_handler(db, 0, 0); } } /* ** Cause any pending operation to stop at its earliest opportunity. */ -void sqlite_interrupt(sqlite *db){ +void sqlite3_interrupt(sqlite *db){ db->flags |= SQLITE_Interrupt; } /* ** Windows systems should call this routine to free memory that -** is returned in the in the errmsg parameter of sqlite_open() when +** is returned in the in the errmsg parameter of sqlite3_open() when ** SQLite is a DLL. For some reason, it does not work to call free() ** directly. ** @@ -974,31 +974,31 @@ void sqlite_interrupt(sqlite *db){ ** string that is exported from SQLite should have already passed through ** sqlite3StrRealloc(). */ -void sqlite_freemem(void *p){ free(p); } +void sqlite3_freemem(void *p){ free(p); } /* -** Windows systems need functions to call to return the sqlite_version -** and sqlite_encoding strings since they are unable to access constants +** Windows systems need functions to call to return the sqlite3_version +** and sqlite3_encoding strings since they are unable to access constants ** within DLLs. */ -const char *sqlite_libversion(void){ return sqlite_version; } -const char *sqlite_libencoding(void){ return sqlite_encoding; } +const char *sqlite3_libversion(void){ return sqlite3_version; } +const char *sqlite3_libencoding(void){ return sqlite3_encoding; } /* -** Create new user-defined functions. The sqlite_create_function() -** routine creates a regular function and sqlite_create_aggregate() +** Create new user-defined functions. The sqlite3_create_function() +** routine creates a regular function and sqlite3_create_aggregate() ** creates an aggregate function. ** ** Passing a NULL xFunc argument or NULL xStep and xFinalize arguments -** disables the function. Calling sqlite_create_function() with the +** disables the function. Calling sqlite3_create_function() with the ** same name and number of arguments as a prior call to -** sqlite_create_aggregate() disables the prior call to -** sqlite_create_aggregate(), and vice versa. +** sqlite3_create_aggregate() disables the prior call to +** sqlite3_create_aggregate(), and vice versa. ** ** If nArg is -1 it means that this function will accept any number ** of arguments, including 0. The maximum allowed value of nArg is 127. */ -int sqlite_create_function( +int sqlite3_create_function( sqlite *db, /* Add the function to this database connection */ const char *zName, /* Name of the function to add */ int nArg, /* Number of arguments */ @@ -1019,7 +1019,7 @@ int sqlite_create_function( p->pUserData = pUserData; return 0; } -int sqlite_create_aggregate( +int sqlite3_create_aggregate( sqlite *db, /* Add the function to this database connection */ const char *zName, /* Name of the function to add */ int nArg, /* Number of arguments */ @@ -1047,7 +1047,7 @@ int sqlite_create_aggregate( ** header comment for the prototype of this function in sqlite.h for ** additional information. */ -int sqlite_function_type(sqlite *db, const char *zName, int dataType){ +int sqlite3_function_type(sqlite *db, const char *zName, int dataType){ FuncDef *p = (FuncDef*)sqlite3HashFind(&db->aFunc, zName, strlen(zName)); while( p ){ p->dataType = dataType; @@ -1062,9 +1062,9 @@ int sqlite_function_type(sqlite *db, const char *zName, int dataType){ ** ** A NULL trace function means that no tracing is executes. A non-NULL ** trace is a pointer to a function that is invoked at the start of each -** sqlite_exec(). +** sqlite3_exec(). */ -void *sqlite_trace(sqlite *db, void (*xTrace)(void*,const char*), void *pArg){ +void *sqlite3_trace(sqlite *db, void (*xTrace)(void*,const char*), void *pArg){ void *pOld = db->pTraceArg; db->xTrace = xTrace; db->pTraceArg = pArg; @@ -1077,7 +1077,7 @@ void *sqlite_trace(sqlite *db, void (*xTrace)(void*,const char*), void *pArg){ ** If either function returns non-zero, then the commit becomes a ** rollback. */ -void *sqlite_commit_hook( +void *sqlite3_commit_hook( sqlite *db, /* Attach the hook to this database */ int (*xCallback)(void*), /* Function to invoke on each commit */ void *pArg /* Argument to the function */ @@ -1141,7 +1141,7 @@ int sqlite3BtreeFactory( ** */ int sqlite3_open(const char *filename, sqlite3 **pDb, const char **options){ - *pDb = sqlite_open(filename, 0, &errmsg); + *pDb = sqlite3_open(filename, 0, &errmsg); return (*pDb?SQLITE_OK:SQLITE_ERROR); } int sqlite3_open16(const void *filename, sqlite3 **pDb, const char **options){ @@ -1164,7 +1164,7 @@ int sqlite3_open16(const void *filename, sqlite3 **pDb, const char **options){ ** */ int sqlite3_close(sqlite3 *db){ - return sqlite_close(db); + return sqlite3_close(db); } /* @@ -1203,7 +1203,7 @@ int sqlite3_prepare( const char** pzTail ){ int rc; - rc = sqlite_compile(db, zSql, pzTail, ppStmt, 0); + rc = sqlite3_compile(db, zSql, pzTail, ppStmt, 0); return rc; } int sqlite3_prepare16( @@ -1233,21 +1233,21 @@ int sqlite3_prepare16( ** sqlite3_finalize */ int sqlite3_finalize(sqlite3_stmt *stmt){ - return sqlite_finalize(stmt, 0); + return sqlite3_finalize(stmt, 0); } /* ** sqlite3_reset */ int sqlite3_reset(sqlite3_stmt*){ - return sqlite_reset(stmt, 0); + return sqlite3_reset(stmt, 0); } /* ** sqlite3_step */ int sqlite3_step(sqlite3_stmt *pStmt){ - return sqlite_step(pStmt); + return sqlite3_step(pStmt); } /* @@ -1260,7 +1260,7 @@ int sqlite3_bind_text( int n, int eCopy ){ - return sqlite_bind(pStmt, i, zVal, n, eCopy); + return sqlite3_bind(pStmt, i, zVal, n, eCopy); } int sqlite3_bind_text16( @@ -1292,7 +1292,7 @@ int sqlite3_bind_text16( ** sqlite3_bind_null */ int sqlite3_bind_null(sqlite3_stmt*, int iParm){ - return sqlite_bind(pStmt, i, 0, 0, 0); + return sqlite3_bind(pStmt, i, 0, 0, 0); } |