Fix a naming conflict between sqlite versions 2 and 3.  An open sqlite3
connection now *must* be called "sqlite3".  You cannot call it "sqlite".
This might break existing code. (CVS 1941)

FossilOrigin-Name: 3ddf5a9d1c480a2e3aa32685879063b11afddbe1
diff --git a/src/attach.c b/src/attach.c
index bd2c48f..d20c662 100644
--- a/src/attach.c
+++ b/src/attach.c
@@ -11,7 +11,7 @@
 *************************************************************************
 ** 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"
 
@@ -33,7 +33,7 @@
   Db *aNew;
   int rc, i;
   char *zFile, *zName;
-  sqlite *db;
+  sqlite3 *db;
   Vdbe *v;
 
   v = sqlite3GetVdbe(pParse);
@@ -154,7 +154,7 @@
 */
 void sqlite3Detach(Parse *pParse, Token *pDbname){
   int i;
-  sqlite *db;
+  sqlite3 *db;
   Vdbe *v;
   Db *pDb = 0;
 
@@ -206,7 +206,7 @@
   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;
diff --git a/src/auth.c b/src/auth.c
index 0ac623c..3a8c1fb 100644
--- a/src/auth.c
+++ b/src/auth.c
@@ -14,7 +14,7 @@
 ** 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"
 
@@ -70,7 +70,7 @@
 ** 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
 ){
@@ -104,7 +104,7 @@
   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 */
@@ -170,7 +170,7 @@
   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. */
diff --git a/src/build.c b/src/build.c
index 1ff47ae..3447898 100644
--- a/src/build.c
+++ b/src/build.c
@@ -23,7 +23,7 @@
 **     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>
@@ -50,7 +50,7 @@
 ** no VDBE code was generated.
 */
 void sqlite3FinishCoding(Parse *pParse){
-  sqlite *db;
+  sqlite3 *db;
   Vdbe *v;
 
   if( sqlite3_malloc_failed ) return;
@@ -124,7 +124,7 @@
 **
 ** 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 );
@@ -184,7 +184,7 @@
 ** 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 );
@@ -213,7 +213,7 @@
 ** 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 );
@@ -231,7 +231,7 @@
 ** 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;
 
@@ -263,7 +263,7 @@
 ** 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;
@@ -334,7 +334,7 @@
 ** 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);
   }
@@ -343,7 +343,7 @@
 /*
 ** This routine is called when a commit occurs.
 */
-void sqlite3CommitInternalChanges(sqlite *db){
+void sqlite3CommitInternalChanges(sqlite3 *db){
   db->flags &= ~SQLITE_InternChanges;
 }
 
@@ -379,7 +379,7 @@
 ** 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;
 
@@ -417,7 +417,7 @@
 ** 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;
@@ -579,7 +579,7 @@
   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 */
@@ -922,7 +922,7 @@
 ** each collation sequence structure.
 */
 static CollSeq * findCollSeqEntry(
-  sqlite *db,
+  sqlite3 *db,
   const char *zName,
   int nName,
   int create
@@ -957,7 +957,7 @@
 ** new entry.  Otherwise return NULL.
 */
 CollSeq *sqlite3FindCollSeq(
-  sqlite *db,
+  sqlite3 *db,
   u8 enc,
   const char *zName,
   int nName,
@@ -975,7 +975,7 @@
 ** 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 ){
@@ -1005,7 +1005,7 @@
   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++){
@@ -1165,7 +1165,7 @@
 ** 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);
 }
@@ -1281,7 +1281,7 @@
 */
 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;
@@ -1542,7 +1542,7 @@
 /*
 ** 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)){
@@ -1562,7 +1562,7 @@
   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;
@@ -1835,7 +1835,7 @@
   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 */
@@ -2182,7 +2182,7 @@
 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 );
@@ -2405,7 +2405,7 @@
 ** 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;
@@ -2421,7 +2421,7 @@
 ** 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;
@@ -2438,7 +2438,7 @@
 ** 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;
@@ -2501,7 +2501,7 @@
 ** 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;
 
@@ -2576,7 +2576,7 @@
 ** 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();
   }
diff --git a/src/date.c b/src/date.c
index 449e295..2fa8af7 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.34 2004/08/17 10:42:55 drh Exp $
+** $Id: date.c,v 1.35 2004/09/06 17:24:12 drh Exp $
 **
 ** NOTES:
 **
@@ -870,7 +870,7 @@
 ** 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;
