System.Data.SQLite
Check-in [aa7259812f]
Not logged in

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Update SQLite core library to the latest trunk code and add support for the sqlite3_errstr API.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: aa7259812fea0aac0d98817cfe034103e1ddcb95
User & Date: mistachkin 2012-09-12 04:29:58
Context
2012-09-14
12:18
Merge all Visual Studio 2012 related changes to trunk. check-in: 3def70ce5e user: mistachkin tags: trunk
07:34
Initial work on supporting Visual Studio 2012. check-in: 58dc41d4c8 user: mistachkin tags: vs2012
2012-09-12
04:29
Update SQLite core library to the latest trunk code and add support for the sqlite3_errstr API. check-in: aa7259812f user: mistachkin tags: trunk
01:56
Fix comments in the SQLiteException class, including an out-of-order summary end-tag. Make sure the error code of the SQLiteException class gets serialized. Make the test project for the .NET Compact Framework more flexible. check-in: 94c5213e35 user: mistachkin tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to Doc/Extra/version.html.

    41     41         </table>
    42     42       </div>
    43     43       <div id="mainSection">
    44     44       <div id="mainBody">
    45     45       <h1 class="heading">Version History</h1>
    46     46       <p><b>1.0.83.0 - November XX, 2012 <font color="red">(release scheduled)</font></b></p>
    47     47       <ul>
    48         -      <li>Updated to <a href="http://www.sqlite.org/releaselog/3_7_14.html">SQLite 3.7.14</a>.</li>
           48  +      <li>Updated to <a href="http://www.sqlite.org/src/info/trunk">SQLite 3.7.15</a>.</li>
    49     49         <li>Add an overload of the SQLiteLog.LogMessage method that takes a single string argument.</li>
    50     50         <li>All applicable calls into the SQLite core library now return a SQLiteErrorCode instead of an integer error code.</li>
    51     51         <li>Make sure the error code of the SQLiteException class gets serialized.</li>
    52     52         <li>Make the test project for the .NET Compact Framework more flexible.</li>
    53     53         <li>When available, the new sqlite3_errstr function from the core library is used to get the error message for a specific return code.</li>
    54     54         <li>The SetMemoryStatus, Shutdown, ResultCode, ExtendedResultCode, and SetAvRetry methods of the SQLiteConnection class now return a SQLiteErrorCode instead of an integer error code.&nbsp;<b>** Potentially Incompatible Change **</b></li>
    55     55         <li>The public constructor for the SQLiteException now takes a SQLiteErrorCode instead of an integer error code.&nbsp;<b>** Potentially Incompatible Change **</b></li>

Changes to SQLite.Interop/props/sqlite3.props.

     5      5    *
     6      6    * Written by Joe Mistachkin.
     7      7    * Released to the public domain, use at your own risk!
     8      8    *
     9      9   -->
    10     10   <Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
    11     11     <PropertyGroup Label="UserMacros">
    12         -    <SQLITE_MANIFEST_VERSION>3.7.14</SQLITE_MANIFEST_VERSION>
    13         -    <SQLITE_RC_VERSION>3,7,14</SQLITE_RC_VERSION>
           12  +    <SQLITE_MANIFEST_VERSION>3.7.15</SQLITE_MANIFEST_VERSION>
           13  +    <SQLITE_RC_VERSION>3,7,15</SQLITE_RC_VERSION>
    14     14       <SQLITE_COMMON_DEFINES>SQLITE_THREADSAFE=1;SQLITE_USE_URI=1;SQLITE_ENABLE_COLUMN_METADATA=1;SQLITE_ENABLE_STAT3=1;SQLITE_ENABLE_FTS3=1;SQLITE_ENABLE_LOAD_EXTENSION=1;SQLITE_ENABLE_RTREE=1;SQLITE_SOUNDEX=1</SQLITE_COMMON_DEFINES>
    15     15       <SQLITE_EXTRA_DEFINES>SQLITE_HAS_CODEC=1</SQLITE_EXTRA_DEFINES>
    16     16       <SQLITE_WINCE_DEFINES>SQLITE_OMIT_WAL=1</SQLITE_WINCE_DEFINES>
    17     17       <SQLITE_DEBUG_DEFINES>SQLITE_DEBUG=1;SQLITE_MEMDEBUG=1</SQLITE_DEBUG_DEFINES>
    18     18       <SQLITE_RELEASE_DEFINES>SQLITE_WIN32_MALLOC=1</SQLITE_RELEASE_DEFINES>
    19     19       <SQLITE_DISABLE_WARNINGS>4018;4055;4057;4090;4100;4127;4132;4146;4152;4210;4232;4244;4245;4389;4701;4706;4996</SQLITE_DISABLE_WARNINGS>
    20     20       <SQLITE_DISABLE_X64_WARNINGS>4232;4267;4306</SQLITE_DISABLE_X64_WARNINGS>

