Index: Doc/Extra/dbfactorysupport.html ================================================================== --- Doc/Extra/dbfactorysupport.html +++ Doc/Extra/dbfactorysupport.html @@ -95,11 +95,11 @@ <DbProviderFactories> <remove invariant="System.Data.SQLite"/> <add name="SQLite Data Provider" invariant="System.Data.SQLite" description=".Net Framework Data Provider for SQLite" type="System.Data.SQLite.SQLiteFactory, System.Data.SQLite, - Version=1.0.59.0, Culture=neutral, + Version=1.0.56.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139"/> </DbProviderFactories> </system.data> </configuration> Index: Doc/Extra/version.html ================================================================== --- Doc/Extra/version.html +++ Doc/Extra/version.html @@ -53,67 +53,10 @@

Version History

-

1.0.59.0 - September 22, 2008

- -

1.0.58.0 - August 30, 2008

- -

1.0.57.0 - August 29, 2008

-

1.0.56.0 - August 11, 2008


-

Distributing the Binaries (Desktop)

+

Distributing the Binaries

System.Data.SQLite.DLL is a mixed assembly signed with a strong name in case you want to add it to the Global Assembly Cache (GAC). This is the only DLL required to be redistributed with your SQLite.NET application(s).  It - comes in 3 - flavors: Win32, Itanium and x64 (AMD64).

-

Distributing the Binaries (Compact Framework)

-

System.Data.SQLite.DLL and SQLite.Interop.XXX.DLL must be - deployed on the Compact Framework.  The XXX is the build number of the - System.Data.SQLite library (e.g. "059").  SQLite.Interop.XXX is a fully - native assembly compiled for the ARM processor, and System.Data.SQLite is the - fully-managed Compact Framework assembly.

+ comes in 4 + flavors: Win32, Itanium, X64 (AMD64) and ARM (Compact Framework).  The Compact + Framework library is signed with a separate strong name, but all the other + versions share the same strong name so they can be interchanged where appropriate without + any change to your application.


+ Send comments on this topic. +

+

+

+