diff --git a/src/delete.c b/src/delete.c
index 918b597..f741b5a 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.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"
 
@@ -65,7 +65,7 @@
   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 */
 
@@ -335,7 +335,7 @@
 ** 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 */
@@ -365,7 +365,7 @@
 **       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 */
diff --git a/src/expr.c b/src/expr.c
index 9175636..b72474a 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.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>
@@ -601,7 +601,7 @@
   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);
@@ -1767,7 +1767,7 @@
 ** 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 */
diff --git a/src/func.c b/src/func.c
index b31f330..22921ba 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.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>
@@ -268,7 +268,7 @@
   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));
 }
 
@@ -281,7 +281,7 @@
   int arg,
   sqlite3_value **argv
 ){
-  sqlite *db = sqlite3_user_data(context);
+  sqlite3 *db = sqlite3_user_data(context);
   sqlite3_result_int(context, sqlite3_changes(db));
 }
 
@@ -294,7 +294,7 @@
   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));
 }
 
@@ -690,7 +690,7 @@
 ){
   char *zVal;
   int len;
-  sqlite *db = sqlite3_user_data(pCtx);
+  sqlite3 *db = sqlite3_user_data(pCtx);
  
   test_destructor_count_var++;
   assert( nArg==1 );
@@ -917,7 +917,7 @@
 ** 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;
diff --git a/src/insert.c b/src/insert.c
index 77638b7..5b67d5c 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.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"
 
@@ -179,7 +179,7 @@
   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 */
diff --git a/src/legacy.c b/src/legacy.c
index c5ffe70..3a93cb4 100644
--- a/src/legacy.c
+++ b/src/legacy.c
@@ -14,7 +14,7 @@
 ** 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"
@@ -32,7 +32,7 @@
 ** 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() */
diff --git a/src/main.c b/src/main.c
index 92479ad..6d03eef 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.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"
@@ -53,7 +53,7 @@
 */
 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 );
@@ -113,7 +113,7 @@
 ** 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;
@@ -309,7 +309,7 @@
 ** 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;
@@ -417,14 +417,14 @@
 /*
 ** 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;
 }
 
@@ -438,7 +438,7 @@
 /*
 ** Close an existing SQLite database
 */
-int sqlite3_close(sqlite *db){
+int sqlite3_close(sqlite3 *db){
   HashElem *i;
   int j;
 
@@ -512,7 +512,7 @@
 /*
 ** 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 ){
@@ -625,7 +625,7 @@
 ** be invoked every nOps opcodes.
 */
 void sqlite3_progress_handler(
-  sqlite *db, 
+  sqlite3 *db, 
   int nOps,
   int (*xProgress)(void*), 
   void *pArg
@@ -659,7 +659,7 @@
 /*
 ** Cause any pending operation to stop at its earliest opportunity.
 */
-void sqlite3_interrupt(sqlite *db){
+void sqlite3_interrupt(sqlite3 *db){
   db->flags |= SQLITE_Interrupt;
 }
 
@@ -761,7 +761,7 @@
 ** 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;
@@ -775,7 +775,7 @@
 ** 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 */
 ){
@@ -812,7 +812,7 @@
 **           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 */
@@ -930,7 +930,7 @@
 ** 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;
@@ -1118,7 +1118,7 @@
   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;
diff --git a/src/pragma.c b/src/pragma.c
index d21f769..1aff7d5 100644
--- a/src/pragma.c
+++ b/src/pragma.c
@@ -11,7 +11,7 @@
 *************************************************************************
 ** 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>
@@ -95,7 +95,7 @@
 */
 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 ){
@@ -147,7 +147,7 @@
   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);
@@ -193,7 +193,7 @@
   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;
diff --git a/src/select.c b/src/select.c
index 876b856..65a2487 100644
--- a/src/select.c
+++ b/src/select.c
@@ -12,7 +12,7 @@
 ** 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"
 
@@ -565,7 +565,7 @@
   KeyInfo *pInfo;
   ExprList *pOrderBy;
   int nCol, i;
-  sqlite *db = pParse->db;
+  sqlite3 *db = pParse->db;
 
   if( eDest==SRT_Sorter ) return;
   pOrderBy = p->pOrderBy;
@@ -720,7 +720,7 @@
 ){
   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 */
@@ -1253,7 +1253,7 @@
 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;
diff --git a/src/sqlite.h.in b/src/sqlite.h.in
index abc76cb..cc50640 100644
--- a/src/sqlite.h.in
+++ b/src/sqlite.h.in
@@ -12,7 +12,7 @@
 ** 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_
@@ -44,7 +44,7 @@
 ** Each open sqlite database is represented by an instance of the
 ** following opaque structure.
 */
-typedef struct sqlite sqlite3;
+typedef struct sqlite3 sqlite3;
 
 
 /*
diff --git a/src/sqliteInt.h b/src/sqliteInt.h
index 2e40eb6..28f9f36 100644
--- a/src/sqliteInt.h
+++ b/src/sqliteInt.h
@@ -11,7 +11,7 @@
 *************************************************************************
 ** 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_
@@ -143,8 +143,6 @@
 #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. 
@@ -347,7 +345,7 @@
 ** 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 */
@@ -970,7 +968,7 @@
 ** 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 */
@@ -1022,7 +1020,7 @@
  * 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
@@ -1158,7 +1156,7 @@
 ** 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;
 
@@ -1214,13 +1212,13 @@
 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);
@@ -1234,7 +1232,7 @@
 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*);
@@ -1263,14 +1261,14 @@
 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*);