Changes to SQLite.Interop/props/sqlite3.vsprops.

    10     10   <VisualStudioPropertySheet
    11     11   	ProjectType="Visual C++"
    12     12   	Version="8.00"
    13     13   	Name="sqlite3"
    14     14   	>
    15     15   	<UserMacro
    16     16   		Name="SQLITE_MANIFEST_VERSION"
    17         -		Value="3.7.14"
           17  +		Value="3.7.15"
    18     18   		PerformEnvironmentSet="true"
    19     19   	/>
    20     20   	<UserMacro
    21     21   		Name="SQLITE_RC_VERSION"
    22         -		Value="3,7,14"
           22  +		Value="3,7,15"
    23     23   		PerformEnvironmentSet="true"
    24     24   	/>
    25     25   	<UserMacro
    26     26   		Name="SQLITE_COMMON_DEFINES"
    27     27   		Value="SQLITE_THREADSAFE=1;SQLITE_USE_URI=1;SQLITE_ENABLE_COLUMN_METADATA=1;SQLITE_ENABLE_STAT3=1;SQLITE_ENABLE_FTS3=1;SQLITE_ENABLE_LOAD_EXTENSION=1;SQLITE_ENABLE_RTREE=1;SQLITE_SOUNDEX=1"
    28     28   		PerformEnvironmentSet="true"
    29     29   	/>