Index: Doc/SQLite.NET.chm ================================================================== --- Doc/SQLite.NET.chm +++ Doc/SQLite.NET.chm cannot compute difference between binary files Index: SQLite.Designer/AssemblyInfo.cs ================================================================== --- SQLite.Designer/AssemblyInfo.cs +++ SQLite.Designer/AssemblyInfo.cs @@ -30,10 +30,10 @@ // Build Number // Revision // // You can specify all the values or you can default the Revision and Build Numbers // by using the '*' as shown below: -[assembly: AssemblyVersion("1.0.36.0")] -[assembly: AssemblyFileVersion("1.0.36.0")] +[assembly: AssemblyVersion("1.0.35.0")] +[assembly: AssemblyFileVersion("1.0.35.0")] [assembly: AssemblyDelaySignAttribute(false)] [assembly: AssemblyKeyFileAttribute("..\\System.Data.SQLite\\System.Data.SQLite.snk")] [assembly: AssemblyKeyNameAttribute("")] Index: SQLite.Designer/Design/Column.cs ================================================================== --- SQLite.Designer/Design/Column.cs +++ SQLite.Designer/Design/Column.cs @@ -241,20 +241,11 @@ [Category("Constraints")] [Description("The default value to populate in the column when an explicit value is not specified.")] public virtual string DefaultValue { get { return _defaultValue; } - set - { - value = value.Trim(); - - if (value != _defaultValue) - { - _defaultValue = value; - _table.MakeDirty(); - } - } + set { _defaultValue = value; } } internal void WriteSql(StringBuilder builder) { builder.AppendFormat("[{0}]", ColumnName); @@ -287,11 +278,8 @@ { builder.Append(" UNIQUE"); if (Unique.Conflict != ConflictEnum.Abort) builder.AppendFormat(" ON CONFLICT {0}", Unique.Conflict.ToString().ToUpperInvariant()); } - - if (String.IsNullOrEmpty(DefaultValue) == false) - builder.AppendFormat(" DEFAULT {0}", DefaultValue); } } } Index: SQLite.Designer/Design/ForeignKey.cs ================================================================== --- SQLite.Designer/Design/ForeignKey.cs +++ SQLite.Designer/Design/ForeignKey.cs @@ -212,11 +212,11 @@ : base(fkey, fkey._table.Catalog, fkey._table.Name, column) { } [Editor(typeof(ColumnsTypeEditor), typeof(UITypeEditor))] - [Description("The column of the current table that refers to the foreign key relationship")] + [Description("The primary (parent) column of the foreign key relationship")] public new string Column { get { return base.Column; } set { SetColumn(value); } } @@ -233,11 +233,11 @@ [Browsable(false)] public override string Table { get { - return base.DesignTable.Name; + return base.Table; } } } [TypeConverter(typeof(ExpandableObjectConverter))] @@ -263,19 +263,19 @@ } } [DisplayName("Base Table")] [Editor(typeof(TablesTypeEditor), typeof(UITypeEditor))] - [Description("The table to which the foreign key refers.")] + [Description("The child table to which the foreign key refers.")] public new string Table { get { return base.Table; } set { SetTable(value); } } [Editor(typeof(ColumnsTypeEditor), typeof(UITypeEditor))] - [Description("The column to which the foreign key refers.")] + [Description("The child column to which the foreign key refers.")] public new string Column { get { return base.Column; } set { SetColumn(value); } } @@ -330,18 +330,18 @@ _from = new ForeignKeyFromItem(this, ""); _to = new ForeignKeyToItem(this, _table.Catalog, "", ""); } } - //internal void WriteSql(StringBuilder builder) - //{ - // if (String.IsNullOrEmpty(_from.Column) == false && String.IsNullOrEmpty(_to.Catalog) == false && - // String.IsNullOrEmpty(_to.Table) == false && String.IsNullOrEmpty(_to.Column) == false) - // { - // builder.AppendFormat("CONSTRAINT [{0}] FOREIGN KEY ([{1}]) REFERENCES [{3}] ([{4}])", Name, _from.Column, _to.Catalog, _to.Table, _to.Column); - // } - //} + internal void WriteSql(StringBuilder builder) + { + if (String.IsNullOrEmpty(_from.Column) == false && String.IsNullOrEmpty(_to.Catalog) == false && + String.IsNullOrEmpty(_to.Table) == false && String.IsNullOrEmpty(_to.Column) == false) + { + builder.AppendFormat("CONSTRAINT [{0}] FOREIGN KEY ([{1}]) REFERENCES [{3}] ([{4}])", Name, _from.Column, _to.Catalog, _to.Table, _to.Column); + } + } [ParenthesizePropertyName(true)] [Category("Identity")] [Description("The name of the foreign key.")] public string Name @@ -375,21 +375,21 @@ return ((IHaveConnection)_table).GetConnection(); } #endregion - [DisplayName("From Key")] - [Category("From")] - [Description("The source column in the current table that refers to the foreign key.")] + [DisplayName("Primary/Unique Key")] + [Category("Source")] + [Description("The source (parent) column in the current table that is to be the unique value of the foreign key.")] public ForeignKeyFromItem From { get { return _from; } } - [DisplayName("To Key")] - [Category("To")] - [Description("The table and column to which the specified from column is related.")] + [DisplayName("Foreign Key")] + [Category("Target")] + [Description("The child table and column to which the specified parent column is related.")] public ForeignKeyToItem To { get { return _to; } } Index: SQLite.Designer/Design/Table.cs ================================================================== --- SQLite.Designer/Design/Table.cs +++ SQLite.Designer/Design/Table.cs @@ -271,11 +271,10 @@ } [Category("Storage")] [RefreshProperties(RefreshProperties.All)] [ParenthesizePropertyName(true)] - [NotifyParentProperty(true)] public override string Name { get { return _name; } set { @@ -405,38 +404,14 @@ } builder.Append(separator); builder.AppendFormat("CONSTRAINT [CK_{0}_{1}] CHECK {2}", Name, n + 1, check); } - List keys = new List(); - - for (int x = 0; x < ForeignKeys.Count; x++) - { - ForeignKey key = ForeignKeys[x]; - - if (String.IsNullOrEmpty(key.From.Column) == true || String.IsNullOrEmpty(key.From.Catalog) == true || - String.IsNullOrEmpty(key.To.Table) == true || String.IsNullOrEmpty(key.To.Column) == true) - continue; - - if (keys.Count > 0) - { - if (keys[0].Name == key.Name && keys[0].To.Catalog == key.To.Catalog && keys[0].To.Table == key.To.Table) - { - keys.Add(key); - continue; - } - builder.Append(separator); - WriteFKeys(keys, builder); - keys.Clear(); - } - keys.Add(key); - } - - if (keys.Count > 0) - { - builder.Append(separator); - WriteFKeys(keys, builder); + foreach (ForeignKey fkey in ForeignKeys) + { + builder.Append(separator); + fkey.WriteSql(builder); } builder.Append("\r\n);\r\n"); // Rebuilding an existing table @@ -494,32 +469,10 @@ } return builder.ToString(); } - private void WriteFKeys(List keys, StringBuilder builder) - { - builder.AppendFormat("CONSTRAINT [{0}] FOREIGN KEY (", keys[0].Name); - string separator = ""; - - foreach (ForeignKey key in keys) - { - builder.AppendFormat("{0}[{1}]", separator, key.From.Column); - separator = ", "; - } - - builder.AppendFormat(") REFERENCES [{0}] (", keys[0].To.Table); - - separator = ""; - foreach (ForeignKey key in keys) - { - builder.AppendFormat("{0}[{1}]", separator, key.To.Column); - separator = ", "; - } - builder.Append(")"); - } - [Browsable(false)] public override ViewTableBase DesignTable { get { return this; } } DELETED SQLite.Designer/Resources/ToolboxItems.txt Index: SQLite.Designer/Resources/ToolboxItems.txt ================================================================== --- SQLite.Designer/Resources/ToolboxItems.txt +++ /dev/null @@ -1,4 +0,0 @@ -[SQLite] -System.Data.SQLite.SQLiteConnection, System.Data.SQLite -System.Data.SQLite.SQLiteDataAdapter, System.Data.SQLite -System.Data.SQLite.SQLiteCommand, System.Data.SQLite Index: SQLite.Designer/SQLiteDataViewSupport2005.xml ================================================================== --- SQLite.Designer/SQLiteDataViewSupport2005.xml +++ SQLite.Designer/SQLiteDataViewSupport2005.xml @@ -349,26 +349,26 @@ - + Referenced Database Referenced Table - + Index: SQLite.Designer/SQLiteDataViewSupport2008.xml ================================================================== --- SQLite.Designer/SQLiteDataViewSupport2008.xml +++ SQLite.Designer/SQLiteDataViewSupport2008.xml @@ -352,26 +352,26 @@ - + Referenced Database Referenced Table - + Index: SQLite.Interop/SQLite.Interop.rc ================================================================== --- SQLite.Interop/SQLite.Interop.rc +++ SQLite.Interop/SQLite.Interop.rc @@ -51,11 +51,11 @@ // // Version // VS_VERSION_INFO VERSIONINFO - FILEVERSION 1,0,59,0 + FILEVERSION 1,0,56,0 PRODUCTVERSION 1,0,0,0 FILEFLAGSMASK 0x17L #ifdef _DEBUG FILEFLAGS 0x1L #else @@ -69,14 +69,14 @@ BEGIN BLOCK "040904b0" BEGIN VALUE "Comments", "http://sqlite.phxsoftware.com" VALUE "FileDescription", "System.Data.SQLite Interop Library" - VALUE "FileVersion", "1.0.59.0" + VALUE "FileVersion", "1.0.56.0" VALUE "InternalName", "SQLite.Interop.DLL" VALUE "LegalCopyright", "Released to the public domain" - VALUE "OriginalFilename", "SQLite3.DLL 3.6.3" + VALUE "OriginalFilename", "SQLite3.DLL 3.6.1" VALUE "ProductName", "System.Data.SQLite" VALUE "ProductVersion", "1.0" END END BLOCK "VarFileInfo" Index: SQLite.Interop/SQLite.Interop.vcproj ================================================================== --- SQLite.Interop/SQLite.Interop.vcproj +++ SQLite.Interop/SQLite.Interop.vcproj @@ -138,12 +138,11 @@ FavorSizeOrSpeed="2" PreprocessorDefinitions="_WIN32_WCE=$(CEVER);UNDER_CE=$(CEVER);WINCE;$(PLATFORMDEFINES);NDEBUG;_WINDOWS;_USRDLL;CPPSMART_EXPORTS;$(ARCHFAM);$(_ARCHFAM_);UNICODE;_UNICODE;SQLITE_HAS_CODEC;SQLITE_ENABLE_COLUMN_METADATA;SQLITE_ENABLE_FTS3;SQLITE_ENABLE_RTREE;SQLITE_ENABLE_LOAD_EXTENSION;SQLITE_SOUNDEX;INVALID_FILE_ATTRIBUTES=((DWORD)-1)" StringPooling="true" ExceptionHandling="0" BufferSecurityCheck="false" - CompileForArchitecture="0" - InterworkCalls="false" + EnableFunctionLevelLinking="true" /> @@ -691,338 +695,10 @@ Name="VCAppVerifierTool" /> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -1083,26 +759,10 @@ ExcludedFromBuild="true" > - - - - - - @@ -1132,26 +792,10 @@ - - - - - - @@ -1187,26 +831,10 @@ ExcludedFromBuild="true" > - - - - - - @@ -1236,26 +864,10 @@ - - - - - - @@ -1291,26 +903,10 @@ ExcludedFromBuild="true" > - - - - - - @@ -1340,26 +936,10 @@ - - - - - - @@ -1395,26 +975,10 @@ ExcludedFromBuild="true" > - - - - - - @@ -1447,26 +1011,10 @@ ExcludedFromBuild="true" > - - - - - - @@ -1496,26 +1044,10 @@ - - - - - - @@ -1551,26 +1083,10 @@ ExcludedFromBuild="true" > - - - - - - @@ -1600,26 +1116,10 @@ - - - - - - @@ -1655,26 +1155,10 @@ ExcludedFromBuild="true" > - - - - - - @@ -1707,26 +1191,10 @@ ExcludedFromBuild="true" > - - - - - - @@ -1756,26 +1224,10 @@ - - - - - - @@ -1811,26 +1263,10 @@ ExcludedFromBuild="true" > - - - - - - @@ -1860,26 +1296,10 @@ - - - - - - @@ -1915,26 +1335,10 @@ ExcludedFromBuild="true" > - - - - - - @@ -1967,26 +1371,10 @@ ExcludedFromBuild="true" > - - - - - - @@ -2016,26 +1404,10 @@ - - - - - - @@ -2071,26 +1443,10 @@ ExcludedFromBuild="true" > - - - - - - @@ -2120,26 +1476,10 @@ - - - - - - @@ -2175,26 +1515,10 @@ ExcludedFromBuild="true" > - - - - - - @@ -2224,26 +1548,10 @@ - - - - - - @@ -2279,26 +1587,10 @@ ExcludedFromBuild="true" > - - - - - - @@ -2328,26 +1620,10 @@ - - - - - - @@ -2383,26 +1659,10 @@ ExcludedFromBuild="true" > - - - - - - @@ -2435,26 +1695,10 @@ ExcludedFromBuild="true" > - - - - - - @@ -2484,26 +1728,10 @@ - - - - - - @@ -2539,26 +1767,10 @@ ExcludedFromBuild="true" > - - - - - - @@ -2588,26 +1800,10 @@ - - - - - - @@ -2643,26 +1839,10 @@ ExcludedFromBuild="true" > - - - - - - @@ -2695,26 +1875,10 @@ ExcludedFromBuild="true" > - - - - - - @@ -2744,26 +1908,10 @@ - - - - - - @@ -2799,26 +1947,10 @@ ExcludedFromBuild="true" > - - - - - - @@ -2848,26 +1980,10 @@ - - - - - - @@ -2903,26 +2019,10 @@ ExcludedFromBuild="true" > - - - - - - @@ -2955,26 +2055,10 @@ ExcludedFromBuild="true" > - - - - - - @@ -3004,26 +2088,10 @@ - - - - - - @@ -3091,42 +2159,10 @@ ExcludedFromBuild="true" > - - - - - - - - - - - - @@ -3154,94 +2190,10 @@ Name="VCCLCompilerTool" /> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -3279,26 +2231,10 @@ ExcludedFromBuild="true" > - - - - - - @@ -3331,26 +2267,10 @@ ExcludedFromBuild="true" > - - - - - - @@ -3380,26 +2300,10 @@ - - - - - - @@ -3435,94 +2339,10 @@ ExcludedFromBuild="true" > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -3552,26 +2372,10 @@ - - - - - - @@ -3607,26 +2411,10 @@ ExcludedFromBuild="true" > - - - - - - @@ -3656,26 +2444,10 @@ - - - - - - @@ -3711,26 +2483,10 @@ ExcludedFromBuild="true" > - - - - - - @@ -3760,26 +2516,10 @@ - - - - - - @@ -3815,26 +2555,10 @@ ExcludedFromBuild="true" > - - - - - - @@ -3867,26 +2591,10 @@ ExcludedFromBuild="true" > - - - - - - @@ -3916,26 +2624,10 @@ - - - - - - @@ -3971,26 +2663,10 @@ ExcludedFromBuild="true" > - - - - - - @@ -4020,26 +2696,10 @@ - - - - - - @@ -4075,26 +2735,10 @@ ExcludedFromBuild="true" > - - - - - - @@ -4124,26 +2768,10 @@ - - - - - - @@ -4179,26 +2807,10 @@ ExcludedFromBuild="true" > - - - - - - @@ -4231,26 +2843,10 @@ ExcludedFromBuild="true" > - - - - - - @@ -4280,26 +2876,10 @@ - - - - - - @@ -4335,26 +2915,10 @@ ExcludedFromBuild="true" > - - - - - - @@ -4387,94 +2951,10 @@ ExcludedFromBuild="true" > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -4504,26 +2984,10 @@ - - - - - - Index: SQLite.Interop/crypt.c ================================================================== --- SQLite.Interop/crypt.c +++ SQLite.Interop/crypt.c @@ -1,9 +1,9 @@ #ifndef SQLITE_OMIT_DISKIO #ifdef SQLITE_HAS_CODEC -#ifdef SQLITE_DEBUG +#if _DEBUG #include "splitsource\pager.c" #endif #include #include Index: SQLite.Interop/interop.c ================================================================== --- SQLite.Interop/interop.c +++ SQLite.Interop/interop.c @@ -1,6 +1,6 @@ -#ifndef SQLITE_DEBUG +#ifdef NDEBUG #include "src/sqlite3.c" #else #include "splitsource\btreeint.h" #include "splitsource\vdbeint.h" #include "splitsource\sqliteInt.h" @@ -11,19 +11,22 @@ #include #ifdef NDEBUG #if _WIN32_WCE -//#include "merge.h" +#include "merge.h" #else #include "merge_full.h" #endif // _WIN32_WCE #endif // NDEBUG extern int RegisterExtensionFunctions(sqlite3 *db); #ifdef SQLITE_OS_WIN + +// Additional flag for sqlite3.flags, we use it as a reference counter +#define SQLITE_WantClose 0x10000000 // Additional open flags, we use this one privately //#define SQLITE_OPEN_SHAREDCACHE 0x01000000 typedef void (*SQLITEUSERFUNC)(sqlite3_context *, int, sqlite3_value **); @@ -36,162 +39,24 @@ LPSECURITY_ATTRIBUTES, DWORD, DWORD, HANDLE); - -/* -** Vista cache hack. Open a file, but don't use FILE_FLAG_RANDOM_ACCESS -- Vista and above only. -*/ -static int winOpenVista( - sqlite3_vfs *pVfs, /* Not used */ - const char *zName, /* Name of the file (UTF-8) */ - sqlite3_file *id, /* Write the SQLite file handle here */ - int flags, /* Open mode flags */ - int *pOutFlags /* Status return flags */ -){ - HANDLE h; - DWORD dwDesiredAccess; - DWORD dwShareMode; - DWORD dwCreationDisposition; - DWORD dwFlagsAndAttributes = 0; - int isTemp; - winFile *pFile = (winFile*)id; - void *zConverted; /* Filename in OS encoding */ - const char *zUtf8Name = zName; /* Filename in UTF-8 encoding */ - char zTmpname[MAX_PATH+1]; /* Buffer used to create temp filename */ - - /* If the second argument to this function is NULL, generate a - ** temporary file name to use - */ - if( !zUtf8Name ){ - int rc = getTempname(MAX_PATH+1, zTmpname); - if( rc!=SQLITE_OK ){ - return rc; - } - zUtf8Name = zTmpname; - } - - /* Convert the filename to the system encoding. */ - zConverted = convertUtf8Filename(zUtf8Name); - if( zConverted==0 ){ - return SQLITE_NOMEM; - } - - if( flags & SQLITE_OPEN_READWRITE ){ - dwDesiredAccess = GENERIC_READ | GENERIC_WRITE; - }else{ - dwDesiredAccess = GENERIC_READ; - } - if( flags & SQLITE_OPEN_CREATE ){ - dwCreationDisposition = OPEN_ALWAYS; - }else{ - dwCreationDisposition = OPEN_EXISTING; - } - if( flags & SQLITE_OPEN_MAIN_DB ){ - dwShareMode = FILE_SHARE_READ | FILE_SHARE_WRITE; - }else{ - dwShareMode = 0; - } - if( flags & SQLITE_OPEN_DELETEONCLOSE ){ -#if SQLITE_OS_WINCE - dwFlagsAndAttributes = FILE_ATTRIBUTE_HIDDEN; -#else - dwFlagsAndAttributes = FILE_ATTRIBUTE_TEMPORARY - | FILE_ATTRIBUTE_HIDDEN - | FILE_FLAG_DELETE_ON_CLOSE; -#endif - isTemp = 1; - }else{ - dwFlagsAndAttributes = FILE_ATTRIBUTE_NORMAL; - isTemp = 0; - } - /* Reports from the internet are that performance is always - ** better if FILE_FLAG_RANDOM_ACCESS is used. Ticket #2699. */ - //dwFlagsAndAttributes |= FILE_FLAG_RANDOM_ACCESS; - if( isNT() ){ - h = CreateFileW((WCHAR*)zConverted, - dwDesiredAccess, - dwShareMode, - NULL, - dwCreationDisposition, - dwFlagsAndAttributes, - NULL - ); - }else{ - h = CreateFileA((char*)zConverted, - dwDesiredAccess, - dwShareMode, - NULL, - dwCreationDisposition, - dwFlagsAndAttributes, - NULL - ); - } - if( h==INVALID_HANDLE_VALUE ){ - free(zConverted); - if( flags & SQLITE_OPEN_READWRITE ){ - return winOpen(0, zName, id, - ((flags|SQLITE_OPEN_READONLY)&~SQLITE_OPEN_READWRITE), pOutFlags); - }else{ - return SQLITE_CANTOPEN; - } - } - if( pOutFlags ){ - if( flags & SQLITE_OPEN_READWRITE ){ - *pOutFlags = SQLITE_OPEN_READWRITE; - }else{ - *pOutFlags = SQLITE_OPEN_READONLY; - } - } - memset(pFile, 0, sizeof(*pFile)); - pFile->pMethod = &winIoMethod; - pFile->h = h; -#if SQLITE_OS_WINCE - if( (flags & (SQLITE_OPEN_READWRITE|SQLITE_OPEN_MAIN_DB)) == - (SQLITE_OPEN_READWRITE|SQLITE_OPEN_MAIN_DB) - && !winceCreateLock(zName, pFile) - ){ - CloseHandle(h); - free(zConverted); - return SQLITE_CANTOPEN; - } - if( isTemp ){ - pFile->zDeleteOnClose = zConverted; - }else -#endif - { - free(zConverted); - } - OpenCounter(+1); - return SQLITE_OK; -} - -int sqlite3_vista_init(void){ - static sqlite3_vfs winVfs = { - 1, /* iVersion */ - sizeof(winFile), /* szOsFile */ - MAX_PATH, /* mxPathname */ - 0, /* pNext */ - "win32", /* zName */ - 0, /* pAppData */ - - winOpenVista, /* xOpen */ - winDelete, /* xDelete */ - winAccess, /* xAccess */ - winFullPathname, /* xFullPathname */ - winDlOpen, /* xDlOpen */ - winDlError, /* xDlError */ - winDlSym, /* xDlSym */ - winDlClose, /* xDlClose */ - winRandomness, /* xRandomness */ - winSleep, /* xSleep */ - winCurrentTime, /* xCurrentTime */ - winGetLastError /* xGetLastError */ - }; - sqlite3_vfs_register(&winVfs, 1); - return SQLITE_OK; +static CRITICAL_SECTION g_cs; +static LONG g_dwcsInit = 0; + +void EnterGlobalMutex() +{ + if (InterlockedCompareExchange(&g_dwcsInit, 1, 0) == 0) + InitializeCriticalSection(&g_cs); + + EnterCriticalSection(&g_cs); +} + +void LeaveGlobalMutex() +{ + LeaveCriticalSection(&g_cs); } int SetCompression(const wchar_t *pwszFilename, unsigned short ufLevel) { #ifdef FSCTL_SET_COMPRESSION @@ -237,27 +102,10 @@ __declspec(dllexport) int WINAPI sqlite3_decompressfile(const wchar_t *pwszFilename) { return SetCompression(pwszFilename, COMPRESSION_FORMAT_NONE); } -__declspec(dllexport) int WINAPI sqlite3_initialize_interop() -{ - int ret = sqlite3_initialize(); - if (ret == SQLITE_OK) - { - // Override Vista and abov OS's so they use our hack open() function - OSVERSIONINFO osi; - osi.dwOSVersionInfoSize = sizeof(osi); - if (GetVersionEx(&osi)) - { - if (osi.dwMajorVersion > 5) - ret = sqlite3_vista_init(); - } - } - return ret; -} - /* The goal of this version of close is different than that of sqlite3_close(), and is designed to lend itself better to .NET's non-deterministic finalizers and the GC thread. SQLite will not close a database if statements are open on it -- but for our purposes, we'd rather finalize all active statements and forcibly close the database. The reason is simple -- a lot of people don't Dispose() of their objects correctly and let the garbage collector do it. This leads to unexpected behavior when a user thinks they've closed a database, but it's still open because not all the statements have @@ -271,10 +119,12 @@ */ __declspec(dllexport) int WINAPI sqlite3_close_interop(sqlite3 *db) { int ret; + EnterGlobalMutex(); + ret = sqlite3_close(db); if (ret == SQLITE_BUSY && db->pVdbe) { while (db->pVdbe) @@ -308,25 +158,31 @@ } } ret = sqlite3_close(db); } + LeaveGlobalMutex(); + return ret; } __declspec(dllexport) int WINAPI sqlite3_open_interop(const char*filename, int flags, sqlite3 **ppdb) { int ret; //int sharedcache = ((flags & SQLITE_OPEN_SHAREDCACHE) != 0); //flags &= ~SQLITE_OPEN_SHAREDCACHE; + + //EnterGlobalMutex(); //sqlite3_enable_shared_cache(sharedcache); ret = sqlite3_open_v2(filename, ppdb, flags, NULL); //sqlite3_enable_shared_cache(0); if (ret == 0) RegisterExtensionFunctions(*ppdb); + + //LeaveGlobalMutex(); return ret; } __declspec(dllexport) int WINAPI sqlite3_open16_interop(const char *filename, int flags, sqlite3 **ppdb) @@ -436,27 +292,48 @@ return pval; } __declspec(dllexport) int WINAPI sqlite3_finalize_interop(sqlite3_stmt *stmt) { + // Try and finalize a statement, and close the database it belonged to if the database was marked for closing Vdbe *p; sqlite3 *db; int ret; + + EnterGlobalMutex(); p = (Vdbe *)stmt; db = (p == NULL) ? NULL : p->db; - if (p->magic == VDBE_MAGIC_DEAD) - { - if (db == NULL) - { - sqlite3_free(p); - ret = SQLITE_OK; - } - } - else - ret = sqlite3_finalize(stmt); + while(1) + { + if (p->magic == VDBE_MAGIC_DEAD) + { + if (db == NULL) + { + sqlite3_free(p); + ret = SQLITE_OK; + break; + } + } + + ret = sqlite3_finalize(stmt); + + if (ret == SQLITE_OK) + { + if (db->flags & SQLITE_WantClose) + { + if (db->pVdbe == NULL) + { + ret = sqlite3_close(db); + } + } + } + break; + } + + LeaveGlobalMutex(); return ret; } __declspec(dllexport) int WINAPI sqlite3_reset_interop(sqlite3_stmt *stmt) Index: SQLite.Interop/merge.h ================================================================== --- SQLite.Interop/merge.h +++ SQLite.Interop/merge.h @@ -1,13 +1,13 @@ // This code was automatically generated from assembly -// C:\Src\SQLite.NET\bin\CompactFramework\System.Data.SQLite.dll +// C:\Src\SQLite.NET\System.Data.SQLite\bin\CompactFramework\System.Data.SQLite.dll #include #pragma data_seg(push,clrseg,".clr") #pragma comment(linker, "/SECTION:.clr,ER") - char __ph[592628] = {0}; // The number of bytes to reserve + char __ph[143484] = {0}; // The number of bytes to reserve #pragma data_seg(pop,clrseg) typedef BOOL (WINAPI *DLLMAIN)(HANDLE, DWORD, LPVOID); typedef struct EXTRA_STUFF { Index: SQLite.Interop/merge_full.h ================================================================== --- SQLite.Interop/merge_full.h +++ SQLite.Interop/merge_full.h @@ -1,13 +1,13 @@ // This code was automatically generated from assembly -// C:\Src\SQLite.NET\System.Data.SQLite\bin\System.Data.SQLite.dll +// C:\Src\SQLite.NET\bin\ManagedOnly\System.Data.SQLite.dll #include #pragma data_seg(push,clrseg,".clr") #pragma comment(linker, "/SECTION:.clr,ER") - char __ph[157996] = {0}; // The number of bytes to reserve + char __ph[155780] = {0}; // The number of bytes to reserve #pragma data_seg(pop,clrseg) typedef BOOL (WINAPI *DLLMAIN)(HANDLE, DWORD, LPVOID); typedef struct EXTRA_STUFF { Index: SQLite.Interop/src/sqlite3.c ================================================================== --- SQLite.Interop/src/sqlite3.c +++ SQLite.Interop/src/sqlite3.c @@ -1,8 +1,8 @@ /****************************************************************************** ** This file is an amalgamation of many separate C source files from SQLite -** version 3.6.3. By combining all the individual C code files into this +** version 3.6.1. By combining all the individual C code files into this ** single large file, the entire code can be compiled as a one translation ** unit. This allows many compilers to do optimizations that would not be ** possible if the files were compiled separately. Performance improvements ** of 5% are more are commonly seen when SQLite is compiled as a single ** translation unit. @@ -9,17 +9,17 @@ ** ** This file is all you need to compile SQLite. To use SQLite in other ** programs, you need this file and the "sqlite3.h" header file that defines ** the programming interface to the SQLite library. (If you do not have ** the "sqlite3.h" header file at hand, you will find a copy in the first -** 6364 lines past this header comment.) Additional code files may be +** 6279 lines past this header comment.) Additional code files may be ** needed if you want a wrapper to interface SQLite with your choice of ** programming language. The code for the "sqlite3" command-line shell ** is also in a separate file. This file contains only code for the core ** SQLite library. ** -** This amalgamation was generated on 2008-09-22 10:45:10 UTC. +** This amalgamation was generated on 2008-08-05 21:36:42 UTC. */ #define SQLITE_CORE 1 #define SQLITE_AMALGAMATION 1 #ifndef SQLITE_PRIVATE # define SQLITE_PRIVATE static @@ -39,11 +39,11 @@ ** May you share freely, never taking more than you give. ** ************************************************************************* ** Internal interface definitions for SQLite. ** -** @(#) $Id: sqlite3.c,v 1.11 2008/09/22 16:30:20 rmsimpson Exp $ +** @(#) $Id: sqlite3.c,v 1.9 2008/08/06 21:45:28 rmsimpson Exp $ */ #ifndef _SQLITEINT_H_ #define _SQLITEINT_H_ /* @@ -68,11 +68,11 @@ ** ************************************************************************* ** ** This file defines various limits of what SQLite can process. ** -** @(#) $Id: sqlite3.c,v 1.11 2008/09/22 16:30:20 rmsimpson Exp $ +** @(#) $Id: sqlite3.c,v 1.9 2008/08/06 21:45:28 rmsimpson Exp $ */ /* ** The maximum length of a TEXT or BLOB in bytes. This also ** limits the size of a row in a table or index. @@ -372,20 +372,10 @@ #else # define SQLITE_THREADSAFE 1 #endif #endif -/* -** The SQLITE_DEFAULT_MEMSTATUS macro must be defined as either 0 or 1. -** It determines whether or not the features related to -** SQLITE_CONFIG_MEMSTATUS are availabe by default or not. This value can -** be overridden at runtime using the sqlite3_config() API. -*/ -#if !defined(SQLITE_DEFAULT_MEMSTATUS) -# define SQLITE_DEFAULT_MEMSTATUS 1 -#endif - /* ** Exactly one of the following macros must be defined in order to ** specify which memory allocation subsystem to use. ** ** SQLITE_SYSTEM_MALLOC // Use normal system malloc() @@ -433,13 +423,10 @@ */ #if !defined(_XOPEN_SOURCE) && !defined(__DARWIN__) && !defined(__APPLE__) && SQLITE_THREADSAFE # define _XOPEN_SOURCE 500 /* Needed to enable pthread recursive mutexes */ #endif -/* -** The TCL headers are only needed when compiling the TCL bindings. -*/ #if defined(SQLITE_TCL) || defined(TCLSH) # include #endif /* @@ -485,11 +472,11 @@ ** The name of this file under configuration management is "sqlite.h.in". ** The makefile makes some minor changes to this file (such as inserting ** the version number) and changes its name to "sqlite3.h" as ** part of the build process. ** -** @(#) $Id: sqlite3.c,v 1.11 2008/09/22 16:30:20 rmsimpson Exp $ +** @(#) $Id: sqlite3.c,v 1.9 2008/08/06 21:45:28 rmsimpson Exp $ */ #ifndef _SQLITE3_H_ #define _SQLITE3_H_ #include /* Needed for the definition of va_list */ @@ -506,35 +493,10 @@ */ #ifndef SQLITE_EXTERN # define SQLITE_EXTERN extern #endif -/* -** Add the ability to mark interfaces as deprecated. -*/ -#if (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1)) - /* GCC added the deprecated attribute in version 3.1 */ - #define SQLITE_DEPRECATED __attribute__ ((deprecated)) -#elif defined(_MSC_VER) && (_MSC_VER>1200) - #define SQLITE_DEPRECATED __declspec(deprecated) -#else - #define SQLITE_DEPRECATED -#endif - -/* -** Add the ability to mark interfaces as experimental. -*/ -#if (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)) - /* I can confirm that it does not work on version 4.1.0... */ - /* First appears in GCC docs for version 4.3.0 */ - #define SQLITE_EXPERIMENTAL __attribute__ ((warning ("is experimental"))) -#elif defined(_MSC_VER) && (_MSC_VER>1200) - #define SQLITE_EXPERIMENTAL __declspec(deprecated("was declared experimental")) -#else - #define SQLITE_EXPERIMENTAL -#endif - /* ** Ensure these symbols were not defined by some previous header file. */ #ifdef SQLITE_VERSION # undef SQLITE_VERSION @@ -571,12 +533,12 @@ ** ** {H10014} The SQLITE_VERSION_NUMBER #define shall resolve to an integer ** with the value (X*1000000 + Y*1000 + Z) where X, Y, and Z ** are the major version, minor version, and release number. */ -#define SQLITE_VERSION "3.6.3" -#define SQLITE_VERSION_NUMBER 3006003 +#define SQLITE_VERSION "3.6.1" +#define SQLITE_VERSION_NUMBER 3006001 /* ** CAPI3REF: Run-Time Library Version Numbers {H10020} ** KEYWORDS: sqlite3_version ** @@ -609,13 +571,12 @@ /* ** CAPI3REF: Test To See If The Library Is Threadsafe {H10100} ** ** SQLite can be compiled with or without mutexes. When -** the [SQLITE_THREADSAFE] C preprocessor macro 1 or 2, mutexes -** are enabled and SQLite is threadsafe. When the -** [SQLITE_THREADSAFE] macro is 0, +** the [SQLITE_THREADSAFE] C preprocessor macro is true, mutexes +** are enabled and SQLite is threadsafe. When that macro is false, ** the mutexes are omitted. Without the mutexes, it is not safe ** to use SQLite concurrently from more than one thread. ** ** Enabling mutexes incurs a measurable performance penalty. ** So if speed is of utmost importance, it makes sense to disable @@ -633,17 +594,16 @@ ** with the verbs [SQLITE_CONFIG_SINGLETHREAD], [SQLITE_CONFIG_MULTITHREAD], ** or [SQLITE_CONFIG_MUTEX]. The return value of this function shows ** only the default compile-time setting, not any run-time changes ** to that setting. ** -** See the [threading mode] documentation for additional information. -** ** INVARIANTS: ** ** {H10101} The [sqlite3_threadsafe()] function shall return nonzero if -** and only if -** SQLite was compiled with the its mutexes enabled by default. +** SQLite was compiled with the its mutexes enabled by default +** or zero if SQLite was compiled such that mutexes are +** permanently disabled. ** ** {H10102} The value returned by the [sqlite3_threadsafe()] function ** shall not change when mutex setting are modified at ** runtime using the [sqlite3_config()] interface and ** especially the [SQLITE_CONFIG_SINGLETHREAD], @@ -973,11 +933,10 @@ #define SQLITE_IOERR_DELETE (SQLITE_IOERR | (10<<8)) #define SQLITE_IOERR_BLOCKED (SQLITE_IOERR | (11<<8)) #define SQLITE_IOERR_NOMEM (SQLITE_IOERR | (12<<8)) #define SQLITE_IOERR_ACCESS (SQLITE_IOERR | (13<<8)) #define SQLITE_IOERR_CHECKRESERVEDLOCK (SQLITE_IOERR | (14<<8)) -#define SQLITE_IOERR_LOCK (SQLITE_IOERR | (15<<8)) /* ** CAPI3REF: Flags For File Open Operations {H10230} ** ** These bit values are intended for use in the @@ -996,11 +955,10 @@ #define SQLITE_OPEN_MAIN_JOURNAL 0x00000800 #define SQLITE_OPEN_TEMP_JOURNAL 0x00001000 #define SQLITE_OPEN_SUBJOURNAL 0x00002000 #define SQLITE_OPEN_MASTER_JOURNAL 0x00004000 #define SQLITE_OPEN_NOMUTEX 0x00008000 -#define SQLITE_OPEN_FULLMUTEX 0x00010000 /* ** CAPI3REF: Device Characteristics {H10240} ** ** The xDeviceCapabilities method of the [sqlite3_io_methods] @@ -1450,11 +1408,11 @@ ** ** When a configuration option is set, sqlite3_config() returns SQLITE_OK. ** If the option is unknown or SQLite is unable to set the option ** then this routine returns a non-zero [error code]. */ -SQLITE_API SQLITE_EXPERIMENTAL int sqlite3_config(int, ...); +SQLITE_API int sqlite3_config(int, ...); /* ** CAPI3REF: Configure database connections {H10180} ** EXPERIMENTAL ** @@ -1471,11 +1429,11 @@ ** aspect of the [database connection] is being configured. ** The only choice for this value is [SQLITE_DBCONFIG_LOOKASIDE]. ** New verbs are likely to be added in future releases of SQLite. ** Additional arguments depend on the verb. */ -SQLITE_API SQLITE_EXPERIMENTAL int sqlite3_db_config(sqlite3*, int op, ...); +SQLITE_API int sqlite3_db_config(sqlite3*, int op, ...); /* ** CAPI3REF: Memory Allocation Routines {H10155} ** EXPERIMENTAL ** @@ -1554,13 +1512,11 @@ **
There are no arguments to this option. This option disables ** mutexing on [database connection] and [prepared statement] objects. ** The application is responsible for serializing access to ** [database connections] and [prepared statements]. But other mutexes ** are enabled so that SQLite will be safe to use in a multi-threaded -** environment as long as no two threads attempt to use the same -** [database connection] at the same time. See the [threading mode] -** documentation for additional information.
+** environment. ** **
SQLITE_CONFIG_SERIALIZED
**
There are no arguments to this option. This option enables ** all mutexes including the recursive ** mutexes on [database connection] and [prepared statement] objects. @@ -1567,11 +1523,15 @@ ** In this mode (which is the default when SQLite is compiled with ** [SQLITE_THREADSAFE=1]) the SQLite library will itself serialize access ** to [database connections] and [prepared statements] so that the ** application is free to use the same [database connection] or the ** same [prepared statement] in different threads at the same time. -** See the [threading mode] documentation for additional information.
+** +**