@@ -1280,7 +1278,7 @@
 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*);
@@ -1288,8 +1286,8 @@
 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);
@@ -1302,13 +1300,13 @@
 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*);
@@ -1340,7 +1338,7 @@
 #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*);
@@ -1367,13 +1365,13 @@
 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 *);
@@ -1387,7 +1385,7 @@
 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
diff --git a/src/table.c b/src/table.c
index dd0438c..2725be9 100644
--- a/src/table.c
+++ b/src/table.c
@@ -118,7 +118,7 @@
 ** 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 */
diff --git a/src/tclsqlite.c b/src/tclsqlite.c
index 8c91ccd..bcc2f0e 100644
--- a/src/tclsqlite.c
+++ b/src/tclsqlite.c
@@ -11,7 +11,7 @@
 *************************************************************************
 ** 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 */
 
@@ -205,7 +205,7 @@
 
 static void tclCollateNeeded(
   void *pCtx,
-  sqlite *db,
+  sqlite3 *db,
   int enc,
   const char *zName
 ){
@@ -367,7 +367,7 @@
 ** 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
@@ -1073,7 +1073,7 @@
 }
 
 /*
-**   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.
@@ -1088,16 +1088,16 @@
 **
 ** 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 
@@ -1190,7 +1190,7 @@
   */
 #ifdef SQLITE_TEST
   {
-    extern void Md5_Register(sqlite*);
+    extern void Md5_Register(sqlite3*);
 #ifdef SQLITE_DEBUG
     int mallocfail = sqlite3_iMallocFail;
     sqlite3_iMallocFail = 0;
diff --git a/src/test1.c b/src/test1.c
index 4498317..cbd3e73 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.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"
@@ -65,9 +65,9 @@
 }
 
 /*
-** 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)
   ){
@@ -168,7 +168,7 @@
   int argc,              /* Number of arguments */
   char **argv            /* Text of each argument */
 ){
-  sqlite *db;
+  sqlite3 *db;
   Tcl_DString str;
   int rc;
   char *zErr = 0;
@@ -229,7 +229,7 @@
   int argc,              /* Number of arguments */
   char **argv            /* Text of each argument */
 ){
-  sqlite *db;
+  sqlite3 *db;
   Tcl_DString str;
   int rc;
   char *zErr = 0;
@@ -278,7 +278,7 @@
   int argc,              /* Number of arguments */
   char **argv            /* Text of each argument */
 ){
-  sqlite *db;
+  sqlite3 *db;
   char zBuf[30];
 
   if( argc!=2 ){
@@ -302,7 +302,7 @@
   int argc,              /* Number of arguments */
   char **argv            /* Text of each argument */
 ){
-  sqlite *db;
+  sqlite3 *db;
   const char *zKey;
   int nKey;
   if( argc!=3 ){
@@ -330,7 +330,7 @@
   int argc,              /* Number of arguments */
   char **argv            /* Text of each argument */
 ){
-  sqlite *db;
+  sqlite3 *db;
   const char *zKey;
   int nKey;
   if( argc!=3 ){
@@ -358,7 +358,7 @@
   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],
@@ -452,7 +452,7 @@
 ){
   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);
@@ -480,9 +480,9 @@
   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],
@@ -540,7 +540,7 @@
   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);
@@ -846,7 +846,7 @@
   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], 