Changes to SQLite.Interop/src/core/sqlite3.c.

     1      1   /******************************************************************************
     2      2   ** This file is an amalgamation of many separate C source files from SQLite
     3         -** version 3.7.14.  By combining all the individual C code files into this 
            3  +** version 3.7.15.  By combining all the individual C code files into this 
     4      4   ** single large file, the entire code can be compiled as a single translation
     5      5   ** unit.  This allows many compilers to do optimizations that would not be
     6      6   ** possible if the files were compiled separately.  Performance improvements
     7      7   ** of 5% or more are commonly seen when SQLite is compiled as a single
     8      8   ** translation unit.
     9      9   **
    10     10   ** This file is all you need to compile SQLite.  To use SQLite in other
................................................................................
   669    669   ** string contains the date and time of the check-in (UTC) and an SHA1
   670    670   ** hash of the entire source tree.
   671    671   **
   672    672   ** See also: [sqlite3_libversion()],
   673    673   ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
   674    674   ** [sqlite_version()] and [sqlite_source_id()].
   675    675   */
   676         -#define SQLITE_VERSION        "3.7.14"
   677         -#define SQLITE_VERSION_NUMBER 3007014
   678         -#define SQLITE_SOURCE_ID      "2012-09-03 15:42:36 c0d89d4a9752922f9e367362366efde4f1b06f2a"
          676  +#define SQLITE_VERSION        "3.7.15"
          677  +#define SQLITE_VERSION_NUMBER 3007015
          678  +#define SQLITE_SOURCE_ID      "2012-09-12 00:11:20 9402f81fade5fcae0a3a6efdc7a5cdf71fc2e79f"
   679    679   
   680    680   /*
   681    681   ** CAPI3REF: Run-Time Library Version Numbers
   682    682   ** KEYWORDS: sqlite3_version, sqlite3_sourceid
   683    683   **
   684    684   ** These interfaces provide the same information as the [SQLITE_VERSION],
   685    685   ** [SQLITE_VERSION_NUMBER], and [SQLITE_SOURCE_ID] C preprocessor macros
................................................................................
  3162   3162   **     the value passed as the fourth parameter to sqlite3_open_v2().
  3163   3163   **
  3164   3164   **   <li> <b>mode</b>: ^(The mode parameter may be set to either "ro", "rw",
  3165   3165   **     "rwc", or "memory". Attempting to set it to any other value is
  3166   3166   **     an error)^. 
  3167   3167   **     ^If "ro" is specified, then the database is opened for read-only 
  3168   3168   **     access, just as if the [SQLITE_OPEN_READONLY] flag had been set in the 
  3169         -**     third argument to sqlite3_prepare_v2(). ^If the mode option is set to 
         3169  +**     third argument to sqlite3_open_v2(). ^If the mode option is set to 
  3170   3170   **     "rw", then the database is opened for read-write (but not create) 
  3171   3171   **     access, as if SQLITE_OPEN_READWRITE (but not SQLITE_OPEN_CREATE) had 
  3172   3172   **     been set. ^Value "rwc" is equivalent to setting both 
  3173   3173   **     SQLITE_OPEN_READWRITE and SQLITE_OPEN_CREATE.  ^If the mode option is
  3174   3174   **     set to "memory" then a pure [in-memory database] that never reads
  3175   3175   **     or writes from disk is used. ^It is an error to specify a value for
  3176   3176   **     the mode parameter that is less restrictive than that specified by
................................................................................
  3313   3313   **
  3314   3314   ** ^The sqlite3_errmsg() and sqlite3_errmsg16() return English-language
  3315   3315   ** text that describes the error, as either UTF-8 or UTF-16 respectively.
  3316   3316   ** ^(Memory to hold the error message string is managed internally.
  3317   3317   ** The application does not need to worry about freeing the result.
  3318   3318   ** However, the error string might be overwritten or deallocated by
  3319   3319   ** subsequent calls to other SQLite interface functions.)^
         3320  +**
         3321  +** ^The sqlite3_errstr() interface returns the English-language text
         3322  +** that describes the [result code], as UTF-8.
         3323  +** ^(Memory to hold the error message string is managed internally
         3324  +** and must not be freed by the application)^.
  3320   3325   **
  3321   3326   ** When the serialized [threading mode] is in use, it might be the
  3322   3327   ** case that a second error occurs on a separate thread in between
  3323   3328   ** the time of the first error and the call to these interfaces.
  3324   3329   ** When that happens, the second error will be reported since these
  3325   3330   ** interfaces always report the most recent result.  To avoid
  3326   3331   ** this, each thread can obtain exclusive use of the [database connection] D
................................................................................
  3332   3337   ** was invoked incorrectly by the application.  In that case, the
  3333   3338   ** error code and message may or may not be set.
  3334   3339   */
  3335   3340   SQLITE_API int sqlite3_errcode(sqlite3 *db);
  3336   3341   SQLITE_API int sqlite3_extended_errcode(sqlite3 *db);
  3337   3342   SQLITE_API const char *sqlite3_errmsg(sqlite3*);
  3338   3343   SQLITE_API const void *sqlite3_errmsg16(sqlite3*);
         3344  +SQLITE_API const char *sqlite3_errstr(int);
  3339   3345   
  3340   3346   /*
  3341   3347   ** CAPI3REF: SQL Statement Object
  3342   3348   ** KEYWORDS: {prepared statement} {prepared statements}
  3343   3349   **
  3344   3350   ** An instance of this object represents a single SQL statement.
  3345   3351   ** This object is variously known as a "prepared statement" or a
................................................................................
 13232  13238     Vdbe *pVdbe;       /* Attach the explanation to this Vdbe */
 13233  13239     StrAccum str;      /* The string being accumulated */
 13234  13240     int nIndent;       /* Number of elements in aIndent */
 13235  13241     u16 aIndent[100];  /* Levels of indentation */
 13236  13242     char zBase[100];   /* Initial space */
 13237  13243   };
 13238  13244   
        13245  +/* A bitfield type for use inside of structures.  Always follow with :N where
        13246  +** N is the number of bits.
        13247  +*/
        13248  +typedef unsigned bft;  /* Bit Field Type */
        13249  +
 13239  13250   /*
 13240  13251   ** An instance of the virtual machine.  This structure contains the complete
 13241  13252   ** state of the virtual machine.
 13242  13253   **
 13243  13254   ** The "sqlite3_stmt" structure pointer that is returned by sqlite3_prepare()
 13244  13255   ** is really a pointer to an instance of this structure.
 13245  13256   **
................................................................................
 13273  13284     char **azVar;           /* Name of variables */
 13274  13285     ynVar nVar;             /* Number of entries in aVar[] */
 13275  13286     ynVar nzVar;            /* Number of entries in azVar[] */
 13276  13287     u32 cacheCtr;           /* VdbeCursor row cache generation counter */
 13277  13288     int pc;                 /* The program counter */
 13278  13289     int rc;                 /* Value to return */
 13279  13290     u8 errorAction;         /* Recovery action to do in case of an error */
 13280         -  u8 explain;             /* True if EXPLAIN present on SQL command */
 13281         -  u8 changeCntOn;         /* True to update the change-counter */
 13282         -  u8 expired;             /* True if the VM needs to be recompiled */
 13283         -  u8 runOnlyOnce;         /* Automatically expire on reset */
 13284  13291     u8 minWriteFileFormat;  /* Minimum file format for writable database files */
 13285         -  u8 inVtabMethod;        /* See comments above */
 13286         -  u8 usesStmtJournal;     /* True if uses a statement journal */
 13287         -  u8 readOnly;            /* True for read-only statements */
 13288         -  u8 isPrepareV2;         /* True if prepared with prepare_v2() */
        13292  +  bft explain:2;          /* True if EXPLAIN present on SQL command */
        13293  +  bft inVtabMethod:2;     /* See comments above */
        13294  +  bft changeCntOn:1;      /* True to update the change-counter */
        13295  +  bft expired:1;          /* True if the VM needs to be recompiled */
        13296  +  bft runOnlyOnce:1;      /* Automatically expire on reset */
        13297  +  bft usesStmtJournal:1;  /* True if uses a statement journal */
        13298  +  bft readOnly:1;         /* True for read-only statements */
        13299  +  bft isPrepareV2:1;      /* True if prepared with prepare_v2() */
        13300  +  bft doingRerun:1;       /* True if rerunning after an auto-reprepare */
 13289  13301     int nChange;            /* Number of db changes made since last reset */
 13290  13302     yDbMask btreeMask;      /* Bitmask of db->aDb[] entries referenced */
 13291  13303     yDbMask lockMask;       /* Subset of btreeMask that requires a lock */
 13292  13304     int iStatement;         /* Statement number (or 0 if has not opened stmt) */
 13293  13305     int aCounter[3];        /* Counters used by sqlite3_stmt_status() */
 13294  13306   #ifndef SQLITE_OMIT_TRACE
 13295  13307     i64 startTime;          /* Time when query started - used for profiling */