This configuration option merely sets the default mutex +** behavior to serialize access to [database connections]. Individual +** [database connections] can override this setting +** using the [SQLITE_OPEN_NOMUTEX] flag to [sqlite3_open_v2()].

** **
SQLITE_CONFIG_MALLOC
**
This option takes a single argument which is a pointer to an ** instance of the [sqlite3_mem_methods] structure. The argument specifies ** alternative low-level memory allocation routines to be used in place of @@ -2030,14 +1990,10 @@ ** There can only be a single busy handler defined for each ** [database connection]. Setting a new busy handler clears any ** previously set handler. Note that calling [sqlite3_busy_timeout()] ** will also set or clear the busy handler. ** -** The busy callback should not take any actions which modify the -** database connection that invoked the busy handler. Any such actions -** result in undefined behavior. -** ** INVARIANTS: ** ** {H12311} The [sqlite3_busy_handler(D,C,A)] function shall replace ** busy callback in the [database connection] D with a new ** a new busy handler C and application data pointer A. @@ -2562,20 +2518,10 @@ ** Only a single authorizer can be in place on a database connection ** at a time. Each call to sqlite3_set_authorizer overrides the ** previous call. Disable the authorizer by installing a NULL callback. ** The authorizer is disabled by default. ** -** The authorizer callback must not do anything that will modify -** the database connection that invoked the authorizer callback. -** Note that [sqlite3_prepare_v2()] and [sqlite3_step()] both modify their -** database connections for the meaning of "modify" in this paragraph. -** -** When [sqlite3_prepare_v2()] is used to prepare a statement, the -** statement might be reprepared during [sqlite3_step()] due to a -** schema change. Hence, the application should ensure that the -** correct authorizer callback remains in place during the [sqlite3_step()]. -** ** Note that the authorizer callback is invoked only during ** [sqlite3_prepare()] or its variants. Authorization is not ** performed during statement evaluation in [sqlite3_step()]. ** ** INVARIANTS: @@ -2582,23 +2528,23 @@ ** ** {H12501} The [sqlite3_set_authorizer(D,...)] interface registers a ** authorizer callback with database connection D. ** ** {H12502} The authorizer callback is invoked as SQL statements are -** being parseed and compiled. +** being compiled. ** ** {H12503} If the authorizer callback returns any value other than ** [SQLITE_IGNORE], [SQLITE_OK], or [SQLITE_DENY], then -** the application interface call that caused +** the [sqlite3_prepare_v2()] or equivalent call that caused ** the authorizer callback to run shall fail with an ** [SQLITE_ERROR] error code and an appropriate error message. ** ** {H12504} When the authorizer callback returns [SQLITE_OK], the operation ** described is processed normally. ** ** {H12505} When the authorizer callback returns [SQLITE_DENY], the -** application interface call that caused the +** [sqlite3_prepare_v2()] or equivalent call that caused the ** authorizer callback to run shall fail ** with an [SQLITE_ERROR] error code and an error message ** explaining that access is denied. ** ** {H12506} If the authorizer code (the 2nd parameter to the authorizer @@ -2668,25 +2614,25 @@ ** top-level SQL code. ** ** INVARIANTS: ** ** {H12551} The second parameter to an -** [sqlite3_set_authorizer | authorizer callback] shall be an integer +** [sqlite3_set_authorizer | authorizer callback] is always an integer ** [SQLITE_COPY | authorizer code] that specifies what action ** is being authorized. ** ** {H12552} The 3rd and 4th parameters to the ** [sqlite3_set_authorizer | authorization callback] -** shall be parameters or NULL depending on which +** will be parameters or NULL depending on which ** [SQLITE_COPY | authorizer code] is used as the second parameter. ** ** {H12553} The 5th parameter to the -** [sqlite3_set_authorizer | authorizer callback] shall be the name +** [sqlite3_set_authorizer | authorizer callback] is the name ** of the database (example: "main", "temp", etc.) if applicable. ** ** {H12554} The 6th parameter to the -** [sqlite3_set_authorizer | authorizer callback] shall be the name +** [sqlite3_set_authorizer | authorizer callback] is the name ** of the inner-most trigger or view that is responsible for ** the access attempt or NULL if this access attempt is directly from ** top-level SQL code. */ /******************************************* 3rd ************ 4th ***********/ @@ -2742,21 +2688,20 @@ ** the original statement text and an estimate of wall-clock time ** of how long that statement took to run. ** ** INVARIANTS: ** -** {H12281} The callback function registered by [sqlite3_trace()] -** shall be invoked +** {H12281} The callback function registered by [sqlite3_trace()] is ** whenever an SQL statement first begins to execute and ** whenever a trigger subprogram first begins to run. ** -** {H12282} Each call to [sqlite3_trace()] shall override the previously +** {H12282} Each call to [sqlite3_trace()] overrides the previously ** registered trace callback. ** -** {H12283} A NULL trace callback shall disable tracing. +** {H12283} A NULL trace callback disables tracing. ** -** {H12284} The first argument to the trace callback shall be a copy of +** {H12284} The first argument to the trace callback is a copy of ** the pointer which was the 3rd argument to [sqlite3_trace()]. ** ** {H12285} The second argument to the trace callback is a ** zero-terminated UTF-8 string containing the original text ** of the SQL statement as it was passed into [sqlite3_prepare_v2()] @@ -2776,12 +2721,12 @@ ** ** {H12290} The third parameter to the profile callback is an estimate ** of the number of nanoseconds of wall-clock time required to ** run the SQL statement from start to finish. */ -SQLITE_API SQLITE_EXPERIMENTAL void *sqlite3_trace(sqlite3*, void(*xTrace)(void*,const char*), void*); -SQLITE_API SQLITE_EXPERIMENTAL void *sqlite3_profile(sqlite3*, +SQLITE_API void *sqlite3_trace(sqlite3*, void(*xTrace)(void*,const char*), void*); +SQLITE_API void *sqlite3_profile(sqlite3*, void(*xProfile)(void*,const char*,sqlite3_uint64), void*); /* ** CAPI3REF: Query Progress Callbacks {H12910} ** @@ -2791,16 +2736,11 @@ ** [sqlite3_get_table()]. An example use for this ** interface is to keep a GUI updated during a large query. ** ** If the progress callback returns non-zero, the operation is ** interrupted. This feature can be used to implement a -** "Cancel" button on a GUI progress dialog box. -** -** The progress handler must not do anything that will modify -** the database connection that invoked the progress handler. -** Note that [sqlite3_prepare_v2()] and [sqlite3_step()] both modify their -** database connections for the meaning of "modify" in this paragraph. +** "Cancel" button on a GUI dialog box. ** ** INVARIANTS: ** ** {H12911} The callback function registered by sqlite3_progress_handler() ** is invoked periodically during long running calls to @@ -2859,11 +2799,11 @@ ** ** The sqlite3_open_v2() interface works like sqlite3_open() ** except that it accepts two additional parameters for additional control ** over the new database connection. The flags parameter can take one of ** the following three values, optionally combined with the -** [SQLITE_OPEN_NOMUTEX] or [SQLITE_OPEN_FULLMUTEX] flags: +** [SQLITE_OPEN_NOMUTEX] flag: ** **
**
[SQLITE_OPEN_READONLY]
**
The database is opened in read-only mode. If the database does not ** already exist, an error is returned.
@@ -2879,19 +2819,20 @@ ** sqlite3_open() and sqlite3_open16().
** ** ** If the 3rd parameter to sqlite3_open_v2() is not one of the ** combinations shown above or one of the combinations shown above combined -** with the [SQLITE_OPEN_NOMUTEX] or [SQLITE_OPEN_FULLMUTEX] flags, -** then the behavior is undefined. +** with the [SQLITE_OPEN_NOMUTEX] flag, then the behavior is undefined. ** -** If the [SQLITE_OPEN_NOMUTEX] flag is set, then the database connection -** opens in the multi-thread [threading mode] as long as the single-thread -** mode has not been set at compile-time or start-time. If the -** [SQLITE_OPEN_FULLMUTEX] flag is set then the database connection opens -** in the serialized [threading mode] unless single-thread was -** previously selected at compile-time or start-time. +** If the [SQLITE_OPEN_NOMUTEX] flag is set, then mutexes on the +** opened [database connection] are disabled and the appliation must +** insure that access to the [database connection] and its associated +** [prepared statements] is serialized. The [SQLITE_OPEN_NOMUTEX] flag +** is the default behavior is SQLite is configured using the +** [SQLITE_CONFIG_MULTITHREAD] or [SQLITE_CONFIG_SINGLETHREAD] options +** to [sqlite3_config()]. The [SQLITE_OPEN_NOMUTEX] flag only makes a +** difference when SQLite is in its default [SQLITE_CONFIG_SERIALIZED] mode. ** ** If the filename is ":memory:", then a private, temporary in-memory database ** is created for the connection. This in-memory database will vanish when ** the database connection is closed. Future versions of SQLite might ** make use of additional special filenames that begin with the ":" character. @@ -2950,15 +2891,15 @@ ** {H12712} If the G parameter to [sqlite3_open_v2(F,D,G,V)] contains the ** bit value [SQLITE_OPEN_READWRITE] then the database is opened ** reading and writing if possible, or for reading only if the ** file is write protected by the operating system. ** -** {H12713} If the G parameter to [sqlite3_open_v2(F,D,G,V)] omits the +** {H12713} If the G parameter to [sqlite3_open(v2(F,D,G,V)] omits the ** bit value [SQLITE_OPEN_CREATE] and the database does not ** previously exist, an error is returned. ** -** {H12714} If the G parameter to [sqlite3_open_v2(F,D,G,V)] contains the +** {H12714} If the G parameter to [sqlite3_open(v2(F,D,G,V)] contains the ** bit value [SQLITE_OPEN_CREATE] and the database does not ** previously exist, then an attempt is made to create and ** initialize the database. ** ** {H12717} If the filename argument to [sqlite3_open()], [sqlite3_open16()], @@ -4306,12 +4247,11 @@ ** redefined. The length of the name is limited to 255 bytes, exclusive of ** the zero-terminator. Note that the name length limit is in bytes, not ** characters. Any attempt to create a function with a longer name ** will result in [SQLITE_ERROR] being returned. ** -** The third parameter (nArg) -** is the number of arguments that the SQL function or +** The third parameter is the number of arguments that the SQL function or ** aggregate takes. If this parameter is negative, then the SQL function or ** aggregate may take any number of arguments. ** ** The fourth parameter, eTextRep, specifies what ** [SQLITE_UTF8 | text encoding] this SQL function prefers for @@ -4338,95 +4278,76 @@ ** ** It is permitted to register multiple implementations of the same ** functions with the same name but with either differing numbers of ** arguments or differing preferred text encodings. SQLite will use ** the implementation most closely matches the way in which the -** SQL function is used. A function implementation with a non-negative -** nArg parameter is a better match than a function implementation with -** a negative nArg. A function where the preferred text encoding -** matches the database encoding is a better -** match than a function where the encoding is different. -** A function where the encoding difference is between UTF16le and UTF16be -** is a closer match than a function where the encoding difference is -** between UTF8 and UTF16. -** -** Built-in functions may be overloaded by new application-defined functions. -** The first application-defined function with a given name overrides all -** built-in functions in the same [database connection] with the same name. -** Subsequent application-defined functions of the same name only override -** prior application-defined functions that are an exact match for the -** number of parameters and preferred encoding. -** -** An application-defined function is permitted to call other -** SQLite interfaces. However, such calls must not -** close the database connection nor finalize or reset the prepared -** statement in which the function is running. +** SQL function is used. ** ** INVARIANTS: ** -** {H16103} The [sqlite3_create_function16(D,X,...)] interface shall behave -** as [sqlite3_create_function(D,X,...)] in every way except that it -** interprets the X argument as zero-terminated UTF-16 +** {H16103} The [sqlite3_create_function16()] interface behaves exactly +** like [sqlite3_create_function()] in every way except that it +** interprets the zFunctionName argument as zero-terminated UTF-16 ** native byte order instead of as zero-terminated UTF-8. ** -** {H16106} A successful invocation of the -** [sqlite3_create_function(D,X,N,E,...)] interface shall register +** {H16106} A successful invocation of +** the [sqlite3_create_function(D,X,N,E,...)] interface registers ** or replaces callback functions in the [database connection] D ** used to implement the SQL function named X with N parameters ** and having a preferred text encoding of E. ** ** {H16109} A successful call to [sqlite3_create_function(D,X,N,E,P,F,S,L)] -** shall replace the P, F, S, and L values from any prior calls with +** replaces the P, F, S, and L values from any prior calls with ** the same D, X, N, and E values. ** -** {H16112} The [sqlite3_create_function(D,X,...)] interface shall fail -** if the SQL function name X is +** {H16112} The [sqlite3_create_function(D,X,...)] interface fails with +** a return code of [SQLITE_ERROR] if the SQL function name X is ** longer than 255 bytes exclusive of the zero terminator. ** -** {H16118} The [sqlite3_create_function(D,X,N,E,P,F,S,L)] interface -** shall fail unless either F is NULL and S and L are non-NULL or -*** F is non-NULL and S and L are NULL. +** {H16118} Either F must be NULL and S and L are non-NULL or else F +** is non-NULL and S and L are NULL, otherwise +** [sqlite3_create_function(D,X,N,E,P,F,S,L)] returns [SQLITE_ERROR]. ** -** {H16121} The [sqlite3_create_function(D,...)] interface shall fails with an +** {H16121} The [sqlite3_create_function(D,...)] interface fails with an ** error code of [SQLITE_BUSY] if there exist [prepared statements] ** associated with the [database connection] D. ** -** {H16124} The [sqlite3_create_function(D,X,N,...)] interface shall fail with -** an error code of [SQLITE_ERROR] if parameter N is less +** {H16124} The [sqlite3_create_function(D,X,N,...)] interface fails with an +** error code of [SQLITE_ERROR] if parameter N (specifying the number +** of arguments to the SQL function being registered) is less ** than -1 or greater than 127. ** ** {H16127} When N is non-negative, the [sqlite3_create_function(D,X,N,...)] -** interface shall register callbacks to be invoked for the -** SQL function +** interface causes callbacks to be invoked for the SQL function ** named X when the number of arguments to the SQL function is ** exactly N. ** ** {H16130} When N is -1, the [sqlite3_create_function(D,X,N,...)] -** interface shall register callbacks to be invoked for the SQL -** function named X with any number of arguments. +** interface causes callbacks to be invoked for the SQL function +** named X with any number of arguments. ** ** {H16133} When calls to [sqlite3_create_function(D,X,N,...)] ** specify multiple implementations of the same function X ** and when one implementation has N>=0 and the other has N=(-1) -** the implementation with a non-zero N shall be preferred. +** the implementation with a non-zero N is preferred. ** ** {H16136} When calls to [sqlite3_create_function(D,X,N,E,...)] ** specify multiple implementations of the same function X with ** the same number of arguments N but with different ** encodings E, then the implementation where E matches the -** database encoding shall preferred. +** database encoding is preferred. ** ** {H16139} For an aggregate SQL function created using ** [sqlite3_create_function(D,X,N,E,P,0,S,L)] the finalizer -** function L shall always be invoked exactly once if the +** function L will always be invoked exactly once if the ** step function S is called one or more times. ** ** {H16142} When SQLite invokes either the xFunc or xStep function of ** an application-defined SQL function or aggregate created ** by [sqlite3_create_function()] or [sqlite3_create_function16()], ** then the array of [sqlite3_value] objects passed as the -** third parameter shall be [protected sqlite3_value] objects. +** third parameter are always [protected sqlite3_value] objects. */ SQLITE_API int sqlite3_create_function( sqlite3 *db, const char *zFunctionName, int nArg, @@ -4468,16 +4389,16 @@ ** backwards compatibility with older code, these functions continue ** to be supported. However, new applications should avoid ** the use of these functions. To help encourage people to avoid ** using these functions, we are not going to tell you want they do. */ -SQLITE_API SQLITE_DEPRECATED int sqlite3_aggregate_count(sqlite3_context*); -SQLITE_API SQLITE_DEPRECATED int sqlite3_expired(sqlite3_stmt*); -SQLITE_API SQLITE_DEPRECATED int sqlite3_transfer_bindings(sqlite3_stmt*, sqlite3_stmt*); -SQLITE_API SQLITE_DEPRECATED int sqlite3_global_recover(void); -SQLITE_API SQLITE_DEPRECATED void sqlite3_thread_cleanup(void); -SQLITE_API SQLITE_DEPRECATED int sqlite3_memory_alarm(void(*)(void*,sqlite3_int64,int),void*,sqlite3_int64); +SQLITE_API int sqlite3_aggregate_count(sqlite3_context*); +SQLITE_API int sqlite3_expired(sqlite3_stmt*); +SQLITE_API int sqlite3_transfer_bindings(sqlite3_stmt*, sqlite3_stmt*); +SQLITE_API int sqlite3_global_recover(void); +SQLITE_API void sqlite3_thread_cleanup(void); +SQLITE_API int sqlite3_memory_alarm(void(*)(void*,sqlite3_int64,int),void*,sqlite3_int64); /* ** CAPI3REF: Obtaining SQL Function Parameter Values {H15100} ** ** The C-language implementation of SQL functions and aggregates uses @@ -5334,18 +5255,10 @@ ** then the commit is converted into a rollback. ** ** If another function was previously registered, its ** pArg value is returned. Otherwise NULL is returned. ** -** The callback implementation must not do anything that will modify -** the database connection that invoked the callback. Any actions -** to modify the database connection must be deferred until after the -** completion of the [sqlite3_step()] call that triggered the commit -** or rollback hook in the first place. -** Note that [sqlite3_prepare_v2()] and [sqlite3_step()] both modify their -** database connections for the meaning of "modify" in this paragraph. -** ** Registering a NULL function disables the callback. ** ** For the purposes of this API, a transaction is said to have been ** rolled back if an explicit "ROLLBACK" statement is executed, or ** an error or constraint causes an implicit rollback to occur. @@ -5416,17 +5329,10 @@ ** an update, this is the rowid after the update takes place. ** ** The update hook is not invoked when internal system tables are ** modified (i.e. sqlite_master and sqlite_sequence). ** -** The update hook implementation must not do anything that will modify -** the database connection that invoked the update hook. Any actions -** to modify the database connection must be deferred until after the -** completion of the [sqlite3_step()] call that triggered the update hook. -** Note that [sqlite3_prepare_v2()] and [sqlite3_step()] both modify their -** database connections for the meaning of "modify" in this paragraph. -** ** If another function was previously registered, its pArg value ** is returned. Otherwise NULL is returned. ** ** INVARIANTS: ** @@ -5913,11 +5819,11 @@ ** preexisting virtual tables of the module. ** ** This interface is experimental and is subject to change or ** removal in future releases of SQLite. */ -SQLITE_API SQLITE_EXPERIMENTAL int sqlite3_create_module( +SQLITE_API int sqlite3_create_module( sqlite3 *db, /* SQLite connection to register module with */ const char *zName, /* Name of the module */ const sqlite3_module *, /* Methods for the module */ void * /* Client data for xCreate/xConnect */ ); @@ -5928,11 +5834,11 @@ ** ** This routine is identical to the [sqlite3_create_module()] method above, ** except that it allows a destructor function to be specified. It is ** even more experimental than the rest of the virtual tables API. */ -SQLITE_API SQLITE_EXPERIMENTAL int sqlite3_create_module_v2( +SQLITE_API int sqlite3_create_module_v2( sqlite3 *db, /* SQLite connection to register module with */ const char *zName, /* Name of the module */ const sqlite3_module *, /* Methods for the module */ void *, /* Client data for xCreate/xConnect */ void(*xDestroy)(void*) /* Module destructor function */ @@ -6000,11 +5906,11 @@ ** the virtual tables they implement. ** ** This interface is experimental and is subject to change or ** removal in future releases of SQLite. */ -SQLITE_API SQLITE_EXPERIMENTAL int sqlite3_declare_vtab(sqlite3*, const char *zCreateTable); +SQLITE_API int sqlite3_declare_vtab(sqlite3*, const char *zCreateTable); /* ** CAPI3REF: Overload A Function For A Virtual Table {H18300} ** EXPERIMENTAL ** @@ -6021,11 +5927,11 @@ ** by virtual tables. ** ** This API should be considered part of the virtual table interface, ** which is experimental and subject to change. */ -SQLITE_API SQLITE_EXPERIMENTAL int sqlite3_overload_function(sqlite3*, const char *zFuncName, int nArg); +SQLITE_API int sqlite3_overload_function(sqlite3*, const char *zFuncName, int nArg); /* ** The interface to the virtual-table mechanism defined above (back up ** to a comment remarkably similar to this one) is currently considered ** to be experimental. The interface might change in incompatible ways. @@ -6678,11 +6584,11 @@ ** and it is possible that another thread might change the parameter ** in between the times when *pCurrent and *pHighwater are written. ** ** See also: [sqlite3_db_status()] */ -SQLITE_API SQLITE_EXPERIMENTAL int sqlite3_status(int op, int *pCurrent, int *pHighwater, int resetFlag); +SQLITE_API int sqlite3_status(int op, int *pCurrent, int *pHighwater, int resetFlag); /* ** CAPI3REF: Database Connection Status {H17201} ** EXPERIMENTAL ** @@ -6698,15 +6604,11 @@ ** the resetFlg is true, then the highest instantaneous value is ** reset back down to the current value. ** ** See also: [sqlite3_status()]. */ -SQLITE_API SQLITE_EXPERIMENTAL int sqlite3_db_status(sqlite3*, int op, int *pCur, int *pHiwtr, int resetFlg); - - -SQLITE_API int sqlite3_wsd_init(int N, int J); -SQLITE_API void *sqlite3_wsd_find(void *K, int L); +SQLITE_API int sqlite3_db_status(sqlite3*, int op, int *pCur, int *pHiwtr, int resetFlg); /* ** CAPI3REF: Status Parameters {H17250} ** EXPERIMENTAL ** @@ -6836,11 +6738,11 @@ ** ************************************************************************* ** This is the header file for the generic hash-table implemenation ** used in SQLite. ** -** $Id: sqlite3.c,v 1.11 2008/09/22 16:30:20 rmsimpson Exp $ +** $Id: sqlite3.c,v 1.9 2008/08/06 21:45:28 rmsimpson Exp $ */ #ifndef _SQLITE_HASH_H_ #define _SQLITE_HASH_H_ /* Forward declarations of structures. */ @@ -7083,15 +6985,16 @@ #define TK_TO_REAL 142 #define TK_END_OF_FILE 143 #define TK_ILLEGAL 144 #define TK_SPACE 145 #define TK_UNCLOSED_STRING 146 -#define TK_FUNCTION 147 -#define TK_COLUMN 148 -#define TK_AGG_FUNCTION 149 -#define TK_AGG_COLUMN 150 -#define TK_CONST_FUNC 151 +#define TK_COMMENT 147 +#define TK_FUNCTION 148 +#define TK_COLUMN 149 +#define TK_AGG_FUNCTION 150 +#define TK_AGG_COLUMN 151 +#define TK_CONST_FUNC 152 /************** End of parse.h ***********************************************/ /************** Continuing where we left off in sqliteInt.h ******************/ #include #include @@ -7228,11 +7131,11 @@ typedef sqlite_uint64 u64; /* 8-byte unsigned integer */ typedef UINT32_TYPE u32; /* 4-byte unsigned integer */ typedef UINT16_TYPE u16; /* 2-byte unsigned integer */ typedef INT16_TYPE i16; /* 2-byte signed integer */ typedef UINT8_TYPE u8; /* 1-byte unsigned integer */ -typedef INT8_TYPE i8; /* 1-byte signed integer */ +typedef UINT8_TYPE i8; /* 1-byte signed integer */ /* ** Macros to determine whether the machine is big or little endian, ** evaluated at runtime. */ @@ -7303,34 +7206,10 @@ ** The following value as a destructor means to use sqlite3DbFree(). ** This is an internal extension to SQLITE_STATIC and SQLITE_TRANSIENT. */ #define SQLITE_DYNAMIC ((sqlite3_destructor_type)sqlite3DbFree) -/* -** When SQLITE_OMIT_WSD is defined, it means that the target platform does -** not support Writable Static Data (WSD) such as global and static variables. -** All variables must either be on the stack or dynamically allocated from -** the heap. When WSD is unsupported, the variable declarations scattered -** throughout the SQLite code must become constants instead. The SQLITE_WSD -** macro is used for this purpose. And instead of referencing the variable -** directly, we use its constant as a key to lookup the run-time allocated -** buffer that holds real variable. The constant is also the initializer -** for the run-time allocated buffer. -** -** In the usually case where WSD is supported, the SQLITE_WSD and GLOBAL -** macros become no-ops and have zero performance impact. -*/ -#ifdef SQLITE_OMIT_WSD - #define SQLITE_WSD const - #define GLOBAL(t,v) (*(t*)sqlite3_wsd_find((void*)&(v), sizeof(v))) - #define sqlite3GlobalConfig GLOBAL(struct Sqlite3Config, sqlite3Config) -#else - #define SQLITE_WSD - #define GLOBAL(t,v) v - #define sqlite3GlobalConfig sqlite3Config -#endif - /* ** Forward references to structures */ typedef struct AggInfo AggInfo; typedef struct AuthContext AuthContext; @@ -7341,11 +7220,10 @@ typedef struct Schema Schema; typedef struct Expr Expr; typedef struct ExprList ExprList; typedef struct FKey FKey; typedef struct FuncDef FuncDef; -typedef struct FuncDefHash FuncDefHash; typedef struct IdList IdList; typedef struct Index Index; typedef struct KeyClass KeyClass; typedef struct KeyInfo KeyInfo; typedef struct Lookaside Lookaside; @@ -7360,12 +7238,10 @@ typedef struct TableLock TableLock; typedef struct Token Token; typedef struct TriggerStack TriggerStack; typedef struct TriggerStep TriggerStep; typedef struct Trigger Trigger; -typedef struct UnpackedRecord UnpackedRecord; -typedef struct Walker Walker; typedef struct WhereInfo WhereInfo; typedef struct WhereLevel WhereLevel; /* ** Defer sourcing vdbe.h and btree.h until after the "u8" and @@ -7387,11 +7263,11 @@ ************************************************************************* ** This header file defines the interface that the sqlite B-Tree file ** subsystem. See comments in the source code for a detailed description ** of what each interface routine does. ** -** @(#) $Id: sqlite3.c,v 1.11 2008/09/22 16:30:20 rmsimpson Exp $ +** @(#) $Id: sqlite3.c,v 1.9 2008/08/06 21:45:28 rmsimpson Exp $ */ #ifndef _BTREE_H_ #define _BTREE_H_ /* TODO: This definition is just included so other modules compile. It @@ -7496,10 +7372,12 @@ SQLITE_PRIVATE int sqlite3BtreeClearTable(Btree*, int); SQLITE_PRIVATE int sqlite3BtreeGetMeta(Btree*, int idx, u32 *pValue); SQLITE_PRIVATE int sqlite3BtreeUpdateMeta(Btree*, int idx, u32 value); SQLITE_PRIVATE void sqlite3BtreeTripAllCursors(Btree*, int); +struct UnpackedRecord; /* Forward declaration. Definition in vdbeaux.c. */ + SQLITE_PRIVATE int sqlite3BtreeCursor( Btree*, /* BTree containing table to open */ int iTable, /* Index of root page */ int wrFlag, /* 1 for writing. 0 for read-only */ struct KeyInfo*, /* First argument to compare function */ @@ -7509,19 +7387,13 @@ SQLITE_PRIVATE int sqlite3BtreeCloseCursor(BtCursor*); SQLITE_PRIVATE int sqlite3BtreeMoveto( BtCursor*, const void *pKey, + struct UnpackedRecord *pUnKey, i64 nKey, int bias, - int *pRes -); -SQLITE_PRIVATE int sqlite3BtreeMovetoUnpacked( - BtCursor*, - UnpackedRecord *pUnKey, - i64 intKey, - int bias, int *pRes ); SQLITE_PRIVATE int sqlite3BtreeCursorHasMoved(BtCursor*, int*); SQLITE_PRIVATE int sqlite3BtreeDelete(BtCursor*); SQLITE_PRIVATE int sqlite3BtreeInsert(BtCursor*, const void *pKey, i64 nKey, @@ -7617,11 +7489,11 @@ ** ** This header defines the interface to the virtual database engine ** or VDBE. The VDBE implements an abstract machine that runs a ** simple program to access and modify the underlying database. ** -** $Id: sqlite3.c,v 1.11 2008/09/22 16:30:20 rmsimpson Exp $ +** $Id: sqlite3.c,v 1.9 2008/08/06 21:45:28 rmsimpson Exp $ */ #ifndef _SQLITE_VDBE_H_ #define _SQLITE_VDBE_H_ /* @@ -7635,10 +7507,11 @@ ** The names of the following types declared in vdbeInt.h are required ** for the VdbeOp definition. */ typedef struct VdbeFunc VdbeFunc; typedef struct Mem Mem; +typedef struct UnpackedRecord UnpackedRecord; /* ** A single instruction of the virtual machine has an opcode ** and as many as three operands. The instruction is recorded ** as an instance of the following structure: @@ -7969,12 +7842,11 @@ SQLITE_PRIVATE void sqlite3VdbeSwap(Vdbe*,Vdbe*); #ifdef SQLITE_ENABLE_MEMORY_MANAGEMENT SQLITE_PRIVATE int sqlite3VdbeReleaseMemory(int); #endif -SQLITE_PRIVATE UnpackedRecord *sqlite3VdbeRecordUnpack(KeyInfo*,int,const void*, - UnpackedRecord*,int); +SQLITE_PRIVATE UnpackedRecord *sqlite3VdbeRecordUnpack(KeyInfo*,int,const void*,void*,int); SQLITE_PRIVATE void sqlite3VdbeDeleteUnpackedRecord(UnpackedRecord*); SQLITE_PRIVATE int sqlite3VdbeRecordCompare(int,const void*,UnpackedRecord*); #ifndef NDEBUG @@ -8006,11 +7878,11 @@ ************************************************************************* ** This header file defines the interface that the sqlite page cache ** subsystem. The page cache subsystem reads and writes a file a page ** at a time and provides a journal for rollback. ** -** @(#) $Id: sqlite3.c,v 1.11 2008/09/22 16:30:20 rmsimpson Exp $ +** @(#) $Id: sqlite3.c,v 1.9 2008/08/06 21:45:28 rmsimpson Exp $ */ #ifndef _PAGER_H_ #define _PAGER_H_ @@ -8063,13 +7935,14 @@ /* ** See source code comments for a detailed description of the following ** routines: */ -SQLITE_PRIVATE int sqlite3PagerOpen(sqlite3_vfs *, Pager **ppPager, const char*, void(*)(DbPage*), int,int,int); +SQLITE_PRIVATE int sqlite3PagerOpen(sqlite3_vfs *, Pager **ppPager, const char*, int,int,int); SQLITE_PRIVATE void sqlite3PagerSetBusyhandler(Pager*, BusyHandler *pBusyHandler); -SQLITE_PRIVATE void sqlite3PagerSetReiniter(Pager*, void(*)(DbPage*)); +SQLITE_PRIVATE void sqlite3PagerSetDestructor(Pager*, void(*)(DbPage*,int)); +SQLITE_PRIVATE void sqlite3PagerSetReiniter(Pager*, void(*)(DbPage*,int)); SQLITE_PRIVATE int sqlite3PagerSetPagesize(Pager*, u16*); SQLITE_PRIVATE int sqlite3PagerMaxPageCount(Pager*, int); SQLITE_PRIVATE int sqlite3PagerReadFileheader(Pager*, int, unsigned char*); SQLITE_PRIVATE void sqlite3PagerSetCachesize(Pager*, int); SQLITE_PRIVATE int sqlite3PagerClose(Pager *pPager); @@ -8088,11 +7961,11 @@ SQLITE_PRIVATE int sqlite3PagerIsreadonly(Pager*); SQLITE_PRIVATE int sqlite3PagerStmtBegin(Pager*); SQLITE_PRIVATE int sqlite3PagerStmtCommit(Pager*); SQLITE_PRIVATE int sqlite3PagerStmtRollback(Pager*); SQLITE_PRIVATE void sqlite3PagerDontRollback(DbPage*); -SQLITE_PRIVATE int sqlite3PagerDontWrite(DbPage*); +SQLITE_PRIVATE void sqlite3PagerDontWrite(DbPage*); SQLITE_PRIVATE int sqlite3PagerRefcount(Pager*); SQLITE_PRIVATE void sqlite3PagerSetSafetyLevel(Pager*,int,int); SQLITE_PRIVATE const char *sqlite3PagerFilename(Pager*); SQLITE_PRIVATE const sqlite3_vfs *sqlite3PagerVfs(Pager*); SQLITE_PRIVATE sqlite3_file *sqlite3PagerFile(Pager*); @@ -8105,10 +7978,14 @@ SQLITE_PRIVATE int sqlite3PagerLockingMode(Pager *, int); SQLITE_PRIVATE int sqlite3PagerJournalMode(Pager *, int); SQLITE_PRIVATE i64 sqlite3PagerJournalSizeLimit(Pager *, i64); SQLITE_PRIVATE void *sqlite3PagerTempSpace(Pager*); SQLITE_PRIVATE int sqlite3PagerSync(Pager *pPager); + +#if defined(SQLITE_ENABLE_MEMORY_MANAGEMENT) && !defined(SQLITE_OMIT_DISKIO) +SQLITE_PRIVATE int sqlite3PagerReleaseMemory(int); +#endif #ifdef SQLITE_HAS_CODEC SQLITE_PRIVATE void sqlite3PagerSetCodec(Pager*,void*(*)(void*,void*,Pgno,int),void*); #endif @@ -8133,184 +8010,10 @@ #endif /* _PAGER_H_ */ /************** End of pager.h ***********************************************/ /************** Continuing where we left off in sqliteInt.h ******************/ -/************** Include pcache.h in the middle of sqliteInt.h ****************/ -/************** Begin file pcache.h ******************************************/ -/* -** 2008 August 05 -** -** The author disclaims copyright to this source code. In place of -** a legal notice, here is a blessing: -** -** May you do good and not evil. -** May you find forgiveness for yourself and forgive others. -** May you share freely, never taking more than you give. -** -************************************************************************* -** This header file defines the interface that the sqlite page cache -** subsystem. -** -** @(#) $Id: sqlite3.c,v 1.11 2008/09/22 16:30:20 rmsimpson Exp $ -*/ - -#ifndef _PCACHE_H_ - -typedef struct PgHdr PgHdr; -typedef struct PCache PCache; - -/* -** Every page in the cache is controlled by an instance of the following -** structure. -*/ -struct PgHdr { - void *pData; /* Content of this page */ - void *pExtra; /* Extra content */ - PgHdr *pDirty; /* Transient list of dirty pages */ - Pgno pgno; /* Page number for this page */ - Pager *pPager; /* The pager this page is part of */ -#ifdef SQLITE_CHECK_PAGES - u32 pageHash; /* Hash of page content */ -#endif - u16 flags; /* PGHDR flags defined below */ - /********************************************************************** - ** Elements above are public. All that follows is private to pcache.c - ** and should not be accessed by other modules. - */ - i16 nRef; /* Number of users of this page */ - PCache *pCache; /* Cache that owns this page */ - void *apSave[2]; /* Journal entries for in-memory databases */ - /********************************************************************** - ** Elements above are accessible at any time by the owner of the cache - ** without the need for a mutex. The elements that follow can only be - ** accessed while holding the SQLITE_MUTEX_STATIC_LRU mutex. - */ - PgHdr *pNextHash, *pPrevHash; /* Hash collision chain for PgHdr.pgno */ - PgHdr *pNext, *pPrev; /* List of clean or dirty pages */ - PgHdr *pNextLru, *pPrevLru; /* Part of global LRU list */ -}; - -/* Bit values for PgHdr.flags */ -#define PGHDR_IN_JOURNAL 0x001 /* Page is in rollback journal */ -#define PGHDR_DIRTY 0x002 /* Page has changed */ -#define PGHDR_NEED_SYNC 0x004 /* Fsync the rollback journal before - ** writing this page to the database */ -#define PGHDR_NEED_READ 0x008 /* Content is unread */ -#define PGHDR_REUSE_UNLIKELY 0x010 /* A hint that reuse is unlikely */ -#define PGHDR_DONT_WRITE 0x020 /* Do not write content to disk */ - -/* Initialize and shutdown the page cache subsystem */ -SQLITE_PRIVATE int sqlite3PcacheInitialize(void); -SQLITE_PRIVATE void sqlite3PcacheShutdown(void); - -/* Page cache buffer management: -** These routines implement SQLITE_CONFIG_PAGECACHE. -*/ -SQLITE_PRIVATE void sqlite3PCacheBufferSetup(void *, int sz, int n); -SQLITE_PRIVATE void *sqlite3PCacheMalloc(int sz); -SQLITE_PRIVATE void sqlite3PCacheFree(void*); - -/* Create a new pager cache. -** Under memory stress, invoke xStress to try to make pages clean. -** Only clean and unpinned pages can be reclaimed. -*/ -SQLITE_PRIVATE void sqlite3PcacheOpen( - int szPage, /* Size of every page */ - int szExtra, /* Extra space associated with each page */ - int bPurgeable, /* True if pages are on backing store */ - void (*xDestroy)(PgHdr *), /* Called to destroy a page */ - int (*xStress)(void*, PgHdr*), /* Call to try to make pages clean */ - void *pStress, /* Argument to xStress */ - PCache *pToInit /* Preallocated space for the PCache */ -); - -/* Modify the page-size after the cache has been created. */ -SQLITE_PRIVATE void sqlite3PcacheSetPageSize(PCache *, int); - -/* Return the size in bytes of a PCache object. Used to preallocate -** storage space. -*/ -SQLITE_PRIVATE int sqlite3PcacheSize(void); - -/* One release per successful fetch. Page is pinned until released. -** Reference counted. -*/ -SQLITE_PRIVATE int sqlite3PcacheFetch(PCache*, Pgno, int createFlag, PgHdr**); -SQLITE_PRIVATE void sqlite3PcacheRelease(PgHdr*); - -SQLITE_PRIVATE void sqlite3PcacheDrop(PgHdr*); /* Remove page from cache */ -SQLITE_PRIVATE void sqlite3PcacheMakeDirty(PgHdr*); /* Make sure page is marked dirty */ -SQLITE_PRIVATE void sqlite3PcacheMakeClean(PgHdr*); /* Mark a single page as clean */ -SQLITE_PRIVATE void sqlite3PcacheCleanAll(PCache*); /* Mark all dirty list pages as clean */ - -/* Change a page number. Used by incr-vacuum. */ -SQLITE_PRIVATE void sqlite3PcacheMove(PgHdr*, Pgno); - -/* Remove all pages with pgno>x. Reset the cache if x==0 */ -SQLITE_PRIVATE void sqlite3PcacheTruncate(PCache*, Pgno x); - -/* Routines used to implement transactions on memory-only databases. */ -SQLITE_PRIVATE int sqlite3PcachePreserve(PgHdr*, int); /* Preserve current page content */ -SQLITE_PRIVATE void sqlite3PcacheCommit(PCache*, int); /* Drop preserved copy */ -SQLITE_PRIVATE void sqlite3PcacheRollback(PCache*, int, void (*xReiniter)(PgHdr*)); - -/* Get a list of all dirty pages in the cache, sorted by page number */ -SQLITE_PRIVATE PgHdr *sqlite3PcacheDirtyList(PCache*); - -/* Reset and close the cache object */ -SQLITE_PRIVATE void sqlite3PcacheClose(PCache*); - -/* Clear flags from pages of the page cache */ -SQLITE_PRIVATE void sqlite3PcacheClearFlags(PCache*, int mask); - -/* Assert flags settings on all pages. Debugging only */ -#ifndef NDEBUG -SQLITE_PRIVATE void sqlite3PcacheAssertFlags(PCache*, int trueMask, int falseMask); -#else -# define sqlite3PcacheAssertFlags(A,B,C) -#endif - -/* Return true if the number of dirty pages is 0 or 1 */ -SQLITE_PRIVATE int sqlite3PcacheZeroOrOneDirtyPages(PCache*); - -/* Discard the contents of the cache */ -SQLITE_PRIVATE int sqlite3PcacheClear(PCache*); - -/* Return the total number of outstanding page references */ -SQLITE_PRIVATE int sqlite3PcacheRefCount(PCache*); - -/* Increment the reference count of an existing page */ -SQLITE_PRIVATE void sqlite3PcacheRef(PgHdr*); - -/* Return the total number of pages stored in the cache */ -SQLITE_PRIVATE int sqlite3PcachePagecount(PCache*); - -/* Iterate through all pages currently stored in the cache. This interface -** is only available if SQLITE_CHECK_PAGES is defined when the library is -** built. -*/ -SQLITE_PRIVATE void sqlite3PcacheIterate(PCache *pCache, void (*xIter)(PgHdr *)); - -/* Set and get the suggested cache-size for the specified pager-cache. -** -** If no global maximum is configured, then the system attempts to limit -** the total number of pages cached by purgeable pager-caches to the sum -** of the suggested cache-sizes. -*/ -SQLITE_PRIVATE int sqlite3PcacheGetCachesize(PCache *); -SQLITE_PRIVATE void sqlite3PcacheSetCachesize(PCache *, int); - -/* Try to return memory used by the pcache module to the main memory heap */ -SQLITE_PRIVATE int sqlite3PcacheReleaseMemory(int); - -SQLITE_PRIVATE void sqlite3PcacheStats(int*,int*,int*,int*); - -#endif /* _PCACHE_H_ */ - -/************** End of pcache.h **********************************************/ -/************** Continuing where we left off in sqliteInt.h ******************/ /************** Include os.h in the middle of sqliteInt.h ********************/ /************** Begin file os.h **********************************************/ /* ** 2001 September 16 @@ -8329,11 +8032,11 @@ ** the SQLite library will work on both POSIX and windows systems. ** ** This header file is #include-ed by sqliteInt.h and thus ends up ** being included by every source file. ** -** $Id: sqlite3.c,v 1.11 2008/09/22 16:30:20 rmsimpson Exp $ +** $Id: sqlite3.c,v 1.9 2008/08/06 21:45:28 rmsimpson Exp $ */ #ifndef _SQLITE_OS_H_ #define _SQLITE_OS_H_ /* @@ -8611,11 +8314,11 @@ ** ** NOTE: source files should *not* #include this header file directly. ** Source files should #include the sqliteInt.h file and let that file ** include this one indirectly. ** -** $Id: sqlite3.c,v 1.11 2008/09/22 16:30:20 rmsimpson Exp $ +** $Id: sqlite3.c,v 1.9 2008/08/06 21:45:28 rmsimpson Exp $ */ #ifdef SQLITE_MUTEX_APPDEF /* @@ -8772,28 +8475,18 @@ u16 sz; /* Size of each buffer in bytes */ u8 bEnabled; /* True if use lookaside. False to ignore it */ u8 bMalloced; /* True if pStart obtained from sqlite3_malloc() */ int nOut; /* Number of buffers currently checked out */ int mxOut; /* Highwater mark for nOut */ - LookasideSlot *pFree; /* List of available buffers */ + LookasideSlot *pFree; /* List if available buffers */ void *pStart; /* First byte of available memory space */ void *pEnd; /* First byte past end of available space */ }; struct LookasideSlot { LookasideSlot *pNext; /* Next buffer in the list of free buffers */ }; -/* -** A hash table for function definitions. -** -** Hash each FuncDef structure into one of the FuncDefHash.a[] slots. -** Collisions are on the FuncDef.pHash chain. -*/ -struct FuncDefHash { - FuncDef *a[23]; /* Hash table for functions */ -}; - /* ** Each database is an instance of the following structure. ** ** The sqlite.lastRowid records the last insert rowid generated by an ** insert statement. Inserts on views do not affect its value. Each @@ -8866,11 +8559,11 @@ void *pCollNeededArg; sqlite3_value *pErr; /* Most recent error message */ char *zErrMsg; /* Most recent error message (UTF-8 encoded) */ char *zErrMsg16; /* Most recent error message (UTF-16 encoded) */ union { - volatile int isInterrupted; /* True if sqlite3_interrupt has been called */ + int isInterrupted; /* True if sqlite3_interrupt has been called */ double notUsed1; /* Spacer */ } u1; Lookaside lookaside; /* Lookaside malloc configuration */ #ifndef SQLITE_OMIT_AUTHORIZATION int (*xAuth)(void*,int,const char*,const char*,const char*,const char*); @@ -8886,11 +8579,11 @@ Hash aModule; /* populated by sqlite3_create_module() */ Table *pVTab; /* vtab with active Connect/Create method */ sqlite3_vtab **aVTrans; /* Virtual tables with open transactions */ int nVTrans; /* Allocated size of aVTrans */ #endif - FuncDefHash aFunc; /* Hash table of connection functions */ + Hash aFunc; /* All functions that can be in SQL exprs */ Hash aCollSeq; /* All collating sequences */ BusyHandler busyHandler; /* Busy callback */ int busyTimeout; /* Busy handler timeout, in msec */ Db aDbStatic[2]; /* Static space for the 2 default backends */ #ifdef SQLITE_SSE @@ -8951,62 +8644,21 @@ ** structure. A pointer to this structure is stored in the sqlite.aFunc ** hash table. When multiple functions have the same name, the hash table ** points to a linked list of these structures. */ struct FuncDef { - i8 nArg; /* Number of arguments. -1 means unlimited */ + i16 nArg; /* Number of arguments. -1 means unlimited */ u8 iPrefEnc; /* Preferred text encoding (SQLITE_UTF8, 16LE, 16BE) */ u8 needCollSeq; /* True if sqlite3GetFuncCollSeq() might be called */ u8 flags; /* Some combination of SQLITE_FUNC_* */ void *pUserData; /* User data parameter */ FuncDef *pNext; /* Next function with same name */ void (*xFunc)(sqlite3_context*,int,sqlite3_value**); /* Regular function */ void (*xStep)(sqlite3_context*,int,sqlite3_value**); /* Aggregate step */ void (*xFinalize)(sqlite3_context*); /* Aggregate finializer */ - char *zName; /* SQL name of the function. */ - FuncDef *pHash; /* Next with a different name but the same hash */ + char zName[1]; /* SQL name of the function. MUST BE LAST */ }; - -/* -** Possible values for FuncDef.flags -*/ -#define SQLITE_FUNC_LIKE 0x01 /* Candidate for the LIKE optimization */ -#define SQLITE_FUNC_CASE 0x02 /* Case-sensitive LIKE-type function */ -#define SQLITE_FUNC_EPHEM 0x04 /* Ephermeral. Delete with VDBE */ - -/* -** The following three macros, FUNCTION(), LIKEFUNC() and AGGREGATE() are -** used to create the initializers for the FuncDef structures. -** -** FUNCTION(zName, nArg, iArg, bNC, xFunc) -** Used to create a scalar function definition of a function zName -** implemented by C function xFunc that accepts nArg arguments. The -** value passed as iArg is cast to a (void*) and made available -** as the user-data (sqlite3_user_data()) for the function. If -** argument bNC is true, then the FuncDef.needCollate flag is set. -** -** AGGREGATE(zName, nArg, iArg, bNC, xStep, xFinal) -** Used to create an aggregate function definition implemented by -** the C functions xStep and xFinal. The first four parameters -** are interpreted in the same way as the first 4 parameters to -** FUNCTION(). -** -** LIKEFUNC(zName, nArg, pArg, flags) -** Used to create a scalar function definition of a function zName -** that accepts nArg arguments and is implemented by a call to C -** function likeFunc. Argument pArg is cast to a (void *) and made -** available as the function user-data (sqlite3_user_data()). The -** FuncDef.flags variable is set to the value passed as the flags -** parameter. -*/ -#define FUNCTION(zName, nArg, iArg, bNC, xFunc) \ - {nArg, SQLITE_UTF8, bNC, 0, SQLITE_INT_TO_PTR(iArg), 0, xFunc, 0, 0, #zName} -#define LIKEFUNC(zName, nArg, arg, flags) \ - {nArg, SQLITE_UTF8, 0, flags, (void *)arg, 0, likeFunc, 0, 0, #zName} -#define AGGREGATE(zName, nArg, arg, nc, xStep, xFinal) \ - {nArg, SQLITE_UTF8, nc, 0, SQLITE_INT_TO_PTR(arg), 0, 0, xStep,xFinal, #zName} - /* ** Each SQLite module (virtual table definition) is defined by an ** instance of the following structure, stored in the sqlite3.aModule ** hash table. @@ -9016,10 +8668,17 @@ const char *zName; /* Name passed to create_module() */ void *pAux; /* pAux passed to create_module() */ void (*xDestroy)(void *); /* Module destructor function */ }; +/* +** Possible values for FuncDef.flags +*/ +#define SQLITE_FUNC_LIKE 0x01 /* Candidate for the LIKE optimization */ +#define SQLITE_FUNC_CASE 0x02 /* Case-sensitive LIKE-type function */ +#define SQLITE_FUNC_EPHEM 0x04 /* Ephermeral. Delete with VDBE */ + /* ** information about each column of an SQL table is held in an instance ** of this structure. */ struct Column { @@ -9064,11 +8723,11 @@ int (*xCmp)(void*,int, const void*, int, const void*); void (*xDel)(void*); /* Destructor for pUser */ }; /* -** Allowed values of CollSeq.type: +** Allowed values of CollSeq flags: */ #define SQLITE_COLL_BINARY 1 /* The default memcmp() collating sequence */ #define SQLITE_COLL_NOCASE 2 /* The built-in NOCASE collating sequence */ #define SQLITE_COLL_REVERSE 3 /* The built-in REVERSE collating sequence */ #define SQLITE_COLL_USER 0 /* Any other user-defined collating sequence */ @@ -9082,11 +8741,11 @@ /* ** Column affinity types. ** ** These used to have mnemonic name like 'i' for SQLITE_AFF_INTEGER and ** 't' for SQLITE_AFF_TEXT. But we can save a little space and improve -** the speed a little by numbering the values consecutively. +** the speed a little by number the values consecutively. ** ** But rather than start with 0 or 1, we begin with 'a'. That way, ** when multiple affinity types are concatenated into a string and ** used as the P4 operand, they will be more readable. ** @@ -9128,74 +8787,66 @@ ** If the table has an INTEGER PRIMARY KEY, then Table.iPKey is the index of ** the column that is that key. Otherwise Table.iPKey is negative. Note ** that the datatype of the PRIMARY KEY must be INTEGER for this field to ** be set. An INTEGER PRIMARY KEY is used as the rowid for each row of ** the table. If a table has no INTEGER PRIMARY KEY, then a random rowid -** is generated for each row of the table. TF_HasPrimaryKey is set if +** is generated for each row of the table. Table.hasPrimKey is true if ** the table has any PRIMARY KEY, INTEGER or otherwise. ** ** Table.tnum is the page number for the root BTree page of the table in the ** database file. If Table.iDb is the index of the database table backend ** in sqlite.aDb[]. 0 is for the main database and 1 is for the file that -** holds temporary tables and indices. If TF_Ephemeral is set -** then the table is stored in a file that is automatically deleted +** holds temporary tables and indices. If Table.isEphem +** is true, then the table is stored in a file that is automatically deleted ** when the VDBE cursor to the table is closed. In this case Table.tnum ** refers VDBE cursor number that holds the table open, not to the root ** page number. Transient tables are used to hold the results of a ** sub-query that appears instead of a real table name in the FROM clause ** of a SELECT statement. */ struct Table { - sqlite3 *db; /* Associated database connection. Might be NULL. */ - char *zName; /* Name of the table or view */ - int iPKey; /* If not negative, use aCol[iPKey] as the primary key */ - int nCol; /* Number of columns in this table */ - Column *aCol; /* Information about each column */ - Index *pIndex; /* List of SQL indexes on this table. */ - int tnum; /* Root BTree node for this table (see note above) */ - Select *pSelect; /* NULL for tables. Points to definition if a view. */ - u16 nRef; /* Number of pointers to this Table */ - u8 tabFlags; /* Mask of TF_* values */ - u8 keyConf; /* What to do in case of uniqueness conflict on iPKey */ - Trigger *pTrigger; /* List of SQL triggers on this table */ - FKey *pFKey; /* Linked list of all foreign keys in this table */ - char *zColAff; /* String defining the affinity of each column */ + sqlite3 *db; /* Associated database connection. Might be NULL. */ + char *zName; /* Name of the table */ + int nCol; /* Number of columns in this table */ + Column *aCol; /* Information about each column */ + int iPKey; /* If not less then 0, use aCol[iPKey] as the primary key */ + Index *pIndex; /* List of SQL indexes on this table. */ + int tnum; /* Root BTree node for this table (see note above) */ + Select *pSelect; /* NULL for tables. Points to definition if a view. */ + int nRef; /* Number of pointers to this Table */ + Trigger *pTrigger; /* List of SQL triggers on this table */ + FKey *pFKey; /* Linked list of all foreign keys in this table */ + char *zColAff; /* String defining the affinity of each column */ #ifndef SQLITE_OMIT_CHECK - Expr *pCheck; /* The AND of all CHECK constraints */ + Expr *pCheck; /* The AND of all CHECK constraints */ #endif #ifndef SQLITE_OMIT_ALTERTABLE - int addColOffset; /* Offset in CREATE TABLE stmt to add a new column */ + int addColOffset; /* Offset in CREATE TABLE statement to add a new column */ #endif + u8 readOnly; /* True if this table should not be written by the user */ + u8 isEphem; /* True if created using OP_OpenEphermeral */ + u8 hasPrimKey; /* True if there exists a primary key */ + u8 keyConf; /* What to do in case of uniqueness conflict on iPKey */ + u8 autoInc; /* True if the integer primary key is autoincrement */ #ifndef SQLITE_OMIT_VIRTUALTABLE - Module *pMod; /* Pointer to the implementation of the module */ - sqlite3_vtab *pVtab; /* Pointer to the module instance */ - int nModuleArg; /* Number of arguments to the module */ - char **azModuleArg; /* Text of all module args. [0] is module name */ + u8 isVirtual; /* True if this is a virtual table */ + u8 isCommit; /* True once the CREATE TABLE has been committed */ + Module *pMod; /* Pointer to the implementation of the module */ + sqlite3_vtab *pVtab; /* Pointer to the module instance */ + int nModuleArg; /* Number of arguments to the module */ + char **azModuleArg; /* Text of all module args. [0] is module name */ #endif - Schema *pSchema; /* Schema that contains this table */ - Table *pNextZombie; /* Next on the Parse.pZombieTab list */ + Schema *pSchema; /* Schema that contains this table */ }; - -/* -** Allowed values for Tabe.tabFlags. -*/ -#define TF_Readonly 0x01 /* Read-only system table */ -#define TF_Ephemeral 0x02 /* An emphermal table */ -#define TF_HasPrimaryKey 0x04 /* Table has a primary key */ -#define TF_Autoincrement 0x08 /* Integer primary key is autoincrement */ -#define TF_Virtual 0x10 /* Is a virtual table */ -#define TF_NeedMetadata 0x20 /* aCol[].zType and aCol[].pColl missing */ - - /* ** Test to see whether or not a table is a virtual table. This is ** done as a macro so that it will be optimized out when virtual ** table support is omitted from the build. */ #ifndef SQLITE_OMIT_VIRTUALTABLE -# define IsVirtual(X) (((X)->tabFlags & TF_Virtual)!=0) +# define IsVirtual(X) ((X)->isVirtual) # define IsHiddenColumn(X) ((X)->isHidden) #else # define IsVirtual(X) 0 # define IsHiddenColumn(X) 0 #endif @@ -9283,49 +8934,25 @@ /* ** An instance of the following structure is passed as the first ** argument to sqlite3VdbeKeyCompare and is used to control the ** comparison of the two index keys. +** +** If the KeyInfo.incrKey value is true and the comparison would +** otherwise be equal, then return a result as if the second key +** were larger. */ struct KeyInfo { sqlite3 *db; /* The database connection */ u8 enc; /* Text encoding - one of the TEXT_Utf* values */ - u16 nField; /* Number of entries in aColl[] */ + u8 incrKey; /* Increase 2nd key by epsilon before comparison */ + u8 prefixIsEqual; /* Treat a prefix as equal */ + int nField; /* Number of entries in aColl[] */ u8 *aSortOrder; /* If defined an aSortOrder[i] is true, sort DESC */ CollSeq *aColl[1]; /* Collating sequence for each term of the key */ }; -/* -** An instance of the following structure holds information about a -** single index record that has already been parsed out into individual -** values. -** -** A record is an object that contains one or more fields of data. -** Records are used to store the content of a table row and to store -** the key of an index. A blob encoding of a record is created by -** the OP_MakeRecord opcode of the VDBE and is disassemblied by the -** OP_Column opcode. -** -** This structure holds a record that has already been disassembled -** into its constitutent fields. -*/ -struct UnpackedRecord { - KeyInfo *pKeyInfo; /* Collation and sort-order information */ - u16 nField; /* Number of entries in apMem[] */ - u16 flags; /* Boolean settings. UNPACKED_... below */ - Mem *aMem; /* Values */ -}; - -/* -** Allowed values of UnpackedRecord.flags -*/ -#define UNPACKED_NEED_FREE 0x0001 /* Memory is from sqlite3Malloc() */ -#define UNPACKED_NEED_DESTROY 0x0002 /* apMem[]s should all be destroyed */ -#define UNPACKED_IGNORE_ROWID 0x0004 /* Ignore trailing rowid on key1 */ -#define UNPACKED_INCRKEY 0x0008 /* Make this key an epsilon larger */ -#define UNPACKED_PREFIX_MATCH 0x0010 /* A prefix match is considered OK */ - /* ** Each SQL index is represented in memory by an ** instance of the following structure. ** ** The columns of the table that are to be indexed are described @@ -9485,11 +9112,11 @@ AggInfo *pAggInfo; /* Used by TK_AGG_COLUMN and TK_AGG_FUNCTION */ int iAgg; /* Which entry in pAggInfo->aCol[] or ->aFunc[] */ int iRightJoinTable; /* If EP_FromJoin, the right table of the join */ Select *pSelect; /* When the expression is a sub-select. Also the ** right side of " IN (