Change the names of external symbols from sqlite_XXX to sqlite3_XXX. (CVS 1338)

FossilOrigin-Name: 2242423e31a5e81e89ffcc99e62307c5cc0120d5
diff --git a/src/md5.c b/src/md5.c
index 0c4ead7..f716dd8 100644
--- a/src/md5.c
+++ b/src/md5.c
@@ -360,9 +360,9 @@
   MD5Context *p;
   int i;
   if( argc<1 ) return;
-  p = sqlite_aggregate_context(context, sizeof(*p));
+  p = sqlite3_aggregate_context(context, sizeof(*p));
   if( p==0 ) return;
-  if( sqlite_aggregate_count(context)==1 ){
+  if( sqlite3_aggregate_count(context)==1 ){
     MD5Init(p);
   }
   for(i=0; i<argc; i++){
@@ -375,13 +375,13 @@
   MD5Context *p;
   unsigned char digest[16];
   char zBuf[33];
-  p = sqlite_aggregate_context(context, sizeof(*p));
+  p = sqlite3_aggregate_context(context, sizeof(*p));
   MD5Final(digest,p);
   DigestToBase16(digest, zBuf);
-  sqlite_set_result_string(context, zBuf, strlen(zBuf));
+  sqlite3_set_result_string(context, zBuf, strlen(zBuf));
 }
 void Md5_Register(sqlite *db){
-  sqlite_create_aggregate(db, "md5sum", -1, md5step, md5finalize, 0);
+  sqlite3_create_aggregate(db, "md5sum", -1, md5step, md5finalize, 0);
 }
 
 
diff --git a/src/os.c b/src/os.c
index 697217f..157b4cf 100644
--- a/src/os.c
+++ b/src/os.c
@@ -362,12 +362,12 @@
 ** is used for testing the I/O recovery logic.
 */
 #ifdef SQLITE_TEST
-int sqlite_io_error_pending = 0;
+int sqlite3_io_error_pending = 0;
 #define SimulateIOError(A)  \
-   if( sqlite_io_error_pending ) \
-     if( sqlite_io_error_pending-- == 1 ){ local_ioerr(); return A; }
+   if( sqlite3_io_error_pending ) \
+     if( sqlite3_io_error_pending-- == 1 ){ local_ioerr(); return A; }
 static void local_ioerr(){
-  sqlite_io_error_pending = 0;  /* Really just a place to set a breakpoint */
+  sqlite3_io_error_pending = 0;  /* Really just a place to set a breakpoint */
 }
 #else
 #define SimulateIOError(A)
@@ -377,8 +377,8 @@
 ** When testing, keep a count of the number of open files.
 */
 #ifdef SQLITE_TEST
-int sqlite_open_file_count = 0;
-#define OpenCounter(X)  sqlite_open_file_count+=(X)
+int sqlite3_open_file_count = 0;
+#define OpenCounter(X)  sqlite3_open_file_count+=(X)
 #else
 #define OpenCounter(X)
 #endif
@@ -1785,7 +1785,7 @@
 ** returned from sqlite3OsCurrentTime().  This is used for testing.
 */
 #ifdef SQLITE_TEST
-int sqlite_current_time = 0;
+int sqlite3_current_time = 0;
 #endif
 
 /*
@@ -1810,8 +1810,8 @@
   *prNow = (now + ft.dwLowDateTime)/864000000000.0 + 2305813.5;
 #endif
 #ifdef SQLITE_TEST
-  if( sqlite_current_time ){
-    *prNow = sqlite_current_time/86400.0 + 2440587.5;
+  if( sqlite3_current_time ){
+    *prNow = sqlite3_current_time/86400.0 + 2440587.5;
   }
 #endif
   return 0;
diff --git a/src/pager.c b/src/pager.c
index f8c7ba0..e098aea 100644
--- a/src/pager.c
+++ b/src/pager.c
@@ -18,7 +18,7 @@
 ** file simultaneously, or one process from reading the database while
 ** another is writing.
 **
-** @(#) $Id: pager.c,v 1.105 2004/05/08 20:07:40 drh Exp $
+** @(#) $Id: pager.c,v 1.106 2004/05/10 10:34:49 danielk1977 Exp $
 */
 #include "os.h"         /* Must be first to enable large file support */
 #include "sqliteInt.h"
@@ -932,7 +932,7 @@
   char zTemp[SQLITE_TEMPNAME_SIZE];
 
   *ppPager = 0;
-  if( sqlite_malloc_failed ){
+  if( sqlite3_malloc_failed ){
     return SQLITE_NOMEM;
   }
   if( zFilename && zFilename[0] ){
@@ -945,7 +945,7 @@
     zFullPathname = sqlite3OsFullPathname(zFilename);
     tempFile = 1;
   }
-  if( sqlite_malloc_failed ){
+  if( sqlite3_malloc_failed ){
     return SQLITE_NOMEM;
   }
   if( rc!=SQLITE_OK ){
diff --git a/src/printf.c b/src/printf.c
index 6aee66d..bce1770 100644
--- a/src/printf.c
+++ b/src/printf.c
@@ -753,7 +753,7 @@
 ** Print into memory obtained from malloc().  Do not use the internal
 ** %-conversion extensions.  This routine is for use by external users.
 */
-char *sqlite_mprintf(const char *zFormat, ...){
+char *sqlite3_mprintf(const char *zFormat, ...){
   va_list ap;
   char *z;
   char zBuf[200];
@@ -765,21 +765,21 @@
   return z;
 }
 
-/* This is the varargs version of sqlite_mprintf.  
+/* This is the varargs version of sqlite3_mprintf.  
 */
-char *sqlite_vmprintf(const char *zFormat, va_list ap){
+char *sqlite3_vmprintf(const char *zFormat, va_list ap){
   char zBuf[200];
   return base_vprintf((void*(*)(void*,int))realloc, 0,
                       zBuf, sizeof(zBuf), zFormat, ap);
 }
 
 /*
-** sqlite_snprintf() works like snprintf() except that it ignores the
+** sqlite3_snprintf() works like snprintf() except that it ignores the
 ** current locale settings.  This is important for SQLite because we
 ** are not able to use a "," as the decimal point in place of "." as
 ** specified by some locales.
 */
-char *sqlite_snprintf(int n, char *zBuf, const char *zFormat, ...){
+char *sqlite3_snprintf(int n, char *zBuf, const char *zFormat, ...){
   char *z;
   va_list ap;
 
@@ -791,13 +791,13 @@
 
 /*
 ** The following four routines implement the varargs versions of the
-** sqlite_exec() and sqlite_get_table() interfaces.  See the sqlite.h
+** sqlite3_exec() and sqlite3_get_table() interfaces.  See the sqlite.h
 ** header files for a more detailed description of how these interfaces
 ** work.
 **
 ** These routines are all just simple wrappers.
 */
-int sqlite_exec_printf(
+int sqlite3_exec_printf(
   sqlite *db,                   /* An open database */
   const char *sqlFormat,        /* printf-style format string for the SQL */
   sqlite_callback xCallback,    /* Callback function */
@@ -809,11 +809,11 @@
   int rc;
 
   va_start(ap, errmsg);
-  rc = sqlite_exec_vprintf(db, sqlFormat, xCallback, pArg, errmsg, ap);
+  rc = sqlite3_exec_vprintf(db, sqlFormat, xCallback, pArg, errmsg, ap);
   va_end(ap);
   return rc;
 }
-int sqlite_exec_vprintf(
+int sqlite3_exec_vprintf(
   sqlite *db,                   /* An open database */
   const char *sqlFormat,        /* printf-style format string for the SQL */
   sqlite_callback xCallback,    /* Callback function */
@@ -824,12 +824,12 @@
   char *zSql;
   int rc;
 
-  zSql = sqlite_vmprintf(sqlFormat, ap);
-  rc = sqlite_exec(db, zSql, xCallback, pArg, errmsg);
+  zSql = sqlite3_vmprintf(sqlFormat, ap);
+  rc = sqlite3_exec(db, zSql, xCallback, pArg, errmsg);
   free(zSql);
   return rc;
 }
-int sqlite_get_table_printf(
+int sqlite3_get_table_printf(
   sqlite *db,            /* An open database */
   const char *sqlFormat, /* printf-style format string for the SQL */
   char ***resultp,       /* Result written to a char *[]  that this points to */
@@ -842,11 +842,11 @@
   int rc;
 
   va_start(ap, errmsg);
-  rc = sqlite_get_table_vprintf(db, sqlFormat, resultp, nrow, ncol, errmsg, ap);
+  rc = sqlite3_get_table_vprintf(db, sqlFormat, resultp, nrow, ncol, errmsg, ap);
   va_end(ap);
   return rc;
 }
-int sqlite_get_table_vprintf(
+int sqlite3_get_table_vprintf(
   sqlite *db,            /* An open database */
   const char *sqlFormat, /* printf-style format string for the SQL */
   char ***resultp,       /* Result written to a char *[]  that this points to */
@@ -858,8 +858,8 @@
   char *zSql;
   int rc;
 
-  zSql = sqlite_vmprintf(sqlFormat, ap);
-  rc = sqlite_get_table(db, zSql, resultp, nrow, ncolumn, errmsg);
+  zSql = sqlite3_vmprintf(sqlFormat, ap);
+  rc = sqlite3_get_table(db, zSql, resultp, nrow, ncolumn, errmsg);
   free(zSql);
   return rc;
 }
diff --git a/src/select.c b/src/select.c
index bd3d7ae..e913d5d 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.162 2004/05/08 08:23:32 danielk1977 Exp $
+** $Id: select.c,v 1.163 2004/05/10 10:34:49 danielk1977 Exp $
 */
 #include "sqliteInt.h"
 
@@ -692,7 +692,7 @@
   int fullNames, shortNames;
 
   assert( v!=0 );
-  if( pParse->colNamesSet || v==0 || sqlite_malloc_failed ) return;
+  if( pParse->colNamesSet || v==0 || sqlite3_malloc_failed ) return;
   pParse->colNamesSet = 1;
   fullNames = (db->flags & SQLITE_FullColNames)!=0;
   shortNames = (db->flags & SQLITE_ShortColNames)!=0;
@@ -2007,7 +2007,7 @@
   int distinct;          /* Table to use for the distinct set */
   int rc = 1;            /* Value to return from this function */
 
-  if( sqlite_malloc_failed || pParse->nErr || p==0 ) return 1;
+  if( sqlite3_malloc_failed || pParse->nErr || p==0 ) return 1;
   if( sqlite3AuthCheck(pParse, SQLITE_SELECT, 0, 0, 0) ) return 1;
 
   /* If there is are a sequence of queries, do the earlier ones first.
diff --git a/src/shell.c b/src/shell.c
index 08ba508..648a9bb 100644
--- a/src/shell.c
+++ b/src/shell.c
@@ -12,7 +12,7 @@
 ** This file contains code to implement the "sqlite" command line
 ** utility for accessing SQLite databases.
 **
-** $Id: shell.c,v 1.94 2004/05/08 08:23:32 danielk1977 Exp $
+** $Id: shell.c,v 1.95 2004/05/10 10:34:52 danielk1977 Exp $
 */
 #include <stdlib.h>
 #include <string.h>
@@ -271,7 +271,7 @@
 */
 static void interrupt_handler(int NotUsed){
   seenInterrupt = 1;
-  if( db ) sqlite_interrupt(db);
+  if( db ) sqlite3_interrupt(db);
 }
 
 /*
@@ -460,7 +460,7 @@
     d2.mode = MODE_Insert;
     d2.zDestTable = 0;
     set_table_name(&d2, azArg[0]);
-    sqlite_exec_printf(p->db,
+    sqlite3_exec_printf(p->db,
        "SELECT * FROM '%q'",
        callback, &d2, 0, azArg[0]
     );
@@ -513,9 +513,9 @@
     char *zErrMsg = 0;
 #ifdef SQLITE_HAS_CODEC
     int n = p->zKey ? strlen(p->zKey) : 0;
-    db = p->db = sqlite_open_encrypted(p->zDbFilename, p->zKey, n, 0, &zErrMsg);
+    db = p->db = sqlite3_open_encrypted(p->zDbFilename, p->zKey, n, 0, &zErrMsg);
 #else
-    db = p->db = sqlite_open(p->zDbFilename, 0, &zErrMsg);
+    db = p->db = sqlite3_open(p->zDbFilename, 0, &zErrMsg);
 #endif
     if( p->db==0 ){
       if( zErrMsg ){
@@ -576,10 +576,10 @@
     data.colWidth[0] = 3;
     data.colWidth[1] = 15;
     data.colWidth[2] = 58;
-    sqlite_exec(p->db, "PRAGMA database_list; ", callback, &data, &zErrMsg);
+    sqlite3_exec(p->db, "PRAGMA database_list; ", callback, &data, &zErrMsg);
     if( zErrMsg ){
       fprintf(stderr,"Error: %s\n", zErrMsg);
-      sqlite_freemem(zErrMsg);
+      sqlite3_freemem(zErrMsg);
     }
   }else
 
@@ -588,7 +588,7 @@
     open_db(p);
     fprintf(p->out, "BEGIN TRANSACTION;\n");
     if( nArg==1 ){
-      sqlite_exec(p->db,
+      sqlite3_exec(p->db,
         "SELECT name, type, sql FROM sqlite_master "
         "WHERE type!='meta' AND sql NOT NULL "
         "ORDER BY substr(type,2,1), name",
@@ -597,7 +597,7 @@
     }else{
       int i;
       for(i=1; i<nArg && zErrMsg==0; i++){
-        sqlite_exec_printf(p->db,
+        sqlite3_exec_printf(p->db,
           "SELECT name, type, sql FROM sqlite_master "
           "WHERE tbl_name LIKE '%q' AND type!='meta' AND sql NOT NULL "
           "ORDER BY substr(type,2,1), name",
@@ -607,7 +607,7 @@
     }
     if( zErrMsg ){
       fprintf(stderr,"Error: %s\n", zErrMsg);
-      sqlite_freemem(zErrMsg);
+      sqlite3_freemem(zErrMsg);
     }else{
       fprintf(p->out, "COMMIT;\n");
     }
@@ -702,7 +702,7 @@
     memcpy(&data, p, sizeof(data));
     data.showHeader = 0;
     data.mode = MODE_List;
-    sqlite_exec_printf(p->db,
+    sqlite3_exec_printf(p->db,
       "SELECT name FROM sqlite_master "
       "WHERE type='index' AND tbl_name LIKE '%q' "
       "UNION ALL "
@@ -713,7 +713,7 @@
     );
     if( zErrMsg ){
       fprintf(stderr,"Error: %s\n", zErrMsg);
-      sqlite_freemem(zErrMsg);
+      sqlite3_freemem(zErrMsg);
     }
   }else
 
@@ -797,8 +797,8 @@
     }else if( strcmp(azArg[2], azArg[3]) ){
       fprintf(stderr,"2nd copy of new key does not match the 1st\n");
     }else{
-      sqlite_freemem(p->zKey);
-      p->zKey = sqlite_mprintf("%s", azArg[2]);
+      sqlite3_freemem(p->zKey);
+      p->zKey = sqlite3_mprintf("%s", azArg[2]);
       sqlite_rekey(p->db, p->zKey, strlen(p->zKey));
     }
   }else
@@ -840,7 +840,7 @@
         new_colv[1] = 0;
         callback(&data, 1, new_argv, new_colv);
       }else{
-        sqlite_exec_printf(p->db,
+        sqlite3_exec_printf(p->db,
           "SELECT sql FROM "
           "  (SELECT * FROM sqlite_master UNION ALL"
           "   SELECT * FROM sqlite_temp_master) "
@@ -849,7 +849,7 @@
           callback, &data, &zErrMsg, azArg[1]);
       }
     }else{
-      sqlite_exec(p->db,
+      sqlite3_exec(p->db,
          "SELECT sql FROM "
          "  (SELECT * FROM sqlite_master UNION ALL"
          "   SELECT * FROM sqlite_temp_master) "
@@ -860,7 +860,7 @@
     }
     if( zErrMsg ){
       fprintf(stderr,"Error: %s\n", zErrMsg);
-      sqlite_freemem(zErrMsg);
+      sqlite3_freemem(zErrMsg);
     }
   }else
 
@@ -891,7 +891,7 @@
     char *zErrMsg;
     open_db(p);
     if( nArg==1 ){
-      rc = sqlite_get_table(p->db,
+      rc = sqlite3_get_table(p->db,
         "SELECT name FROM sqlite_master "
         "WHERE type IN ('table','view') "
         "UNION ALL "
@@ -901,7 +901,7 @@
         &azResult, &nRow, 0, &zErrMsg
       );
     }else{
-      rc = sqlite_get_table_printf(p->db,
+      rc = sqlite3_get_table_printf(p->db,
         "SELECT name FROM sqlite_master "
         "WHERE type IN ('table','view') AND name LIKE '%%%q%%' "
         "UNION ALL "
@@ -913,7 +913,7 @@
     }
     if( zErrMsg ){
       fprintf(stderr,"Error: %s\n", zErrMsg);
-      sqlite_freemem(zErrMsg);
+      sqlite3_freemem(zErrMsg);
     }
     if( rc==SQLITE_OK ){
       int len, maxlen = 0;
@@ -935,12 +935,12 @@
         printf("\n");
       }
     }
-    sqlite_free_table(azResult);
+    sqlite3_free_table(azResult);
   }else
 
   if( c=='t' && n>1 && strncmp(azArg[0], "timeout", n)==0 && nArg>=2 ){
     open_db(p);
-    sqlite_busy_timeout(p->db, atoi(azArg[1]));
+    sqlite3_busy_timeout(p->db, atoi(azArg[1]));
   }else
 
   if( c=='w' && strncmp(azArg[0], "width", n)==0 ){
@@ -1055,18 +1055,18 @@
       nSql += len;
     }
     free(zLine);
-    if( zSql && _ends_with_semicolon(zSql, nSql) && sqlite_complete(zSql) ){
+    if( zSql && _ends_with_semicolon(zSql, nSql) && sqlite3_complete(zSql) ){
       p->cnt = 0;
       open_db(p);
-      rc = sqlite_exec(p->db, zSql, callback, p, &zErrMsg);
+      rc = sqlite3_exec(p->db, zSql, callback, p, &zErrMsg);
       if( rc || zErrMsg ){
         if( in!=0 && !p->echoOn ) printf("%s\n",zSql);
         if( zErrMsg!=0 ){
           printf("SQL error: %s\n", zErrMsg);
-          sqlite_freemem(zErrMsg);
+          sqlite3_freemem(zErrMsg);
           zErrMsg = 0;
         }else{
-          printf("SQL error: %s\n", sqlite_error_string(rc));
+          printf("SQL error: %s\n", sqlite3_error_string(rc));
         }
       }
       free(zSql);
@@ -1239,7 +1239,7 @@
       zInitFile = argv[i];
     }else if( strcmp(argv[i],"-key")==0 ){
       i++;
-      data.zKey = sqlite_mprintf("%s",argv[i]);
+      data.zKey = sqlite3_mprintf("%s",argv[i]);
     }
   }
   if( i<argc ){
@@ -1297,7 +1297,7 @@
     }else if( strcmp(z,"-echo")==0 ){
       data.echoOn = 1;
     }else if( strcmp(z,"-version")==0 ){
-      printf("%s\n", sqlite_version);
+      printf("%s\n", sqlite3_version);
       return 1;
     }else if( strcmp(z,"-help")==0 ){
       usage(1);
@@ -1317,7 +1317,7 @@
     }else{
       int rc;
       open_db(&data);
-      rc = sqlite_exec(data.db, zFirstCmd, callback, &data, &zErrMsg);
+      rc = sqlite3_exec(data.db, zFirstCmd, callback, &data, &zErrMsg);
       if( rc!=0 && zErrMsg!=0 ){
         fprintf(stderr,"SQL error: %s\n", zErrMsg);
         exit(1);
@@ -1332,7 +1332,7 @@
       printf(
         "SQLite version %s\n"
         "Enter \".help\" for instructions\n",
-        sqlite_version
+        sqlite3_version
       );
       zHome = find_home_dir();
       if( zHome && (zHistory = malloc(strlen(zHome)+20))!=0 ){
@@ -1349,7 +1349,7 @@
     }
   }
   set_table_name(&data, 0);
-  if( db ) sqlite_close(db);
+  if( db ) sqlite3_close(db);
   return 0;
 }
 
diff --git a/src/sqlite.h.in b/src/sqlite.h.in
index 3b210eb..272735d 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.61 2004/05/08 08:23:33 danielk1977 Exp $
+** @(#) $Id: sqlite.h.in,v 1.62 2004/05/10 10:34:52 danielk1977 Exp $
 */
 #ifndef _SQLITE_H_
 #define _SQLITE_H_
@@ -35,7 +35,7 @@
 ** can check to make sure that the lib*.a file and the *.h file are from
 ** the same version.
 */
-extern const char sqlite_version[];
+extern const char sqlite3_version[];
 
 /*
 ** The SQLITE_UTF8 macro is defined if the library expects to see
@@ -50,7 +50,7 @@
 ** see.  The character encoding makes a difference for the LIKE and GLOB
 ** operators and for the LENGTH() and SUBSTR() functions.
 */
-extern const char sqlite_encoding[];
+extern const char sqlite3_encoding[];
 
 /*
 ** Each open sqlite database is represented by an instance of the
@@ -75,15 +75,15 @@
 ** ability to open a database readonly.  The mode parameters is
 ** provided in anticipation of that enhancement.
 */
-sqlite *sqlite_open(const char *filename, int mode, char **errmsg);
+sqlite *sqlite3_open(const char *filename, int mode, char **errmsg);
 
 /*
 ** A function to close the database.
 **
 ** Call this function with a pointer to a structure that was previously
-** returned from sqlite_open() and the corresponding database will by closed.
+** returned from sqlite3_open() and the corresponding database will by closed.
 */
-void sqlite_close(sqlite *);
+void sqlite3_close(sqlite *);
 
 /*
 ** The type for a callback function.
@@ -98,7 +98,7 @@
 ** invoked once for each row of the query result.  This callback
 ** should normally return 0.  If the callback returns a non-zero
 ** value then the query is aborted, all subsequent SQL statements
-** are skipped and the sqlite_exec() function returns the SQLITE_ABORT.
+** are skipped and the sqlite3_exec() function returns the SQLITE_ABORT.
 **
 ** The 4th parameter is an arbitrary pointer that is passed
 ** to the callback function as its first parameter.
@@ -118,7 +118,7 @@
 ** message is written into memory obtained from malloc() and
 ** *errmsg is made to point to that message.  The calling function
 ** is responsible for freeing the memory that holds the error
-** message.   Use sqlite_freemem() for this.  If errmsg==NULL,
+** message.   Use sqlite3_freemem() for this.  If errmsg==NULL,
 ** then no error message is ever written.
 **
 ** The return value is is SQLITE_OK if there are no errors and
@@ -127,10 +127,10 @@
 **
 ** If the query could not be executed because a database file is
 ** locked or busy, then this function returns SQLITE_BUSY.  (This
-** behavior can be modified somewhat using the sqlite_busy_handler()
-** and sqlite_busy_timeout() functions below.)
+** behavior can be modified somewhat using the sqlite3_busy_handler()
+** and sqlite3_busy_timeout() functions below.)
 */
-int sqlite_exec(
+int sqlite3_exec(
   sqlite*,                      /* An open database */
   const char *sql,              /* SQL to be executed */
   sqlite_callback,              /* Callback function */
@@ -139,7 +139,7 @@
 );
 
 /*
-** Return values for sqlite_exec() and sqlite_step()
+** Return values for sqlite3_exec() and sqlite3_step()
 */
 #define SQLITE_OK           0   /* Successful result */
 #define SQLITE_ERROR        1   /* SQL error or missing database */
@@ -150,7 +150,7 @@
 #define SQLITE_LOCKED       6   /* A table in the database is locked */
 #define SQLITE_NOMEM        7   /* A malloc() failed */
 #define SQLITE_READONLY     8   /* Attempt to write a readonly database */
-#define SQLITE_INTERRUPT    9   /* Operation terminated by sqlite_interrupt() */
+#define SQLITE_INTERRUPT    9   /* Operation terminated by sqlite3_interrupt() */
 #define SQLITE_IOERR       10   /* Some kind of disk I/O error occurred */
 #define SQLITE_CORRUPT     11   /* The database disk image is malformed */
 #define SQLITE_NOTFOUND    12   /* (Internal Only) Table or record not found */
@@ -166,10 +166,10 @@
 #define SQLITE_NOLFS       22   /* Uses OS features not supported on host */
 #define SQLITE_AUTH        23   /* Authorization denied */
 #define SQLITE_FORMAT      24   /* Auxiliary database format error */
-#define SQLITE_RANGE       25   /* 2nd parameter to sqlite_bind out of range */
+#define SQLITE_RANGE       25   /* 2nd parameter to sqlite3_bind out of range */
 #define SQLITE_NOTADB      26   /* File opened that is not a database file */
-#define SQLITE_ROW         100  /* sqlite_step() has another row ready */
-#define SQLITE_DONE        101  /* sqlite_step() has finished executing */
+#define SQLITE_ROW         100  /* sqlite3_step() has another row ready */
+#define SQLITE_DONE        101  /* sqlite3_step() has finished executing */
 
 /*
 ** Each entry in an SQLite table has a unique integer key.  (The key is
@@ -180,17 +180,17 @@
 **
 ** This function is similar to the mysql_insert_id() function from MySQL.
 */
-int sqlite_last_insert_rowid(sqlite*);
+int sqlite3_last_insert_rowid(sqlite*);
 
 /*
 ** This function returns the number of database rows that were changed
-** (or inserted or deleted) by the most recent called sqlite_exec().
+** (or inserted or deleted) by the most recent called sqlite3_exec().
 **
 ** All changes are counted, even if they were later undone by a
 ** ROLLBACK or ABORT.  Except, changes associated with creating and
 ** dropping tables are not counted.
 **
-** If a callback invokes sqlite_exec() recursively, then the changes
+** If a callback invokes sqlite3_exec() recursively, then the changes
 ** in the inner, recursive call are counted together with the changes
 ** in the outer call.
 **
@@ -202,11 +202,11 @@
 ** table. To get an accurate count of the number of rows deleted, use
 ** "DELETE FROM table WHERE 1" instead.
 */
-int sqlite_changes(sqlite*);
+int sqlite3_changes(sqlite*);
 
 /*
 ** This function returns the number of database rows that were changed
-** by the last INSERT, UPDATE, or DELETE statment executed by sqlite_exec(),
+** by the last INSERT, UPDATE, or DELETE statment executed by sqlite3_exec(),
 ** or by the last VM to run to completion. The change count is not updated
 ** by SQL statements other than INSERT, UPDATE or DELETE.
 **
@@ -214,7 +214,7 @@
 ** ABORT. Changes associated with trigger programs that execute as a
 ** result of the INSERT, UPDATE, or DELETE statement are not counted.
 **
-** If a callback invokes sqlite_exec() recursively, then the changes
+** If a callback invokes sqlite3_exec() recursively, then the changes
 ** in the inner, recursive call are counted together with the changes
 ** in the outer call.
 **
@@ -228,14 +228,14 @@
 **
 ******* THIS IS AN EXPERIMENTAL API AND IS SUBJECT TO CHANGE ******
 */
-int sqlite_last_statement_changes(sqlite*);
+int sqlite3_last_statement_changes(sqlite*);
 
 /* If the parameter to this routine is one of the return value constants
 ** defined above, then this routine returns a constant text string which
 ** descripts (in English) the meaning of the return value.
 */
-const char *sqlite_error_string(int);
-#define sqliteErrStr sqlite_error_string  /* Legacy. Do not use in new code. */
+const char *sqlite3_error_string(int);
+#define sqliteErrStr sqlite3_error_string  /* Legacy. Do not use in new code. */
 
 /* This function causes any pending database operation to abort and
 ** return at its earliest opportunity.  This routine is typically
@@ -243,7 +243,7 @@
 ** or Ctrl-C where the user wants a long query operation to halt
 ** immediately.
 */
-void sqlite_interrupt(sqlite*);
+void sqlite3_interrupt(sqlite*);
 
 
 /* This function returns true if the given input string comprises
@@ -253,19 +253,19 @@
 ** and comments is a semicolon, then return true.  otherwise return
 ** false.
 */
-int sqlite_complete(const char *sql);
+int sqlite3_complete(const char *sql);
 
 /*
 ** This routine identifies a callback function that is invoked
 ** whenever an attempt is made to open a database table that is
 ** currently locked by another process or thread.  If the busy callback
-** is NULL, then sqlite_exec() returns SQLITE_BUSY immediately if
+** is NULL, then sqlite3_exec() returns SQLITE_BUSY immediately if
 ** it finds a locked table.  If the busy callback is not NULL, then
-** sqlite_exec() invokes the callback with three arguments.  The
+** sqlite3_exec() invokes the callback with three arguments.  The
 ** second argument is the name of the locked table and the third
 ** argument is the number of times the table has been busy.  If the
-** busy callback returns 0, then sqlite_exec() immediately returns
-** SQLITE_BUSY.  If the callback returns non-zero, then sqlite_exec()
+** busy callback returns 0, then sqlite3_exec() immediately returns
+** SQLITE_BUSY.  If the callback returns non-zero, then sqlite3_exec()
 ** tries to open the table again and the cycle repeats.
 **
 ** The default busy callback is NULL.
@@ -277,22 +277,22 @@
 ** data structures out from under the executing query and will 
 ** probably result in a coredump.
 */
-void sqlite_busy_handler(sqlite*, int(*)(void*,const char*,int), void*);
+void sqlite3_busy_handler(sqlite*, int(*)(void*,const char*,int), void*);
 
 /*
 ** This routine sets a busy handler that sleeps for a while when a
 ** table is locked.  The handler will sleep multiple times until 
 ** at least "ms" milleseconds of sleeping have been done.  After
 ** "ms" milleseconds of sleeping, the handler returns 0 which
-** causes sqlite_exec() to return SQLITE_BUSY.
+** causes sqlite3_exec() to return SQLITE_BUSY.
 **
 ** Calling this routine with an argument less than or equal to zero
 ** turns off all busy handlers.
 */
-void sqlite_busy_timeout(sqlite*, int ms);
+void sqlite3_busy_timeout(sqlite*, int ms);
 
 /*
-** This next routine is really just a wrapper around sqlite_exec().
+** This next routine is really just a wrapper around sqlite3_exec().
 ** Instead of invoking a user-supplied callback for each row of the
 ** result, this routine remembers each row of the result in memory
 ** obtained from malloc(), then returns all of the result after the
@@ -324,15 +324,15 @@
 ** will be ((*nrow) + 1)*(*ncolumn).
 **
 ** After the calling function has finished using the result, it should 
-** pass the result data pointer to sqlite_free_table() in order to 
+** pass the result data pointer to sqlite3_free_table() in order to 
 ** release the memory that was malloc-ed.  Because of the way the 
 ** malloc() happens, the calling function must not try to call 
-** malloc() directly.  Only sqlite_free_table() is able to release 
+** malloc() directly.  Only sqlite3_free_table() is able to release 
 ** the memory properly and safely.
 **
-** The return value of this routine is the same as from sqlite_exec().
+** The return value of this routine is the same as from sqlite3_exec().
 */
-int sqlite_get_table(
+int sqlite3_get_table(
   sqlite*,               /* An open database */
   const char *sql,       /* SQL to be executed */
   char ***resultp,       /* Result written to a char *[]  that this points to */
@@ -342,13 +342,13 @@
 );
 
 /*
-** Call this routine to free the memory that sqlite_get_table() allocated.
+** Call this routine to free the memory that sqlite3_get_table() allocated.
 */
-void sqlite_free_table(char **result);
+void sqlite3_free_table(char **result);
 
 /*
-** The following routines are wrappers around sqlite_exec() and
-** sqlite_get_table().  The only difference between the routines that
+** The following routines are wrappers around sqlite3_exec() and
+** sqlite3_get_table().  The only difference between the routines that
 ** follow and the originals is that the second argument to the 
 ** routines that follow is really a printf()-style format
 ** string describing the SQL to be executed.  Arguments to the format
@@ -367,7 +367,7 @@
 **
 ** We can use this text in an SQL statement as follows:
 **
-**      sqlite_exec_printf(db, "INSERT INTO table VALUES('%q')",
+**      sqlite3_exec_printf(db, "INSERT INTO table VALUES('%q')",
 **          callback1, 0, 0, zText);
 **
 ** Because the %q format string is used, the '\'' character in zText
@@ -384,7 +384,7 @@
 ** should always use %q instead of %s when inserting text into a string 
 ** literal.
 */
-int sqlite_exec_printf(
+int sqlite3_exec_printf(
   sqlite*,                      /* An open database */
   const char *sqlFormat,        /* printf-style format string for the SQL */
   sqlite_callback,              /* Callback function */
@@ -392,7 +392,7 @@
   char **errmsg,                /* Error msg written here */
   ...                           /* Arguments to the format string. */
 );
-int sqlite_exec_vprintf(
+int sqlite3_exec_vprintf(
   sqlite*,                      /* An open database */
   const char *sqlFormat,        /* printf-style format string for the SQL */
   sqlite_callback,              /* Callback function */
@@ -400,7 +400,7 @@
   char **errmsg,                /* Error msg written here */
   va_list ap                    /* Arguments to the format string. */
 );
-int sqlite_get_table_printf(
+int sqlite3_get_table_printf(
   sqlite*,               /* An open database */
   const char *sqlFormat, /* printf-style format string for the SQL */
   char ***resultp,       /* Result written to a char *[]  that this points to */
@@ -409,7 +409,7 @@
   char **errmsg,         /* Error msg written here */
   ...                    /* Arguments to the format string */
 );
-int sqlite_get_table_vprintf(
+int sqlite3_get_table_vprintf(
   sqlite*,               /* An open database */
   const char *sqlFormat, /* printf-style format string for the SQL */
   char ***resultp,       /* Result written to a char *[]  that this points to */
@@ -418,23 +418,23 @@
   char **errmsg,         /* Error msg written here */
   va_list ap             /* Arguments to the format string */
 );
-char *sqlite_mprintf(const char*,...);
-char *sqlite_vmprintf(const char*, va_list);
+char *sqlite3_mprintf(const char*,...);
+char *sqlite3_vmprintf(const char*, va_list);
 
 /*
 ** Windows systems should call this routine to free memory that
-** is returned in the in the errmsg parameter of sqlite_open() when
+** is returned in the in the errmsg parameter of sqlite3_open() when
 ** SQLite is a DLL.  For some reason, it does not work to call free()
 ** directly.
 */
-void sqlite_freemem(void *p);
+void sqlite3_freemem(void *p);
 
 /*
-** Windows systems need functions to call to return the sqlite_version
-** and sqlite_encoding strings.
+** Windows systems need functions to call to return the sqlite3_version
+** and sqlite3_encoding strings.
 */
-const char *sqlite_libversion(void);
-const char *sqlite_libencoding(void);
+const char *sqlite3_libversion(void);
+const char *sqlite3_libencoding(void);
 
 /*
 ** A pointer to the following structure is used to communicate with
@@ -446,20 +446,20 @@
 ** Use the following routines to create new user-defined functions.  See
 ** the documentation for details.
 */
-int sqlite_create_function(
+int sqlite3_create_function(
   sqlite*,                  /* Database where the new function is registered */
   const char *zName,        /* Name of the new function */
   int nArg,                 /* Number of arguments.  -1 means any number */
   void (*xFunc)(sqlite_func*,int,const char**),  /* C code to implement */
-  void *pUserData           /* Available via the sqlite_user_data() call */
+  void *pUserData           /* Available via the sqlite3_user_data() call */
 );
-int sqlite_create_aggregate(
+int sqlite3_create_aggregate(
   sqlite*,                  /* Database where the new function is registered */
   const char *zName,        /* Name of the function */
   int nArg,                 /* Number of arguments */
   void (*xStep)(sqlite_func*,int,const char**), /* Called for each row */
   void (*xFinalize)(sqlite_func*),       /* Called once to get final result */
-  void *pUserData           /* Available via the sqlite_user_data() call */
+  void *pUserData           /* Available via the sqlite3_user_data() call */
 );
 
 /*
@@ -473,7 +473,7 @@
 ** the result is always text.  If datatype==SQLITE_ARGS then the result
 ** is numeric if any argument is numeric and is text otherwise.
 */
-int sqlite_function_type(
+int sqlite3_function_type(
   sqlite *db,               /* The database there the function is registered */
   const char *zName,        /* Name of the function */
   int datatype              /* The datatype for this function */
@@ -487,30 +487,30 @@
 ** in order to return their results.  The first parameter to each of these
 ** routines is a copy of the first argument to xFunc() or xFinialize().
 ** The second parameter to these routines is the result to be returned.
-** A NULL can be passed as the second parameter to sqlite_set_result_string()
+** A NULL can be passed as the second parameter to sqlite3_set_result_string()
 ** in order to return a NULL result.
 **
 ** The 3rd argument to _string and _error is the number of characters to
 ** take from the string.  If this argument is negative, then all characters
 ** up to and including the first '\000' are used.
 **
-** The sqlite_set_result_string() function allocates a buffer to hold the
+** The sqlite3_set_result_string() function allocates a buffer to hold the
 ** result and returns a pointer to this buffer.  The calling routine
 ** (that is, the implmentation of a user function) can alter the content
 ** of this buffer if desired.
 */
-char *sqlite_set_result_string(sqlite_func*,const char*,int);
-void sqlite_set_result_int(sqlite_func*,int);
-void sqlite_set_result_double(sqlite_func*,double);
-void sqlite_set_result_error(sqlite_func*,const char*,int);
+char *sqlite3_set_result_string(sqlite_func*,const char*,int);
+void sqlite3_set_result_int(sqlite_func*,int);
+void sqlite3_set_result_double(sqlite_func*,double);
+void sqlite3_set_result_error(sqlite_func*,const char*,int);
 
 /*
-** The pUserData parameter to the sqlite_create_function() and
-** sqlite_create_aggregate() routines used to register user functions
+** The pUserData parameter to the sqlite3_create_function() and
+** sqlite3_create_aggregate() routines used to register user functions
 ** is available to the implementation of the function using this
 ** call.
 */
-void *sqlite_user_data(sqlite_func*);
+void *sqlite3_user_data(sqlite_func*);
 
 /*
 ** Aggregate functions use the following routine to allocate
@@ -522,14 +522,14 @@
 **
 ** The buffer allocated is freed automatically be SQLite.
 */
-void *sqlite_aggregate_context(sqlite_func*, int nBytes);
+void *sqlite3_aggregate_context(sqlite_func*, int nBytes);
 
 /*
 ** The next routine returns the number of calls to xStep for a particular
 ** aggregate function instance.  The current call to xStep counts so this
 ** routine always returns at least 1.
 */
-int sqlite_aggregate_count(sqlite_func*);
+int sqlite3_aggregate_count(sqlite_func*);
 
 /*
 ** This routine registers a callback with the SQLite library.  The
@@ -539,7 +539,7 @@
 ** SQL statement should be aborted with an error and SQLITE_IGNORE
 ** if the column should be treated as a NULL value.
 */
-int sqlite_set_authorizer(
+int sqlite3_set_authorizer(
   sqlite*,
   int (*xAuth)(void*,int,const char*,const char*,const char*,const char*),
   void *pUserData
@@ -595,11 +595,11 @@
 #define SQLITE_IGNORE 2   /* Don't allow access, but don't generate an error */
 
 /*
-** Register a function that is called at every invocation of sqlite_exec()
-** or sqlite_compile().  This function can be used (for example) to generate
+** Register a function that is called at every invocation of sqlite3_exec()
+** or sqlite3_compile().  This function can be used (for example) to generate
 ** a log file of all SQL executed against a database.
 */
-void *sqlite_trace(sqlite*, void(*xTrace)(void*,const char*), void*);
+void *sqlite3_trace(sqlite*, void(*xTrace)(void*,const char*), void*);
 
 /*** The Callback-Free API
 ** 
@@ -614,7 +614,7 @@
 /*
 ** To execute an SQLite query without the use of callbacks, you first have
 ** to compile the SQL using this routine.  The 1st parameter "db" is a pointer
-** to an sqlite object obtained from sqlite_open().  The 2nd parameter
+** to an sqlite object obtained from sqlite3_open().  The 2nd parameter
 ** "zSql" is the text of the SQL to be compiled.   The remaining parameters
 ** are all outputs.
 **
@@ -630,13 +630,13 @@
 ** If any errors are detected during compilation, an error message is written
 ** into space obtained from malloc() and *pzErrMsg is made to point to that
 ** error message.  The calling routine is responsible for freeing the text
-** of this message when it has finished with it.  Use sqlite_freemem() to
+** of this message when it has finished with it.  Use sqlite3_freemem() to
 ** free the message.  pzErrMsg may be NULL in which case no error message
 ** will be generated.
 **
 ** On success, SQLITE_OK is returned.  Otherwise and error code is returned.
 */
-int sqlite_compile(
+int sqlite3_compile(
   sqlite *db,                   /* The open database */
   const char *zSql,             /* SQL statement to be compiled */
   const char **pzTail,          /* OUT: uncompiled tail of zSql */
@@ -651,7 +651,7 @@
 ** SQLITE_ERROR, SQLITE_BUSY, SQLITE_ROW, or SQLITE_MISUSE.
 **
 ** SQLITE_DONE means that the execute of the SQL statement is complete
-** an no errors have occurred.  sqlite_step() should not be called again
+** an no errors have occurred.  sqlite3_step() should not be called again
 ** for the same virtual machine.  *pN is set to the number of columns in
 ** the result set and *pazColName is set to an array of strings that
 ** describe the column names and datatypes.  The name of the i-th column
@@ -659,16 +659,16 @@
 ** (*pazColName)[i+*pN].  *pazValue is set to NULL.
 **
 ** SQLITE_ERROR means that the virtual machine encountered a run-time
-** error.  sqlite_step() should not be called again for the same
+** error.  sqlite3_step() should not be called again for the same
 ** virtual machine.  *pN is set to 0 and *pazColName and *pazValue are set
-** to NULL.  Use sqlite_finalize() to obtain the specific error code
+** to NULL.  Use sqlite3_finalize() to obtain the specific error code
 ** and the error message text for the error.
 **
 ** SQLITE_BUSY means that an attempt to open the database failed because
 ** another thread or process is holding a lock.  The calling routine
-** can try again to open the database by calling sqlite_step() again.
+** can try again to open the database by calling sqlite3_step() again.
 ** The return code will only be SQLITE_BUSY if no busy handler is registered
-** using the sqlite_busy_handler() or sqlite_busy_timeout() routines.  If
+** using the sqlite3_busy_handler() or sqlite3_busy_timeout() routines.  If
 ** a busy handler callback has been registered but returns 0, then this
 ** routine will return SQLITE_ERROR and sqltie_finalize() will return
 ** SQLITE_BUSY when it is called.
@@ -676,16 +676,16 @@
 ** SQLITE_ROW means that a single row of the result is now available.
 ** The data is contained in *pazValue.  The value of the i-th column is
 ** (*azValue)[i].  *pN and *pazColName are set as described in SQLITE_DONE.
-** Invoke sqlite_step() again to advance to the next row.
+** Invoke sqlite3_step() again to advance to the next row.
 **
-** SQLITE_MISUSE is returned if sqlite_step() is called incorrectly.
-** For example, if you call sqlite_step() after the virtual machine
-** has halted (after a prior call to sqlite_step() has returned SQLITE_DONE)
-** or if you call sqlite_step() with an incorrectly initialized virtual
+** SQLITE_MISUSE is returned if sqlite3_step() is called incorrectly.
+** For example, if you call sqlite3_step() after the virtual machine
+** has halted (after a prior call to sqlite3_step() has returned SQLITE_DONE)
+** or if you call sqlite3_step() with an incorrectly initialized virtual
 ** machine or a virtual machine that has been deleted or that is associated
 ** with an sqlite structure that has been closed.
 */
-int sqlite_step(
+int sqlite3_step(
   sqlite_vm *pVm,              /* The virtual machine to execute */
   int *pN,                     /* OUT: Number of columns in result */
   const char ***pazValue,      /* OUT: Column data */
@@ -699,39 +699,39 @@
 ** there was any kind of error.  If an error occurred and pzErrMsg is not
 ** NULL, then an error message is written into memory obtained from malloc()
 ** and *pzErrMsg is made to point to that error message.  The calling routine
-** should use sqlite_freemem() to delete this message when it has finished
+** should use sqlite3_freemem() to delete this message when it has finished
 ** with it.
 **
 ** This routine can be called at any point during the execution of the
 ** virtual machine.  If the virtual machine has not completed execution
 ** when this routine is called, that is like encountering an error or
-** an interrupt.  (See sqlite_interrupt().)  Incomplete updates may be
+** an interrupt.  (See sqlite3_interrupt().)  Incomplete updates may be
 ** rolled back and transactions cancelled,  depending on the circumstances,
 ** and the result code returned will be SQLITE_ABORT.
 */
-int sqlite_finalize(sqlite_vm*, char **pzErrMsg);
+int sqlite3_finalize(sqlite_vm*, char **pzErrMsg);
 
 /*
 ** This routine deletes the virtual machine, writes any error message to
 ** *pzErrMsg and returns an SQLite return code in the same way as the
-** sqlite_finalize() function.
+** sqlite3_finalize() function.
 **
 ** Additionally, if ppVm is not NULL, *ppVm is left pointing to a new virtual
 ** machine loaded with the compiled version of the original query ready for
 ** execution.
 **
-** If sqlite_reset() returns SQLITE_SCHEMA, then *ppVm is set to NULL.
+** If sqlite3_reset() returns SQLITE_SCHEMA, then *ppVm is set to NULL.
 **
 ******* THIS IS AN EXPERIMENTAL API AND IS SUBJECT TO CHANGE ******
 */
-int sqlite_reset(sqlite_vm*, char **pzErrMsg);
+int sqlite3_reset(sqlite_vm*, char **pzErrMsg);
 
 /*
-** If the SQL that was handed to sqlite_compile contains variables that
+** If the SQL that was handed to sqlite3_compile contains variables that
 ** are represeted in the SQL text by a question mark ('?').  This routine
 ** is used to assign values to those variables.
 **
-** The first parameter is a virtual machine obtained from sqlite_compile().
+** The first parameter is a virtual machine obtained from sqlite3_compile().
 ** The 2nd "idx" parameter determines which variable in the SQL statement
 ** to bind the value to.  The left most '?' is 1.  The 3rd parameter is
 ** the value to assign to that variable.  The 4th parameter is the number
@@ -748,17 +748,17 @@
 ** If the 4th "len" parameter is -1, then strlen() is used to find the
 ** length.
 **
-** This routine can only be called immediately after sqlite_compile()
-** or sqlite_reset() and before any calls to sqlite_step().
+** This routine can only be called immediately after sqlite3_compile()
+** or sqlite3_reset() and before any calls to sqlite3_step().
 **
 ******* THIS IS AN EXPERIMENTAL API AND IS SUBJECT TO CHANGE ******
 */
-int sqlite_bind(sqlite_vm*, int idx, const char *value, int len, int copy);
+int sqlite3_bind(sqlite_vm*, int idx, const char *value, int len, int copy);
 
 /*
 ** This routine configures a callback function - the progress callback - that
-** is invoked periodically during long running calls to sqlite_exec(),
-** sqlite_step() and sqlite_get_table(). An example use for this API is to keep
+** is invoked periodically during long running calls to sqlite3_exec(),
+** sqlite3_step() and sqlite3_get_table(). An example use for this API is to keep
 ** a GUI updated during a large query.
 **
 ** The progress callback is invoked once for every N virtual machine opcodes,
@@ -767,7 +767,7 @@
 ** argument to this function is a void pointer passed to the progress callback
 ** function each time it is invoked.
 **
-** If a call to sqlite_exec(), sqlite_step() or sqlite_get_table() results 
+** If a call to sqlite3_exec(), sqlite3_step() or sqlite3_get_table() results 
 ** in less than N opcodes being executed, then the progress callback is not
 ** invoked.
 ** 
@@ -778,11 +778,11 @@
 ** If the progress callback returns a result other than 0, then the current 
 ** query is immediately terminated and any database changes rolled back. If the
 ** query was part of a larger transaction, then the transaction is not rolled
-** back and remains active. The sqlite_exec() call returns SQLITE_ABORT. 
+** back and remains active. The sqlite3_exec() call returns SQLITE_ABORT. 
 **
 ******* THIS IS AN EXPERIMENTAL API AND IS SUBJECT TO CHANGE ******
 */
-void sqlite_progress_handler(sqlite*, int, int(*)(void*), void*);
+void sqlite3_progress_handler(sqlite*, int, int(*)(void*), void*);
 
 /*
 ** Register a callback function to be invoked whenever a new transaction
@@ -797,16 +797,16 @@
 **
 ******* THIS IS AN EXPERIMENTAL API AND IS SUBJECT TO CHANGE ******
 */
-void *sqlite_commit_hook(sqlite*, int(*)(void*), void*);
+void *sqlite3_commit_hook(sqlite*, int(*)(void*), void*);
 
 /*
 ** Open an encrypted SQLite database.  If pKey==0 or nKey==0, this routine
-** is the same as sqlite_open().
+** is the same as sqlite3_open().
 **
 ** The code to implement this API is not available in the public release
 ** of SQLite.
 */
-sqlite *sqlite_open_encrypted(
+sqlite *sqlite3_open_encrypted(
   const char *zFilename,   /* Name of the encrypted database */
   const void *pKey,        /* Pointer to the key */
   int nKey,                /* Number of bytes in the key */
diff --git a/src/sqliteInt.h b/src/sqliteInt.h
index c2a5be9..a04fb2c 100644
--- a/src/sqliteInt.h
+++ b/src/sqliteInt.h
@@ -11,7 +11,7 @@
 *************************************************************************
 ** Internal interface definitions for SQLite.
 **
-** @(#) $Id: sqliteInt.h,v 1.227 2004/05/10 10:05:54 danielk1977 Exp $
+** @(#) $Id: sqliteInt.h,v 1.228 2004/05/10 10:34:52 danielk1977 Exp $
 */
 #include "config.h"
 #include "sqlite.h"
@@ -197,16 +197,16 @@
 ** This variable gets set if malloc() ever fails.  After it gets set,
 ** the SQLite library shuts down permanently.
 */
-extern int sqlite_malloc_failed;
+extern int sqlite3_malloc_failed;
 
 /*
 ** The following global variables are used for testing and debugging
 ** only.  They only work if MEMORY_DEBUG is defined.
 */
 #ifdef MEMORY_DEBUG
-extern int sqlite_nMalloc;       /* Number of sqliteMalloc() calls */
-extern int sqlite_nFree;         /* Number of sqliteFree() calls */
-extern int sqlite_iMallocFail;   /* Fail sqliteMalloc() after this many calls */
+extern int sqlite3_nMalloc;       /* Number of sqliteMalloc() calls */
+extern int sqlite3_nFree;         /* Number of sqliteFree() calls */
+extern int sqlite3_iMallocFail;   /* Fail sqliteMalloc() after this many calls */
 #endif
 
 /*
@@ -339,7 +339,7 @@
 ** longer (since after version 2.8.12) reset to -1.
 **
 ** The sqlite.nChange does not count changes within triggers and keeps no
-** context.  It is reset at start of sqlite_exec.
+** context.  It is reset at start of sqlite3_exec.
 ** The sqlite.lsChange represents the number of changes made by the last
 ** insert, update, or delete statement.  It remains constant throughout the
 ** length of a statement and is then updated by OP_SetCounts.  It keeps a
@@ -1276,7 +1276,7 @@
 int sqlite3FixExprList(DbFixer*, ExprList*);
 int sqlite3FixTriggerStep(DbFixer*, TriggerStep*);
 double sqlite3AtoF(const char *z, const char **);
-char *sqlite_snprintf(int,char*,const char*,...);
+char *sqlite3_snprintf(int,char*,const char*,...);
 int sqlite3FitsIn32Bits(const char *);
 
 unsigned char *sqlite3utf16to8(const void *pData, int N);
diff --git a/src/table.c b/src/table.c
index 39692c2..f47ba60 100644
--- a/src/table.c
+++ b/src/table.c
@@ -9,9 +9,9 @@
 **    May you share freely, never taking more than you give.
 **
 *************************************************************************
-** This file contains the sqlite_get_table() and sqlite_free_table()
+** This file contains the sqlite3_get_table() and sqlite3_free_table()
 ** interface routines.  These are just wrappers around the main
-** interface routine of sqlite_exec().
+** interface routine of sqlite3_exec().
 **
 ** These routines are in a separate files so that they will not be linked
 ** if they are not used.
@@ -21,7 +21,7 @@
 #include "sqliteInt.h"
 
 /*
-** This structure is used to pass data from sqlite_get_table() through
+** This structure is used to pass data from sqlite3_get_table() through
 ** to the callback function is uses to build the result.
 */
 typedef struct TabResult {
@@ -40,7 +40,7 @@
 ** is to fill in the TabResult structure appropriately, allocating new
 ** memory as necessary.
 */
-static int sqlite_get_table_cb(void *pArg, int nCol, char **argv, char **colv){
+static int sqlite3_get_table_cb(void *pArg, int nCol, char **argv, char **colv){
   TabResult *p = (TabResult*)pArg;
   int need;
   int i;
@@ -85,7 +85,7 @@
     }
   }else if( p->nColumn!=nCol ){
     sqlite3SetString(&p->zErrMsg,
-       "sqlite_get_table() called with two or more incompatible queries",
+       "sqlite3_get_table() called with two or more incompatible queries",
        (char*)0);
     p->rc = SQLITE_ERROR;
     return 1;
@@ -119,10 +119,10 @@
 **
 ** The result that is written to ***pazResult is held in memory obtained
 ** from malloc().  But the caller cannot free this memory directly.  
-** Instead, the entire table should be passed to sqlite_free_table() when
+** Instead, the entire table should be passed to sqlite3_free_table() when
 ** the calling procedure is finished using it.
 */
-int sqlite_get_table(
+int sqlite3_get_table(
   sqlite *db,                 /* The database on which the SQL executes */
   const char *zSql,           /* The SQL to be executed */
   char ***pazResult,          /* Write the result table here */
@@ -148,12 +148,12 @@
     return SQLITE_NOMEM;
   }
   res.azResult[0] = 0;
-  rc = sqlite_exec(db, zSql, sqlite_get_table_cb, &res, pzErrMsg);
+  rc = sqlite3_exec(db, zSql, sqlite3_get_table_cb, &res, pzErrMsg);
   if( res.azResult ){
     res.azResult[0] = (char*)res.nData;
   }
   if( rc==SQLITE_ABORT ){
-    sqlite_free_table(&res.azResult[1]);
+    sqlite3_free_table(&res.azResult[1]);
     if( res.zErrMsg ){
       if( pzErrMsg ){
         free(*pzErrMsg);
@@ -167,14 +167,14 @@
   }
   sqliteFree(res.zErrMsg);
   if( rc!=SQLITE_OK ){
-    sqlite_free_table(&res.azResult[1]);
+    sqlite3_free_table(&res.azResult[1]);
     return rc;
   }
   if( res.nAlloc>res.nData ){
     char **azNew;
     azNew = realloc( res.azResult, sizeof(char*)*(res.nData+1) );
     if( azNew==0 ){
-      sqlite_free_table(&res.azResult[1]);
+      sqlite3_free_table(&res.azResult[1]);
       return SQLITE_NOMEM;
     }
     res.nAlloc = res.nData+1;
@@ -187,10 +187,10 @@
 }
 
 /*
-** This routine frees the space the sqlite_get_table() malloced.
+** This routine frees the space the sqlite3_get_table() malloced.
 */
-void sqlite_free_table(
-  char **azResult             /* Result returned from from sqlite_get_table() */
+void sqlite3_free_table(
+  char **azResult             /* Result returned from from sqlite3_get_table() */
 ){
   if( azResult ){
     int i, n;
diff --git a/src/tclsqlite.c b/src/tclsqlite.c
index 474a72b..2c3b921 100644
--- a/src/tclsqlite.c
+++ b/src/tclsqlite.c
@@ -11,7 +11,7 @@
 *************************************************************************
 ** A TCL Interface to SQLite
 **
-** $Id: tclsqlite.c,v 1.63 2004/05/08 08:23:37 danielk1977 Exp $
+** $Id: tclsqlite.c,v 1.64 2004/05/10 10:34:53 danielk1977 Exp $
 */
 #ifndef NO_TCL     /* Omit this whole file if TCL is unavailable */
 
@@ -56,7 +56,7 @@
   char *zProgress;      /* The progress callback routine */
   char *zAuth;          /* The authorization callback routine */
   SqlFunc *pFunc;       /* List of SQL functions */
-  int rc;               /* Return code of most recent sqlite_exec() */
+  int rc;               /* Return code of most recent sqlite3_exec() */
 };
 
 /*
@@ -185,10 +185,10 @@
       Tcl_SetVar2(cbData->interp, cbData->zArray, "*", azN[i],
          TCL_LIST_ELEMENT|TCL_APPEND_VALUE);
       if( azN[nCol] ){
-        char *z = sqlite_mprintf("typeof:%s", azN[i]);
+        char *z = sqlite3_mprintf("typeof:%s", azN[i]);
         Tcl_SetVar2(cbData->interp, cbData->zArray, z, azN[i+nCol],
            TCL_LIST_ELEMENT|TCL_APPEND_VALUE);
-        sqlite_freemem(z);
+        sqlite3_freemem(z);
       }
     }
     cbData->once = 0;
@@ -284,7 +284,7 @@
 */
 static void DbDeleteCmd(void *db){
   SqliteDb *pDb = (SqliteDb*)db;
-  sqlite_close(pDb->db);
+  sqlite3_close(pDb->db);
   while( pDb->pFunc ){
     SqlFunc *pFunc = pDb->pFunc;
     pDb->pFunc = pFunc->pNext;
@@ -380,7 +380,7 @@
 ** using TCL script.
 */
 static void tclSqlFunc(sqlite_func *context, int argc, const char **argv){
-  SqlFunc *p = sqlite_user_data(context);
+  SqlFunc *p = sqlite3_user_data(context);
   Tcl_DString cmd;
   int i;
   int rc;
@@ -392,9 +392,9 @@
   }
   rc = Tcl_Eval(p->interp, Tcl_DStringValue(&cmd));
   if( rc ){
-    sqlite_set_result_error(context, Tcl_GetStringResult(p->interp), -1); 
+    sqlite3_set_result_error(context, Tcl_GetStringResult(p->interp), -1); 
   }else{
-    sqlite_set_result_string(context, Tcl_GetStringResult(p->interp), -1);
+    sqlite3_set_result_string(context, Tcl_GetStringResult(p->interp), -1);
   }
 }
 #ifndef SQLITE_OMIT_AUTHORIZATION
@@ -556,9 +556,9 @@
 #ifndef SQLITE_OMIT_AUTHORIZATION
       if( pDb->zAuth ){
         pDb->interp = interp;
-        sqlite_set_authorizer(pDb->db, auth_callback, pDb);
+        sqlite3_set_authorizer(pDb->db, auth_callback, pDb);
       }else{
-        sqlite_set_authorizer(pDb->db, 0, 0);
+        sqlite3_set_authorizer(pDb->db, 0, 0);
       }
 #endif
     }
@@ -593,9 +593,9 @@
       }
       if( pDb->zBusy ){
         pDb->interp = interp;
-        sqlite_busy_handler(pDb->db, DbBusyHandler, pDb);
+        sqlite3_busy_handler(pDb->db, DbBusyHandler, pDb);
       }else{
-        sqlite_busy_handler(pDb->db, 0, 0);
+        sqlite3_busy_handler(pDb->db, 0, 0);
       }
     }
     break;
@@ -631,9 +631,9 @@
 #ifndef SQLITE_OMIT_PROGRESS_CALLBACK
       if( pDb->zProgress ){
         pDb->interp = interp;
-        sqlite_progress_handler(pDb->db, N, DbProgressHandler, pDb);
+        sqlite3_progress_handler(pDb->db, N, DbProgressHandler, pDb);
       }else{
-        sqlite_progress_handler(pDb->db, 0, 0, 0);
+        sqlite3_progress_handler(pDb->db, 0, 0, 0);
       }
 #endif
     }else{
@@ -656,7 +656,7 @@
       Tcl_WrongNumArgs(interp, 2, objv, "");
       return TCL_ERROR;
     }
-    nChange = sqlite_changes(pDb->db);
+    nChange = sqlite3_changes(pDb->db);
     pResult = Tcl_GetObjResult(interp);
     Tcl_SetIntObj(pResult, nChange);
     break;
@@ -676,7 +676,7 @@
       Tcl_WrongNumArgs(interp, 2, objv, "");
       return TCL_ERROR;
     }
-    lsChange = sqlite_last_statement_changes(pDb->db);
+    lsChange = sqlite3_last_statement_changes(pDb->db);
     pResult = Tcl_GetObjResult(interp);
     Tcl_SetIntObj(pResult, lsChange);
     break;
@@ -720,9 +720,9 @@
       }
       if( pDb->zCommit ){
         pDb->interp = interp;
-        sqlite_commit_hook(pDb->db, DbCommitHandler, pDb);
+        sqlite3_commit_hook(pDb->db, DbCommitHandler, pDb);
       }else{
-        sqlite_commit_hook(pDb->db, 0, 0);
+        sqlite3_commit_hook(pDb->db, 0, 0);
       }
     }
     break;
@@ -741,7 +741,7 @@
       Tcl_WrongNumArgs(interp, 2, objv, "SQL");
       return TCL_ERROR;
     }
-    isComplete = sqlite_complete( Tcl_GetStringFromObj(objv[2], 0) );
+    isComplete = sqlite3_complete( Tcl_GetStringFromObj(objv[2], 0) );
     pResult = Tcl_GetObjResult(interp);
     Tcl_SetBooleanObj(pResult, isComplete);
     break;
@@ -751,7 +751,7 @@
   **    $db errorcode
   **
   ** Return the numeric error code that was returned by the most recent
-  ** call to sqlite_exec().
+  ** call to sqlite3_exec().
   */
   case DB_ERRORCODE: {
     Tcl_SetObjResult(interp, Tcl_NewIntObj(pDb->rc));
@@ -799,14 +799,14 @@
       zErrMsg = 0;
       Tcl_IncrRefCount(objv[3]);
       Tcl_IncrRefCount(objv[4]);
-      rc = sqlite_exec(pDb->db, zSql, DbEvalCallback, &cbData, &zErrMsg);
+      rc = sqlite3_exec(pDb->db, zSql, DbEvalCallback, &cbData, &zErrMsg);
       Tcl_DecrRefCount(objv[4]);
       Tcl_DecrRefCount(objv[3]);
       if( cbData.tcl_rc==TCL_BREAK ){ cbData.tcl_rc = TCL_OK; }
     }else{
       Tcl_Obj *pList = Tcl_NewObj();
       cbData.tcl_rc = TCL_OK;
-      rc = sqlite_exec(pDb->db, zSql, DbEvalCallback2, pList, &zErrMsg);
+      rc = sqlite3_exec(pDb->db, zSql, DbEvalCallback2, pList, &zErrMsg);
       Tcl_SetObjResult(interp, pList);
     }
     pDb->rc = rc;
@@ -818,7 +818,7 @@
       free(zErrMsg);
       rc = TCL_ERROR;
     }else if( rc!=SQLITE_OK ){
-      Tcl_AppendResult(interp, sqlite_error_string(rc), 0);
+      Tcl_AppendResult(interp, sqlite3_error_string(rc), 0);
       rc = TCL_ERROR;
     }else{
     }
@@ -859,8 +859,8 @@
     pFunc->pNext = pDb->pFunc;
     pFunc->zScript = (char*)&pFunc[1];
     strcpy(pFunc->zScript, zScript);
-    sqlite_create_function(pDb->db, zName, -1, tclSqlFunc, pFunc);
-    sqlite_function_type(pDb->db, zName, SQLITE_NUMERIC);
+    sqlite3_create_function(pDb->db, zName, -1, tclSqlFunc, pFunc);
+    sqlite3_function_type(pDb->db, zName, SQLITE_NUMERIC);
     break;
   }
 
@@ -876,7 +876,7 @@
       Tcl_WrongNumArgs(interp, 2, objv, "");
       return TCL_ERROR;
     }
-    rowid = sqlite_last_insert_rowid(pDb->db);
+    rowid = sqlite3_last_insert_rowid(pDb->db);
     pResult = Tcl_GetObjResult(interp);
     Tcl_SetIntObj(pResult, rowid);
     break;
@@ -895,7 +895,7 @@
       return TCL_ERROR;
     }
     zSql = Tcl_GetStringFromObj(objv[2], 0);
-    rc = sqlite_exec(pDb->db, zSql, DbEvalCallback3, interp, &zErrMsg);
+    rc = sqlite3_exec(pDb->db, zSql, DbEvalCallback3, interp, &zErrMsg);
     if( rc==SQLITE_ABORT ){
       rc = SQLITE_OK;
     }else if( zErrMsg ){
@@ -903,7 +903,7 @@
       free(zErrMsg);
       rc = TCL_ERROR;
     }else if( rc!=SQLITE_OK ){
-      Tcl_AppendResult(interp, sqlite_error_string(rc), 0);
+      Tcl_AppendResult(interp, sqlite3_error_string(rc), 0);
       rc = TCL_ERROR;
     }
     break;
@@ -925,7 +925,7 @@
 #ifdef SQLITE_HAS_CODEC
     rc = sqlite_rekey(pDb->db, pKey, nKey);
     if( rc ){
-      Tcl_AppendResult(interp, sqlite_error_string(rc), 0);
+      Tcl_AppendResult(interp, sqlite3_error_string(rc), 0);
       rc = TCL_ERROR;
     }
 #endif
@@ -944,7 +944,7 @@
       return TCL_ERROR;
     }
     if( Tcl_GetIntFromObj(interp, objv[2], &ms) ) return TCL_ERROR;
-    sqlite_busy_timeout(pDb->db, ms);
+    sqlite3_busy_timeout(pDb->db, ms);
     break;
   }
 
@@ -976,9 +976,9 @@
       }
       if( pDb->zTrace ){
         pDb->interp = interp;
-        sqlite_trace(pDb->db, DbTraceHandler, pDb);
+        sqlite3_trace(pDb->db, DbTraceHandler, pDb);
       }else{
-        sqlite_trace(pDb->db, 0, 0);
+        sqlite3_trace(pDb->db, 0, 0);
       }
     }
     break;
@@ -1031,11 +1031,11 @@
   if( objc==2 ){
     zArg = Tcl_GetStringFromObj(objv[1], 0);
     if( strcmp(zArg,"-encoding")==0 ){
-      Tcl_AppendResult(interp,sqlite_encoding,0);
+      Tcl_AppendResult(interp,sqlite3_encoding,0);
       return TCL_OK;
     }
     if( strcmp(zArg,"-version")==0 ){
-      Tcl_AppendResult(interp,sqlite_version,0);
+      Tcl_AppendResult(interp,sqlite3_version,0);
       return TCL_OK;
     }
     if( strcmp(zArg,"-has-codec")==0 ){
@@ -1086,9 +1086,9 @@
   memset(p, 0, sizeof(*p));
   zFile = Tcl_GetStringFromObj(objv[2], 0);
 #ifdef SQLITE_HAS_CODEC
-  p->db = sqlite_open_encrypted(zFile, pKey, nKey, 0, &zErrMsg);
+  p->db = sqlite3_open_encrypted(zFile, pKey, nKey, 0, &zErrMsg);
 #else
-  p->db = sqlite_open(zFile, mode, &zErrMsg);
+  p->db = sqlite3_open(zFile, mode, &zErrMsg);
 #endif
   if( p->db==0 ){
     Tcl_SetResult(interp, zErrMsg, TCL_VOLATILE);
diff --git a/src/test1.c b/src/test1.c
index 3436bc7..109beb9 100644
--- a/src/test1.c
+++ b/src/test1.c
@@ -13,7 +13,7 @@
 ** is not included in the SQLite library.  It is used for automated
 ** testing of the SQLite library.
 **
-** $Id: test1.c,v 1.37 2004/05/08 08:23:39 danielk1977 Exp $
+** $Id: test1.c,v 1.38 2004/05/10 10:34:53 danielk1977 Exp $
 */
 #include "sqliteInt.h"
 #include "tcl.h"
@@ -82,7 +82,7 @@
 }
 
 /*
-** Usage:   sqlite_open filename
+** Usage:   sqlite3_open filename
 **
 ** Returns:  The name of an open database.
 */
@@ -100,7 +100,7 @@
        " FILENAME\"", 0);
     return TCL_ERROR;
   }
-  db = sqlite_open(argv[1], 0666, &zErr);
+  db = sqlite3_open(argv[1], 0666, &zErr);
   if( db==0 ){
     Tcl_AppendResult(interp, zErr, 0);
     free(zErr);
@@ -112,7 +112,7 @@
 }
 
 /*
-** The callback routine for sqlite_exec_printf().
+** The callback routine for sqlite3_exec_printf().
 */
 static int exec_printf_cb(void *pArg, int argc, char **argv, char **name){
   Tcl_DString *str = (Tcl_DString*)pArg;
@@ -130,9 +130,9 @@
 }
 
 /*
-** Usage:  sqlite_exec_printf  DB  FORMAT  STRING
+** Usage:  sqlite3_exec_printf  DB  FORMAT  STRING
 **
-** Invoke the sqlite_exec_printf() interface using the open database
+** Invoke the sqlite3_exec_printf() interface using the open database
 ** DB.  The SQL is the string FORMAT.  The format string should contain
 ** one %s or %q.  STRING is the value inserted into %s or %q.
 */
@@ -154,7 +154,7 @@
   }
   if( getDbPointer(interp, argv[1], &db) ) return TCL_ERROR;
   Tcl_DStringInit(&str);
-  rc = sqlite_exec_printf(db, argv[2], exec_printf_cb, &str, &zErr, argv[3]);
+  rc = sqlite3_exec_printf(db, argv[2], exec_printf_cb, &str, &zErr, argv[3]);
   sprintf(zBuf, "%d", rc);
   Tcl_AppendElement(interp, zBuf);
   Tcl_AppendElement(interp, rc==SQLITE_OK ? Tcl_DStringValue(&str) : zErr);
@@ -164,7 +164,7 @@
 }
 
 /*
-** Usage:  sqlite_mprintf_z_test  SEPARATOR  ARG0  ARG1 ...
+** Usage:  sqlite3_mprintf_z_test  SEPARATOR  ARG0  ARG1 ...
 **
 ** Test the %z format of mprintf().  Use multiple mprintf() calls to 
 ** concatenate arg0 through argn using separator as the separator.
@@ -188,9 +188,9 @@
 }
 
 /*
-** Usage:  sqlite_get_table_printf  DB  FORMAT  STRING
+** Usage:  sqlite3_get_table_printf  DB  FORMAT  STRING
 **
-** Invoke the sqlite_get_table_printf() interface using the open database
+** Invoke the sqlite3_get_table_printf() interface using the open database
 ** DB.  The SQL is the string FORMAT.  The format string should contain
 ** one %s or %q.  STRING is the value inserted into %s or %q.
 */
@@ -215,7 +215,7 @@
   }
   if( getDbPointer(interp, argv[1], &db) ) return TCL_ERROR;
   Tcl_DStringInit(&str);
-  rc = sqlite_get_table_printf(db, argv[2], &aResult, &nRow, &nCol, 
+  rc = sqlite3_get_table_printf(db, argv[2], &aResult, &nRow, &nCol, 
                &zErr, argv[3]);
   sprintf(zBuf, "%d", rc);
   Tcl_AppendElement(interp, zBuf);
@@ -230,14 +230,14 @@
   }else{
     Tcl_AppendElement(interp, zErr);
   }
-  sqlite_free_table(aResult);
+  sqlite3_free_table(aResult);
   if( zErr ) free(zErr);
   return TCL_OK;
 }
 
 
 /*
-** Usage:  sqlite_last_insert_rowid DB
+** Usage:  sqlite3_last_insert_rowid DB
 **
 ** Returns the integer ROWID of the most recent insert.
 */
@@ -255,15 +255,15 @@
     return TCL_ERROR;
   }
   if( getDbPointer(interp, argv[1], &db) ) return TCL_ERROR;
-  sprintf(zBuf, "%d", sqlite_last_insert_rowid(db));
+  sprintf(zBuf, "%d", sqlite3_last_insert_rowid(db));
   Tcl_AppendResult(interp, zBuf, 0);
   return SQLITE_OK;
 }
 
 /*
-** Usage:  sqlite_close DB
+** Usage:  sqlite3_close DB
 **
-** Closes the database opened by sqlite_open.
+** Closes the database opened by sqlite3_open.
 */
 static int sqlite_test_close(
   void *NotUsed,
@@ -278,7 +278,7 @@
     return TCL_ERROR;
   }
   if( getDbPointer(interp, argv[1], &db) ) return TCL_ERROR;
-  sqlite_close(db);
+  sqlite3_close(db);
   return TCL_OK;
 }
 
@@ -290,7 +290,7 @@
   int i;
   for(i=0; i<argc; i++){
     if( argv[i] ){
-      sqlite_set_result_string(context, argv[i], -1);
+      sqlite3_set_result_string(context, argv[i], -1);
       break;
     }
   }
@@ -345,11 +345,11 @@
 }
 
 /*
-** Implementation of the x_sqlite_exec() function.  This function takes
+** Implementation of the x_sqlite3_exec() function.  This function takes
 ** a single argument and attempts to execute that argument as SQL code.
 ** This is illegal and should set the SQLITE_MISUSE flag on the database.
 **
-** 2004-Jan-07:  We have changed this to make it legal to call sqlite_exec()
+** 2004-Jan-07:  We have changed this to make it legal to call sqlite3_exec()
 ** from within a function call.  
 ** 
 ** This routine simulates the effect of having two threads attempt to
@@ -358,25 +358,25 @@
 static void sqlite3ExecFunc(sqlite_func *context, int argc, const char **argv){
   struct dstr x;
   memset(&x, 0, sizeof(x));
-  sqlite_exec((sqlite*)sqlite_user_data(context), argv[0], 
+  sqlite3_exec((sqlite*)sqlite3_user_data(context), argv[0], 
       execFuncCallback, &x, 0);
-  sqlite_set_result_string(context, x.z, x.nUsed);
+  sqlite3_set_result_string(context, x.z, x.nUsed);
   sqliteFree(x.z);
 }
 
 /*
 ** Usage:  sqlite_test_create_function DB
 **
-** Call the sqlite_create_function API on the given database in order
+** Call the sqlite3_create_function API on the given database in order
 ** to create a function named "x_coalesce".  This function does the same thing
 ** as the "coalesce" function.  This function also registers an SQL function
-** named "x_sqlite_exec" that invokes sqlite_exec().  Invoking sqlite_exec()
+** named "x_sqlite3_exec" that invokes sqlite3_exec().  Invoking sqlite3_exec()
 ** in this way is illegal recursion and should raise an SQLITE_MISUSE error.
 ** The effect is similar to trying to use the same database connection from
 ** two threads at the same time.
 **
 ** The original motivation for this routine was to be able to call the
-** sqlite_create_function function while a query is in progress in order
+** sqlite3_create_function function while a query is in progress in order
 ** to test the SQLITE_MISUSE detection logic.
 */
 static int test_create_function(
@@ -393,8 +393,8 @@
     return TCL_ERROR;
   }
   if( getDbPointer(interp, argv[1], &db) ) return TCL_ERROR;
-  sqlite_create_function(db, "x_coalesce", -1, ifnullFunc, 0);
-  sqlite_create_function(db, "x_sqlite_exec", 1, sqlite3ExecFunc, db);
+  sqlite3_create_function(db, "x_coalesce", -1, ifnullFunc, 0);
+  sqlite3_create_function(db, "x_sqlite3_exec", 1, sqlite3ExecFunc, db);
   return TCL_OK;
 }
 
@@ -407,26 +407,26 @@
 };
 static void countStep(sqlite_func *context, int argc, const char **argv){
   CountCtx *p;
-  p = sqlite_aggregate_context(context, sizeof(*p));
+  p = sqlite3_aggregate_context(context, sizeof(*p));
   if( (argc==0 || argv[0]) && p ){
     p->n++;
   }
 }   
 static void countFinalize(sqlite_func *context){
   CountCtx *p;
-  p = sqlite_aggregate_context(context, sizeof(*p));
-  sqlite_set_result_int(context, p ? p->n : 0);
+  p = sqlite3_aggregate_context(context, sizeof(*p));
+  sqlite3_set_result_int(context, p ? p->n : 0);
 }
 
 /*
 ** Usage:  sqlite_test_create_aggregate DB
 **
-** Call the sqlite_create_function API on the given database in order
+** Call the sqlite3_create_function API on the given database in order
 ** to create a function named "x_count".  This function does the same thing
 ** as the "md5sum" function.
 **
 ** The original motivation for this routine was to be able to call the
-** sqlite_create_aggregate function while a query is in progress in order
+** sqlite3_create_aggregate function while a query is in progress in order
 ** to test the SQLITE_MISUSE detection logic.
 */
 static int test_create_aggregate(
@@ -442,19 +442,19 @@
     return TCL_ERROR;
   }
   if( getDbPointer(interp, argv[1], &db) ) return TCL_ERROR;
-  sqlite_create_aggregate(db, "x_count", 0, countStep, countFinalize, 0);
-  sqlite_create_aggregate(db, "x_count", 1, countStep, countFinalize, 0);
+  sqlite3_create_aggregate(db, "x_count", 0, countStep, countFinalize, 0);
+  sqlite3_create_aggregate(db, "x_count", 1, countStep, countFinalize, 0);
   return TCL_OK;
 }
 
 
 
 /*
-** Usage:  sqlite_mprintf_int FORMAT INTEGER INTEGER INTEGER
+** Usage:  sqlite3_mprintf_int FORMAT INTEGER INTEGER INTEGER
 **
 ** Call mprintf with three integer arguments
 */
-static int sqlite_mprintf_int(
+static int sqlite3_mprintf_int(
   void *NotUsed,
   Tcl_Interp *interp,    /* The TCL interpreter that invoked this command */
   int argc,              /* Number of arguments */
@@ -470,18 +470,18 @@
   for(i=2; i<5; i++){
     if( Tcl_GetInt(interp, argv[i], &a[i-2]) ) return TCL_ERROR;
   }
-  z = sqlite_mprintf(argv[1], a[0], a[1], a[2]);
+  z = sqlite3_mprintf(argv[1], a[0], a[1], a[2]);
   Tcl_AppendResult(interp, z, 0);
-  sqlite_freemem(z);
+  sqlite3_freemem(z);
   return TCL_OK;
 }
 
 /*
-** Usage:  sqlite_mprintf_str FORMAT INTEGER INTEGER STRING
+** Usage:  sqlite3_mprintf_str FORMAT INTEGER INTEGER STRING
 **
 ** Call mprintf with two integer arguments and one string argument
 */
-static int sqlite_mprintf_str(
+static int sqlite3_mprintf_str(
   void *NotUsed,
   Tcl_Interp *interp,    /* The TCL interpreter that invoked this command */
   int argc,              /* Number of arguments */
@@ -497,18 +497,18 @@
   for(i=2; i<4; i++){
     if( Tcl_GetInt(interp, argv[i], &a[i-2]) ) return TCL_ERROR;
   }
-  z = sqlite_mprintf(argv[1], a[0], a[1], argc>4 ? argv[4] : NULL);
+  z = sqlite3_mprintf(argv[1], a[0], a[1], argc>4 ? argv[4] : NULL);
   Tcl_AppendResult(interp, z, 0);
-  sqlite_freemem(z);
+  sqlite3_freemem(z);
   return TCL_OK;
 }
 
 /*
-** Usage:  sqlite_mprintf_str FORMAT INTEGER INTEGER DOUBLE
+** Usage:  sqlite3_mprintf_str FORMAT INTEGER INTEGER DOUBLE
 **
 ** Call mprintf with two integer arguments and one double argument
 */
-static int sqlite_mprintf_double(
+static int sqlite3_mprintf_double(
   void *NotUsed,
   Tcl_Interp *interp,    /* The TCL interpreter that invoked this command */
   int argc,              /* Number of arguments */
@@ -526,20 +526,20 @@
     if( Tcl_GetInt(interp, argv[i], &a[i-2]) ) return TCL_ERROR;
   }
   if( Tcl_GetDouble(interp, argv[4], &r) ) return TCL_ERROR;
-  z = sqlite_mprintf(argv[1], a[0], a[1], r);
+  z = sqlite3_mprintf(argv[1], a[0], a[1], r);
   Tcl_AppendResult(interp, z, 0);
-  sqlite_freemem(z);
+  sqlite3_freemem(z);
   return TCL_OK;
 }
 
 /*
-** Usage:  sqlite_mprintf_str FORMAT DOUBLE DOUBLE
+** Usage:  sqlite3_mprintf_str FORMAT DOUBLE DOUBLE
 **
 ** Call mprintf with a single double argument which is the product of the
 ** two arguments given above.  This is used to generate overflow and underflow
 ** doubles to test that they are converted properly.
 */
-static int sqlite_mprintf_scaled(
+static int sqlite3_mprintf_scaled(
   void *NotUsed,
   Tcl_Interp *interp,    /* The TCL interpreter that invoked this command */
   int argc,              /* Number of arguments */
@@ -556,9 +556,9 @@
   for(i=2; i<4; i++){
     if( Tcl_GetDouble(interp, argv[i], &r[i-2]) ) return TCL_ERROR;
   }
-  z = sqlite_mprintf(argv[1], r[0]*r[1]);
+  z = sqlite3_mprintf(argv[1], r[0]*r[1]);
   Tcl_AppendResult(interp, z, 0);
-  sqlite_freemem(z);
+  sqlite3_freemem(z);
   return TCL_OK;
 }
 
@@ -566,7 +566,7 @@
 ** Usage: sqlite_malloc_fail N
 **
 ** Rig sqliteMalloc() to fail on the N-th call.  Turn off this mechanism
-** and reset the sqlite_malloc_failed variable is N==0.
+** and reset the sqlite3_malloc_failed variable is N==0.
 */
 #ifdef MEMORY_DEBUG
 static int sqlite_malloc_fail(
@@ -581,8 +581,8 @@
     return TCL_ERROR;
   }
   if( Tcl_GetInt(interp, argv[1], &n) ) return TCL_ERROR;
-  sqlite_iMallocFail = n;
-  sqlite_malloc_failed = 0;
+  sqlite3_iMallocFail = n;
+  sqlite3_malloc_failed = 0;
   return TCL_OK;
 }
 #endif
@@ -600,7 +600,7 @@
   char **argv            /* Text of each argument */
 ){
   char zBuf[200];
-  sprintf(zBuf, "%d %d %d", sqlite_nMalloc, sqlite_nFree, sqlite_iMallocFail);
+  sprintf(zBuf, "%d %d %d", sqlite3_nMalloc, sqlite3_nFree, sqlite3_iMallocFail);
   Tcl_AppendResult(interp, zBuf, 0);
   return TCL_OK;
 }
@@ -630,19 +630,19 @@
 static void testFunc(sqlite_func *context, int argc, const char **argv){
   while( argc>=2 ){
     if( argv[0]==0 ){
-      sqlite_set_result_error(context, "first argument to test function "
+      sqlite3_set_result_error(context, "first argument to test function "
          "may not be NULL", -1);
     }else if( sqlite3StrICmp(argv[0],"string")==0 ){
-      sqlite_set_result_string(context, argv[1], -1);
+      sqlite3_set_result_string(context, argv[1], -1);
     }else if( argv[1]==0 ){
-      sqlite_set_result_error(context, "2nd argument may not be NULL if the "
+      sqlite3_set_result_error(context, "2nd argument may not be NULL if the "
          "first argument is not \"string\"", -1);
     }else if( sqlite3StrICmp(argv[0],"int")==0 ){
-      sqlite_set_result_int(context, atoi(argv[1]));
+      sqlite3_set_result_int(context, atoi(argv[1]));
     }else if( sqlite3StrICmp(argv[0],"double")==0 ){
-      sqlite_set_result_double(context, sqlite3AtoF(argv[1], 0));
+      sqlite3_set_result_double(context, sqlite3AtoF(argv[1], 0));
     }else{
-      sqlite_set_result_error(context,"first argument should be one of: "
+      sqlite3_set_result_error(context,"first argument should be one of: "
           "string int double", -1);
     }
     argc -= 2;
@@ -669,9 +669,9 @@
     return TCL_ERROR;
   }
   if( getDbPointer(interp, argv[1], &db) ) return TCL_ERROR;
-  rc = sqlite_create_function(db, argv[2], -1, testFunc, 0);
+  rc = sqlite3_create_function(db, argv[2], -1, testFunc, 0);
   if( rc!=0 ){
-    Tcl_AppendResult(interp, sqlite_error_string(rc), 0);
+    Tcl_AppendResult(interp, sqlite3_error_string(rc), 0);
     return TCL_ERROR;
   }
   return TCL_OK;
@@ -722,16 +722,16 @@
     return TCL_ERROR;
   }
   if( getDbPointer(interp, argv[1], &db) ) return TCL_ERROR;
-  rc = sqlite_exec(db, argv[2], rememberDataTypes, interp, 0);
+  rc = sqlite3_exec(db, argv[2], rememberDataTypes, interp, 0);
   if( rc!=0 && rc!=SQLITE_ABORT ){
-    Tcl_AppendResult(interp, sqlite_error_string(rc), 0);
+    Tcl_AppendResult(interp, sqlite3_error_string(rc), 0);
     return TCL_ERROR;
   }
   return TCL_OK;
 }
 
 /*
-** Usage:  sqlite_compile  DB  SQL  ?TAILVAR?
+** Usage:  sqlite3_compile  DB  SQL  ?TAILVAR?
 **
 ** Attempt to compile an SQL statement.  Return a pointer to the virtual
 ** machine used to execute that statement.  Unprocessed SQL is written
@@ -755,13 +755,13 @@
     return TCL_ERROR;
   }
   if( getDbPointer(interp, argv[1], &db) ) return TCL_ERROR;
-  rc = sqlite_compile(db, argv[2], argc==4 ? &zTail : 0, &vm, &zErr);
+  rc = sqlite3_compile(db, argv[2], argc==4 ? &zTail : 0, &vm, &zErr);
   if( argc==4 ) Tcl_SetVar(interp, argv[3], zTail, 0);
   if( rc ){
     assert( vm==0 );
     sprintf(zBuf, "(%d) ", rc);
     Tcl_AppendResult(interp, zBuf, zErr, 0);
-    sqlite_freemem(zErr);
+    sqlite3_freemem(zErr);
     return TCL_ERROR;
   }
   if( vm ){
@@ -772,7 +772,7 @@
 }
 
 /*
-** Usage:  sqlite_step  VM  ?NVAR?  ?VALUEVAR?  ?COLNAMEVAR?
+** Usage:  sqlite3_step  VM  ?NVAR?  ?VALUEVAR?  ?COLNAMEVAR?
 **
 ** Step a virtual machine.  Return a the result code as a string.
 ** Column results are written into three variables.
@@ -796,7 +796,7 @@
     return TCL_ERROR;
   }
   if( getVmPointer(interp, argv[1], &vm) ) return TCL_ERROR;
-  rc = sqlite_step(vm, argc>=3?&N:0, argc>=4?&azValue:0, argc==5?&azColName:0);
+  rc = sqlite3_step(vm, argc>=3?&N:0, argc>=4?&azValue:0, argc==5?&azColName:0);
   if( argc>=3 ){
     sprintf(zBuf, "%d", N);
     Tcl_SetVar(interp, argv[2], zBuf, 0);
@@ -832,7 +832,7 @@
 }
 
 /*
-** Usage:  sqlite_finalize  VM 
+** Usage:  sqlite3_finalize  VM 
 **
 ** Shutdown a virtual machine.
 */
@@ -851,19 +851,19 @@
     return TCL_ERROR;
   }
   if( getVmPointer(interp, argv[1], &vm) ) return TCL_ERROR;
-  rc = sqlite_finalize(vm, &zErrMsg);
+  rc = sqlite3_finalize(vm, &zErrMsg);
   if( rc ){
     char zBuf[50];
     sprintf(zBuf, "(%d) ", rc);
     Tcl_AppendResult(interp, zBuf, zErrMsg, 0);
-    sqlite_freemem(zErrMsg);
+    sqlite3_freemem(zErrMsg);
     return TCL_ERROR;
   }
   return TCL_OK;
 }
 
 /*
-** Usage:  sqlite_reset   VM 
+** Usage:  sqlite3_reset   VM 
 **
 ** Reset a virtual machine and prepare it to be run again.
 */
@@ -882,12 +882,12 @@
     return TCL_ERROR;
   }
   if( getVmPointer(interp, argv[1], &vm) ) return TCL_ERROR;
-  rc = sqlite_reset(vm, &zErrMsg);
+  rc = sqlite3_reset(vm, &zErrMsg);
   if( rc ){
     char zBuf[50];
     sprintf(zBuf, "(%d) ", rc);
     Tcl_AppendResult(interp, zBuf, zErrMsg, 0);
-    sqlite_freemem(zErrMsg);
+    sqlite3_freemem(zErrMsg);
     return TCL_ERROR;
   }
   return TCL_OK;
@@ -895,12 +895,12 @@
 
 /*
 ** This is the "static_bind_value" that variables are bound to when
-** the FLAG option of sqlite_bind is "static"
+** the FLAG option of sqlite3_bind is "static"
 */
 static char *sqlite_static_bind_value = 0;
 
 /*
-** Usage:  sqlite_bind  VM  IDX  VALUE  FLAGS
+** Usage:  sqlite3_bind  VM  IDX  VALUE  FLAGS
 **
 ** Sets the value of the IDX-th occurance of "?" in the original SQL
 ** string.  VALUE is the new value.  If FLAGS=="null" then VALUE is
@@ -926,11 +926,11 @@
   if( getVmPointer(interp, argv[1], &vm) ) return TCL_ERROR;
   if( Tcl_GetInt(interp, argv[2], &idx) ) return TCL_ERROR;
   if( strcmp(argv[4],"null")==0 ){
-    rc = sqlite_bind(vm, idx, 0, 0, 0);
+    rc = sqlite3_bind(vm, idx, 0, 0, 0);
   }else if( strcmp(argv[4],"static")==0 ){
-    rc = sqlite_bind(vm, idx, sqlite_static_bind_value, -1, 0);
+    rc = sqlite3_bind(vm, idx, sqlite_static_bind_value, -1, 0);
   }else if( strcmp(argv[4],"normal")==0 ){
-    rc = sqlite_bind(vm, idx, argv[3], -1, 1);
+    rc = sqlite3_bind(vm, idx, argv[3], -1, 1);
   }else{
     Tcl_AppendResult(interp, "4th argument should be "
         "\"null\" or \"static\" or \"normal\"", 0);
@@ -939,7 +939,7 @@
   if( rc ){
     char zBuf[50];
     sprintf(zBuf, "(%d) ", rc);
-    Tcl_AppendResult(interp, zBuf, sqlite_error_string(rc), 0);
+    Tcl_AppendResult(interp, zBuf, sqlite3_error_string(rc), 0);
     return TCL_ERROR;
   }
   return TCL_OK;
@@ -971,26 +971,26 @@
 ** Register commands with the TCL interpreter.
 */
 int Sqlitetest1_Init(Tcl_Interp *interp){
-  extern int sqlite_search_count;
-  extern int sqlite_interrupt_count;
-  extern int sqlite_open_file_count;
-  extern int sqlite_current_time;
+  extern int sqlite3_search_count;
+  extern int sqlite3_interrupt_count;
+  extern int sqlite3_open_file_count;
+  extern int sqlite3_current_time;
   static struct {
      char *zName;
      Tcl_CmdProc *xProc;
   } aCmd[] = {
-     { "sqlite_mprintf_int",             (Tcl_CmdProc*)sqlite_mprintf_int    },
-     { "sqlite_mprintf_str",             (Tcl_CmdProc*)sqlite_mprintf_str    },
-     { "sqlite_mprintf_double",          (Tcl_CmdProc*)sqlite_mprintf_double },
-     { "sqlite_mprintf_scaled",          (Tcl_CmdProc*)sqlite_mprintf_scaled },
-     { "sqlite_mprintf_z_test",          (Tcl_CmdProc*)test_mprintf_z        },
-     { "sqlite_open",                    (Tcl_CmdProc*)sqlite_test_open      },
-     { "sqlite_last_insert_rowid",       (Tcl_CmdProc*)test_last_rowid       },
-     { "sqlite_exec_printf",             (Tcl_CmdProc*)test_exec_printf      },
-     { "sqlite_get_table_printf",        (Tcl_CmdProc*)test_get_table_printf },
-     { "sqlite_close",                   (Tcl_CmdProc*)sqlite_test_close     },
-     { "sqlite_create_function",         (Tcl_CmdProc*)test_create_function  },
-     { "sqlite_create_aggregate",        (Tcl_CmdProc*)test_create_aggregate },
+     { "sqlite3_mprintf_int",             (Tcl_CmdProc*)sqlite3_mprintf_int    },
+     { "sqlite3_mprintf_str",             (Tcl_CmdProc*)sqlite3_mprintf_str    },
+     { "sqlite3_mprintf_double",          (Tcl_CmdProc*)sqlite3_mprintf_double },
+     { "sqlite3_mprintf_scaled",          (Tcl_CmdProc*)sqlite3_mprintf_scaled },
+     { "sqlite3_mprintf_z_test",          (Tcl_CmdProc*)test_mprintf_z        },
+     { "sqlite3_open",                    (Tcl_CmdProc*)sqlite_test_open      },
+     { "sqlite3_last_insert_rowid",       (Tcl_CmdProc*)test_last_rowid       },
+     { "sqlite3_exec_printf",             (Tcl_CmdProc*)test_exec_printf      },
+     { "sqlite3_get_table_printf",        (Tcl_CmdProc*)test_get_table_printf },
+     { "sqlite3_close",                   (Tcl_CmdProc*)sqlite_test_close     },
+     { "sqlite3_create_function",         (Tcl_CmdProc*)test_create_function  },
+     { "sqlite3_create_aggregate",        (Tcl_CmdProc*)test_create_aggregate },
      { "sqlite_register_test_function",  (Tcl_CmdProc*)test_register_func    },
      { "sqlite_abort",                   (Tcl_CmdProc*)sqlite_abort          },
      { "sqlite_datatypes",               (Tcl_CmdProc*)sqlite_datatypes      },
@@ -998,11 +998,11 @@
      { "sqlite_malloc_fail",             (Tcl_CmdProc*)sqlite_malloc_fail    },
      { "sqlite_malloc_stat",             (Tcl_CmdProc*)sqlite_malloc_stat    },
 #endif
-     { "sqlite_compile",                 (Tcl_CmdProc*)test_compile          },
-     { "sqlite_step",                    (Tcl_CmdProc*)test_step             },
-     { "sqlite_finalize",                (Tcl_CmdProc*)test_finalize         },
-     { "sqlite_bind",                    (Tcl_CmdProc*)test_bind             },
-     { "sqlite_reset",                   (Tcl_CmdProc*)test_reset            },
+     { "sqlite3_compile",                 (Tcl_CmdProc*)test_compile          },
+     { "sqlite3_step",                    (Tcl_CmdProc*)test_step             },
+     { "sqlite3_finalize",                (Tcl_CmdProc*)test_finalize         },
+     { "sqlite3_bind",                    (Tcl_CmdProc*)test_bind             },
+     { "sqlite3_reset",                   (Tcl_CmdProc*)test_reset            },
      { "breakpoint",                     (Tcl_CmdProc*)test_breakpoint       },
   };
   int i;
@@ -1010,14 +1010,14 @@
   for(i=0; i<sizeof(aCmd)/sizeof(aCmd[0]); i++){
     Tcl_CreateCommand(interp, aCmd[i].zName, aCmd[i].xProc, 0, 0);
   }
-  Tcl_LinkVar(interp, "sqlite_search_count", 
-      (char*)&sqlite_search_count, TCL_LINK_INT);
-  Tcl_LinkVar(interp, "sqlite_interrupt_count", 
-      (char*)&sqlite_interrupt_count, TCL_LINK_INT);
-  Tcl_LinkVar(interp, "sqlite_open_file_count", 
-      (char*)&sqlite_open_file_count, TCL_LINK_INT);
-  Tcl_LinkVar(interp, "sqlite_current_time", 
-      (char*)&sqlite_current_time, TCL_LINK_INT);
+  Tcl_LinkVar(interp, "sqlite3_search_count", 
+      (char*)&sqlite3_search_count, TCL_LINK_INT);
+  Tcl_LinkVar(interp, "sqlite3_interrupt_count", 
+      (char*)&sqlite3_interrupt_count, TCL_LINK_INT);
+  Tcl_LinkVar(interp, "sqlite3_open_file_count", 
+      (char*)&sqlite3_open_file_count, TCL_LINK_INT);
+  Tcl_LinkVar(interp, "sqlite3_current_time", 
+      (char*)&sqlite3_current_time, TCL_LINK_INT);
   Tcl_LinkVar(interp, "sqlite_static_bind_value",
       (char*)&sqlite_static_bind_value, TCL_LINK_STRING);
   return TCL_OK;
diff --git a/src/test2.c b/src/test2.c
index 13a7dae..72b68c5 100644
--- a/src/test2.c
+++ b/src/test2.c
@@ -13,7 +13,7 @@
 ** is not included in the SQLite library.  It is used for automated
 ** testing of the SQLite library.
 **
-** $Id: test2.c,v 1.18 2004/05/08 08:23:39 danielk1977 Exp $
+** $Id: test2.c,v 1.19 2004/05/10 10:34:53 danielk1977 Exp $
 */
 #include "os.h"
 #include "sqliteInt.h"
@@ -524,7 +524,7 @@
 ** Register commands with the TCL interpreter.
 */
 int Sqlitetest2_Init(Tcl_Interp *interp){
-  extern int sqlite_io_error_pending;
+  extern int sqlite3_io_error_pending;
   char zBuf[100];
   static struct {
     char *zName;
@@ -551,8 +551,8 @@
   for(i=0; i<sizeof(aCmd)/sizeof(aCmd[0]); i++){
     Tcl_CreateCommand(interp, aCmd[i].zName, aCmd[i].xProc, 0, 0);
   }
-  Tcl_LinkVar(interp, "sqlite_io_error_pending",
-     (char*)&sqlite_io_error_pending, TCL_LINK_INT);
+  Tcl_LinkVar(interp, "sqlite3_io_error_pending",
+     (char*)&sqlite3_io_error_pending, TCL_LINK_INT);
 #ifdef SQLITE_TEST
   {
     extern int journal_format;
diff --git a/src/test4.c b/src/test4.c
index b1161e8..c547ea1 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.4 2004/05/08 08:23:39 danielk1977 Exp $
+** $Id: test4.c,v 1.5 2004/05/10 10:34:53 danielk1977 Exp $
 */
 #include "sqliteInt.h"
 #include "tcl.h"
@@ -63,15 +63,15 @@
 static void *thread_main(void *pArg){
   Thread *p = (Thread*)pArg;
   if( p->db ){
-    sqlite_close(p->db);
+    sqlite3_close(p->db);
   }
-  p->db = sqlite_open(p->zFilename, 0, &p->zErr);
+  p->db = sqlite3_open(p->zFilename, 0, &p->zErr);
   p->vm = 0;
   p->completed = 1;
   while( p->opnum<=p->completed ) sched_yield();
   while( p->xOp ){
     if( p->zErr && p->zErr!=p->zStaticErr ){
-      sqlite_freemem(p->zErr);
+      sqlite3_freemem(p->zErr);
       p->zErr = 0;
     }
     (*p->xOp)(p);
@@ -79,15 +79,15 @@
     while( p->opnum<=p->completed ) sched_yield();
   }
   if( p->vm ){
-    sqlite_finalize(p->vm, 0);
+    sqlite3_finalize(p->vm, 0);
     p->vm = 0;
   }
   if( p->db ){
-    sqlite_close(p->db);
+    sqlite3_close(p->db);
     p->db = 0;
   }
   if( p->zErr && p->zErr!=p->zStaticErr ){
-    sqlite_freemem(p->zErr);
+    sqlite3_freemem(p->zErr);
     p->zErr = 0;
   }
   p->completed++;
@@ -441,10 +441,10 @@
     return;
   }
   if( p->vm ){
-    sqlite_finalize(p->vm, 0);
+    sqlite3_finalize(p->vm, 0);
     p->vm = 0;
   }
-  p->rc = sqlite_compile(p->db, p->zArg, 0, &p->vm, &p->zErr);
+  p->rc = sqlite3_compile(p->db, p->zArg, 0, &p->vm, &p->zErr);
 }
 
 /*
@@ -487,7 +487,7 @@
     p->rc = SQLITE_ERROR;
     return;
   }
-  p->rc = sqlite_step(p->vm, &p->argc, &p->argv, &p->colv);
+  p->rc = sqlite3_step(p->vm, &p->argc, &p->argv, &p->colv);
 }
 
 /*
@@ -528,7 +528,7 @@
     p->rc = SQLITE_ERROR;
     return;
   }
-  p->rc = sqlite_finalize(p->vm, &p->zErr);
+  p->rc = sqlite3_finalize(p->vm, &p->zErr);
   p->vm = 0;
 }
 
diff --git a/src/tokenize.c b/src/tokenize.c
index 065d1b4..4ccc98f 100644
--- a/src/tokenize.c
+++ b/src/tokenize.c
@@ -15,7 +15,7 @@
 ** individual tokens and sends those tokens one-by-one over to the
 ** parser for analysis.
 **
-** $Id: tokenize.c,v 1.69 2004/05/08 08:23:39 danielk1977 Exp $
+** $Id: tokenize.c,v 1.70 2004/05/10 10:34:53 danielk1977 Exp $
 */
 #include "sqliteInt.h"
 #include "os.h"
@@ -416,7 +416,7 @@
   }
   pParse->sLastToken.dyn = 0;
   pParse->zTail = zSql;
-  while( sqlite_malloc_failed==0 && zSql[i]!=0 ){
+  while( sqlite3_malloc_failed==0 && zSql[i]!=0 ){
     assert( i>=0 );
     pParse->sLastToken.z = &zSql[i];
     assert( pParse->sLastToken.dyn==0 );
@@ -462,7 +462,7 @@
   }
   sqlite3ParserFree(pEngine, free);
   if( pParse->rc!=SQLITE_OK && pParse->rc!=SQLITE_DONE && pParse->zErrMsg==0 ){
-    sqlite3SetString(&pParse->zErrMsg, sqlite_error_string(pParse->rc),
+    sqlite3SetString(&pParse->zErrMsg, sqlite3_error_string(pParse->rc),
                     (char*)0);
   }
   if( pParse->zErrMsg ){
@@ -493,7 +493,7 @@
 }
 
 /*
-** Token types used by the sqlite_complete() routine.  See the header
+** Token types used by the sqlite3_complete() routine.  See the header
 ** comments on that procedure for additional information.
 */
 #define tkEXPLAIN 0
@@ -551,7 +551,7 @@
 **
 ** Whitespace never causes a state transition and is always ignored.
 */
-int sqlite_complete(const char *zSql){
+int sqlite3_complete(const char *zSql){
   u8 state = 0;   /* Current state, using numbers defined in header comment */
   u8 token;       /* Value of the next token */
 
diff --git a/src/trigger.c b/src/trigger.c
index d152255..985b0b4 100644
--- a/src/trigger.c
+++ b/src/trigger.c
@@ -63,7 +63,7 @@
   ** 4. That we are not trying to create an INSTEAD OF trigger on a table.
   ** 5. That we are not trying to create a BEFORE or AFTER trigger on a view.
   */
-  if( sqlite_malloc_failed ) goto trigger_cleanup;
+  if( sqlite3_malloc_failed ) goto trigger_cleanup;
   assert( pTableName->nSrc==1 );
   if( db->init.busy
    && sqlite3FixInit(&sFix, pParse, db->init.iDb, "trigger", pName)
@@ -133,7 +133,7 @@
   nt->name = zName;
   zName = 0;
   nt->table = sqliteStrDup(pTableName->a[0].zName);
-  if( sqlite_malloc_failed ) goto trigger_cleanup;
+  if( sqlite3_malloc_failed ) goto trigger_cleanup;
   nt->iDb = iDb;
   nt->iTabDb = tab->iDb;
   nt->op = op;
@@ -234,10 +234,10 @@
 ** the effect of copying all Expr.token.z values into memory obtained
 ** from sqliteMalloc().  As initially created, the Expr.token.z values
 ** all point to the input string that was fed to the parser.  But that
-** string is ephemeral - it will go away as soon as the sqlite_exec()
+** string is ephemeral - it will go away as soon as the sqlite3_exec()
 ** call that started the parser exits.  This routine makes a persistent
 ** copy of all the Expr.token.z strings so that the TriggerStep structure
-** will be valid even after the sqlite_exec() call returns.
+** will be valid even after the sqlite3_exec() call returns.
 */
 static void sqlitePersistTriggerStep(TriggerStep *p){
   if( p->target.z ){
@@ -393,7 +393,7 @@
   int nName;
   sqlite *db = pParse->db;
 
-  if( sqlite_malloc_failed ) goto drop_trigger_cleanup;
+  if( sqlite3_malloc_failed ) goto drop_trigger_cleanup;
   assert( pName->nSrc==1 );
   zDb = pName->a[0].zDatabase;
   zName = pName->a[0].zName;
diff --git a/src/update.c b/src/update.c
index 128b6ed..71d8938 100644
--- a/src/update.c
+++ b/src/update.c
@@ -12,7 +12,7 @@
 ** This file contains C code routines that are called by the parser
 ** to handle UPDATE statements.
 **
-** $Id: update.c,v 1.71 2004/05/08 08:23:40 danielk1977 Exp $
+** $Id: update.c,v 1.72 2004/05/10 10:35:00 danielk1977 Exp $
 */
 #include "sqliteInt.h"
 
@@ -59,7 +59,7 @@
   int oldIdx      = -1;  /* index of trigger "old" temp table       */
 
   sContext.pParse = 0;
-  if( pParse->nErr || sqlite_malloc_failed ) goto update_cleanup;
+  if( pParse->nErr || sqlite3_malloc_failed ) goto update_cleanup;
   db = pParse->db;
   assert( pTabList->nSrc==1 );
 
diff --git a/src/util.c b/src/util.c
index 420a7c2..3052116 100644
--- a/src/util.c
+++ b/src/util.c
@@ -14,7 +14,7 @@
 ** This file contains functions for allocating memory, comparing
 ** strings, and stuff like that.
 **
-** $Id: util.c,v 1.78 2004/05/10 10:05:54 danielk1977 Exp $
+** $Id: util.c,v 1.79 2004/05/10 10:35:00 danielk1977 Exp $
 */
 #include "sqliteInt.h"
 #include <stdarg.h>
@@ -24,7 +24,7 @@
 ** If malloc() ever fails, this global variable gets set to 1.
 ** This causes the library to abort and never again function.
 */
-int sqlite_malloc_failed = 0;
+int sqlite3_malloc_failed = 0;
 
 /*
 ** If MEMORY_DEBUG is defined, then use versions of malloc() and
@@ -36,9 +36,9 @@
 ** For keeping track of the number of mallocs and frees.   This
 ** is used to check for memory leaks.
 */
-int sqlite_nMalloc;         /* Number of sqliteMalloc() calls */
-int sqlite_nFree;           /* Number of sqliteFree() calls */
-int sqlite_iMallocFail;     /* Fail sqliteMalloc() after this many calls */
+int sqlite3_nMalloc;         /* Number of sqliteMalloc() calls */
+int sqlite3_nFree;           /* Number of sqliteFree() calls */
+int sqlite3_iMallocFail;     /* Fail sqliteMalloc() after this many calls */
 #if MEMORY_DEBUG>1
 static int memcnt = 0;
 #endif
@@ -56,15 +56,15 @@
   void *p;
   int *pi;
   int i, k;
-  if( sqlite_iMallocFail>=0 ){
-    sqlite_iMallocFail--;
-    if( sqlite_iMallocFail==0 ){
-      sqlite_malloc_failed++;
+  if( sqlite3_iMallocFail>=0 ){
+    sqlite3_iMallocFail--;
+    if( sqlite3_iMallocFail==0 ){
+      sqlite3_malloc_failed++;
 #if MEMORY_DEBUG>1
       fprintf(stderr,"**** failed to allocate %d bytes at %s:%d\n",
               n, zFile,line);
 #endif
-      sqlite_iMallocFail--;
+      sqlite3_iMallocFail--;
       return 0;
     }
   }
@@ -72,10 +72,10 @@
   k = (n+sizeof(int)-1)/sizeof(int);
   pi = malloc( (N_GUARD*2+1+k)*sizeof(int));
   if( pi==0 ){
-    sqlite_malloc_failed++;
+    sqlite3_malloc_failed++;
     return 0;
   }
-  sqlite_nMalloc++;
+  sqlite3_nMalloc++;
   for(i=0; i<N_GUARD; i++) pi[i] = 0xdead1122;
   pi[N_GUARD] = n;
   for(i=0; i<N_GUARD; i++) pi[k+1+N_GUARD+i] = 0xdead3344;
@@ -118,7 +118,7 @@
     int *pi, i, k, n;
     pi = p;
     pi -= N_GUARD+1;
-    sqlite_nFree++;
+    sqlite3_nFree++;
     for(i=0; i<N_GUARD; i++){
       if( pi[i]!=0xdead1122 ){
         fprintf(stderr,"Low-end memory corruption at 0x%x\n", (int)p);
@@ -175,7 +175,7 @@
   k = (n + sizeof(int) - 1)/sizeof(int);
   pi = malloc( (k+N_GUARD*2+1)*sizeof(int) );
   if( pi==0 ){
-    sqlite_malloc_failed++;
+    sqlite3_malloc_failed++;
     return 0;
   }
   for(i=0; i<N_GUARD; i++) pi[i] = 0xdead1122;
@@ -208,7 +208,7 @@
   if( pz==0 || *pz==0 ) return;
   zNew = malloc( strlen(*pz) + 1 );
   if( zNew==0 ){
-    sqlite_malloc_failed++;
+    sqlite3_malloc_failed++;
     sqliteFree(*pz);
     *pz = 0;
   }
@@ -252,7 +252,7 @@
 void *sqliteMalloc(int n){
   void *p;
   if( (p = malloc(n))==0 ){
-    if( n>0 ) sqlite_malloc_failed++;
+    if( n>0 ) sqlite3_malloc_failed++;
   }else{
     memset(p, 0, n);
   }
@@ -266,7 +266,7 @@
 void *sqliteMallocRaw(int n){
   void *p;
   if( (p = malloc(n))==0 ){
-    if( n>0 ) sqlite_malloc_failed++;
+    if( n>0 ) sqlite3_malloc_failed++;
   }
   return p;
 }
@@ -296,7 +296,7 @@
   }
   p2 = realloc(p, n);
   if( p2==0 ){
-    sqlite_malloc_failed++;
+    sqlite3_malloc_failed++;
   }
   return p2;
 }
@@ -1085,7 +1085,7 @@
 ** Ticket #202:  If db->magic is not a valid open value, take care not
 ** to modify the db structure at all.  It could be that db is a stale
 ** pointer.  In other words, it could be that there has been a prior
-** call to sqlite_close(db) and db has been deallocated.  And we do
+** call to sqlite3_close(db) and db has been deallocated.  And we do
 ** not want to write into deallocated memory.
 */
 int sqlite3SafetyOn(sqlite *db){
@@ -1118,8 +1118,8 @@
 }
 
 /*
-** Check to make sure we are not currently executing an sqlite_exec().
-** If we are currently in an sqlite_exec(), return true and set
+** Check to make sure we are not currently executing an sqlite3_exec().
+** If we are currently in an sqlite3_exec(), return true and set
 ** sqlite.magic to SQLITE_MAGIC_ERROR.  This will cause a complete
 ** shutdown of the database.
 **
diff --git a/src/vacuum.c b/src/vacuum.c
index 0822ac3..52ca39b 100644
--- a/src/vacuum.c
+++ b/src/vacuum.c
@@ -14,7 +14,7 @@
 ** Most of the code in this file may be omitted by defining the
 ** SQLITE_OMIT_VACUUM macro.
 **
-** $Id: vacuum.c,v 1.14 2004/05/08 08:23:40 danielk1977 Exp $
+** $Id: vacuum.c,v 1.15 2004/05/10 10:35:00 danielk1977 Exp $
 */
 #include "sqliteInt.h"
 #include "os.h"
@@ -93,10 +93,10 @@
   int rc;
 
   /* printf("***** executing *****\n%s\n", zSql); */
-  rc = sqlite_exec(db, zSql, 0, 0, &zErrMsg);
+  rc = sqlite3_exec(db, zSql, 0, 0, &zErrMsg);
   if( zErrMsg ){
     sqlite3SetString(pzErrMsg, zErrMsg, (char*)0);
-    sqlite_freemem(zErrMsg);
+    sqlite3_freemem(zErrMsg);
   }
   return rc;
 }
@@ -153,10 +153,10 @@
     appendText(&p->s1, "SELECT * FROM ", -1);
     appendQuoted(&p->s1, argv[1]);
     p->zTable = argv[1];
-    rc = sqlite_exec(p->dbOld, p->s1.z, vacuumCallback2, p, &zErrMsg);
+    rc = sqlite3_exec(p->dbOld, p->s1.z, vacuumCallback2, p, &zErrMsg);
     if( zErrMsg ){
       sqlite3SetString(p->pzErrMsg, zErrMsg, (char*)0);
-      sqlite_freemem(zErrMsg);
+      sqlite3_freemem(zErrMsg);
     }
   }
   if( rc!=SQLITE_ABORT ) p->rc = rc;
@@ -266,7 +266,7 @@
   }
 
   
-  dbNew = sqlite_open(zTemp, 0, &zErrMsg);
+  dbNew = sqlite3_open(zTemp, 0, &zErrMsg);
   if( dbNew==0 ){
     sqlite3SetString(pzErrMsg, "unable to open a temporary database at ",
        zTemp, " - ", zErrMsg, (char*)0);
@@ -285,10 +285,10 @@
     assert( strlen(zPragma[i])<100 );
     sprintf(zBuf, "PRAGMA %s;", zPragma[i]);
     sVac.zPragma = zPragma[i];
-    rc = sqlite_exec(db, zBuf, vacuumCallback3, &sVac, &zErrMsg);
+    rc = sqlite3_exec(db, zBuf, vacuumCallback3, &sVac, &zErrMsg);
   }
   if( rc==SQLITE_OK ){
-    rc = sqlite_exec(db, 
+    rc = sqlite3_exec(db, 
       "SELECT type, name, sql FROM sqlite_master "
       "WHERE sql NOT NULL AND type!='view' "
       "UNION ALL "
@@ -298,7 +298,7 @@
   }
   if( rc==SQLITE_OK ){
     rc = sqlite3BtreeCopyFile(db->aDb[0].pBt, dbNew->aDb[0].pBt);
-    sqlite_exec(db, "COMMIT", 0, 0, 0);
+    sqlite3_exec(db, "COMMIT", 0, 0, 0);
     sqlite3ResetInternalSchema(db, 0);
   }
 
@@ -307,13 +307,13 @@
     sqlite3SetString(pzErrMsg, "unable to vacuum database - ", 
        zErrMsg, (char*)0);
   }
-  sqlite_exec(db, "ROLLBACK", 0, 0, 0);
-  if( dbNew ) sqlite_close(dbNew);
+  sqlite3_exec(db, "ROLLBACK", 0, 0, 0);
+  if( dbNew ) sqlite3_close(dbNew);
   sqlite3OsDelete(zTemp);
   sqliteFree(zTemp);
   sqliteFree(sVac.s1.z);
   sqliteFree(sVac.s2.z);
-  if( zErrMsg ) sqlite_freemem(zErrMsg);
+  if( zErrMsg ) sqlite3_freemem(zErrMsg);
   if( rc==SQLITE_ABORT ) sVac.rc = SQLITE_ERROR;
   return sVac.rc;
 #endif
diff --git a/src/vdbe.c b/src/vdbe.c
index b9b558d..4193a9b 100644
--- a/src/vdbe.c
+++ b/src/vdbe.c
@@ -43,7 +43,7 @@
 ** in this file for details.  If in doubt, do not deviate from existing
 ** commenting and indentation practices when changing or adding code.
 **
-** $Id: vdbe.c,v 1.272 2004/05/10 07:17:32 danielk1977 Exp $
+** $Id: vdbe.c,v 1.273 2004/05/10 10:35:00 danielk1977 Exp $
 */
 #include "sqliteInt.h"
 #include "os.h"
@@ -57,7 +57,7 @@
 ** working correctly.  This variable has no function other than to
 ** help verify the correct operation of the library.
 */
-int sqlite_search_count = 0;
+int sqlite3_search_count = 0;
 
 /*
 ** When this global variable is positive, it gets decremented once before
@@ -67,7 +67,7 @@
 ** This facility is used for testing purposes only.  It does not function
 ** in an ordinary build.
 */
-int sqlite_interrupt_count = 0;
+int sqlite3_interrupt_count = 0;
 
 /*
 ** Advance the virtual machine to the next output row.
@@ -77,11 +77,11 @@
 **
 ** SQLITE_BUSY means that the virtual machine attempted to open
 ** a locked database and there is no busy callback registered.
-** Call sqlite_step() again to retry the open.  *pN is set to 0
+** Call sqlite3_step() again to retry the open.  *pN is set to 0
 ** and *pazColName and *pazValue are both set to NULL.
 **
 ** SQLITE_DONE means that the virtual machine has finished
-** executing.  sqlite_step() should not be called again on this
+** executing.  sqlite3_step() should not be called again on this
 ** virtual machine.  *pN and *pazColName are set appropriately
 ** but *pazValue is set to NULL.
 **
@@ -95,7 +95,7 @@
 **
 ** SQLITE_ERROR means that a run-time error (such as a constraint
 ** violation) has occurred.  The details of the error will be returned
-** by the next call to sqlite_finalize().  sqlite_step() should not
+** by the next call to sqlite3_finalize().  sqlite3_step() should not
 ** be called again on the VM.
 **
 ** SQLITE_MISUSE means that the this routine was called inappropriately.
@@ -104,7 +104,7 @@
 ** SQLITE_DONE.  Or it could be the case the the same database connection
 ** is being used simulataneously by two or more threads.
 */
-int sqlite_step(
+int sqlite3_step(
   sqlite_vm *pVm,              /* The virtual machine to execute */
   int *pN,                     /* OUT: Number of columns in result */
   const char ***pazValue,      /* OUT: Column data */
@@ -197,9 +197,9 @@
 static int hardStringify(Mem *pStack){
   int fg = pStack->flags;
   if( fg & MEM_Real ){
-    sqlite_snprintf(sizeof(pStack->zShort),pStack->zShort,"%.15g",pStack->r);
+    sqlite3_snprintf(sizeof(pStack->zShort),pStack->zShort,"%.15g",pStack->r);
   }else if( fg & MEM_Int ){
-    sqlite_snprintf(sizeof(pStack->zShort),pStack->zShort,"%d",pStack->i);
+    sqlite3_snprintf(sizeof(pStack->zShort),pStack->zShort,"%d",pStack->i);
   }else{
     pStack->zShort[0] = 0;
   }
@@ -439,7 +439,7 @@
 
 /*
 ** The CHECK_FOR_INTERRUPT macro defined here looks to see if the
-** sqlite_interrupt() routine has been called.  If it has been, then
+** sqlite3_interrupt() routine has been called.  If it has been, then
 ** processing of the VDBE program is interrupted.
 **
 ** This macro added to every instruction that does a jump in order to
@@ -504,7 +504,7 @@
   assert( p->rc==SQLITE_OK || p->rc==SQLITE_BUSY );
   p->rc = SQLITE_OK;
   assert( p->explain==0 );
-  if( sqlite_malloc_failed ) goto no_mem;
+  if( sqlite3_malloc_failed ) goto no_mem;
   pTos = p->pTos;
   if( p->popStack ){
     popStack(&pTos, p->popStack);
@@ -532,10 +532,10 @@
     ** if we have a special test build.
     */
 #ifdef SQLITE_TEST
-    if( sqlite_interrupt_count>0 ){
-      sqlite_interrupt_count--;
-      if( sqlite_interrupt_count==0 ){
-        sqlite_interrupt(db);
+    if( sqlite3_interrupt_count>0 ){
+      sqlite3_interrupt_count--;
+      if( sqlite3_interrupt_count==0 ){
+        sqlite3_interrupt(db);
       }
     }
 #endif
@@ -645,7 +645,7 @@
 ** Exit immediately.  All open cursors, Lists, Sorts, etc are closed
 ** automatically.
 **
-** P1 is the result code returned by sqlite_exec().  For a normal
+** P1 is the result code returned by sqlite3_exec().  For a normal
 ** halt, this should be SQLITE_OK (0).  For errors, it can be some
 ** other value.  If P1!=0 then P2 will determine whether or not to
 ** rollback the current transaction.  Do not rollback if P2==OE_Fail.
@@ -711,11 +711,11 @@
 /* Opcode: Variable P1 * *
 **
 ** Push the value of variable P1 onto the stack.  A variable is
-** an unknown in the original SQL string as handed to sqlite_compile().
+** an unknown in the original SQL string as handed to sqlite3_compile().
 ** Any occurance of the '?' character in the original SQL is considered
 ** a variable.  Variables in the SQL string are number from left to
 ** right beginning with 1.  The values of variables are set using the
-** sqlite_bind() API.
+** sqlite3_bind() API.
 */
 case OP_Variable: {
   int j = pOp->p1 - 1;
@@ -770,7 +770,7 @@
       pTos->z = pTos->zShort;
     }else if( (pTos->flags & MEM_Static)==0 ){
       pTos->z = sqliteMallocRaw(pFrom->n);
-      if( sqlite_malloc_failed ) goto no_mem;
+      if( sqlite3_malloc_failed ) goto no_mem;
       memcpy(pTos->z, pFrom->z, pFrom->n);
       pTos->flags &= ~(MEM_Static|MEM_Ephem|MEM_Short);
       pTos->flags |= MEM_Dyn;
@@ -2441,7 +2441,7 @@
           p->pTos = pTos;
           return SQLITE_BUSY;
         }else if( (*db->xBusyCallback)(db->pBusyArg, "", busy++)==0 ){
-          sqlite3SetString(&p->zErrMsg, sqlite_error_string(rc), (char*)0);
+          sqlite3SetString(&p->zErrMsg, sqlite3_error_string(rc), (char*)0);
           busy = 0;
         }
         break;
@@ -2701,7 +2701,7 @@
           p->pTos = &pTos[1 + (pOp->p2<=0)]; /* Operands must remain on stack */
           return SQLITE_BUSY;
         }else if( (*db->xBusyCallback)(db->pBusyArg, pOp->p3, ++busy)==0 ){
-          sqlite3SetString(&p->zErrMsg, sqlite_error_string(rc), (char*)0);
+          sqlite3SetString(&p->zErrMsg, sqlite3_error_string(rc), (char*)0);
           busy = 0;
         }
         break;
@@ -2855,7 +2855,7 @@
       pC->recnoIsValid = 0;
     }
     pC->deferredMoveto = 0;
-    sqlite_search_count++;
+    sqlite3_search_count++;
     oc = pOp->opcode;
     if( oc==OP_MoveTo && res<0 ){
       sqlite3BtreeNext(pC->pCursor, &res);
@@ -3187,7 +3187,7 @@
 ** incremented (otherwise not).  If the OPFLAG_CSCHANGE flag is set,
 ** then the current statement change count is incremented (otherwise not).
 ** If the OPFLAG_LASTROWID flag of P2 is set, then rowid is
-** stored for subsequent return by the sqlite_last_insert_rowid() function
+** stored for subsequent return by the sqlite3_last_insert_rowid() function
 ** (otherwise it's unmodified).
 */
 /* Opcode: PutStrKey P1 * *
@@ -3694,7 +3694,7 @@
     }
     if( res==0 ){
       pc = pOp->p2 - 1;
-      sqlite_search_count++;
+      sqlite3_search_count++;
     }
   }else{
     pC->nullRow = 1;
@@ -4780,7 +4780,7 @@
     pc = pOp->p2 - 1;
   }else{
     AggInsert(&p->agg, zKey, nKey);
-    if( sqlite_malloc_failed ) goto no_mem;
+    if( sqlite3_malloc_failed ) goto no_mem;
   }
   Release(pTos);
   pTos--;
@@ -4913,7 +4913,7 @@
     Release(pTos);
     pTos--;
   }
-  if( sqlite_malloc_failed ) goto no_mem;
+  if( sqlite3_malloc_failed ) goto no_mem;
   break;
 }
 
@@ -5013,7 +5013,7 @@
 /* An other opcode is illegal...
 */
 default: {
-  sqlite_snprintf(sizeof(zBuf),zBuf,"%d",pOp->opcode);
+  sqlite3_snprintf(sizeof(zBuf),zBuf,"%d",pOp->opcode);
   sqlite3SetString(&p->zErrMsg, "unknown opcode ", zBuf, (char*)0);
   rc = SQLITE_INTERNAL;
   break;
@@ -5151,12 +5151,12 @@
   */
 abort_due_to_error:
   if( p->zErrMsg==0 ){
-    if( sqlite_malloc_failed ) rc = SQLITE_NOMEM;
-    sqlite3SetString(&p->zErrMsg, sqlite_error_string(rc), (char*)0);
+    if( sqlite3_malloc_failed ) rc = SQLITE_NOMEM;
+    sqlite3SetString(&p->zErrMsg, sqlite3_error_string(rc), (char*)0);
   }
   goto vdbe_halt;
 
-  /* Jump to here if the sqlite_interrupt() API sets the interrupt
+  /* Jump to here if the sqlite3_interrupt() API sets the interrupt
   ** flag.
   */
 abort_due_to_interrupt:
@@ -5167,6 +5167,6 @@
   }else{
     rc = SQLITE_INTERRUPT;
   }
-  sqlite3SetString(&p->zErrMsg, sqlite_error_string(rc), (char*)0);
+  sqlite3SetString(&p->zErrMsg, sqlite3_error_string(rc), (char*)0);
   goto vdbe_halt;
 }