................................................................................
 61829  61841     sqlite3 *db;             /* The database connection */
 61830  61842   
 61831  61843     if( vdbeSafetyNotNull(v) ){
 61832  61844       return SQLITE_MISUSE_BKPT;
 61833  61845     }
 61834  61846     db = v->db;
 61835  61847     sqlite3_mutex_enter(db->mutex);
        61848  +  v->doingRerun = 0;
 61836  61849     while( (rc = sqlite3Step(v))==SQLITE_SCHEMA
 61837  61850            && cnt++ < SQLITE_MAX_SCHEMA_RETRY
 61838  61851            && (rc2 = rc = sqlite3Reprepare(v))==SQLITE_OK ){
 61839  61852       sqlite3_reset(pStmt);
        61853  +    v->doingRerun = 1;
 61840  61854       assert( v->expired==0 );
 61841  61855     }
 61842  61856     if( rc2!=SQLITE_OK && ALWAYS(v->isPrepareV2) && ALWAYS(db->pErr) ){
 61843  61857       /* This case occurs after failing to recompile an sql statement. 
 61844  61858       ** The error message from the SQL compiler has already been loaded 
 61845  61859       ** into the database handle. This block copies the error message 
 61846  61860       ** from the database handle into the statement and sets the statement
................................................................................
 69658  69672   */
 69659  69673   case OP_Trace: {
 69660  69674   #if 0  /* local variables moved into u.cr */
 69661  69675     char *zTrace;
 69662  69676     char *z;
 69663  69677   #endif /* local variables moved into u.cr */
 69664  69678   
 69665         -  if( db->xTrace && (u.cr.zTrace = (pOp->p4.z ? pOp->p4.z : p->zSql))!=0 ){
        69679  +  if( db->xTrace
        69680  +   && !p->doingRerun
        69681  +   && (u.cr.zTrace = (pOp->p4.z ? pOp->p4.z : p->zSql))!=0
        69682  +  ){
 69666  69683       u.cr.z = sqlite3VdbeExpandSql(p, u.cr.zTrace);
 69667  69684       db->xTrace(db->pTraceArg, u.cr.z);
 69668  69685       sqlite3DbFree(db, u.cr.z);
 69669  69686     }
 69670  69687   #ifdef SQLITE_DEBUG
 69671  69688     if( (db->flags & SQLITE_SqlTrace)!=0
 69672  69689      && (u.cr.zTrace = (pOp->p4.z ? pOp->p4.z : p->zSql))!=0
................................................................................
 85466  85483           z1[i] = sqlite3Tolower(z2[i]);
 85467  85484         }
 85468  85485         sqlite3_result_text(context, z1, n, sqlite3_free);
 85469  85486       }
 85470  85487     }
 85471  85488   }
 85472  85489   
 85473         -
 85474         -#if 0  /* This function is never used. */
 85475  85490   /*
 85476         -** The COALESCE() and IFNULL() functions used to be implemented as shown
 85477         -** here.  But now they are implemented as VDBE code so that unused arguments
 85478         -** do not have to be computed.  This legacy implementation is retained as
 85479         -** comment.
        85491  +** The COALESCE() and IFNULL() functions are implemented as VDBE code so
        85492  +** that unused argument values do not have to be computed.  However, we
        85493  +** still need some kind of function implementation for this routines in
        85494  +** the function table.  That function implementation will never be called
        85495  +** so it doesn't matter what the implementation is.  We might as well use
        85496  +** the "version()" function as a substitute.
 85480  85497   */
 85481         -/*
 85482         -** Implementation of the IFNULL(), NVL(), and COALESCE() functions.  
 85483         -** All three do the same thing.  They return the first non-NULL
 85484         -** argument.
 85485         -*/
 85486         -static void ifnullFunc(
 85487         -  sqlite3_context *context,
 85488         -  int argc,
 85489         -  sqlite3_value **argv
 85490         -){
 85491         -  int i;
 85492         -  for(i=0; i<argc; i++){
 85493         -    if( SQLITE_NULL!=sqlite3_value_type(argv[i]) ){
 85494         -      sqlite3_result_value(context, argv[i]);
 85495         -      break;
 85496         -    }
 85497         -  }
 85498         -}
 85499         -#endif /* NOT USED */
 85500  85498   #define ifnullFunc versionFunc   /* Substitute function - never called */
 85501  85499   
 85502  85500   /*
 85503  85501   ** Implementation of random().  Return a random integer.  
 85504  85502   */
 85505  85503   static void randomFunc(
 85506  85504     sqlite3_context *context,
................................................................................
113366 113364       return SQLITE_MISUSE_BKPT;
113367 113365     }
113368 113366     if( !db || db->mallocFailed ){
113369 113367       return SQLITE_NOMEM;
113370 113368     }
113371 113369     return db->errCode;
113372 113370   }
       113371  +
       113372  +/*
       113373  +** Return a string that describes the kind of error specified in the
       113374  +** argument.  For now, this simply calls the internal sqlite3ErrStr()
       113375  +** function.
       113376  +*/
       113377  +SQLITE_API const char *sqlite3_errstr(int rc){
       113378  +  return sqlite3ErrStr(rc);
       113379  +}