@@ -1681,7 +1681,7 @@
   int objc,
   Tcl_Obj *CONST objv[]
 ){
-  sqlite *db;
+  sqlite3 *db;
   const char *zErr;
 
   if( objc!=2 ){
@@ -1710,7 +1710,7 @@
   int objc,
   Tcl_Obj *CONST objv[]
 ){
-  sqlite *db;
+  sqlite3 *db;
   const void *zErr;
   int bytes;
 
diff --git a/src/test4.c b/src/test4.c
index a5ebe0b..403f9e1 100644
--- a/src/test4.c
+++ b/src/test4.c
@@ -11,7 +11,7 @@
 *************************************************************************
 ** 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"
@@ -40,7 +40,7 @@
   /* 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 */
@@ -591,7 +591,7 @@
   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);
diff --git a/src/tokenize.c b/src/tokenize.c
index 891a635..f3bda60 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.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"
@@ -461,7 +461,7 @@
   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*);
diff --git a/src/trigger.c b/src/trigger.c
index 3c07996..c387d03 100644
--- a/src/trigger.c
+++ b/src/trigger.c
@@ -53,7 +53,7 @@
   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;
@@ -191,7 +191,7 @@
   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;
@@ -419,7 +419,7 @@
   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) ){
@@ -463,7 +463,7 @@
 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;
diff --git a/src/update.c b/src/update.c
index 97e9aff..60c049d 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.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"
 
@@ -39,7 +39,7 @@
   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
diff --git a/src/util.c b/src/util.c
index 0ce4e7d..4c14808 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.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>
@@ -452,7 +452,7 @@
 ** 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 ){
@@ -782,7 +782,7 @@
 ** 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;
@@ -798,7 +798,7 @@
 ** 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;
@@ -818,7 +818,7 @@
 ** 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;
diff --git a/src/vacuum.c b/src/vacuum.c
index 9141cfe..016da05 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.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"
@@ -91,7 +91,7 @@
 /*
 ** 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 */
diff --git a/src/vdbe.c b/src/vdbe.c
index a3d3dd6..d4920a8 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.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"
@@ -461,7 +461,7 @@
   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
diff --git a/src/vdbe.h b/src/vdbe.h
index 6e7d11c..edef241 100644
--- a/src/vdbe.h
+++ b/src/vdbe.h
@@ -15,7 +15,7 @@
 ** 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_
@@ -97,7 +97,7 @@
 ** 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);
diff --git a/src/vdbeInt.h b/src/vdbeInt.h
index ef92acc..ba6b591 100644
--- a/src/vdbeInt.h
+++ b/src/vdbeInt.h
@@ -295,7 +295,7 @@
 ** 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 */
@@ -356,7 +356,7 @@
 */
 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*);
diff --git a/src/vdbeapi.c b/src/vdbeapi.c
index 1909c14..b238c7f 100644
--- a/src/vdbeapi.c
+++ b/src/vdbeapi.c
@@ -135,7 +135,7 @@
 */
 int sqlite3_step(sqlite3_stmt *pStmt){
   Vdbe *p = (Vdbe*)pStmt;
-  sqlite *db;
+  sqlite3 *db;
   int rc;
 
   if( p==0 || p->magic!=VDBE_MAGIC_RUN ){
diff --git a/src/vdbeaux.c b/src/vdbeaux.c
index ba81e1b..5e0b480 100644
--- a/src/vdbeaux.c
+++ b/src/vdbeaux.c
@@ -33,7 +33,7 @@
 /*
 ** 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;
@@ -451,7 +451,7 @@
 int sqlite3VdbeList(
   Vdbe *p                   /* The VDBE */
 ){
-  sqlite *db = p->db;
+  sqlite3 *db = p->db;
   int i;
   int rc = SQLITE_OK;
 
@@ -698,7 +698,7 @@
 ** 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;
 
@@ -925,7 +925,7 @@
 ** 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;
@@ -1137,7 +1137,7 @@
 ** 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;
@@ -1166,7 +1166,7 @@
 ** 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 */
 
@@ -1322,7 +1322,7 @@
 */
 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);
diff --git a/src/where.c b/src/where.c
index 49091d4..ec77360 100644
--- a/src/where.c
+++ b/src/where.c
@@ -12,7 +12,7 @@
 ** 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"
 
@@ -270,7 +270,7 @@
   Index *pMatch;
   Index *pIdx;
   int sortOrder;
-  sqlite *db = pParse->db;
+  sqlite3 *db = pParse->db;
 
   assert( pOrderBy!=0 );
   assert( pOrderBy->nExpr>0 );