-C Comment\schanges\sand\sminor\scode\scleanup.\s(CVS\s1940)
-D 2004-09-05T23:23:42
+C Fix\sa\snaming\sconflict\sbetween\ssqlite\sversions\s2\sand\s3.\s\sAn\sopen\ssqlite3\nconnection\snow\s*must*\sbe\scalled\s"sqlite3".\s\sYou\scannot\scall\sit\s"sqlite".\nThis\smight\sbreak\sexisting\scode.\s(CVS\s1941)
+D 2004-09-06T17:24:12
F Makefile.in 65a7c43fcaf9a710d62f120b11b6e435eeb4a450
F Makefile.linux-gcc a9e5a0d309fa7c38e7c14d3ecf7690879d3a5457
F README f1de682fbbd94899d50aca13d387d1b3fd3be2dd
F sqlite.pc.in 30552343140c53304c2a658c080fbe810cd09ca2
F sqlite3.def 84215604aa7b547d75e0f7b437966e7ad18fa8b2
F sqlite3.pc.in 985b9bf34192a549d7d370e0f0b6b34a4f61369a
-F src/attach.c 3fe50b71cf6b324c7d217fc13742124dba726486
-F src/auth.c 60db23b98bb94c8b0178180faaf49dc116674217
+F src/attach.c e49d09dad9f5f9fb10b4b0c1be5a70ae4c45e689
+F src/auth.c 038d7c7c2224fa92f0125c0c30c90f7b2ca8c39a
F src/btree.c fe763fde639793ef2010d5388d0d135ecc02b4eb
F src/btree.h 94dfec0a1722d33359b23e7e310f2b64ffedf029
-F src/build.c 35275654d9c5ce6c1c0c78e391f85e6915a8a66b
-F src/date.c edff4aa851eeca8abbc737dc3933a2f0671156ce
-F src/delete.c cebfdde83e7bf68d8118e1c13e40c99787302fbf
+F src/build.c c6940e4a663fa6b7dc3dff34f7dddbc45d331d48
+F src/date.c eb8d5fa1a6d5cfc09031c8852d10ff742a94b15b
+F src/delete.c e887f44aae1e33da1643df58abe86cd9cde45ad1
F src/encode.c a876af473d1d636faa3dca51c7571f2e007eea37
-F src/expr.c d618305952f75567514824cf9bdd5de74db5e00a
-F src/func.c 54a095713dd117e5482b25fa829e241d6938f1b6
+F src/expr.c 5b6881a229e49869c348825aa1f1af6bd6b4bc76
+F src/func.c 14bf20710a10fe66266e16da4364ca2dd8c4c36d
F src/hash.c a97721a55440b7bea31ffe471bb2f6b4123cddd5
F src/hash.h 1b0c445e1c89ff2aaad9b4605ba61375af001e84
-F src/insert.c fc1ce65a0fe68f226143de9b43c3582164a92aff
-F src/legacy.c 2f3617c61bcdcd1d776154a9cfebf99facda8ad8
-F src/main.c 981bbcf4521762ab9f8ecbda1a4260ef94d7234f
+F src/insert.c bfd21070c28dd94e58ae918260a6985d2b5e4477
+F src/legacy.c 1cf9a326313f99879b4970a1d454725deb12e81b
+F src/main.c ac302ed646bdb256b78c87385627b3142357eced
F src/md5.c 7ae1c39044b95de2f62e066f47bb1deb880a1070
F src/os.h d1780e0db95cad01f213d48da22ab490eb4fd345
F src/os_common.h cd7eb025fdab7dc91e0e97bf6310f1648205857f
F src/pager.c ae06c85de0db43f61a7a3e5eacad3fd5615daf59
F src/pager.h 67739fe649f33be55dba522ca8a9cc4e42d14f71
F src/parse.y 581a2ce014b843506805b2470c02b7865ad034d5
-F src/pragma.c 0fbfb50491ac971dd22c049c3042c322e9cadb39
+F src/pragma.c 6385059dfd77eee9fe7e53c0469776315f136ae0
F src/printf.c 17b28a1eedfe8129b05de981719306c18c3f1327
F src/random.c eff68e3f257e05e81eae6c4d50a51eb88beb4ff3
-F src/select.c 14534579535579a082fda8bbc7d621d7d170f406
+F src/select.c 6e3ec12a01c6d5b51459d6ddaca36040d9e7730e
F src/shell.c 4f1a2760ced81c829defb47b0a3b61ffec61b604
-F src/sqlite.h.in b89ced1acc705bc9c79a2a4e725ac0eb64bd0614
-F src/sqliteInt.h 71de4b0400b50579d5dfab70b59adbb7776e77d8
-F src/table.c 4521c278892f60e4d630788c0ea5cf4db1e75c49
-F src/tclsqlite.c b7dd8b3531b70188d03354db530de0f2ffcac697
-F src/test1.c 3670f318c473b5a81cae548d9cc42da3f6a6efee
+F src/sqlite.h.in 40c365c4af381fea8f103d579d4ce021c1b5fbc6
+F src/sqliteInt.h 0840e651db8e16f88f2b8a2393ac98dfdbf01df0
+F src/table.c 8168c6e824009f8485bff79fc60ea8fea6829b10
+F src/tclsqlite.c ad6460a22cee18f292614a083cd15db670298213
+F src/test1.c 0a7ae23d822177ecf3e8b577d026f0c8a39fe5c3
F src/test2.c f4c2f3928f1998fd8cb75a81e33a60e025ea85d4
F src/test3.c 94d0a2a90bccd85802488cb42c69ec8afd2e4646
-F src/test4.c c38766914e924091516030b6a8b677d849c08bf0
+F src/test4.c 7c6b9fc33dd1f3f93c7f1ee6e5e6d016afa6c1df
F src/test5.c b001fa7f1b9e2dc5c2331de62fc641b5ab2bd7a1
-F src/tokenize.c 32171c3d576c7ec6acd6cf15e55c00ac0b314769
-F src/trigger.c 40e10f4b219b55e56478bc17480ce77654300e8d
-F src/update.c bbe126c67529bd699016af2d72bc4ceb8fd41527
+F src/tokenize.c 566ca7d1354dcb990475a52990056fc387d49df1
+F src/trigger.c 98dd620bebd9f3dadaacf0db3958b916cf1e7b7f
+F src/update.c 0e00300763d2ce0dbd6a0598882a5039580b225e
F src/utf.c 328890099db492dda5620ee5f924e244c6e57ff7
-F src/util.c f53a683ff6daf25694920c42020848fc38967a8f
-F src/vacuum.c c5f11bf25e49479940133d1bb882ad2a5d6fa021
-F src/vdbe.c 45f659497b479f001c2f4e8251474aba3975b9f8
-F src/vdbe.h e081c72cd0f7c19d49b1927460aeefcf0fbc85ac
-F src/vdbeInt.h f8df57a9dc272967991f806e612628e0aa57e705
-F src/vdbeapi.c 854732720c2cfc6ff76b28eef6253ac84a5408bc
-F src/vdbeaux.c 77eaaf62b8b3acad4a2ef351e3c44ecffc67faf6
+F src/util.c dc00e84eabc09d89fec31e908306fffa3eab449b
+F src/vacuum.c 819a3f411cb8d2d714e55f0805e8c23a642dd7ba
+F src/vdbe.c b19de04c57b4136a8e0203d5e3b76dd82bded1b5
+F src/vdbe.h 067ca8d6750ba4f69a50284765e5883dee860181
+F src/vdbeInt.h e09362d6323a725de3c30b0cc381a691e86ed697
+F src/vdbeapi.c e3fa5b775161bc8337c20f2e46a68bb4746b2094
+F src/vdbeaux.c 4080a6162d96818f875a95ead4f67cb9ca8ecf15
F src/vdbemem.c ef9ac7d32acfe4bce5c5b408b1294c8d9e0cdb56
-F src/where.c a84eee276cd072158224da6b5f30733df2d56027
+F src/where.c 12e214870c84546858ddb9f121165a1fbfce6811
F test/all.test 929bfa932b55e75c96fe2203f7650ba451c1862c
F test/attach.test feb2ce54e78688df4c84553416d5aec3b2a0112e
F test/attach2.test 32ca2c1a5a347a7404219a11f9f84739a63d2582
F www/vdbe.tcl 59288db1ac5c0616296b26dce071c36cb611dfe9
F www/version3.tcl 092a01f5ef430d2c4acc0ae558d74c4bb89638a0
F www/whentouse.tcl a8335bce47cc2fddb07f19052cb0cb4d9129a8e4
-P fa82becae7e41c47a6387061932f692c6f9f472e
-R edad9a6786f399b5ab4dfba836413b99
+P dfa9ea89c473e1fea804ad07e8e58a9af1e92f6c
+R d6d5fe458835a0a28a6ff1bc8acf5454
U drh
-Z 8c9e068ca55b5659b9e57265a53ffefe
+Z eb4e97b9a729a6f470349fc7f802efa6
-dfa9ea89c473e1fea804ad07e8e58a9af1e92f6c
\ No newline at end of file
+3ddf5a9d1c480a2e3aa32685879063b11afddbe1
\ No newline at end of file
*************************************************************************
** This file contains code used to implement the ATTACH and DETACH commands.
**
-** $Id: attach.c,v 1.27 2004/09/05 23:23:42 drh Exp $
+** $Id: attach.c,v 1.28 2004/09/06 17:24:12 drh Exp $
*/
#include "sqliteInt.h"
Db *aNew;
int rc, i;
char *zFile, *zName;
- sqlite *db;
+ sqlite3 *db;
Vdbe *v;
v = sqlite3GetVdbe(pParse);
*/
void sqlite3Detach(Parse *pParse, Token *pDbname){
int i;
- sqlite *db;
+ sqlite3 *db;
Vdbe *v;
Db *pDb = 0;
const char *zType, /* "view", "trigger", or "index" */
const Token *pName /* Name of the view, trigger, or index */
){
- sqlite *db;
+ sqlite3 *db;
if( iDb<0 || iDb==1 ) return 0;
db = pParse->db;
** systems that do not need this facility may omit it by recompiling
** the library with -DSQLITE_OMIT_AUTHORIZATION=1
**
-** $Id: auth.c,v 1.16 2004/06/19 16:06:11 drh Exp $
+** $Id: auth.c,v 1.17 2004/09/06 17:24:12 drh Exp $
*/
#include "sqliteInt.h"
** setting of the auth function is NULL.
*/
int sqlite3_set_authorizer(
- sqlite *db,
+ sqlite3 *db,
int (*xAuth)(void*,int,const char*,const char*,const char*,const char*),
void *pArg
){
Expr *pExpr, /* The expression to check authorization on */
SrcList *pTabList /* All table that pExpr might refer to */
){
- sqlite *db = pParse->db;
+ sqlite3 *db = pParse->db;
int rc;
Table *pTab; /* The table being read */
const char *zCol; /* Name of the column of the table */
const char *zArg2,
const char *zArg3
){
- sqlite *db = pParse->db;
+ sqlite3 *db = pParse->db;
int rc;
/* Don't do any authorization checks if the database is initialising. */
** ROLLBACK
** PRAGMA
**
-** $Id: build.c,v 1.250 2004/08/31 13:45:11 drh Exp $
+** $Id: build.c,v 1.251 2004/09/06 17:24:12 drh Exp $
*/
#include "sqliteInt.h"
#include <ctype.h>
** no VDBE code was generated.
*/
void sqlite3FinishCoding(Parse *pParse){
- sqlite *db;
+ sqlite3 *db;
Vdbe *v;
if( sqlite3_malloc_failed ) return;
**
** See also sqlite3LocateTable().
*/
-Table *sqlite3FindTable(sqlite *db, const char *zName, const char *zDatabase){
+Table *sqlite3FindTable(sqlite3 *db, const char *zName, const char *zDatabase){
Table *p = 0;
int i;
assert( zName!=0 );
** TEMP first, then MAIN, then any auxiliary databases added
** using the ATTACH command.
*/
-Index *sqlite3FindIndex(sqlite *db, const char *zName, const char *zDb){
+Index *sqlite3FindIndex(sqlite3 *db, const char *zName, const char *zDb){
Index *p = 0;
int i;
assert( (db->flags & SQLITE_Initialized) || db->init.busy );
** it is not unlinked from the Table that it indexes.
** Unlinking from the Table must be done by the calling function.
*/
-static void sqliteDeleteIndex(sqlite *db, Index *p){
+static void sqliteDeleteIndex(sqlite3 *db, Index *p){
Index *pOld;
assert( db!=0 && p->zName!=0 );
** the index from the index hash table and free its memory
** structures.
*/
-void sqlite3UnlinkAndDeleteIndex(sqlite *db, int iDb, const char *zIdxName){
+void sqlite3UnlinkAndDeleteIndex(sqlite3 *db, int iDb, const char *zIdxName){
Index *pIndex;
int len;
** files. If iDb>=2 then reset the internal schema for only the
** single file indicated.
*/
-void sqlite3ResetInternalSchema(sqlite *db, int iDb){
+void sqlite3ResetInternalSchema(sqlite3 *db, int iDb){
HashElem *pElem;
Hash temp1;
Hash temp2;
** schema changes during the transaction, then we have to reset the
** internal hash tables and reload them from disk.
*/
-void sqlite3RollbackInternalChanges(sqlite *db){
+void sqlite3RollbackInternalChanges(sqlite3 *db){
if( db->flags & SQLITE_InternChanges ){
sqlite3ResetInternalSchema(db, 0);
}
/*
** This routine is called when a commit occurs.
*/
-void sqlite3CommitInternalChanges(sqlite *db){
+void sqlite3CommitInternalChanges(sqlite3 *db){
db->flags &= ~SQLITE_InternChanges;
}
** the table are deleted, but it is assumed they have already been
** unlinked.
*/
-void sqlite3DeleteTable(sqlite *db, Table *pTable){
+void sqlite3DeleteTable(sqlite3 *db, Table *pTable){
Index *pIndex, *pNext;
FKey *pFKey, *pNextFKey;
** Unlink the given table from the hash tables and the delete the
** table structure with all its indices and foreign keys.
*/
-void sqlite3UnlinkAndDeleteTable(sqlite *db, int iDb, const char *zTabName){
+void sqlite3UnlinkAndDeleteTable(sqlite3 *db, int iDb, const char *zTabName){
Table *p;
FKey *pF1, *pF2;
Db *pDb;
Table *pTable;
Index *pIdx;
char *zName;
- sqlite *db = pParse->db;
+ sqlite3 *db = pParse->db;
Vdbe *v;
int iDb; /* Database number to create the table in */
Token *pName; /* Unqualified name of the table to create */
** each collation sequence structure.
*/
static CollSeq * findCollSeqEntry(
- sqlite *db,
+ sqlite3 *db,
const char *zName,
int nName,
int create
** new entry. Otherwise return NULL.
*/
CollSeq *sqlite3FindCollSeq(
- sqlite *db,
+ sqlite3 *db,
u8 enc,
const char *zName,
int nName,
** in the database text encoding of name zName, length nName.
** If the collation sequence
*/
-static void callCollNeeded(sqlite *db, const char *zName, int nName){
+static void callCollNeeded(sqlite3 *db, const char *zName, int nName){
assert( !db->xCollNeeded || !db->xCollNeeded16 );
if( nName<0 ) nName = strlen(zName);
if( db->xCollNeeded ){
CollSeq *pColl2;
char *z = pColl->zName;
int n = strlen(z);
- sqlite *db = pParse->db;
+ sqlite3 *db = pParse->db;
int i;
static const u8 aEnc[] = { SQLITE_UTF16BE, SQLITE_UTF16LE, SQLITE_UTF8 };
for(i=0; i<3; i++){
** and the probability of hitting the same cookie value is only
** 1 chance in 2^32. So we're safe enough.
*/
-void sqlite3ChangeCookie(sqlite *db, Vdbe *v, int iDb){
+void sqlite3ChangeCookie(sqlite3 *db, Vdbe *v, int iDb){
sqlite3VdbeAddOp(v, OP_Integer, db->aDb[iDb].schema_cookie+1, 0);
sqlite3VdbeAddOp(v, OP_SetCookie, iDb, 0);
}
*/
void sqlite3EndTable(Parse *pParse, Token *pEnd, Select *pSelect){
Table *p;
- sqlite *db = pParse->db;
+ sqlite3 *db = pParse->db;
if( (pEnd==0 && pSelect==0) || pParse->nErr || sqlite3_malloc_failed ) return;
p = pParse->pNewTable;
/*
** Clear the column names from every VIEW in database idx.
*/
-static void sqliteViewResetAll(sqlite *db, int idx){
+static void sqliteViewResetAll(sqlite3 *db, int idx){
HashElem *i;
if( !DbHasProperty(db, idx, DB_UnresetViews) ) return;
for(i=sqliteHashFirst(&db->aDb[idx].tblHash); i; i=sqliteHashNext(i)){
Table *pTab;
Vdbe *v;
int base;
- sqlite *db = pParse->db;
+ sqlite3 *db = pParse->db;
int iDb;
if( pParse->nErr || sqlite3_malloc_failed ) goto exit_drop_table;
Token nullId; /* Fake token for an empty ID list */
DbFixer sFix; /* For assigning database names to pTable */
int isTemp; /* True for a temporary index */
- sqlite *db = pParse->db;
+ sqlite3 *db = pParse->db;
int iDb; /* Index of the database that is being written */
Token *pName = 0; /* Unqualified name of the index to create */
void sqlite3DropIndex(Parse *pParse, SrcList *pName){
Index *pIndex;
Vdbe *v;
- sqlite *db = pParse->db;
+ sqlite3 *db = pParse->db;
if( pParse->nErr || sqlite3_malloc_failed ) return;
assert( pName->nSrc==1 );
** Begin a transaction
*/
void sqlite3BeginTransaction(Parse *pParse){
- sqlite *db;
+ sqlite3 *db;
Vdbe *v;
if( pParse==0 || (db=pParse->db)==0 || db->aDb[0].pBt==0 ) return;
** Commit a transaction
*/
void sqlite3CommitTransaction(Parse *pParse){
- sqlite *db;
+ sqlite3 *db;
Vdbe *v;
if( pParse==0 || (db=pParse->db)==0 || db->aDb[0].pBt==0 ) return;
** Rollback a transaction
*/
void sqlite3RollbackTransaction(Parse *pParse){
- sqlite *db;
+ sqlite3 *db;
Vdbe *v;
if( pParse==0 || (db=pParse->db)==0 || db->aDb[0].pBt==0 ) return;
** early in the code, before we know if any database tables will be used.
*/
void sqlite3CodeVerifySchema(Parse *pParse, int iDb){
- sqlite *db;
+ sqlite3 *db;
Vdbe *v;
int mask;
** Return the transient sqlite3_value object used for encoding conversions
** during SQL compilation.
*/
-sqlite3_value *sqlite3GetTransientValue(sqlite *db){
+sqlite3_value *sqlite3GetTransientValue(sqlite3 *db){
if( !db->pValue ){
db->pValue = sqlite3ValueNew();
}
** sqlite3RegisterDateTimeFunctions() found at the bottom of the file.
** All other code has file scope.
**
-** $Id: date.c,v 1.34 2004/08/17 10:42:55 drh Exp $
+** $Id: date.c,v 1.35 2004/09/06 17:24:12 drh Exp $
**
** NOTES:
**
** functions. This should be the only routine in this file with
** external linkage.
*/
-void sqlite3RegisterDateTimeFunctions(sqlite *db){
+void sqlite3RegisterDateTimeFunctions(sqlite3 *db){
#ifndef SQLITE_OMIT_DATETIME_FUNCS
static struct {
char *zName;
** This file contains C code routines that are called by the parser
** to handle DELETE FROM statements.
**
-** $Id: delete.c,v 1.79 2004/08/31 13:45:12 drh Exp $
+** $Id: delete.c,v 1.80 2004/09/06 17:24:13 drh Exp $
*/
#include "sqliteInt.h"
WhereInfo *pWInfo; /* Information about the WHERE clause */
Index *pIdx; /* For looping over indices of the table */
int iCur; /* VDBE Cursor number for pTab */
- sqlite *db; /* Main database structure */
+ sqlite3 *db; /* Main database structure */
int isView; /* True if attempting to delete from a view */
AuthContext sContext; /* Authorization context */
** entries that point to that record.
*/
void sqlite3GenerateRowDelete(
- sqlite *db, /* The database containing the index */
+ sqlite3 *db, /* The database containing the index */
Vdbe *v, /* Generate code into this VDBE */
Table *pTab, /* Table containing the row to be deleted */
int iCur, /* Cursor number for the table */
** deleted.
*/
void sqlite3GenerateRowIndexDelete(
- sqlite *db, /* The database containing the index */
+ sqlite3 *db, /* The database containing the index */
Vdbe *v, /* Generate code into this VDBE */
Table *pTab, /* Table containing the row to be deleted */
int iCur, /* Cursor number for the table */
** This file contains routines used for analyzing expressions and
** for generating VDBE code that evaluates expressions in SQLite.
**
-** $Id: expr.c,v 1.159 2004/09/01 03:06:35 drh Exp $
+** $Id: expr.c,v 1.160 2004/09/06 17:24:13 drh Exp $
*/
#include "sqliteInt.h"
#include <ctype.h>
int i, j; /* Loop counters */
int cnt = 0; /* Number of matching column names */
int cntTab = 0; /* Number of matching table names */
- sqlite *db = pParse->db; /* The database */
+ sqlite3 *db = pParse->db; /* The database */
assert( pColumnToken && pColumnToken->z ); /* The Z in X.Y.Z cannot be NULL */
zDb = sqlite3NameFromToken(pDbToken);
** match that requested.
*/
FuncDef *sqlite3FindFunction(
- sqlite *db, /* An open database */
+ sqlite3 *db, /* An open database */
const char *zName, /* Name of the function. Not null-terminated */
int nName, /* Number of characters in the name */
int nArg, /* Number of arguments. -1 means any number */
** sqliteRegisterBuildinFunctions() found at the bottom of the file.
** All other code has file scope.
**
-** $Id: func.c,v 1.82 2004/09/02 15:53:57 drh Exp $
+** $Id: func.c,v 1.83 2004/09/06 17:24:13 drh Exp $
*/
#include <ctype.h>
#include <math.h>
int arg,
sqlite3_value **argv
){
- sqlite *db = sqlite3_user_data(context);
+ sqlite3 *db = sqlite3_user_data(context);
sqlite3_result_int64(context, sqlite3_last_insert_rowid(db));
}
int arg,
sqlite3_value **argv
){
- sqlite *db = sqlite3_user_data(context);
+ sqlite3 *db = sqlite3_user_data(context);
sqlite3_result_int(context, sqlite3_changes(db));
}
int arg,
sqlite3_value **argv
){
- sqlite *db = sqlite3_user_data(context);
+ sqlite3 *db = sqlite3_user_data(context);
sqlite3_result_int(context, sqlite3_total_changes(db));
}
){
char *zVal;
int len;
- sqlite *db = sqlite3_user_data(pCtx);
+ sqlite3 *db = sqlite3_user_data(pCtx);
test_destructor_count_var++;
assert( nArg==1 );
** functions. This should be the only routine in this file with
** external linkage.
*/
-void sqlite3RegisterBuiltinFunctions(sqlite *db){
+void sqlite3RegisterBuiltinFunctions(sqlite3 *db){
static struct {
char *zName;
signed char nArg;
** This file contains C code routines that are called by the parser
** to handle INSERT statements in SQLite.
**
-** $Id: insert.c,v 1.115 2004/08/21 17:54:45 drh Exp $
+** $Id: insert.c,v 1.116 2004/09/06 17:24:13 drh Exp $
*/
#include "sqliteInt.h"
int nColumn; /* Number of columns in the data */
int base = 0; /* VDBE Cursor number for pTab */
int iCont=0,iBreak=0; /* Beginning and end of the loop over srcTab */
- sqlite *db; /* The main database structure */
+ sqlite3 *db; /* The main database structure */
int keyColumn = -1; /* Column that is the INTEGER PRIMARY KEY */
int endOfLoop; /* Label for the end of the insertion loop */
int useTempTable; /* Store SELECT results in intermediate table */
** other files are for internal use by SQLite and should not be
** accessed by users of the library.
**
-** $Id: legacy.c,v 1.5 2004/08/08 23:39:19 drh Exp $
+** $Id: legacy.c,v 1.6 2004/09/06 17:24:13 drh Exp $
*/
#include "sqliteInt.h"
** is invoked, even for queries.
*/
int sqlite3_exec(
- sqlite *db, /* The database on which the SQL executes */
+ sqlite3 *db, /* The database on which the SQL executes */
const char *zSql, /* The SQL to be executed */
sqlite_callback xCallback, /* Invoke this callback routine */
void *pArg, /* First argument to xCallback() */
** other files are for internal use by SQLite and should not be
** accessed by users of the library.
**
-** $Id: main.c,v 1.258 2004/09/02 15:53:57 drh Exp $
+** $Id: main.c,v 1.259 2004/09/06 17:24:13 drh Exp $
*/
#include "sqliteInt.h"
#include "os.h"
*/
int sqlite3InitCallback(void *pInit, int argc, char **argv, char **azColName){
InitData *pData = (InitData*)pInit;
- sqlite *db = pData->db;
+ sqlite3 *db = pData->db;
int iDb;
assert( argc==4 );
** auxiliary databases. Return one of the SQLITE_ error codes to
** indicate success or failure.
*/
-static int sqlite3InitOne(sqlite *db, int iDb, char **pzErrMsg){
+static int sqlite3InitOne(sqlite3 *db, int iDb, char **pzErrMsg){
int rc;
BtCursor *curMain;
int size;
** After the database is initialized, the SQLITE_Initialized
** bit is set in the flags field of the sqlite structure.
*/
-int sqlite3Init(sqlite *db, char **pzErrMsg){
+int sqlite3Init(sqlite3 *db, char **pzErrMsg){
int i, rc;
if( db->init.busy ) return SQLITE_OK;
/*
** Return the ROWID of the most recent insert
*/
-sqlite_int64 sqlite3_last_insert_rowid(sqlite *db){
+sqlite_int64 sqlite3_last_insert_rowid(sqlite3 *db){
return db->lastRowid;
}
/*
** Return the number of changes in the most recent call to sqlite3_exec().
*/
-int sqlite3_changes(sqlite *db){
+int sqlite3_changes(sqlite3 *db){
return db->nChange;
}
/*
** Close an existing SQLite database
*/
-int sqlite3_close(sqlite *db){
+int sqlite3_close(sqlite3 *db){
HashElem *i;
int j;
/*
** Rollback all database files.
*/
-void sqlite3RollbackAll(sqlite *db){
+void sqlite3RollbackAll(sqlite3 *db){
int i;
for(i=0; i<db->nDb; i++){
if( db->aDb[i].pBt ){
** be invoked every nOps opcodes.
*/
void sqlite3_progress_handler(
- sqlite *db,
+ sqlite3 *db,
int nOps,
int (*xProgress)(void*),
void *pArg
/*
** Cause any pending operation to stop at its earliest opportunity.
*/
-void sqlite3_interrupt(sqlite *db){
+void sqlite3_interrupt(sqlite3 *db){
db->flags |= SQLITE_Interrupt;
}
** trace is a pointer to a function that is invoked at the start of each
** sqlite3_exec().
*/
-void *sqlite3_trace(sqlite *db, void (*xTrace)(void*,const char*), void *pArg){
+void *sqlite3_trace(sqlite3 *db, void (*xTrace)(void*,const char*), void *pArg){
void *pOld = db->pTraceArg;
db->xTrace = xTrace;
db->pTraceArg = pArg;
** rollback.
*/
void *sqlite3_commit_hook(
- sqlite *db, /* Attach the hook to this database */
+ sqlite3 *db, /* Attach the hook to this database */
int (*xCallback)(void*), /* Function to invoke on each commit */
void *pArg /* Argument to the function */
){
** 3 any memory
*/
int sqlite3BtreeFactory(
- const sqlite *db, /* Main database when opening aux otherwise 0 */
+ const sqlite3 *db, /* Main database when opening aux otherwise 0 */
const char *zFilename, /* Name of the file containing the BTree database */
int omitJournal, /* if TRUE then do not journal this file */
int nCache, /* How many pages in the page cache */
** Check schema cookies in all databases. If any cookie is out
** of date, return 0. If all schema cookies are current, return 1.
*/
-static int schemaIsValid(sqlite *db){
+static int schemaIsValid(sqlite3 *db){
int iDb;
int rc;
BtCursor *curTemp;
char *zErrMsg = 0;
/* Allocate the sqlite data structure */
- db = sqliteMalloc( sizeof(sqlite) );
+ db = sqliteMalloc( sizeof(sqlite3) );
if( db==0 ) goto opendb_out;
db->priorNewRowid = 0;
db->magic = SQLITE_MAGIC_BUSY;
*************************************************************************
** This file contains code used to implement the PRAGMA command.
**
-** $Id: pragma.c,v 1.63 2004/09/05 23:23:42 drh Exp $
+** $Id: pragma.c,v 1.64 2004/09/06 17:24:13 drh Exp $
*/
#include "sqliteInt.h"
#include <ctype.h>
*/
static int changeTempStorage(Parse *pParse, const char *zStorageType){
int ts = getTempStore(zStorageType);
- sqlite *db = pParse->db;
+ sqlite3 *db = pParse->db;
if( db->temp_store==ts ) return SQLITE_OK;
if( db->aDb[1].pBt!=0 ){
if( db->flags & SQLITE_InTrans ){
int i;
for(i=0; i<sizeof(aPragma)/sizeof(aPragma[0]); i++){
if( sqlite3StrICmp(zLeft, aPragma[i].zName)==0 ){
- sqlite *db = pParse->db;
+ sqlite3 *db = pParse->db;
Vdbe *v;
if( zRight==0 ){
v = sqlite3GetVdbe(pParse);
const char *zDb = 0; /* The database name */
Token *pId; /* Pointer to <id> token */
int iDb; /* Database index for <database> */
- sqlite *db = pParse->db;
+ sqlite3 *db = pParse->db;
Db *pDb;
Vdbe *v = sqlite3GetVdbe(pParse);
if( v==0 ) return;
** This file contains C code routines that are called by the parser
** to handle SELECT statements in SQLite.
**
-** $Id: select.c,v 1.206 2004/09/01 03:06:35 drh Exp $
+** $Id: select.c,v 1.207 2004/09/06 17:24:13 drh Exp $
*/
#include "sqliteInt.h"
KeyInfo *pInfo;
ExprList *pOrderBy;
int nCol, i;
- sqlite *db = pParse->db;
+ sqlite3 *db = pParse->db;
if( eDest==SRT_Sorter ) return;
pOrderBy = p->pOrderBy;
){
Vdbe *v = pParse->pVdbe;
int i, j;
- sqlite *db = pParse->db;
+ sqlite3 *db = pParse->db;
int fullNames, shortNames;
/* If this is an EXPLAIN, skip this step */
static int openTempIndex(Parse *pParse, Select *p, int iTab, int keyAsData){
KeyInfo *pKeyInfo;
int nColumn;
- sqlite *db = pParse->db;
+ sqlite3 *db = pParse->db;
int i;
Vdbe *v = pParse->pVdbe;
int addr;
** This header file defines the interface that the SQLite library
** presents to client programs.
**
-** @(#) $Id: sqlite.h.in,v 1.116 2004/08/29 23:42:14 drh Exp $
+** @(#) $Id: sqlite.h.in,v 1.117 2004/09/06 17:24:13 drh Exp $
*/
#ifndef _SQLITE_H_
#define _SQLITE_H_
** Each open sqlite database is represented by an instance of the
** following opaque structure.
*/
-typedef struct sqlite sqlite3;
+typedef struct sqlite3 sqlite3;
/*
*************************************************************************
** Internal interface definitions for SQLite.
**
-** @(#) $Id: sqliteInt.h,v 1.318 2004/09/01 03:06:35 drh Exp $
+** @(#) $Id: sqliteInt.h,v 1.319 2004/09/06 17:24:13 drh Exp $
*/
#ifndef _SQLITEINT_H_
#define _SQLITEINT_H_
#define SQLITE_BIGENDIAN (*(char *)(&sqlite3one)==0)
#define SQLITE_LITTLEENDIAN (*(char *)(&sqlite3one)==1)
-typedef struct sqlite sqlite;
-
/*
** An instance of the following structure is used to store the busy-handler
** callback for a given sqlite handle.
** internal function sqlite3Error() is used to set these variables
** consistently.
*/
-struct sqlite {
+struct sqlite3 {
int nDb; /* Number of backends currently in use */
Db *aDb; /* All backends */
Db aDbStatic[2]; /* Static space for the 2 default backends */
** carry around information that is global to the entire parse.
*/
struct Parse {
- sqlite *db; /* The main database structure */
+ sqlite3 *db; /* The main database structure */
int rc; /* Return code from execution */
char *zErrMsg; /* An error message */
Token sErrToken; /* The token at which the error occurred */
* struct Trigger.
*
* Pointers to instances of struct Trigger are stored in two ways.
- * 1. In the "trigHash" hash table (part of the sqlite* that represents the
+ * 1. In the "trigHash" hash table (part of the sqlite3* that represents the
* database). This allows Trigger structures to be retrieved by name.
* 2. All triggers associated with a single table form a linked list, using the
* pNext member of struct Trigger. A pointer to the first element of the
** from sqlite3Init and OP_ParseSchema into the sqlite3InitCallback.
*/
typedef struct {
- sqlite *db; /* The database being initialized */
+ sqlite3 *db; /* The database being initialized */
char **pzErrMsg; /* Error message stored here */
} InitData;
void sqlite3ExprDelete(Expr*);
ExprList *sqlite3ExprListAppend(ExprList*,Expr*,Token*);
void sqlite3ExprListDelete(ExprList*);
-int sqlite3Init(sqlite*, char**);
+int sqlite3Init(sqlite3*, char**);
int sqlite3InitCallback(void*, int, char**, char**);
void sqlite3Pragma(Parse*,Token*,Token*,Token*,int);
-void sqlite3ResetInternalSchema(sqlite*, int);
+void sqlite3ResetInternalSchema(sqlite3*, int);
void sqlite3BeginParse(Parse*,int);
-void sqlite3RollbackInternalChanges(sqlite*);
-void sqlite3CommitInternalChanges(sqlite*);
+void sqlite3RollbackInternalChanges(sqlite3*);
+void sqlite3CommitInternalChanges(sqlite3*);
Table *sqlite3ResultSetOfSelect(Parse*,char*,Select*);
void sqlite3OpenMasterTable(Vdbe *v, int);
void sqlite3StartTable(Parse*,Token*,Token*,Token*,int,int);
void sqlite3CreateView(Parse*,Token*,Token*,Token*,Select*,int);
int sqlite3ViewGetColumnNames(Parse*,Table*);
void sqlite3DropTable(Parse*, SrcList*, int);
-void sqlite3DeleteTable(sqlite*, Table*);
+void sqlite3DeleteTable(sqlite3*, Table*);
void sqlite3Insert(Parse*, SrcList*, ExprList*, Select*, IdList*, int);
IdList *sqlite3IdListAppend(IdList*, Token*);
int sqlite3IdListIndex(IdList*,const char*);
int sqlite3ExprCodeExprList(Parse*, ExprList*);
void sqlite3ExprIfTrue(Parse*, Expr*, int, int);
void sqlite3ExprIfFalse(Parse*, Expr*, int, int);
-Table *sqlite3FindTable(sqlite*,const char*, const char*);
+Table *sqlite3FindTable(sqlite3*,const char*, const char*);
Table *sqlite3LocateTable(Parse*,const char*, const char*);
-Index *sqlite3FindIndex(sqlite*,const char*, const char*);
-void sqlite3UnlinkAndDeleteTable(sqlite*,int,const char*);
-void sqlite3UnlinkAndDeleteIndex(sqlite*,int,const char*);
-void sqlite3UnlinkAndDeleteTrigger(sqlite*,int,const char*);
+Index *sqlite3FindIndex(sqlite3*,const char*, const char*);
+void sqlite3UnlinkAndDeleteTable(sqlite3*,int,const char*);
+void sqlite3UnlinkAndDeleteIndex(sqlite3*,int,const char*);
+void sqlite3UnlinkAndDeleteTrigger(sqlite3*,int,const char*);
void sqlite3Vacuum(Parse*, Token*);
-int sqlite3RunVacuum(char**, sqlite*);
+int sqlite3RunVacuum(char**, sqlite3*);
char *sqlite3NameFromToken(Token*);
int sqlite3ExprCheck(Parse*, Expr*, int, int*);
int sqlite3ExprCompare(Expr*, Expr*);
int sqlite3ExprAnalyzeAggregates(Parse*, Expr*);
Vdbe *sqlite3GetVdbe(Parse*);
void sqlite3Randomness(int, void*);
-void sqlite3RollbackAll(sqlite*);
+void sqlite3RollbackAll(sqlite3*);
void sqlite3CodeVerifySchema(Parse*, int);
void sqlite3BeginTransaction(Parse*);
void sqlite3CommitTransaction(Parse*);
int sqlite3ExprIsConstant(Expr*);
int sqlite3ExprIsInteger(Expr*, int*);
int sqlite3IsRowid(const char*);
-void sqlite3GenerateRowDelete(sqlite*, Vdbe*, Table*, int, int);
-void sqlite3GenerateRowIndexDelete(sqlite*, Vdbe*, Table*, int, char*);
+void sqlite3GenerateRowDelete(sqlite3*, Vdbe*, Table*, int, int);
+void sqlite3GenerateRowIndexDelete(sqlite3*, Vdbe*, Table*, int, char*);
void sqlite3GenerateIndexKey(Vdbe*, Index*, int);
void sqlite3GenerateConstraintChecks(Parse*,Table*,int,char*,int,int,int,int);
void sqlite3CompleteInsertion(Parse*, Table*, int, char*, int, int, int);
SrcList *sqlite3SrcListDup(SrcList*);
IdList *sqlite3IdListDup(IdList*);
Select *sqlite3SelectDup(Select*);
-FuncDef *sqlite3FindFunction(sqlite*,const char*,int,int,u8,int);
-void sqlite3RegisterBuiltinFunctions(sqlite*);
-void sqlite3RegisterDateTimeFunctions(sqlite*);
-int sqlite3SafetyOn(sqlite*);
-int sqlite3SafetyOff(sqlite*);
-int sqlite3SafetyCheck(sqlite*);
-void sqlite3ChangeCookie(sqlite*, Vdbe*, int);
+FuncDef *sqlite3FindFunction(sqlite3*,const char*,int,int,u8,int);
+void sqlite3RegisterBuiltinFunctions(sqlite3*);
+void sqlite3RegisterDateTimeFunctions(sqlite3*);
+int sqlite3SafetyOn(sqlite3*);
+int sqlite3SafetyOff(sqlite3*);
+int sqlite3SafetyCheck(sqlite3*);
+void sqlite3ChangeCookie(sqlite3*, Vdbe*, int);
void sqlite3BeginTrigger(Parse*, Token*,Token*,int,int,IdList*,SrcList*,
int,Expr*,int);
void sqlite3FinishTrigger(Parse*, TriggerStep*, Token*);
#endif
void sqlite3Attach(Parse*, Token*, Token*, int, Token*);
void sqlite3Detach(Parse*, Token*);
-int sqlite3BtreeFactory(const sqlite *db, const char *zFilename,
+int sqlite3BtreeFactory(const sqlite3 *db, const char *zFilename,
int omitJournal, int nCache, Btree **ppBtree);
int sqlite3FixInit(DbFixer*, Parse*, int, const char*, const Token*);
int sqlite3FixSrcList(DbFixer*, SrcList*);
int sqlite3IndexAffinityOk(Expr *pExpr, char idx_affinity);
char sqlite3ExprAffinity(Expr *pExpr);
int sqlite3atoi64(const char*, i64*);
-void sqlite3Error(sqlite *, int, const char*,...);
+void sqlite3Error(sqlite3*, int, const char*,...);
void *sqlite3HexToBlob(const char *z);
int sqlite3TwoPartName(Parse *, Token *, Token *, Token **);
const char *sqlite3ErrStr(int);
int sqlite3ReadUniChar(const char *zStr, int *pOffset, u8 *pEnc, int fold);
int sqlite3ReadSchema(Parse *pParse);
-CollSeq *sqlite3FindCollSeq(sqlite *,u8 enc, const char *,int,int);
+CollSeq *sqlite3FindCollSeq(sqlite3*,u8 enc, const char *,int,int);
CollSeq *sqlite3LocateCollSeq(Parse *pParse, const char *zName, int nName);
CollSeq *sqlite3ExprCollSeq(Parse *pParse, Expr *pExpr);
int sqlite3CheckCollSeq(Parse *, CollSeq *);
void sqlite3ValueSetStr(sqlite3_value*, int, const void *,u8, void(*)(void*));
void sqlite3ValueFree(sqlite3_value*);
sqlite3_value *sqlite3ValueNew();
-sqlite3_value *sqlite3GetTransientValue(sqlite *db);
+sqlite3_value *sqlite3GetTransientValue(sqlite3*db);
extern const unsigned char sqlite3UpperToLower[];
#endif
** the calling procedure is finished using it.
*/
int sqlite3_get_table(
- sqlite *db, /* The database on which the SQL executes */
+ sqlite3 *db, /* The database on which the SQL executes */
const char *zSql, /* The SQL to be executed */
char ***pazResult, /* Write the result table here */
int *pnRow, /* Write the number of rows in the result here */
*************************************************************************
** A TCL Interface to SQLite
**
-** $Id: tclsqlite.c,v 1.103 2004/08/26 00:56:05 drh Exp $
+** $Id: tclsqlite.c,v 1.104 2004/09/06 17:24:13 drh Exp $
*/
#ifndef NO_TCL /* Omit this whole file if TCL is unavailable */
static void tclCollateNeeded(
void *pCtx,
- sqlite *db,
+ sqlite3 *db,
int enc,
const char *zName
){
** whenever one of those connection-specific commands is executed
** in Tcl. For example, if you run Tcl code like this:
**
-** sqlite db1 "my_database"
+** sqlite3 db1 "my_database"
** db1 close
**
** The first command opens a connection to the "my_database" database
}
/*
-** sqlite DBNAME FILENAME ?MODE? ?-key KEY?
+** sqlite3 DBNAME FILENAME ?MODE? ?-key KEY?
**
** This is the main Tcl command. When the "sqlite" Tcl command is
** invoked, this routine runs to process that command.
**
** For testing purposes, we also support the following:
**
-** sqlite -encoding
+** sqlite3 -encoding
**
** Return the encoding used by LIKE and GLOB operators. Choices
** are UTF-8 and iso8859.
**
-** sqlite -version
+** sqlite3 -version
**
** Return the version number of the SQLite library.
**
-** sqlite -tcl-uses-utf
+** sqlite3 -tcl-uses-utf
**
** Return "1" if compiled with a Tcl uses UTF-8. Return "0" if
** not. Used by tests to make sure the library was compiled
*/
#ifdef SQLITE_TEST
{
- extern void Md5_Register(sqlite*);
+ extern void Md5_Register(sqlite3*);
#ifdef SQLITE_DEBUG
int mallocfail = sqlite3_iMallocFail;
sqlite3_iMallocFail = 0;
** is not included in the SQLite library. It is used for automated
** testing of the SQLite library.
**
-** $Id: test1.c,v 1.100 2004/08/29 23:42:14 drh Exp $
+** $Id: test1.c,v 1.101 2004/09/06 17:24:13 drh Exp $
*/
#include "sqliteInt.h"
#include "tcl.h"
}
/*
-** Decode a pointer to an sqlite object.
+** Decode a pointer to an sqlite3 object.
*/
-static int getDbPointer(Tcl_Interp *interp, const char *zA, sqlite **ppDb){
+static int getDbPointer(Tcl_Interp *interp, const char *zA, sqlite3 **ppDb){
if( sscanf(zA, PTR_FMT, (void**)ppDb)!=1 &&
(zA[0]!='0' || zA[1]!='x' || sscanf(&zA[2], PTR_FMT, (void**)ppDb)!=1)
){
int argc, /* Number of arguments */
char **argv /* Text of each argument */
){
- sqlite *db;
+ sqlite3 *db;
Tcl_DString str;
int rc;
char *zErr = 0;
int argc, /* Number of arguments */
char **argv /* Text of each argument */
){
- sqlite *db;
+ sqlite3 *db;
Tcl_DString str;
int rc;
char *zErr = 0;
int argc, /* Number of arguments */
char **argv /* Text of each argument */
){
- sqlite *db;
+ sqlite3 *db;
char zBuf[30];
if( argc!=2 ){
int argc, /* Number of arguments */
char **argv /* Text of each argument */
){
- sqlite *db;
+ sqlite3 *db;
const char *zKey;
int nKey;
if( argc!=3 ){
int argc, /* Number of arguments */
char **argv /* Text of each argument */
){
- sqlite *db;
+ sqlite3 *db;
const char *zKey;
int nKey;
if( argc!=3 ){
int argc, /* Number of arguments */
char **argv /* Text of each argument */
){
- sqlite *db;
+ sqlite3 *db;
int rc;
if( argc!=2 ){
Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0],
){
struct dstr x;
memset(&x, 0, sizeof(x));
- sqlite3_exec((sqlite*)sqlite3_user_data(context),
+ sqlite3_exec((sqlite3*)sqlite3_user_data(context),
sqlite3_value_text(argv[0]),
execFuncCallback, &x, 0);
sqlite3_result_text(context, x.z, x.nUsed, SQLITE_TRANSIENT);
int argc, /* Number of arguments */
char **argv /* Text of each argument */
){
- sqlite *db;
+ sqlite3 *db;
sqlite3_value *pVal;
- extern void Md5_Register(sqlite*);
+ extern void Md5_Register(sqlite3*);
if( argc!=2 ){
Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0],
int argc, /* Number of arguments */
char **argv /* Text of each argument */
){
- sqlite *db;
+ sqlite3 *db;
if( argc!=2 ){
Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0],
" FILENAME\"", 0);
int argc, /* Number of arguments */
char **argv /* Text of each argument */
){
- sqlite *db;
+ sqlite3 *db;
int rc;
if( argc!=3 ){
Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0],
int objc,
Tcl_Obj *CONST objv[]
){
- sqlite *db;
+ sqlite3 *db;
const char *zErr;
if( objc!=2 ){
int objc,
Tcl_Obj *CONST objv[]
){
- sqlite *db;
+ sqlite3 *db;
const void *zErr;
int bytes;
*************************************************************************
** Code for testing the the SQLite library in a multithreaded environment.
**
-** $Id: test4.c,v 1.11 2004/08/08 20:22:18 drh Exp $
+** $Id: test4.c,v 1.12 2004/09/06 17:24:13 drh Exp $
*/
#include "sqliteInt.h"
#include "tcl.h"
/* The next group of fields are writable by the thread but read-only to the
** master. */
int completed; /* Number of operations completed */
- sqlite *db; /* Open database */
+ sqlite3 *db; /* Open database */
sqlite3_stmt *pStmt; /* Pending operation */
char *zErr; /* operation error */
char *zStaticErr; /* Static error message */
const char **argv /* Text of each argument */
){
int i, j;
- sqlite *temp;
+ sqlite3 *temp;
if( argc!=3 ){
Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0],
" ID1 ID2", 0);
** individual tokens and sends those tokens one-by-one over to the
** parser for analysis.
**
-** $Id: tokenize.c,v 1.84 2004/08/25 04:07:02 drh Exp $
+** $Id: tokenize.c,v 1.85 2004/09/06 17:24:13 drh Exp $
*/
#include "sqliteInt.h"
#include "os.h"
void *pEngine;
int tokenType;
int lastTokenParsed = -1;
- sqlite *db = pParse->db;
+ sqlite3 *db = pParse->db;
extern void *sqlite3ParserAlloc(void*(*)(int));
extern void sqlite3ParserFree(void*, void(*)(void*));
extern int sqlite3Parser(void*, int, Token, Parse*);
Trigger *pTrigger;
Table *pTab;
char *zName = 0; /* Name of the trigger */
- sqlite *db = pParse->db;
+ sqlite3 *db = pParse->db;
int iDb; /* The database to store the trigger in */
Token *pName; /* The unqualified db name */
DbFixer sFix;
Token *pAll /* Token that describes the complete CREATE TRIGGER */
){
Trigger *nt = 0; /* The trigger whose construction is finishing up */
- sqlite *db = pParse->db; /* The database */
+ sqlite3 *db = pParse->db; /* The database */
DbFixer sFix;
if( pParse->nErr || pParse->pNewTrigger==0 ) goto triggerfinish_cleanup;
const char *zDb;
const char *zName;
int nName;
- sqlite *db = pParse->db;
+ sqlite3 *db = pParse->db;
if( sqlite3_malloc_failed ) goto drop_trigger_cleanup;
if( SQLITE_OK!=sqlite3ReadSchema(pParse) ){
void sqlite3DropTriggerPtr(Parse *pParse, Trigger *pTrigger, int nested){
Table *pTable;
Vdbe *v;
- sqlite *db = pParse->db;
+ sqlite3 *db = pParse->db;
int iDb;
iDb = pTrigger->iDb;
** This file contains C code routines that are called by the parser
** to handle UPDATE statements.
**
-** $Id: update.c,v 1.87 2004/08/31 13:45:12 drh Exp $
+** $Id: update.c,v 1.88 2004/09/06 17:24:13 drh Exp $
*/
#include "sqliteInt.h"
int nIdx; /* Number of indices that need updating */
int nIdxTotal; /* Total number of indices */
int iCur; /* VDBE Cursor number of pTab */
- sqlite *db; /* The database structure */
+ sqlite3 *db; /* The database structure */
Index **apIdx = 0; /* An array of indices that need updating too */
char *aIdxUsed = 0; /* aIdxUsed[i]==1 if the i-th index is used */
int *aXRef = 0; /* aXRef[i] is the index in pChanges->a[] of the
** This file contains functions for allocating memory, comparing
** strings, and stuff like that.
**
-** $Id: util.c,v 1.115 2004/09/05 23:23:42 drh Exp $
+** $Id: util.c,v 1.116 2004/09/06 17:24:13 drh Exp $
*/
#include "sqliteInt.h"
#include <stdarg.h>
** should be called with err_code set to SQLITE_OK and zFormat set
** to NULL.
*/
-void sqlite3Error(sqlite *db, int err_code, const char *zFormat, ...){
+void sqlite3Error(sqlite3 *db, int err_code, const char *zFormat, ...){
if( db && (db->pErr || (db->pErr = sqlite3ValueNew())) ){
db->errCode = err_code;
if( zFormat ){
** call to sqlite3_close(db) and db has been deallocated. And we do
** not want to write into deallocated memory.
*/
-int sqlite3SafetyOn(sqlite *db){
+int sqlite3SafetyOn(sqlite3 *db){
if( db->magic==SQLITE_MAGIC_OPEN ){
db->magic = SQLITE_MAGIC_BUSY;
return 0;
** Return an error (non-zero) if the magic was not SQLITE_MAGIC_BUSY
** when this routine is called.
*/
-int sqlite3SafetyOff(sqlite *db){
+int sqlite3SafetyOff(sqlite3 *db){
if( db->magic==SQLITE_MAGIC_BUSY ){
db->magic = SQLITE_MAGIC_OPEN;
return 0;
** This routine is used to try to detect when API routines are called
** at the wrong time or in the wrong sequence.
*/
-int sqlite3SafetyCheck(sqlite *db){
+int sqlite3SafetyCheck(sqlite3 *db){
if( db->pVdbe!=0 ){
db->magic = SQLITE_MAGIC_ERROR;
return 1;
** Most of the code in this file may be omitted by defining the
** SQLITE_OMIT_VACUUM macro.
**
-** $Id: vacuum.c,v 1.30 2004/09/05 00:33:43 drh Exp $
+** $Id: vacuum.c,v 1.31 2004/09/06 17:24:13 drh Exp $
*/
#include "sqliteInt.h"
#include "os.h"
/*
** This routine implements the OP_Vacuum opcode of the VDBE.
*/
-int sqlite3RunVacuum(char **pzErrMsg, sqlite *db){
+int sqlite3RunVacuum(char **pzErrMsg, sqlite3 *db){
int rc = SQLITE_OK; /* Return code from service routines */
#if !defined(SQLITE_OMIT_VACUUM) || SQLITE_OMIT_VACUUM
const char *zFilename; /* full pathname of the database file */
** 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.413 2004/09/02 14:57:09 drh Exp $
+** $Id: vdbe.c,v 1.414 2004/09/06 17:24:13 drh Exp $
*/
#include "sqliteInt.h"
#include "os.h"
int pc; /* The program counter */
Op *pOp; /* Current operation */
int rc = SQLITE_OK; /* Value to return */
- sqlite *db = p->db; /* The database */
+ sqlite3 *db = p->db; /* The database */
Mem *pTos; /* Top entry in the operand stack */
char zBuf[100]; /* Space to sprintf() an integer */
#ifdef VDBE_PROFILE
** or VDBE. The VDBE implements an abstract machine that runs a
** simple program to access and modify the underlying database.
**
-** $Id: vdbe.h,v 1.90 2004/08/21 17:54:45 drh Exp $
+** $Id: vdbe.h,v 1.91 2004/09/06 17:24:13 drh Exp $
*/
#ifndef _SQLITE_VDBE_H_
#define _SQLITE_VDBE_H_
** Prototypes for the VDBE interface. See comments on the implementation
** for a description of what each of these routines does.
*/
-Vdbe *sqlite3VdbeCreate(sqlite*);
+Vdbe *sqlite3VdbeCreate(sqlite3*);
void sqlite3VdbeCreateCallback(Vdbe*, int*);
int sqlite3VdbeAddOp(Vdbe*,int,int,int);
int sqlite3VdbeOp3(Vdbe*,int,int,int,const char *zP3,int);
** is really a pointer to an instance of this structure.
*/
struct Vdbe {
- sqlite *db; /* The whole database */
+ sqlite3 *db; /* The whole database */
Vdbe *pPrev,*pNext; /* Linked list of VDBEs with the same Vdbe.db */
FILE *trace; /* Write an execution trace here, if not NULL */
int nOp; /* Number of instructions in the program */
*/
void sqlite3VdbeFreeCursor(Cursor*);
void sqlite3VdbeSorterReset(Vdbe*);
-int sqlite3VdbeAggReset(sqlite *, Agg *, KeyInfo *);
+int sqlite3VdbeAggReset(sqlite3*, Agg *, KeyInfo *);
void sqlite3VdbeKeylistFree(Keylist*);
void sqliteVdbePopStack(Vdbe*,int);
int sqlite3VdbeCursorMoveto(Cursor*);
*/
int sqlite3_step(sqlite3_stmt *pStmt){
Vdbe *p = (Vdbe*)pStmt;
- sqlite *db;
+ sqlite3 *db;
int rc;
if( p==0 || p->magic!=VDBE_MAGIC_RUN ){
/*
** Create a new virtual database engine.
*/
-Vdbe *sqlite3VdbeCreate(sqlite *db){
+Vdbe *sqlite3VdbeCreate(sqlite3 *db){
Vdbe *p;
p = sqliteMalloc( sizeof(Vdbe) );
if( p==0 ) return 0;
int sqlite3VdbeList(
Vdbe *p /* The VDBE */
){
- sqlite *db = p->db;
+ sqlite3 *db = p->db;
int i;
int rc = SQLITE_OK;
** delete the contents of the table used for aggregate information, ready
** for the next round of aggregate processing.
*/
-int sqlite3VdbeAggReset(sqlite *db, Agg *pAgg, KeyInfo *pKeyInfo){
+int sqlite3VdbeAggReset(sqlite3 *db, Agg *pAgg, KeyInfo *pKeyInfo){
int rc = 0;
BtCursor *pCsr = pAgg->pCsr;
** write-transaction spanning more than one database file, this routine
** takes care of the master journal trickery.
*/
-static int vdbeCommit(sqlite *db){
+static int vdbeCommit(sqlite3 *db){
int i;
int nTrans = 0; /* Number of databases with an active write-transaction */
int rc = SQLITE_OK;
** This is a no-op if NDEBUG is defined.
*/
#ifndef NDEBUG
-static void checkActiveVdbeCnt(sqlite *db){
+static void checkActiveVdbeCnt(sqlite3 *db){
Vdbe *p;
int cnt = 0;
p = db->pVdbe;
** means the close did not happen and needs to be repeated.
*/
int sqlite3VdbeHalt(Vdbe *p){
- sqlite *db = p->db;
+ sqlite3 *db = p->db;
int i;
int (*xFunc)(Btree *pBt) = 0; /* Function to call on each btree backend */
*/
int sqlite3VdbeFinalize(Vdbe *p){
int rc = SQLITE_OK;
- sqlite *db = p->db;
+ sqlite3 *db = p->db;
if( p->magic==VDBE_MAGIC_RUN || p->magic==VDBE_MAGIC_HALT ){
rc = sqlite3VdbeReset(p);
** This module contains C code that generates VDBE code used to process
** the WHERE clause of SQL statements.
**
-** $Id: where.c,v 1.112 2004/08/21 17:54:45 drh Exp $
+** $Id: where.c,v 1.113 2004/09/06 17:24:13 drh Exp $
*/
#include "sqliteInt.h"
Index *pMatch;
Index *pIdx;
int sortOrder;
- sqlite *db = pParse->db;
+ sqlite3 *db = pParse->db;
assert( pOrderBy!=0 );
assert( pOrderBy->nExpr>0 );