113373 113380   
113374 113381   /*
113375 113382   ** Create a new collating function for database "db".  The name is zName
113376 113383   ** and the encoding is enc.
113377 113384   */
113378 113385   static int createCollation(
113379 113386     sqlite3* db,

Changes to SQLite.Interop/src/core/sqlite3.h.

   103    103   ** string contains the date and time of the check-in (UTC) and an SHA1
   104    104   ** hash of the entire source tree.
   105    105   **
   106    106   ** See also: [sqlite3_libversion()],
   107    107   ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
   108    108   ** [sqlite_version()] and [sqlite_source_id()].
   109    109   */
   110         -#define SQLITE_VERSION        "3.7.14"
   111         -#define SQLITE_VERSION_NUMBER 3007014
   112         -#define SQLITE_SOURCE_ID      "2012-09-03 15:42:36 c0d89d4a9752922f9e367362366efde4f1b06f2a"
          110  +#define SQLITE_VERSION        "3.7.15"
          111  +#define SQLITE_VERSION_NUMBER 3007015
          112  +#define SQLITE_SOURCE_ID      "2012-09-12 00:11:20 9402f81fade5fcae0a3a6efdc7a5cdf71fc2e79f"
   113    113   
   114    114   /*
   115    115   ** CAPI3REF: Run-Time Library Version Numbers
   116    116   ** KEYWORDS: sqlite3_version, sqlite3_sourceid
   117    117   **
   118    118   ** These interfaces provide the same information as the [SQLITE_VERSION],
   119    119   ** [SQLITE_VERSION_NUMBER], and [SQLITE_SOURCE_ID] C preprocessor macros
................................................................................
  2596   2596   **     the value passed as the fourth parameter to sqlite3_open_v2().
  2597   2597   **
  2598   2598   **   <li> <b>mode</b>: ^(The mode parameter may be set to either "ro", "rw",
  2599   2599   **     "rwc", or "memory". Attempting to set it to any other value is
  2600   2600   **     an error)^. 
  2601   2601   **     ^If "ro" is specified, then the database is opened for read-only 
  2602   2602   **     access, just as if the [SQLITE_OPEN_READONLY] flag had been set in the 
  2603         -**     third argument to sqlite3_prepare_v2(). ^If the mode option is set to 
         2603  +**     third argument to sqlite3_open_v2(). ^If the mode option is set to 
  2604   2604   **     "rw", then the database is opened for read-write (but not create) 
  2605   2605   **     access, as if SQLITE_OPEN_READWRITE (but not SQLITE_OPEN_CREATE) had 
  2606   2606   **     been set. ^Value "rwc" is equivalent to setting both 
  2607   2607   **     SQLITE_OPEN_READWRITE and SQLITE_OPEN_CREATE.  ^If the mode option is
  2608   2608   **     set to "memory" then a pure [in-memory database] that never reads
  2609   2609   **     or writes from disk is used. ^It is an error to specify a value for
  2610   2610   **     the mode parameter that is less restrictive than that specified by
................................................................................
  2747   2747   **
  2748   2748   ** ^The sqlite3_errmsg() and sqlite3_errmsg16() return English-language
  2749   2749   ** text that describes the error, as either UTF-8 or UTF-16 respectively.
  2750   2750   ** ^(Memory to hold the error message string is managed internally.
  2751   2751   ** The application does not need to worry about freeing the result.
  2752   2752   ** However, the error string might be overwritten or deallocated by
  2753   2753   ** subsequent calls to other SQLite interface functions.)^
         2754  +**
         2755  +** ^The sqlite3_errstr() interface returns the English-language text
         2756  +** that describes the [result code], as UTF-8.
         2757  +** ^(Memory to hold the error message string is managed internally
         2758  +** and must not be freed by the application)^.
  2754   2759   **
  2755   2760   ** When the serialized [threading mode] is in use, it might be the
  2756   2761   ** case that a second error occurs on a separate thread in between
  2757   2762   ** the time of the first error and the call to these interfaces.
  2758   2763   ** When that happens, the second error will be reported since these
  2759   2764   ** interfaces always report the most recent result.  To avoid
  2760   2765   ** this, each thread can obtain exclusive use of the [database connection] D
................................................................................
  2766   2771   ** was invoked incorrectly by the application.  In that case, the
  2767   2772   ** error code and message may or may not be set.
  2768   2773   */
  2769   2774   SQLITE_API int sqlite3_errcode(sqlite3 *db);
  2770   2775   SQLITE_API int sqlite3_extended_errcode(sqlite3 *db);
  2771   2776   SQLITE_API const char *sqlite3_errmsg(sqlite3*);
  2772   2777   SQLITE_API const void *sqlite3_errmsg16(sqlite3*);
         2778  +SQLITE_API const char *sqlite3_errstr(int);
  2773   2779   
  2774   2780   /*
  2775   2781   ** CAPI3REF: SQL Statement Object
  2776   2782   ** KEYWORDS: {prepared statement} {prepared statements}
  2777   2783   **
  2778   2784   ** An instance of this object represents a single SQL statement.
  2779   2785   ** This object is variously known as a "prepared statement" or a

Changes to System.Data.SQLite/SQLiteBase.cs.

     4      4    * 
     5      5    * Released to the public domain, use at your own risk!
     6      6    ********************************************************/
     7      7   
     8      8   namespace System.Data.SQLite
     9      9   {
    10     10     using System;
    11         -  // using System.Runtime.InteropServices;
           11  +
           12  +#if !PLATFORM_COMPACTFRAMEWORK
           13  +  using System.Runtime.InteropServices;
           14  +#endif
    12     15   
    13     16     /// <summary>
    14     17     /// This internal class provides the foundation of SQLite support.  It defines all the abstract members needed to implement
    15     18     /// a SQLite data provider, and inherits from SQLiteConvert which allows for simple translations of string to and from SQLite.
    16     19     /// </summary>
    17     20     internal abstract class SQLiteBase : SQLiteConvert, IDisposable
    18     21     {
................................................................................
   388    391           /* SQLITE_CONSTRAINT  */ "constraint failed",
   389    392           /* SQLITE_MISMATCH    */ "datatype mismatch",
   390    393           /* SQLITE_MISUSE      */ "library routine called out of sequence",
   391    394           /* SQLITE_NOLFS       */ "large file support is disabled",
   392    395           /* SQLITE_AUTH        */ "authorization denied",
   393    396           /* SQLITE_FORMAT      */ "auxiliary database format error",
   394    397           /* SQLITE_RANGE       */ "bind or column index out of range",
   395         -        /* SQLITE_NOTADB      */ "file is encrypted or is not a database",
          398  +        /* SQLITE_NOTADB      */ "file is encrypted or is not a database"
   396    399       };
   397    400   
   398    401       ///////////////////////////////////////////////////////////////////////////////////////////////
   399    402   
          403  +    /// <summary>
          404  +    /// Returns the error message for the specified SQLite return code using
          405  +    /// the internal static lookup table.
          406  +    /// </summary>
          407  +    /// <param name="rc">The SQLite return code.</param>
          408  +    /// <returns>The error message or null if it cannot be found.</returns>
   400    409       private static string FallbackGetErrorString(SQLiteErrorCode rc)
   401    410       {
   402    411           if (_errorMessages == null)
   403    412               return null;
   404    413   
   405    414           int index = (int)rc;
   406    415   
   407    416           if ((index < 0) || (index >= _errorMessages.Length))
   408    417               index = (int)SQLiteErrorCode.Error; /* Make into generic error. */
   409    418   
   410    419           return _errorMessages[index];
   411    420       }
   412    421   
          422  +    /// <summary>
          423  +    /// Returns the error message for the specified SQLite return code using
          424  +    /// the sqlite3_errstr() function, falling back to the internal lookup
          425  +    /// table if necessary.
          426  +    /// </summary>
          427  +    /// <param name="rc">The SQLite return code.</param>
          428  +    /// <returns>The error message or null if it cannot be found.</returns>
   413    429       internal static string GetErrorString(SQLiteErrorCode rc)
   414    430       {
   415         -        //try
   416         -        //{
   417         -        //    IntPtr ptr = UnsafeNativeMethods.sqlite3_errstr(rc);
   418         -        //
   419         -        //    if (ptr != IntPtr.Zero)
   420         -        //        return Marshal.PtrToStringAnsi(ptr);
   421         -        //}
   422         -        //catch (EntryPointNotFoundException)
   423         -        //{
   424         -        //    // do nothing.
   425         -        //}
          431  +        try
          432  +        {
          433  +            IntPtr ptr = UnsafeNativeMethods.sqlite3_errstr(rc);
          434  +
          435  +            if (ptr != IntPtr.Zero)
          436  +            {
          437  +#if !PLATFORM_COMPACTFRAMEWORK
          438  +                return Marshal.PtrToStringAnsi(ptr);
          439  +#else
          440  +                return UTF8ToString(ptr, -1);
          441  +#endif
          442  +            }
          443  +        }
          444  +        catch (EntryPointNotFoundException)
          445  +        {
          446  +            // do nothing.
          447  +        }
   426    448   
   427    449           return FallbackGetErrorString(rc);
   428    450       }
   429    451   
   430    452       internal static string GetLastError(SQLiteConnectionHandle hdl, IntPtr db)
   431    453       {
   432    454           if ((hdl == null) || (db == IntPtr.Zero))

Changes to System.Data.SQLite/SQLiteException.cs.

     7      7   
     8      8   namespace System.Data.SQLite
     9      9   {
    10     10     using System;
    11     11     using System.Data.Common;
    12     12   
    13     13   #if !PLATFORM_COMPACTFRAMEWORK
           14  +  using System.Reflection;
    14     15     using System.Runtime.Serialization;
    15     16     using System.Security.Permissions;
    16     17   #endif
    17     18   
    18     19     /// <summary>
    19     20     /// SQLite exception class.
    20     21     /// </summary>
................................................................................
   120    121       public new SQLiteErrorCode ErrorCode
   121    122   #else
   122    123       public SQLiteErrorCode ErrorCode
   123    124   #endif
   124    125       {
   125    126         get { return _errorCode; }
   126    127       }
          128  +
          129  +    /// <summary>
          130  +    /// Returns the error message for the specified SQLite return code.
          131  +    /// </summary>
          132  +    /// <param name="errorCode">The SQLite return code.</param>
          133  +    /// <returns>The error message or null if it cannot be found.</returns>
          134  +    private static string GetErrorString(
          135  +        SQLiteErrorCode errorCode
          136  +        )
          137  +    {
          138  +#if !PLATFORM_COMPACTFRAMEWORK
          139  +        //
          140  +        // HACK: This must be done via reflection in order to prevent
          141  +        //       the RuntimeHelpers.PrepareDelegate method from over-
          142  +        //       eagerly attempting to locate the new (and optional)
          143  +        //       sqlite3_errstr() function in the SQLite core library
          144  +        //       because it happens to be in the static call graph for
          145  +        //       the AppDomain.DomainUnload event handler registered
          146  +        //       by the SQLiteLog class.
          147  +        //
          148  +        BindingFlags flags = BindingFlags.Static |
          149  +            BindingFlags.NonPublic | BindingFlags.InvokeMethod;
          150  +
          151  +        return typeof(SQLiteBase).InvokeMember("GetErrorString",
          152  +            flags, null, null, new object[] { errorCode }) as string;
          153  +#else
          154  +        return SQLiteBase.GetErrorString(errorCode);
          155  +#endif
          156  +    }
   127    157   
   128    158       /// <summary>
   129    159       /// Returns the composite error message based on the SQLite return code
   130    160       /// and the optional detailed error message.
   131    161       /// </summary>
   132    162       /// <param name="errorCode">The SQLite return code.</param>
   133    163       /// <param name="message">Optional detailed error message.</param>
................................................................................
   134    164       /// <returns>Error message text for the return code.</returns>
   135    165       private static string GetStockErrorMessage(
   136    166           SQLiteErrorCode errorCode,
   137    167           string message
   138    168           )
   139    169       {
   140    170           return String.Format("{0}{1}{2}",
   141         -            SQLiteBase.GetErrorString(errorCode),
          171  +            GetErrorString(errorCode),
   142    172               Environment.NewLine, message).Trim();
   143    173       }
   144    174     }
   145    175   
   146    176     /// <summary>
   147    177     /// SQLite error codes.  Actually, this enumeration represents a return code,
   148    178     /// which may also indicate success in one of several ways (e.g. SQLITE_OK,

Changes to System.Data.SQLite/UnsafeNativeMethods.cs.

   607    607       internal static extern SQLiteErrorCode sqlite3_close(IntPtr db);
   608    608   
   609    609   #if !PLATFORM_COMPACTFRAMEWORK
   610    610       [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
   611    611   #else
   612    612       [DllImport(SQLITE_DLL)]
   613    613   #endif
   614         -    internal static extern SQLiteErrorCode sqlite3_close_v2(IntPtr db);
          614  +    internal static extern SQLiteErrorCode sqlite3_close_v2(IntPtr db); /* 3.7.14+ */
   615    615   
   616    616   #if !PLATFORM_COMPACTFRAMEWORK
   617    617       [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
   618    618   #else
   619    619       [DllImport(SQLITE_DLL)]
   620    620   #endif
   621    621       internal static extern SQLiteErrorCode sqlite3_create_function(IntPtr db, byte[] strName, int nArgs, int nType, IntPtr pvUser, SQLiteCallback func, SQLiteCallback fstep, SQLiteFinalCallback ffinal);
................................................................................
  1290   1290   #if !PLATFORM_COMPACTFRAMEWORK
  1291   1291       [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
  1292   1292   #else
  1293   1293       [DllImport(SQLITE_DLL)]
  1294   1294   #endif
  1295   1295       internal static extern SQLiteErrorCode sqlite3_extended_errcode(IntPtr db);
  1296   1296   
  1297         -//#if !PLATFORM_COMPACTFRAMEWORK
  1298         -//    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
  1299         -//#else
  1300         -//    [DllImport(SQLITE_DLL)]
  1301         -//#endif
  1302         -//    internal static extern IntPtr sqlite3_errstr(SQLiteErrorCode rc); /* 3.7.15+ */
         1297  +#if !PLATFORM_COMPACTFRAMEWORK
         1298  +    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
         1299  +#else
         1300  +    [DllImport(SQLITE_DLL)]
         1301  +#endif
         1302  +    internal static extern IntPtr sqlite3_errstr(SQLiteErrorCode rc); /* 3.7.15+ */
  1303   1303   
  1304   1304       // Since sqlite3_log() takes a variable argument list, we have to overload declarations
  1305   1305       // for all possible calls.  For now, we are only exposing a single string, and 
  1306   1306       // depend on the caller to format the string.
  1307   1307   #if !PLATFORM_COMPACTFRAMEWORK
  1308   1308       [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
  1309   1309   #else

Changes to readme.htm.

     2      2   <html>
     3      3   <head>
     4      4   <title></title>
     5      5   </head>
     6      6   <body>
     7      7   ADO.NET SQLite Data Provider<br />
     8      8   Version 1.0.83.0 November XX, 2012 <font color="red">(release scheduled)</font><br />
     9         -Using <a href="http://www.sqlite.org/releaselog/3_7_14.html">SQLite 3.7.14</a><br />
            9  +Using <a href="http://www.sqlite.org/src/info/trunk">SQLite 3.7.15</a><br />
    10     10   Originally written by Robert Simpson<br />
    11     11   Released to the public domain, use at your own risk!<br />
    12     12   Official provider website:&nbsp;<a href="http://system.data.sqlite.org/">http://system.data.sqlite.org/</a><br />
    13     13   Legacy versions:&nbsp;<a href="http://sqlite.phxsoftware.com/">http://sqlite.phxsoftware.com/</a><br />
    14     14   <br />
    15     15   The current development version can be downloaded from <a href="http://system.data.sqlite.org/index.html/timeline?y=ci">
    16     16   http://system.data.sqlite.org/index.html/timeline?y=ci</a>
................................................................................
   186    186   
   187    187   <h2><b>Version History</b></h2>
   188    188   
   189    189   <p>
   190    190       <b>1.0.83.0 - November XX, 2012</b>
   191    191   </p>
   192    192   <ul>
   193         -    <li>Updated to <a href="http://www.sqlite.org/releaselog/3_7_14.html">SQLite 3.7.14</a>.</li>
          193  +    <li>Updated to <a href="http://www.sqlite.org/src/info/trunk">SQLite 3.7.15</a>.</li>
   194    194       <li>Add an overload of the SQLiteLog.LogMessage method that takes a single string argument.</li>
   195    195       <li>All applicable calls into the SQLite core library now return a SQLiteErrorCode instead of an integer error code.</li>
   196    196       <li>Make sure the error code of the SQLiteException class gets serialized.</li>
   197    197       <li>Make the test project for the .NET Compact Framework more flexible.</li>
   198    198       <li>When available, the new sqlite3_errstr function from the core library is used to get the error message for a specific return code.</li>
   199    199       <li>The SetMemoryStatus, Shutdown, ResultCode, ExtendedResultCode, and SetAvRetry methods of the SQLiteConnection class now return a SQLiteErrorCode instead of an integer error code.&nbsp;<b>** Potentially Incompatible Change **</b></li>
   200    200       <li>The public constructor for the SQLiteException now takes a SQLiteErrorCode instead of an integer error code.&nbsp;<b>** Potentially Incompatible Change **</b></li>

Changes to www/news.wiki.

     2      2   
     3      3   <b>Version History</b>
     4      4   
     5      5   <p>
     6      6       <b>1.0.83.0 - November XX, 2012 <font color="red">(release scheduled)</font></b>
     7      7   </p>
     8      8   <ul>
     9         -    <li>Updated to [http://www.sqlite.org/releaselog/3_7_14.html|SQLite 3.7.14].</li>
            9  +    <li>Updated to [http://www.sqlite.org/src/info/trunk|SQLite 3.7.15].</li>
    10     10       <li>Add an overload of the SQLiteLog.LogMessage method that takes a single string argument.</li>
    11     11       <li>All applicable calls into the SQLite core library now return a SQLiteErrorCode instead of an integer error code.</li>
    12     12       <li>Make sure the error code of the SQLiteException class gets serialized.</li>
    13     13       <li>Make the test project for the .NET Compact Framework more flexible.</li>
    14     14       <li>When available, the new sqlite3_errstr function from the core library is used to get the error message for a specific return code.</li>
    15     15       <li>The SetMemoryStatus, Shutdown, ResultCode, ExtendedResultCode, and SetAvRetry methods of the SQLiteConnection class now return a SQLiteErrorCode instead of an integer error code.&nbsp;<b>** Potentially Incompatible Change **</b></li>
    16     16       <li>The public constructor for the SQLiteException now takes a SQLiteErrorCode instead of an integer error code.&nbsp;<b>** Potentially Incompatible Change **</b></li>