Index: SQLite.Designer/AssemblyInfo.cs ================================================================== --- SQLite.Designer/AssemblyInfo.cs +++ SQLite.Designer/AssemblyInfo.cs @@ -1,41 +1,41 @@ -using System; -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; -using System.Runtime.ConstrainedExecution; -using System.Resources; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("SQLite.Designer")] -[assembly: AssemblyDescription("ADO.NET 2.0 Data Designer for SQLite")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("http://sqlite.phxsoftware.com")] -[assembly: AssemblyProduct("SQLite Designer")] -[assembly: AssemblyCopyright("Public Domain")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM componenets. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] -[assembly: CLSCompliant(true)] -[assembly: ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)] -[assembly: NeutralResourcesLanguage("en")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// 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.37.0")] -[assembly: AssemblyFileVersion("1.0.37.0")] -[assembly: AssemblyDelaySignAttribute(false)] -[assembly: AssemblyKeyFileAttribute("..\\System.Data.SQLite\\System.Data.SQLite.snk")] -[assembly: AssemblyKeyNameAttribute("")] +using System; +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; +using System.Runtime.ConstrainedExecution; +using System.Resources; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("SQLite.Designer")] +[assembly: AssemblyDescription("ADO.NET 4.0 Data Designer for SQLite")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("http://sqlite.phxsoftware.com")] +[assembly: AssemblyProduct("SQLite Designer")] +[assembly: AssemblyCopyright("Public Domain")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM componenets. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] +[assembly: CLSCompliant(true)] +[assembly: ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)] +[assembly: NeutralResourcesLanguage("en")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// 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.38.1")] +[assembly: AssemblyFileVersion("1.0.38.1")] +[assembly: AssemblyDelaySignAttribute(false)] +[assembly: AssemblyKeyFileAttribute("..\\System.Data.SQLite\\System.Data.SQLite.snk")] +[assembly: AssemblyKeyNameAttribute("")] Index: SQLite.Designer/SQLite.Designer.csproj ================================================================== --- SQLite.Designer/SQLite.Designer.csproj +++ SQLite.Designer/SQLite.Designer.csproj @@ -1,221 +1,292 @@ - - - Debug - AnyCPU - 9.0.30729 - 2.0 - {9B4A5CF6-5BE5-4926-ACC7-B729A8C05198} - Library - Properties - SQLite.Designer - SQLite.Designer - false - false - false - false - - - 2.0 - - - - - true - full - false - ..\bin\designer\ - DEBUG;TRACE - prompt - 4 - 1701;1702;1699;3001 - 512 - x86 - false - false - false - false - - - none - true - ..\bin\Designer\ - - - prompt - 4 - 1701;1702;1699;3001 - 512 - x86 - false - false - false - false - false - - - - False - ..\..\..\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\IDE\PublicAssemblies\EnvDTE.dll - - - False - ..\..\Microsoft.Data.ConnectionUI.dll - False - - - False - ..\..\..\Program Files (x86)\Common Files\Microsoft Shared\MSEnv\PublicAssemblies\Microsoft.VisualStudio.CommandBars.dll - - - ..\..\Microsoft.VisualStudio.Data.dll - False - False - - - False - - - False - - - False - - - False - - - - - - - - - - - Form - - - ChangePasswordDialog.cs - - - Form - - - ChangeScriptDialog.cs - - - - - - - - - - - - - Component - - - UserControl - - - TableDesignerDoc.cs - - - UserControl - - - ViewDesignerDoc.cs - - - - - - - - - - UserControl - - - SQLiteConnectionUIControl.cs - - - - - - - - - - - - Form - - - TableNameDialog.cs - - - True - True - VSPackage.resx - - - - - 1000 - - - - - - ResXFileCodeGenerator - VSPackage.Designer.cs - true - Designer - - - - - Designer - ChangePasswordDialog.cs - - - Designer - TableDesignerDoc.cs - - - ViewDesignerDoc.cs - - - Designer - SQLiteConnectionUIControl.cs - - - - TableNameDialog.cs - - - - - ChangeScriptDialog.cs - - - - - - - - - - - - - - - - - - + + + + Debug + AnyCPU + 9.0.30729 + 2.0 + {9B4A5CF6-5BE5-4926-ACC7-B729A8C05198} + Library + Properties + SQLite.Designer + SQLite.Designer + false + false + false + false + + + 3.5 + + + v4.0 + publish\ + true + Disk + false + Foreground + 7 + Days + false + false + true + 0 + 1.0.0.%2a + false + false + true + + + + true + full + false + ..\bin\designer\ + DEBUG;TRACE + prompt + 4 + 1701;1702;1699;3001 + 512 + x86 + false + false + false + false + AllRules.ruleset + + + none + true + ..\bin\Designer\ + + + prompt + 4 + 1701;1702;1699;3001 + 512 + x86 + false + false + false + false + false + AllRules.ruleset + + + true + bin\x86\Debug\ + DEBUG;TRACE + 1701;1702;1699;3001 + full + x86 + ..\bin\designer\SQLite.Designer.dll.CodeAnalysisLog.xml + true + GlobalSuppressions.cs + prompt + AllRules.ruleset + ;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\\Rule Sets + ;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\FxCop\\Rules + + + ..\bin\designer\ + true + 1701;1702;1699;3001 + x86 + ..\bin\Designer\SQLite.Designer.dll.CodeAnalysisLog.xml + true + GlobalSuppressions.cs + false + prompt + AllRules.ruleset + ;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\\Rule Sets + ;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\FxCop\\Rules + + + + False + ..\..\..\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\IDE\PublicAssemblies\EnvDTE.dll + + + False + ..\..\..\Program Files (x86)\Microsoft Visual Studio 2008 SDK\VisualStudioIntegration\Common\Assemblies\2005\Microsoft.Data.ConnectionUI.dll + False + + + False + ..\..\..\Program Files (x86)\Common Files\Microsoft Shared\MSEnv\PublicAssemblies\Microsoft.VisualStudio.CommandBars.dll + + + False + ..\..\..\Program Files (x86)\Microsoft Visual Studio 2008 SDK\VisualStudioIntegration\Common\Assemblies\2005\Microsoft.VisualStudio.Data.dll + False + + + + False + + + False + + + False + + + False + + + + + + + + + + + Form + + + ChangePasswordDialog.cs + + + Form + + + ChangeScriptDialog.cs + + + + + + + + + + + + + Component + + + UserControl + + + TableDesignerDoc.cs + + + UserControl + + + ViewDesignerDoc.cs + + + + + + + + + + UserControl + + + SQLiteConnectionUIControl.cs + + + + + + + + + + + + Form + + + TableNameDialog.cs + + + True + True + VSPackage.resx + + + + + 1000 + + + + + + + ResXFileCodeGenerator + VSPackage.Designer.cs + true + Designer + + + + + Designer + ChangePasswordDialog.cs + + + Designer + TableDesignerDoc.cs + + + ViewDesignerDoc.cs + + + Designer + SQLiteConnectionUIControl.cs + + + + TableNameDialog.cs + + + + + ChangeScriptDialog.cs + + + + + + + + + + + + + + + + + + False + .NET Framework 3.5 SP1 Client Profile + false + + + False + .NET Framework 3.5 SP1 + true + + + False + Windows Installer 3.1 + true + + + + + + + + Index: SQLite.Designer/SQLite.Designer.sln ================================================================== --- SQLite.Designer/SQLite.Designer.sln +++ SQLite.Designer/SQLite.Designer.sln @@ -1,36 +1,39 @@ - -Microsoft Visual Studio Solution File, Format Version 10.00 -# Visual Studio 2008 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SQLite.Designer", "SQLite.Designer.csproj", "{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "install", "..\tools\install\install.csproj", "{71EED886-B5BF-488E-A4AA-1403E393D224}" - ProjectSection(ProjectDependencies) = postProject - {AC139962-261A-4463-B6FA-AEBC25283A66} = {AC139962-261A-4463-B6FA-AEBC25283A66} - {9B4A5CF6-5BE5-4926-ACC7-B729A8C05198} = {9B4A5CF6-5BE5-4926-ACC7-B729A8C05198} - EndProjectSection -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "System.Data.SQLite - CFDT", "..\System.Data.SQLite\System.Data.SQLite - CFDT.csproj", "{AC139962-261A-4463-B6FA-AEBC25283A66}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - Release|Any CPU = Release|Any CPU - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.Debug|Any CPU.Build.0 = Debug|Any CPU - {9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.Release|Any CPU.ActiveCfg = Release|Any CPU - {9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.Release|Any CPU.Build.0 = Release|Any CPU - {71EED886-B5BF-488E-A4AA-1403E393D224}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {71EED886-B5BF-488E-A4AA-1403E393D224}.Debug|Any CPU.Build.0 = Debug|Any CPU - {71EED886-B5BF-488E-A4AA-1403E393D224}.Release|Any CPU.ActiveCfg = Release|Any CPU - {71EED886-B5BF-488E-A4AA-1403E393D224}.Release|Any CPU.Build.0 = Release|Any CPU - {AC139962-261A-4463-B6FA-AEBC25283A66}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {AC139962-261A-4463-B6FA-AEBC25283A66}.Debug|Any CPU.Build.0 = Debug|Any CPU - {AC139962-261A-4463-B6FA-AEBC25283A66}.Release|Any CPU.ActiveCfg = Release|Any CPU - {AC139962-261A-4463-B6FA-AEBC25283A66}.Release|Any CPU.Build.0 = Release|Any CPU - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal + +Microsoft Visual Studio Solution File, Format Version 11.00 +# Visual Studio 2010 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SQLite.Designer", "SQLite.Designer.csproj", "{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "install", "..\tools\install\install.csproj", "{71EED886-B5BF-488E-A4AA-1403E393D224}" + ProjectSection(ProjectDependencies) = postProject + {9B4A5CF6-5BE5-4926-ACC7-B729A8C05198} = {9B4A5CF6-5BE5-4926-ACC7-B729A8C05198} + EndProjectSection +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Debug|x86 = Debug|x86 + Release|Any CPU = Release|Any CPU + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.Debug|Any CPU.Build.0 = Debug|Any CPU + {9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.Debug|x86.ActiveCfg = Debug|x86 + {9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.Debug|x86.Build.0 = Debug|x86 + {9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.Release|Any CPU.ActiveCfg = Release|x86 + {9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.Release|Any CPU.Build.0 = Release|x86 + {9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.Release|x86.ActiveCfg = Release|x86 + {9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.Release|x86.Build.0 = Release|x86 + {71EED886-B5BF-488E-A4AA-1403E393D224}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {71EED886-B5BF-488E-A4AA-1403E393D224}.Debug|Any CPU.Build.0 = Debug|Any CPU + {71EED886-B5BF-488E-A4AA-1403E393D224}.Debug|x86.ActiveCfg = Debug|x86 + {71EED886-B5BF-488E-A4AA-1403E393D224}.Debug|x86.Build.0 = Debug|x86 + {71EED886-B5BF-488E-A4AA-1403E393D224}.Release|Any CPU.ActiveCfg = Release|Any CPU + {71EED886-B5BF-488E-A4AA-1403E393D224}.Release|Any CPU.Build.0 = Release|Any CPU + {71EED886-B5BF-488E-A4AA-1403E393D224}.Release|x86.ActiveCfg = Release|x86 + {71EED886-B5BF-488E-A4AA-1403E393D224}.Release|x86.Build.0 = Release|x86 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal Index: SQLite.Designer/SQLiteDataViewSupport.cs ================================================================== --- SQLite.Designer/SQLiteDataViewSupport.cs +++ SQLite.Designer/SQLiteDataViewSupport.cs @@ -1,41 +1,41 @@ -/******************************************************** - * ADO.NET 2.0 Data Provider for SQLite Version 3.X - * Written by Robert Simpson (robert@blackcastlesoft.com) - * - * Released to the public domain, use at your own risk! - ********************************************************/ - -namespace SQLite.Designer -{ - using System; - using System.Collections.Generic; - using System.Text; - using System.Globalization; - using Microsoft.VisualStudio.Data; - using Microsoft.VisualStudio.OLE.Interop; - using Microsoft.VisualStudio.Data.AdoDotNet; - - /// - /// Provides DataViewSupport with a location where the XML file is for the Server Explorer's view. - /// - internal sealed class SQLiteDataViewSupport : DataViewSupport - { - public SQLiteDataViewSupport() - : base(String.Format(CultureInfo.InvariantCulture, "SQLite.Designer.SQLiteDataViewSupport{0}", GetVSVersion()), typeof(SQLiteDataViewSupport).Assembly) - { - } - - private static string GetVSVersion() - { - switch (System.Diagnostics.FileVersionInfo.GetVersionInfo(Environment.GetCommandLineArgs()[0]).FileMajorPart) - { - case 8: - return "2005"; - case 9: - return "2008"; - case 10: - return "2010"; - } - } - } -} +/******************************************************** + * ADO.NET 2.0 Data Provider for SQLite Version 3.X + * Written by Robert Simpson (robert@blackcastlesoft.com) + * + * Released to the public domain, use at your own risk! + ********************************************************/ + +namespace SQLite.Designer +{ + using System; + using System.Collections.Generic; + using System.Text; + using System.Globalization; + using Microsoft.VisualStudio.Data; + using Microsoft.VisualStudio.OLE.Interop; + using Microsoft.VisualStudio.Data.AdoDotNet; + + /// + /// Provides DataViewSupport with a location where the XML file is for the Server Explorer's view. + /// + internal sealed class SQLiteDataViewSupport : DataViewSupport + { + public SQLiteDataViewSupport() + : base(String.Format(CultureInfo.InvariantCulture, "SQLite.Designer.SQLiteDataViewSupport{0}", GetVSVersion()), typeof(SQLiteDataViewSupport).Assembly) + { + } + + private static string GetVSVersion() + { + switch (System.Diagnostics.FileVersionInfo.GetVersionInfo(Environment.GetCommandLineArgs()[0]).FileMajorPart) + { + case 8: + return "2005"; + case 10: + return "2010"; + default: + return "2008"; + } + } + } +} Index: SQLite.Designer/VSPackage.Designer.cs ================================================================== --- SQLite.Designer/VSPackage.Designer.cs +++ SQLite.Designer/VSPackage.Designer.cs @@ -1,115 +1,119 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// Runtime Version:2.0.50727.3031 -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -namespace SQLite.Designer { - using System; - - - /// - /// A strongly-typed resource class, for looking up localized strings, etc. - /// - // This class was auto-generated by the StronglyTypedResourceBuilder - // class via a tool like ResGen or Visual Studio. - // To add or remove a member, edit your .ResX file then rerun ResGen - // with the /str option, or rebuild your VS project. - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "2.0.0.0")] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - internal class VSPackage { - - private static global::System.Resources.ResourceManager resourceMan; - - private static global::System.Globalization.CultureInfo resourceCulture; - - [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - internal VSPackage() { - } - - /// - /// Returns the cached ResourceManager instance used by this class. - /// - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Resources.ResourceManager ResourceManager { - get { - if (object.ReferenceEquals(resourceMan, null)) { - global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("SQLite.Designer.VSPackage", typeof(VSPackage).Assembly); - resourceMan = temp; - } - return resourceMan; - } - } - - /// - /// Overrides the current thread's CurrentUICulture property for all - /// resource lookups using this strongly typed resource class. - /// - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Globalization.CultureInfo Culture { - get { - return resourceCulture; - } - set { - resourceCulture = value; - } - } - - /// - /// Looks up a localized string similar to MHM2ZQETQKDTJEPTC1MTQCZ1R1KQEMAPZHETDZPZI9RPJ0E0DHAHKCHZPKQ8AQZICADHKIZ1JAQED8IDEHZPZKZEIKAQERHPRCQMAMRKDEZZQRDRDHJEZIKECZPDIIKC. - /// - internal static string _400 { - get { - return ResourceManager.GetString("400", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to The database and its metadata will be un-encrypted. No password will be required to open the database and view its contents.. - /// - internal static string Decrypt { - get { - return ResourceManager.GetString("Decrypt", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to The database and its metadata will be encrypted using the supplied password as a hash.. - /// - internal static string Encrypt { - get { - return ResourceManager.GetString("Encrypt", resourceCulture); - } - } - - internal static System.Drawing.Bitmap info { - get { - object obj = ResourceManager.GetObject("info", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized string similar to The database and its metadata will be re-encrypted using the supplied password as a hash.. - /// - internal static string ReEncrypt { - get { - return ResourceManager.GetString("ReEncrypt", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to . - /// - internal static string ToolboxItems { - get { - return ResourceManager.GetString("ToolboxItems", resourceCulture); - } - } - } -} +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.1 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace SQLite.Designer { + using System; + + + /// + /// A strongly-typed resource class, for looking up localized strings, etc. + /// + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class VSPackage { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal VSPackage() { + } + + /// + /// Returns the cached ResourceManager instance used by this class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager { + get { + if (object.ReferenceEquals(resourceMan, null)) { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("SQLite.Designer.VSPackage", typeof(VSPackage).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + + /// + /// Looks up a localized string similar to MHM2ZQETQKDTJEPTC1MTQCZ1R1KQEMAPZHETDZPZI9RPJ0E0DHAHKCHZPKQ8AQZICADHKIZ1JAQED8IDEHZPZKZEIKAQERHPRCQMAMRKDEZZQRDRDHJEZIKECZPDIIKC. + /// + internal static string _400 { + get { + return ResourceManager.GetString("400", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The database and its metadata will be un-encrypted. No password will be required to open the database and view its contents.. + /// + internal static string Decrypt { + get { + return ResourceManager.GetString("Decrypt", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The database and its metadata will be encrypted using the supplied password as a hash.. + /// + internal static string Encrypt { + get { + return ResourceManager.GetString("Encrypt", resourceCulture); + } + } + + internal static System.Drawing.Bitmap info { + get { + object obj = ResourceManager.GetObject("info", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Looks up a localized string similar to The database and its metadata will be re-encrypted using the supplied password as a hash.. + /// + internal static string ReEncrypt { + get { + return ResourceManager.GetString("ReEncrypt", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to [SQLite] + ///System.Data.SQLite.SQLiteConnection, System.Data.SQLite + ///System.Data.SQLite.SQLiteDataAdapter, System.Data.SQLite + ///System.Data.SQLite.SQLiteCommand, System.Data.SQLite + ///. + /// + internal static string ToolboxItems { + get { + return ResourceManager.GetString("ToolboxItems", resourceCulture); + } + } + } +} Index: SQLite.Interop/SQLite.Interop.rc ================================================================== --- SQLite.Interop/SQLite.Interop.rc +++ SQLite.Interop/SQLite.Interop.rc @@ -1,102 +1,102 @@ -// Microsoft Visual C++ generated resource script. -// -#include "resource.h" - -#define APSTUDIO_READONLY_SYMBOLS -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 2 resource. -// -#include "afxres.h" - -///////////////////////////////////////////////////////////////////////////// -#undef APSTUDIO_READONLY_SYMBOLS - -///////////////////////////////////////////////////////////////////////////// -// English (U.S.) resources - -#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) -#ifdef _WIN32 -LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US -#pragma code_page(1252) -#endif //_WIN32 - -#ifdef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// TEXTINCLUDE -// - -1 TEXTINCLUDE -BEGIN - "resource.h\0" -END - -2 TEXTINCLUDE -BEGIN - "#include ""afxres.h""\r\n" - "\0" -END - -3 TEXTINCLUDE -BEGIN - "\r\n" - "\0" -END - -#endif // APSTUDIO_INVOKED - - -///////////////////////////////////////////////////////////////////////////// -// -// Version -// - -VS_VERSION_INFO VERSIONINFO - FILEVERSION 1,0,67,0 - PRODUCTVERSION 1,0,0,0 - FILEFLAGSMASK 0x17L -#ifdef _DEBUG - FILEFLAGS 0x1L -#else - FILEFLAGS 0x0L -#endif - FILEOS 0x4L - FILETYPE 0x2L - FILESUBTYPE 0x0L -BEGIN - BLOCK "StringFileInfo" - BEGIN - BLOCK "040904b0" - BEGIN - VALUE "Comments", "http://sqlite.phxsoftware.com" - VALUE "FileDescription", "System.Data.SQLite Interop Library" - VALUE "FileVersion", "1.0.67.0" - VALUE "InternalName", "SQLite.Interop.DLL" - VALUE "LegalCopyright", "Released to the public domain" - VALUE "OriginalFilename", "SQLite3.DLL 3.7.0.1" - VALUE "ProductName", "System.Data.SQLite" - VALUE "ProductVersion", "1.0" - END - END - BLOCK "VarFileInfo" - BEGIN - VALUE "Translation", 0x409, 1200 - END -END - -#endif // English (U.S.) resources -///////////////////////////////////////////////////////////////////////////// - - - -#ifndef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 3 resource. -// - - -///////////////////////////////////////////////////////////////////////////// -#endif // not APSTUDIO_INVOKED - +// Microsoft Visual C++ generated resource script. +// +#include "resource.h" + +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 2 resource. +// +#include "afxres.h" + +///////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +// English (U.S.) resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) +#ifdef _WIN32 +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US +#pragma code_page(1252) +#endif //_WIN32 + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +1 TEXTINCLUDE +BEGIN + "resource.h\0" +END + +2 TEXTINCLUDE +BEGIN + "#include ""afxres.h""\r\n" + "\0" +END + +3 TEXTINCLUDE +BEGIN + "\r\n" + "\0" +END + +#endif // APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// +// Version +// + +VS_VERSION_INFO VERSIONINFO + FILEVERSION 1,0,66,1 + PRODUCTVERSION 1,0,0,0 + FILEFLAGSMASK 0x17L +#ifdef _DEBUG + FILEFLAGS 0x1L +#else + FILEFLAGS 0x0L +#endif + FILEOS 0x4L + FILETYPE 0x2L + FILESUBTYPE 0x0L +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904b0" + BEGIN + VALUE "Comments", "http://sqlite.phxsoftware.com" + VALUE "FileDescription", "System.Data.SQLite Interop Library" + VALUE "FileVersion", "1.0.66.1" + VALUE "InternalName", "SQLite.Interop.DLL" + VALUE "LegalCopyright", "Released to the public domain" + VALUE "OriginalFilename", "SQLite3.DLL 3.6.23.1" + VALUE "ProductName", "System.Data.SQLite" + VALUE "ProductVersion", "1.0" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x409, 1200 + END +END + +#endif // English (U.S.) resources +///////////////////////////////////////////////////////////////////////////// + + + +#ifndef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 3 resource. +// + + +///////////////////////////////////////////////////////////////////////////// +#endif // not APSTUDIO_INVOKED + Index: SQLite.Interop/SQLite.Interop.vcproj ================================================================== --- SQLite.Interop/SQLite.Interop.vcproj +++ SQLite.Interop/SQLite.Interop.vcproj @@ -1,1175 +1,606 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Index: SQLite.NET.sln ================================================================== --- SQLite.NET.sln +++ SQLite.NET.sln @@ -1,262 +1,126 @@ - -Microsoft Visual Studio Solution File, Format Version 10.00 -# Visual Studio 2008 -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{39A3B743-1EBD-4CC0-8E37-ACE3DD38B1C0}" - ProjectSection(SolutionItems) = preProject - readme.htm = readme.htm - EndProjectSection -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "System.Data.SQLite - Compact", "System.Data.SQLite\System.Data.SQLite - Compact.csproj", "{AC139951-261A-4463-B6FA-AEBC25283A66}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "test", "test\test.csproj", "{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}" - ProjectSection(ProjectDependencies) = postProject - {10B51CE8-A838-44DE-BD82-B658F0296F80} = {10B51CE8-A838-44DE-BD82-B658F0296F80} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SQLite.Interop", "SQLite.Interop\SQLite.Interop.vcproj", "{10B51CE8-A838-44DE-BD82-B658F0296F80}" - ProjectSection(ProjectDependencies) = postProject - {AC139951-261A-4463-B6FA-AEBC25283A66} = {AC139951-261A-4463-B6FA-AEBC25283A66} - {AC139952-261A-4463-B6FA-AEBC25283A66} = {AC139952-261A-4463-B6FA-AEBC25283A66} - {AC139952-261A-4463-B6FA-AEBC25284A66} = {AC139952-261A-4463-B6FA-AEBC25284A66} - EndProjectSection -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "testce", "testce\testce.csproj", "{B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}" - ProjectSection(ProjectDependencies) = postProject - {AC139951-261A-4463-B6FA-AEBC25283A66} = {AC139951-261A-4463-B6FA-AEBC25283A66} - {10B51CE8-A838-44DE-BD82-B658F0296F80} = {10B51CE8-A838-44DE-BD82-B658F0296F80} - EndProjectSection -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "System.Data.SQLite - ManagedOnly", "System.Data.SQLite\System.Data.SQLite - ManagedOnly.csproj", "{AC139952-261A-4463-B6FA-AEBC25283A66}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "System.Data.SQLite.Linq", "System.Data.SQLite.Linq\System.Data.SQLite.Linq.csproj", "{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}" - ProjectSection(ProjectDependencies) = postProject - {10B51CE8-A838-44DE-BD82-B658F0296F80} = {10B51CE8-A838-44DE-BD82-B658F0296F80} - EndProjectSection -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "testlinq", "testlinq\testlinq.csproj", "{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}" - ProjectSection(ProjectDependencies) = postProject - {E6BF9F74-58E2-413B-A7CE-EA653ECB728D} = {E6BF9F74-58E2-413B-A7CE-EA653ECB728D} - EndProjectSection -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "System.Data.SQLite - Netmodule", "System.Data.SQLite\System.Data.SQLite - Netmodule.csproj", "{AC139952-261A-4463-B6FA-AEBC25284A66}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug - Stock|Compact Framework (ARMV4) = Debug - Stock|Compact Framework (ARMV4) - Debug - Stock|Itanium = Debug - Stock|Itanium - Debug - Stock|Win32 = Debug - Stock|Win32 - Debug - Stock|x64 = Debug - Stock|x64 - Debug|Compact Framework (ARMV4) = Debug|Compact Framework (ARMV4) - Debug|Itanium = Debug|Itanium - Debug|Win32 = Debug|Win32 - Debug|x64 = Debug|x64 - Release - Stock|Compact Framework (ARMV4) = Release - Stock|Compact Framework (ARMV4) - Release - Stock|Itanium = Release - Stock|Itanium - Release - Stock|Win32 = Release - Stock|Win32 - Release - Stock|x64 = Release - Stock|x64 - Release|Compact Framework (ARMV4) = Release|Compact Framework (ARMV4) - Release|Itanium = Release|Itanium - Release|Win32 = Release|Win32 - Release|x64 = Release|x64 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {AC139951-261A-4463-B6FA-AEBC25283A66}.Debug - Stock|Compact Framework (ARMV4).ActiveCfg = Debug|Any CPU - {AC139951-261A-4463-B6FA-AEBC25283A66}.Debug - Stock|Compact Framework (ARMV4).Build.0 = Debug|Any CPU - {AC139951-261A-4463-B6FA-AEBC25283A66}.Debug - Stock|Itanium.ActiveCfg = Debug|Any CPU - {AC139951-261A-4463-B6FA-AEBC25283A66}.Debug - Stock|Win32.ActiveCfg = Debug|Any CPU - {AC139951-261A-4463-B6FA-AEBC25283A66}.Debug - Stock|x64.ActiveCfg = Debug|Any CPU - {AC139951-261A-4463-B6FA-AEBC25283A66}.Debug|Compact Framework (ARMV4).ActiveCfg = Debug|Any CPU - {AC139951-261A-4463-B6FA-AEBC25283A66}.Debug|Compact Framework (ARMV4).Build.0 = Debug|Any CPU - {AC139951-261A-4463-B6FA-AEBC25283A66}.Debug|Itanium.ActiveCfg = Debug|Any CPU - {AC139951-261A-4463-B6FA-AEBC25283A66}.Debug|Win32.ActiveCfg = Debug|Any CPU - {AC139951-261A-4463-B6FA-AEBC25283A66}.Debug|x64.ActiveCfg = Debug|Any CPU - {AC139951-261A-4463-B6FA-AEBC25283A66}.Release - Stock|Compact Framework (ARMV4).ActiveCfg = Release|Any CPU - {AC139951-261A-4463-B6FA-AEBC25283A66}.Release - Stock|Compact Framework (ARMV4).Build.0 = Release|Any CPU - {AC139951-261A-4463-B6FA-AEBC25283A66}.Release - Stock|Itanium.ActiveCfg = Release|Any CPU - {AC139951-261A-4463-B6FA-AEBC25283A66}.Release - Stock|Win32.ActiveCfg = Release|Any CPU - {AC139951-261A-4463-B6FA-AEBC25283A66}.Release - Stock|x64.ActiveCfg = Release|Any CPU - {AC139951-261A-4463-B6FA-AEBC25283A66}.Release|Compact Framework (ARMV4).ActiveCfg = Release|Any CPU - {AC139951-261A-4463-B6FA-AEBC25283A66}.Release|Compact Framework (ARMV4).Build.0 = Release|Any CPU - {AC139951-261A-4463-B6FA-AEBC25283A66}.Release|Itanium.ActiveCfg = Release|Any CPU - {AC139951-261A-4463-B6FA-AEBC25283A66}.Release|Win32.ActiveCfg = Release|Any CPU - {AC139951-261A-4463-B6FA-AEBC25283A66}.Release|x64.ActiveCfg = Release|Any CPU - {E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Debug - Stock|Compact Framework (ARMV4).ActiveCfg = Debug|Any CPU - {E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Debug - Stock|Itanium.ActiveCfg = Debug|Itanium - {E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Debug - Stock|Itanium.Build.0 = Debug|Itanium - {E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Debug - Stock|Win32.ActiveCfg = Debug|Any CPU - {E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Debug - Stock|Win32.Build.0 = Debug|Any CPU - {E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Debug - Stock|x64.ActiveCfg = Debug|x64 - {E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Debug - Stock|x64.Build.0 = Debug|x64 - {E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Debug|Compact Framework (ARMV4).ActiveCfg = Debug|Any CPU - {E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Debug|Itanium.ActiveCfg = Debug|Itanium - {E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Debug|Itanium.Build.0 = Debug|Itanium - {E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Debug|Win32.ActiveCfg = Debug|x86 - {E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Debug|Win32.Build.0 = Debug|x86 - {E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Debug|x64.ActiveCfg = Debug|x64 - {E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Debug|x64.Build.0 = Debug|x64 - {E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Release - Stock|Compact Framework (ARMV4).ActiveCfg = Release|Any CPU - {E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Release - Stock|Itanium.ActiveCfg = Release|Itanium - {E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Release - Stock|Itanium.Build.0 = Release|Itanium - {E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Release - Stock|Win32.ActiveCfg = Release|Any CPU - {E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Release - Stock|Win32.Build.0 = Release|Any CPU - {E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Release - Stock|x64.ActiveCfg = Release|x64 - {E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Release - Stock|x64.Build.0 = Release|x64 - {E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Release|Compact Framework (ARMV4).ActiveCfg = Release|Any CPU - {E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Release|Itanium.ActiveCfg = Release|Itanium - {E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Release|Itanium.Build.0 = Release|Itanium - {E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Release|Win32.ActiveCfg = Release|x86 - {E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Release|Win32.Build.0 = Release|x86 - {E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Release|x64.ActiveCfg = Release|x64 - {E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Release|x64.Build.0 = Release|x64 - {10B51CE8-A838-44DE-BD82-B658F0296F80}.Debug - Stock|Compact Framework (ARMV4).ActiveCfg = StockDebug|Pocket PC 2003 (ARMV4) - {10B51CE8-A838-44DE-BD82-B658F0296F80}.Debug - Stock|Compact Framework (ARMV4).Build.0 = StockDebug|Pocket PC 2003 (ARMV4) - {10B51CE8-A838-44DE-BD82-B658F0296F80}.Debug - Stock|Compact Framework (ARMV4).Deploy.0 = StockDebug|Pocket PC 2003 (ARMV4) - {10B51CE8-A838-44DE-BD82-B658F0296F80}.Debug - Stock|Itanium.ActiveCfg = Debug|Itanium - {10B51CE8-A838-44DE-BD82-B658F0296F80}.Debug - Stock|Itanium.Deploy.0 = Debug|Itanium - {10B51CE8-A838-44DE-BD82-B658F0296F80}.Debug - Stock|Win32.ActiveCfg = StockDebug|Win32 - {10B51CE8-A838-44DE-BD82-B658F0296F80}.Debug - Stock|Win32.Deploy.0 = StockDebug|Win32 - {10B51CE8-A838-44DE-BD82-B658F0296F80}.Debug - Stock|x64.ActiveCfg = Debug|x64 - {10B51CE8-A838-44DE-BD82-B658F0296F80}.Debug - Stock|x64.Deploy.0 = Debug|x64 - {10B51CE8-A838-44DE-BD82-B658F0296F80}.Debug|Compact Framework (ARMV4).ActiveCfg = Debug|Pocket PC 2003 (ARMV4) - {10B51CE8-A838-44DE-BD82-B658F0296F80}.Debug|Compact Framework (ARMV4).Build.0 = Debug|Pocket PC 2003 (ARMV4) - {10B51CE8-A838-44DE-BD82-B658F0296F80}.Debug|Compact Framework (ARMV4).Deploy.0 = Debug|Pocket PC 2003 (ARMV4) - {10B51CE8-A838-44DE-BD82-B658F0296F80}.Debug|Itanium.ActiveCfg = Debug|Itanium - {10B51CE8-A838-44DE-BD82-B658F0296F80}.Debug|Itanium.Build.0 = Debug|Itanium - {10B51CE8-A838-44DE-BD82-B658F0296F80}.Debug|Itanium.Deploy.0 = Debug|Itanium - {10B51CE8-A838-44DE-BD82-B658F0296F80}.Debug|Win32.ActiveCfg = Debug|Win32 - {10B51CE8-A838-44DE-BD82-B658F0296F80}.Debug|Win32.Build.0 = Debug|Win32 - {10B51CE8-A838-44DE-BD82-B658F0296F80}.Debug|Win32.Deploy.0 = Debug|Win32 - {10B51CE8-A838-44DE-BD82-B658F0296F80}.Debug|x64.ActiveCfg = Debug|x64 - {10B51CE8-A838-44DE-BD82-B658F0296F80}.Debug|x64.Build.0 = Debug|x64 - {10B51CE8-A838-44DE-BD82-B658F0296F80}.Debug|x64.Deploy.0 = Debug|x64 - {10B51CE8-A838-44DE-BD82-B658F0296F80}.Release - Stock|Compact Framework (ARMV4).ActiveCfg = Release|Pocket PC 2003 (ARMV4) - {10B51CE8-A838-44DE-BD82-B658F0296F80}.Release - Stock|Compact Framework (ARMV4).Build.0 = Release|Pocket PC 2003 (ARMV4) - {10B51CE8-A838-44DE-BD82-B658F0296F80}.Release - Stock|Compact Framework (ARMV4).Deploy.0 = Release|Pocket PC 2003 (ARMV4) - {10B51CE8-A838-44DE-BD82-B658F0296F80}.Release - Stock|Itanium.ActiveCfg = Release|Itanium - {10B51CE8-A838-44DE-BD82-B658F0296F80}.Release - Stock|Win32.ActiveCfg = Release|Win32 - {10B51CE8-A838-44DE-BD82-B658F0296F80}.Release - Stock|x64.ActiveCfg = Release|x64 - {10B51CE8-A838-44DE-BD82-B658F0296F80}.Release|Compact Framework (ARMV4).ActiveCfg = Release|Pocket PC 2003 (ARMV4) - {10B51CE8-A838-44DE-BD82-B658F0296F80}.Release|Compact Framework (ARMV4).Build.0 = Release|Pocket PC 2003 (ARMV4) - {10B51CE8-A838-44DE-BD82-B658F0296F80}.Release|Itanium.ActiveCfg = Release|Itanium - {10B51CE8-A838-44DE-BD82-B658F0296F80}.Release|Itanium.Build.0 = Release|Itanium - {10B51CE8-A838-44DE-BD82-B658F0296F80}.Release|Win32.ActiveCfg = Release|Win32 - {10B51CE8-A838-44DE-BD82-B658F0296F80}.Release|Win32.Build.0 = Release|Win32 - {10B51CE8-A838-44DE-BD82-B658F0296F80}.Release|x64.ActiveCfg = Release|x64 - {10B51CE8-A838-44DE-BD82-B658F0296F80}.Release|x64.Build.0 = Release|x64 - {B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}.Debug - Stock|Compact Framework (ARMV4).ActiveCfg = Debug|Any CPU - {B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}.Debug - Stock|Compact Framework (ARMV4).Build.0 = Debug|Any CPU - {B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}.Debug - Stock|Compact Framework (ARMV4).Deploy.0 = Debug|Any CPU - {B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}.Debug - Stock|Itanium.ActiveCfg = Debug|Any CPU - {B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}.Debug - Stock|Win32.ActiveCfg = Debug|Any CPU - {B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}.Debug - Stock|x64.ActiveCfg = Debug|Any CPU - {B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}.Debug|Compact Framework (ARMV4).ActiveCfg = Debug|Any CPU - {B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}.Debug|Compact Framework (ARMV4).Build.0 = Debug|Any CPU - {B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}.Debug|Compact Framework (ARMV4).Deploy.0 = Debug|Any CPU - {B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}.Debug|Itanium.ActiveCfg = Debug|Any CPU - {B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}.Debug|Win32.ActiveCfg = Debug|Any CPU - {B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}.Debug|x64.ActiveCfg = Debug|Any CPU - {B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}.Release - Stock|Compact Framework (ARMV4).ActiveCfg = Release|Any CPU - {B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}.Release - Stock|Compact Framework (ARMV4).Build.0 = Release|Any CPU - {B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}.Release - Stock|Compact Framework (ARMV4).Deploy.0 = Release|Any CPU - {B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}.Release - Stock|Itanium.ActiveCfg = Release|Any CPU - {B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}.Release - Stock|Win32.ActiveCfg = Release|Any CPU - {B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}.Release - Stock|x64.ActiveCfg = Release|Any CPU - {B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}.Release|Compact Framework (ARMV4).ActiveCfg = Release|Any CPU - {B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}.Release|Compact Framework (ARMV4).Build.0 = Release|Any CPU - {B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}.Release|Compact Framework (ARMV4).Deploy.0 = Release|Any CPU - {B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}.Release|Itanium.ActiveCfg = Release|Any CPU - {B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}.Release|Win32.ActiveCfg = Release|Any CPU - {B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}.Release|x64.ActiveCfg = Release|Any CPU - {AC139952-261A-4463-B6FA-AEBC25283A66}.Debug - Stock|Compact Framework (ARMV4).ActiveCfg = Debug|Any CPU - {AC139952-261A-4463-B6FA-AEBC25283A66}.Debug - Stock|Itanium.ActiveCfg = Debug|Any CPU - {AC139952-261A-4463-B6FA-AEBC25283A66}.Debug - Stock|Itanium.Build.0 = Debug|Any CPU - {AC139952-261A-4463-B6FA-AEBC25283A66}.Debug - Stock|Win32.ActiveCfg = StockDebug|Any CPU - {AC139952-261A-4463-B6FA-AEBC25283A66}.Debug - Stock|Win32.Build.0 = StockDebug|Any CPU - {AC139952-261A-4463-B6FA-AEBC25283A66}.Debug - Stock|x64.ActiveCfg = Debug|Any CPU - {AC139952-261A-4463-B6FA-AEBC25283A66}.Debug - Stock|x64.Build.0 = Debug|Any CPU - {AC139952-261A-4463-B6FA-AEBC25283A66}.Debug|Compact Framework (ARMV4).ActiveCfg = Debug|Any CPU - {AC139952-261A-4463-B6FA-AEBC25283A66}.Debug|Itanium.ActiveCfg = Debug|Any CPU - {AC139952-261A-4463-B6FA-AEBC25283A66}.Debug|Itanium.Build.0 = Debug|Any CPU - {AC139952-261A-4463-B6FA-AEBC25283A66}.Debug|Win32.ActiveCfg = Debug|Any CPU - {AC139952-261A-4463-B6FA-AEBC25283A66}.Debug|Win32.Build.0 = Debug|Any CPU - {AC139952-261A-4463-B6FA-AEBC25283A66}.Debug|x64.ActiveCfg = Debug|Any CPU - {AC139952-261A-4463-B6FA-AEBC25283A66}.Debug|x64.Build.0 = Debug|Any CPU - {AC139952-261A-4463-B6FA-AEBC25283A66}.Release - Stock|Compact Framework (ARMV4).ActiveCfg = Release|Any CPU - {AC139952-261A-4463-B6FA-AEBC25283A66}.Release - Stock|Itanium.ActiveCfg = Release|Any CPU - {AC139952-261A-4463-B6FA-AEBC25283A66}.Release - Stock|Itanium.Build.0 = Release|Any CPU - {AC139952-261A-4463-B6FA-AEBC25283A66}.Release - Stock|Win32.ActiveCfg = StockRelease|Any CPU - {AC139952-261A-4463-B6FA-AEBC25283A66}.Release - Stock|Win32.Build.0 = StockRelease|Any CPU - {AC139952-261A-4463-B6FA-AEBC25283A66}.Release - Stock|x64.ActiveCfg = Release|Any CPU - {AC139952-261A-4463-B6FA-AEBC25283A66}.Release - Stock|x64.Build.0 = Release|Any CPU - {AC139952-261A-4463-B6FA-AEBC25283A66}.Release|Compact Framework (ARMV4).ActiveCfg = Release|Any CPU - {AC139952-261A-4463-B6FA-AEBC25283A66}.Release|Itanium.ActiveCfg = Release|Any CPU - {AC139952-261A-4463-B6FA-AEBC25283A66}.Release|Win32.ActiveCfg = Release|Any CPU - {AC139952-261A-4463-B6FA-AEBC25283A66}.Release|x64.ActiveCfg = Release|Any CPU - {E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.Debug - Stock|Compact Framework (ARMV4).ActiveCfg = Debug|Any CPU - {E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.Debug - Stock|Itanium.ActiveCfg = Debug|Any CPU - {E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.Debug - Stock|Itanium.Build.0 = Debug|Any CPU - {E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.Debug - Stock|Win32.ActiveCfg = Debug|Any CPU - {E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.Debug - Stock|Win32.Build.0 = Debug|Any CPU - {E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.Debug - Stock|x64.ActiveCfg = Debug|Any CPU - {E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.Debug - Stock|x64.Build.0 = Debug|Any CPU - {E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.Debug|Compact Framework (ARMV4).ActiveCfg = Debug|Any CPU - {E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.Debug|Itanium.ActiveCfg = Debug|Any CPU - {E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.Debug|Itanium.Build.0 = Debug|Any CPU - {E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.Debug|Win32.ActiveCfg = Debug|Any CPU - {E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.Debug|Win32.Build.0 = Debug|Any CPU - {E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.Debug|x64.ActiveCfg = Debug|Any CPU - {E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.Debug|x64.Build.0 = Debug|Any CPU - {E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.Release - Stock|Compact Framework (ARMV4).ActiveCfg = Release|Any CPU - {E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.Release - Stock|Itanium.ActiveCfg = Release|Any CPU - {E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.Release - Stock|Itanium.Build.0 = Release|Any CPU - {E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.Release - Stock|Win32.ActiveCfg = Release|Any CPU - {E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.Release - Stock|Win32.Build.0 = Release|Any CPU - {E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.Release - Stock|x64.ActiveCfg = Release|Any CPU - {E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.Release - Stock|x64.Build.0 = Release|Any CPU - {E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.Release|Compact Framework (ARMV4).ActiveCfg = Release|Any CPU - {E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.Release|Itanium.ActiveCfg = Release|Any CPU - {E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.Release|Itanium.Build.0 = Release|Any CPU - {E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.Release|Win32.ActiveCfg = Release|Any CPU - {E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.Release|Win32.Build.0 = Release|Any CPU - {E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.Release|x64.ActiveCfg = Release|Any CPU - {E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.Release|x64.Build.0 = Release|Any CPU - {9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.Debug - Stock|Compact Framework (ARMV4).ActiveCfg = Debug|Any CPU - {9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.Debug - Stock|Itanium.ActiveCfg = Debug|Any CPU - {9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.Debug - Stock|Win32.ActiveCfg = Debug|Any CPU - {9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.Debug - Stock|x64.ActiveCfg = Debug|Any CPU - {9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.Debug|Compact Framework (ARMV4).ActiveCfg = Debug|Any CPU - {9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.Debug|Itanium.ActiveCfg = Debug|Any CPU - {9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.Debug|Win32.ActiveCfg = Debug|Any CPU - {9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.Debug|x64.ActiveCfg = Debug|Any CPU - {9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.Release - Stock|Compact Framework (ARMV4).ActiveCfg = Release|Any CPU - {9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.Release - Stock|Itanium.ActiveCfg = Release|Any CPU - {9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.Release - Stock|Win32.ActiveCfg = Release|Any CPU - {9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.Release - Stock|x64.ActiveCfg = Release|Any CPU - {9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.Release|Compact Framework (ARMV4).ActiveCfg = Release|Any CPU - {9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.Release|Itanium.ActiveCfg = Release|Any CPU - {9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.Release|Win32.ActiveCfg = Release|Any CPU - {9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.Release|x64.ActiveCfg = Release|Any CPU - {AC139952-261A-4463-B6FA-AEBC25284A66}.Debug - Stock|Compact Framework (ARMV4).ActiveCfg = Debug|Any CPU - {AC139952-261A-4463-B6FA-AEBC25284A66}.Debug - Stock|Itanium.ActiveCfg = Debug|Any CPU - {AC139952-261A-4463-B6FA-AEBC25284A66}.Debug - Stock|Win32.ActiveCfg = Debug|Any CPU - {AC139952-261A-4463-B6FA-AEBC25284A66}.Debug - Stock|x64.ActiveCfg = Debug|Any CPU - {AC139952-261A-4463-B6FA-AEBC25284A66}.Debug|Compact Framework (ARMV4).ActiveCfg = Debug|Any CPU - {AC139952-261A-4463-B6FA-AEBC25284A66}.Debug|Itanium.ActiveCfg = Debug|Any CPU - {AC139952-261A-4463-B6FA-AEBC25284A66}.Debug|Win32.ActiveCfg = Debug|Any CPU - {AC139952-261A-4463-B6FA-AEBC25284A66}.Debug|x64.ActiveCfg = Debug|Any CPU - {AC139952-261A-4463-B6FA-AEBC25284A66}.Release - Stock|Compact Framework (ARMV4).ActiveCfg = Release|Any CPU - {AC139952-261A-4463-B6FA-AEBC25284A66}.Release - Stock|Itanium.ActiveCfg = Release|Any CPU - {AC139952-261A-4463-B6FA-AEBC25284A66}.Release - Stock|Win32.ActiveCfg = Release|Any CPU - {AC139952-261A-4463-B6FA-AEBC25284A66}.Release - Stock|x64.ActiveCfg = Release|Any CPU - {AC139952-261A-4463-B6FA-AEBC25284A66}.Release|Compact Framework (ARMV4).ActiveCfg = Release|Any CPU - {AC139952-261A-4463-B6FA-AEBC25284A66}.Release|Itanium.ActiveCfg = Release|Any CPU - {AC139952-261A-4463-B6FA-AEBC25284A66}.Release|Itanium.Build.0 = Release|Any CPU - {AC139952-261A-4463-B6FA-AEBC25284A66}.Release|Win32.ActiveCfg = Release|Any CPU - {AC139952-261A-4463-B6FA-AEBC25284A66}.Release|Win32.Build.0 = Release|Any CPU - {AC139952-261A-4463-B6FA-AEBC25284A66}.Release|x64.ActiveCfg = Release|Any CPU - {AC139952-261A-4463-B6FA-AEBC25284A66}.Release|x64.Build.0 = Release|Any CPU - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal + +Microsoft Visual Studio Solution File, Format Version 11.00 +# Visual Studio 2010 +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{39A3B743-1EBD-4CC0-8E37-ACE3DD38B1C0}" + ProjectSection(SolutionItems) = preProject + readme.htm = readme.htm + EndProjectSection +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "test", "test\test.csproj", "{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}" + ProjectSection(ProjectDependencies) = postProject + {10B51CE8-A838-44DE-BD82-B658F0296F80} = {10B51CE8-A838-44DE-BD82-B658F0296F80} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SQLite.Interop", "SQLite.Interop\SQLite.Interop.vcxproj", "{10B51CE8-A838-44DE-BD82-B658F0296F80}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "System.Data.SQLite - ManagedOnly", "System.Data.SQLite\System.Data.SQLite - ManagedOnly.csproj", "{AC139952-261A-4463-B6FA-AEBC25283A66}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "System.Data.SQLite.Linq", "System.Data.SQLite.Linq\System.Data.SQLite.Linq.csproj", "{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}" + ProjectSection(ProjectDependencies) = postProject + {10B51CE8-A838-44DE-BD82-B658F0296F80} = {10B51CE8-A838-44DE-BD82-B658F0296F80} + EndProjectSection +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "testlinq", "testlinq\testlinq.csproj", "{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}" + ProjectSection(ProjectDependencies) = postProject + {E6BF9F74-58E2-413B-A7CE-EA653ECB728D} = {E6BF9F74-58E2-413B-A7CE-EA653ECB728D} + EndProjectSection +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "System.Data.SQLite - Netmodule", "System.Data.SQLite\System.Data.SQLite - Netmodule.csproj", "{AC139952-261A-4463-B6FA-AEBC25284A66}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug - Stock|Win32 = Debug - Stock|Win32 + Debug - Stock|x64 = Debug - Stock|x64 + Debug|Win32 = Debug|Win32 + Debug|x64 = Debug|x64 + Release - Stock|Win32 = Release - Stock|Win32 + Release - Stock|x64 = Release - Stock|x64 + Release|Win32 = Release|Win32 + Release|x64 = Release|x64 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Debug - Stock|Win32.ActiveCfg = Debug|Any CPU + {E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Debug - Stock|Win32.Build.0 = Debug|Any CPU + {E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Debug - Stock|x64.ActiveCfg = Debug|x64 + {E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Debug - Stock|x64.Build.0 = Debug|x64 + {E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Debug|Win32.ActiveCfg = Debug|x86 + {E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Debug|Win32.Build.0 = Debug|x86 + {E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Debug|x64.ActiveCfg = Debug|x64 + {E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Debug|x64.Build.0 = Debug|x64 + {E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Release - Stock|Win32.ActiveCfg = Release|Any CPU + {E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Release - Stock|Win32.Build.0 = Release|Any CPU + {E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Release - Stock|x64.ActiveCfg = Release|x64 + {E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Release - Stock|x64.Build.0 = Release|x64 + {E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Release|Win32.ActiveCfg = Release|x86 + {E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Release|Win32.Build.0 = Release|x86 + {E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Release|x64.ActiveCfg = Release|x64 + {E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Release|x64.Build.0 = Release|x64 + {10B51CE8-A838-44DE-BD82-B658F0296F80}.Debug - Stock|Win32.ActiveCfg = StockDebug|Win32 + {10B51CE8-A838-44DE-BD82-B658F0296F80}.Debug - Stock|Win32.Deploy.0 = StockDebug|Win32 + {10B51CE8-A838-44DE-BD82-B658F0296F80}.Debug - Stock|x64.ActiveCfg = Debug|x64 + {10B51CE8-A838-44DE-BD82-B658F0296F80}.Debug - Stock|x64.Deploy.0 = Debug|x64 + {10B51CE8-A838-44DE-BD82-B658F0296F80}.Debug|Win32.ActiveCfg = Debug|Win32 + {10B51CE8-A838-44DE-BD82-B658F0296F80}.Debug|Win32.Build.0 = Debug|Win32 + {10B51CE8-A838-44DE-BD82-B658F0296F80}.Debug|Win32.Deploy.0 = Debug|Win32 + {10B51CE8-A838-44DE-BD82-B658F0296F80}.Debug|x64.ActiveCfg = Debug|x64 + {10B51CE8-A838-44DE-BD82-B658F0296F80}.Debug|x64.Build.0 = Debug|x64 + {10B51CE8-A838-44DE-BD82-B658F0296F80}.Debug|x64.Deploy.0 = Debug|x64 + {10B51CE8-A838-44DE-BD82-B658F0296F80}.Release - Stock|Win32.ActiveCfg = Release|Win32 + {10B51CE8-A838-44DE-BD82-B658F0296F80}.Release - Stock|x64.ActiveCfg = Release|x64 + {10B51CE8-A838-44DE-BD82-B658F0296F80}.Release|Win32.ActiveCfg = Release|Win32 + {10B51CE8-A838-44DE-BD82-B658F0296F80}.Release|Win32.Build.0 = Release|Win32 + {10B51CE8-A838-44DE-BD82-B658F0296F80}.Release|x64.ActiveCfg = Release|x64 + {10B51CE8-A838-44DE-BD82-B658F0296F80}.Release|x64.Build.0 = Release|x64 + {AC139952-261A-4463-B6FA-AEBC25283A66}.Debug - Stock|Win32.ActiveCfg = StockDebug|Any CPU + {AC139952-261A-4463-B6FA-AEBC25283A66}.Debug - Stock|Win32.Build.0 = StockDebug|Any CPU + {AC139952-261A-4463-B6FA-AEBC25283A66}.Debug - Stock|x64.ActiveCfg = Debug|Any CPU + {AC139952-261A-4463-B6FA-AEBC25283A66}.Debug - Stock|x64.Build.0 = Debug|Any CPU + {AC139952-261A-4463-B6FA-AEBC25283A66}.Debug|Win32.ActiveCfg = Debug|Any CPU + {AC139952-261A-4463-B6FA-AEBC25283A66}.Debug|Win32.Build.0 = Debug|Any CPU + {AC139952-261A-4463-B6FA-AEBC25283A66}.Debug|x64.ActiveCfg = Debug|Any CPU + {AC139952-261A-4463-B6FA-AEBC25283A66}.Debug|x64.Build.0 = Debug|Any CPU + {AC139952-261A-4463-B6FA-AEBC25283A66}.Release - Stock|Win32.ActiveCfg = StockRelease|Any CPU + {AC139952-261A-4463-B6FA-AEBC25283A66}.Release - Stock|Win32.Build.0 = StockRelease|Any CPU + {AC139952-261A-4463-B6FA-AEBC25283A66}.Release - Stock|x64.ActiveCfg = Release|Any CPU + {AC139952-261A-4463-B6FA-AEBC25283A66}.Release - Stock|x64.Build.0 = Release|Any CPU + {AC139952-261A-4463-B6FA-AEBC25283A66}.Release|Win32.ActiveCfg = Release|Any CPU + {AC139952-261A-4463-B6FA-AEBC25283A66}.Release|x64.ActiveCfg = Release|Any CPU + {E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.Debug - Stock|Win32.ActiveCfg = Debug|Any CPU + {E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.Debug - Stock|Win32.Build.0 = Debug|Any CPU + {E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.Debug - Stock|x64.ActiveCfg = Debug|Any CPU + {E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.Debug - Stock|x64.Build.0 = Debug|Any CPU + {E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.Debug|Win32.ActiveCfg = Debug|Any CPU + {E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.Debug|Win32.Build.0 = Debug|Any CPU + {E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.Debug|x64.ActiveCfg = Debug|Any CPU + {E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.Debug|x64.Build.0 = Debug|Any CPU + {E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.Release - Stock|Win32.ActiveCfg = Release|Any CPU + {E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.Release - Stock|Win32.Build.0 = Release|Any CPU + {E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.Release - Stock|x64.ActiveCfg = Release|Any CPU + {E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.Release - Stock|x64.Build.0 = Release|Any CPU + {E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.Release|Win32.ActiveCfg = Release|Any CPU + {E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.Release|Win32.Build.0 = Release|Any CPU + {E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.Release|x64.ActiveCfg = Release|Any CPU + {E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.Release|x64.Build.0 = Release|Any CPU + {9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.Debug - Stock|Win32.ActiveCfg = Debug|Any CPU + {9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.Debug - Stock|x64.ActiveCfg = Debug|Any CPU + {9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.Debug|Win32.ActiveCfg = Debug|Any CPU + {9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.Debug|x64.ActiveCfg = Debug|Any CPU + {9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.Release - Stock|Win32.ActiveCfg = Release|Any CPU + {9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.Release - Stock|x64.ActiveCfg = Release|Any CPU + {9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.Release|Win32.ActiveCfg = Release|Any CPU + {9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.Release|x64.ActiveCfg = Release|Any CPU + {AC139952-261A-4463-B6FA-AEBC25284A66}.Debug - Stock|Win32.ActiveCfg = Debug|Any CPU + {AC139952-261A-4463-B6FA-AEBC25284A66}.Debug - Stock|x64.ActiveCfg = Debug|Any CPU + {AC139952-261A-4463-B6FA-AEBC25284A66}.Debug|Win32.ActiveCfg = Debug|Any CPU + {AC139952-261A-4463-B6FA-AEBC25284A66}.Debug|x64.ActiveCfg = Debug|Any CPU + {AC139952-261A-4463-B6FA-AEBC25284A66}.Release - Stock|Win32.ActiveCfg = Release|Any CPU + {AC139952-261A-4463-B6FA-AEBC25284A66}.Release - Stock|x64.ActiveCfg = Release|Any CPU + {AC139952-261A-4463-B6FA-AEBC25284A66}.Release|Win32.ActiveCfg = Release|Any CPU + {AC139952-261A-4463-B6FA-AEBC25284A66}.Release|Win32.Build.0 = Release|Any CPU + {AC139952-261A-4463-B6FA-AEBC25284A66}.Release|x64.ActiveCfg = Release|Any CPU + {AC139952-261A-4463-B6FA-AEBC25284A66}.Release|x64.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal Index: SQLite.NET.suo ================================================================== --- SQLite.NET.suo +++ SQLite.NET.suo cannot compute difference between binary files Index: System.Data.SQLite.Linq/AssemblyInfo.cs ================================================================== --- System.Data.SQLite.Linq/AssemblyInfo.cs +++ System.Data.SQLite.Linq/AssemblyInfo.cs @@ -1,41 +1,40 @@ -using System; -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; -using System.Security.Permissions; -using System.Security; -using System.Runtime.ConstrainedExecution; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("System.Data.SQLite.Linq")] -[assembly: AssemblyDescription("ADO.NET 3.5SP1 Entity Framework support for SQLite")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("http://sqlite.phxsoftware.com")] -[assembly: AssemblyProduct("System.Data.SQLite")] -[assembly: AssemblyCopyright("Public Domain")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] -[assembly: CLSCompliant(true)] -[assembly: AllowPartiallyTrustedCallers] -[assembly: ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)] -[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the values or you can default the Build and Revision Numbers -// by using the '*' as shown below: -// [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("2.0.38.0")] -[assembly: AssemblyFileVersion("2.0.38.0")] +using System; +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; +using System.Security.Permissions; +using System.Security; +using System.Runtime.ConstrainedExecution; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("System.Data.SQLite.Linq")] +[assembly: AssemblyDescription("ADO.NET 4.0 Entity Framework support for SQLite")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("http://sqlite.phxsoftware.com")] +[assembly: AssemblyProduct("System.Data.SQLite")] +[assembly: AssemblyCopyright("Public Domain")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] +[assembly: CLSCompliant(true)] +[assembly: AllowPartiallyTrustedCallers] +[assembly: ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.38.1")] +[assembly: AssemblyFileVersion("1.0.38.1")] Index: System.Data.SQLite.Linq/Properties/Resources.Designer.cs ================================================================== --- System.Data.SQLite.Linq/Properties/Resources.Designer.cs +++ System.Data.SQLite.Linq/Properties/Resources.Designer.cs @@ -1,93 +1,93 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// Runtime Version:2.0.50727.3053 -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -namespace System.Data.SQLite.Properties { - using System; - - - /// - /// A strongly-typed resource class, for looking up localized strings, etc. - /// - // This class was auto-generated by the StronglyTypedResourceBuilder - // class via a tool like ResGen or Visual Studio. - // To add or remove a member, edit your .ResX file then rerun ResGen - // with the /str option, or rebuild your VS project. - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "2.0.0.0")] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - internal class Resources { - - private static global::System.Resources.ResourceManager resourceMan; - - private static global::System.Globalization.CultureInfo resourceCulture; - - [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - internal Resources() { - } - - /// - /// Returns the cached ResourceManager instance used by this class. - /// - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Resources.ResourceManager ResourceManager { - get { - if (object.ReferenceEquals(resourceMan, null)) { - global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("System.Data.SQLite.Properties.Resources", typeof(Resources).Assembly); - resourceMan = temp; - } - return resourceMan; - } - } - - /// - /// Overrides the current thread's CurrentUICulture property for all - /// resource lookups using this strongly typed resource class. - /// - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Globalization.CultureInfo Culture { - get { - return resourceCulture; - } - set { - resourceCulture = value; - } - } - - /// - /// Looks up a localized string similar to CREATE TEMP VIEW SCHEMACONSTRAINTCOLUMNS AS - ///SELECT CONSTRAINT_CATALOG, NULL AS CONSTRAINT_SCHEMA, CONSTRAINT_NAME, TABLE_CATALOG, NULL AS TABLE_SCHEMA, TABLE_NAME, COLUMN_NAME - ///FROM TEMP.SCHEMAINDEXCOLUMNS - ///UNION - ///SELECT CONSTRAINT_CATALOG, NULL, CONSTRAINT_NAME, TABLE_CATALOG, NULL, TABLE_NAME, FKEY_FROM_COLUMN - ///FROM TEMP.SCHEMAFOREIGNKEYS;. - /// - internal static string SQL_CONSTRAINTCOLUMNS { - get { - return ResourceManager.GetString("SQL_CONSTRAINTCOLUMNS", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to CREATE TEMP VIEW SCHEMACONSTRAINTS AS - ///SELECT INDEX_CATALOG AS CONSTRAINT_CATALOG, NULL AS CONSTRAINT_SCHEMA, INDEX_NAME AS CONSTRAINT_NAME, TABLE_CATALOG, NULL AS TABLE_SCHEMA, TABLE_NAME, 'PRIMARY KEY' AS CONSTRAINT_TYPE, 0 AS IS_DEFERRABLE, 0 AS INITIALLY_DEFERRED, NULL AS CHECK_CLAUSE - ///FROM TEMP.SCHEMAINDEXES WHERE PRIMARY_KEY = 1 - ///UNION - ///SELECT INDEX_CATALOG, NULL, INDEX_NAME, TABLE_CATALOG, NULL, TABLE_NAME, 'UNIQUE', 0, 0, NULL - ///FROM TEMP.SCHEMAINDEXES WHERE PRIMARY_KEY = 0 AND [UNIQUE] = 1 - ///UNION - /// [rest of string was truncated]";. - /// - internal static string SQL_CONSTRAINTS { - get { - return ResourceManager.GetString("SQL_CONSTRAINTS", resourceCulture); - } - } - } -} +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.1 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace System.Data.SQLite.Properties { + using System; + + + /// + /// A strongly-typed resource class, for looking up localized strings, etc. + /// + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class Resources { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal Resources() { + } + + /// + /// Returns the cached ResourceManager instance used by this class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager { + get { + if (object.ReferenceEquals(resourceMan, null)) { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("System.Data.SQLite.Properties.Resources", typeof(Resources).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + + /// + /// Looks up a localized string similar to CREATE TEMP VIEW SCHEMACONSTRAINTCOLUMNS AS + ///SELECT CONSTRAINT_CATALOG, NULL AS CONSTRAINT_SCHEMA, CONSTRAINT_NAME, TABLE_CATALOG, NULL AS TABLE_SCHEMA, TABLE_NAME, COLUMN_NAME + ///FROM TEMP.SCHEMAINDEXCOLUMNS + ///UNION + ///SELECT CONSTRAINT_CATALOG, NULL, CONSTRAINT_NAME, TABLE_CATALOG, NULL, TABLE_NAME, FKEY_FROM_COLUMN + ///FROM TEMP.SCHEMAFOREIGNKEYS;. + /// + internal static string SQL_CONSTRAINTCOLUMNS { + get { + return ResourceManager.GetString("SQL_CONSTRAINTCOLUMNS", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to CREATE TEMP VIEW SCHEMACONSTRAINTS AS + ///SELECT INDEX_CATALOG AS CONSTRAINT_CATALOG, NULL AS CONSTRAINT_SCHEMA, INDEX_NAME AS CONSTRAINT_NAME, TABLE_CATALOG, NULL AS TABLE_SCHEMA, TABLE_NAME, 'PRIMARY KEY' AS CONSTRAINT_TYPE, 0 AS IS_DEFERRABLE, 0 AS INITIALLY_DEFERRED, NULL AS CHECK_CLAUSE + ///FROM TEMP.SCHEMAINDEXES WHERE PRIMARY_KEY = 1 + ///UNION + ///SELECT INDEX_CATALOG, NULL, INDEX_NAME, TABLE_CATALOG, NULL, TABLE_NAME, 'UNIQUE', 0, 0, NULL + ///FROM TEMP.SCHEMAINDEXES WHERE PRIMARY_KEY = 0 AND [UNIQUE] = 1 + ///UNION + /// [rest of string was truncated]";. + /// + internal static string SQL_CONSTRAINTS { + get { + return ResourceManager.GetString("SQL_CONSTRAINTS", resourceCulture); + } + } + } +} Index: System.Data.SQLite.Linq/System.Data.SQLite.Linq.csproj ================================================================== --- System.Data.SQLite.Linq/System.Data.SQLite.Linq.csproj +++ System.Data.SQLite.Linq/System.Data.SQLite.Linq.csproj @@ -1,99 +1,139 @@ - - - - Debug - AnyCPU - 9.0.30729 - 2.0 - {E6BF9F74-58E2-413B-A7CE-EA653ECB728D} - Library - Properties - System.Data.SQLite - System.Data.SQLite.Linq - v3.5 - 512 - Full - true - ..\System.Data.SQLite\System.Data.SQLite.snk - - - true - full - false - ..\bin\ - DEBUG;TRACE - prompt - 4 - AnyCPU - false - - - none - true - ..\bin\ - TRACE - prompt - 4 - AnyCPU - false - - - - - 3.5 - - - - 3.5 - - - False - ..\bin\System.Data.SQLite.DLL - False - - - - - - - True - True - Resources.resx - - - - - - - - - - - - - - - - - - - - - - - - - ResXFileCodeGenerator - Resources.Designer.cs - - - - - + + + + Debug + AnyCPU + 9.0.30729 + 2.0 + {E6BF9F74-58E2-413B-A7CE-EA653ECB728D} + Library + Properties + System.Data.SQLite + System.Data.SQLite.Linq + v4.0 + 512 + true + ..\System.Data.SQLite\System.Data.SQLite.snk + + + 3.5 + + publish\ + true + Disk + false + Foreground + 7 + Days + false + false + true + 0 + 1.0.0.%2a + false + false + true + Client + + + true + full + false + ..\bin\ + DEBUG;TRACE + prompt + 4 + AnyCPU + false + AllRules.ruleset + + + none + true + ..\bin\ + TRACE + prompt + 4 + AnyCPU + false + AllRules.ruleset + + + + + 3.5 + + + + 3.5 + + + False + False + + + + + + + True + True + Resources.resx + + + + + + + + + + + + + + + + + + + + + + + + + + + + ResXFileCodeGenerator + Resources.Designer.cs + + + + + + False + .NET Framework 3.5 SP1 Client Profile + false + + + False + .NET Framework 3.5 SP1 + true + + + False + Windows Installer 3.1 + true + + + + Index: System.Data.SQLite/AssemblyInfo.cs ================================================================== --- System.Data.SQLite/AssemblyInfo.cs +++ System.Data.SQLite/AssemblyInfo.cs @@ -1,55 +1,55 @@ -using System; -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; -using System.Security.Permissions; -using System.Security; -using System.Resources; - -#if !PLATFORM_COMPACTFRAMEWORK -using System.Runtime.ConstrainedExecution; -#endif - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("System.Data.SQLite")] -[assembly: AssemblyDescription("ADO.NET 2.0 Data Provider for SQLite")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("http://sqlite.phxsoftware.com")] -[assembly: AssemblyProduct("System.Data.SQLite")] -[assembly: AssemblyCopyright("Public Domain")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -#if PLATFORM_COMPACTFRAMEWORK && RETARGETABLE -[assembly: AssemblyFlags(AssemblyNameFlags.Retargetable)] -#endif - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM componenets. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] -[assembly: CLSCompliant(true)] -[assembly: InternalsVisibleTo("System.Data.SQLite.Linq, PublicKey=002400000480000094000000060200000024000052534131000400000100010005a288de5687c4e1b621ddff5d844727418956997f475eb829429e411aff3e93f97b70de698b972640925bdd44280df0a25a843266973704137cbb0e7441c1fe7cae4e2440ae91ab8cde3933febcb1ac48dd33b40e13c421d8215c18a4349a436dd499e3c385cc683015f886f6c10bd90115eb2bd61b67750839e3a19941dc9c")] -[assembly: NeutralResourcesLanguage("en")] - -#if !PLATFORM_COMPACTFRAMEWORK -[assembly: AllowPartiallyTrustedCallers] -[assembly: ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)] -[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] -#endif - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// 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.67.0")] -#if !PLATFORM_COMPACTFRAMEWORK -[assembly: AssemblyFileVersion("1.0.67.0")] -#endif +using System; +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; +using System.Security.Permissions; +using System.Security; +using System.Resources; + +#if !PLATFORM_COMPACTFRAMEWORK +using System.Runtime.ConstrainedExecution; +#endif + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("System.Data.SQLite")] +[assembly: AssemblyDescription("ADO.NET 4.0 Data Provider for SQLite")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("http://sqlite.phxsoftware.com")] +[assembly: AssemblyProduct("System.Data.SQLite")] +[assembly: AssemblyCopyright("Public Domain")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +#if PLATFORM_COMPACTFRAMEWORK && RETARGETABLE +[assembly: AssemblyFlags(AssemblyNameFlags.Retargetable)] +#endif + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM componenets. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] +[assembly: CLSCompliant(true)] +[assembly: InternalsVisibleTo("System.Data.SQLite.Linq, PublicKey=002400000480000094000000060200000024000052534131000400000100010005a288de5687c4e1b621ddff5d844727418956997f475eb829429e411aff3e93f97b70de698b972640925bdd44280df0a25a843266973704137cbb0e7441c1fe7cae4e2440ae91ab8cde3933febcb1ac48dd33b40e13c421d8215c18a4349a436dd499e3c385cc683015f886f6c10bd90115eb2bd61b67750839e3a19941dc9c")] +[assembly: NeutralResourcesLanguage("en")] + +#if !PLATFORM_COMPACTFRAMEWORK +[assembly: AllowPartiallyTrustedCallers] +[assembly: ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)] +[assembly: SecurityRules(System.Security.SecurityRuleSet.Level1)] +#endif + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// 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.66.1")] +#if !PLATFORM_COMPACTFRAMEWORK +[assembly: AssemblyFileVersion("1.0.66.1")] +#endif Index: System.Data.SQLite/DataTypes.xml ================================================================== --- System.Data.SQLite/DataTypes.xml +++ System.Data.SQLite/DataTypes.xml @@ -1,779 +1,779 @@ - - - - smallint - 10 - 5 - System.Int16 - smallint - false - false - true - true - false - true - true - false - false - true - - - int - 11 - 10 - System.Int32 - int - false - false - true - true - false - true - true - false - false - true - - - real - 15 - 7 - System.Single - real - false - false - true - false - false - true - true - false - false - true - - - float - 8 - 6 - System.Double - float - false - false - true - false - false - true - true - false - false - true - - - double - 8 - 6 - System.Double - double - false - false - true - false - false - true - true - false - false - false - - - money - 7 - 19 - System.Decimal - money - false - false - true - true - false - true - true - false - false - true - - - currency - 7 - 19 - System.Decimal - currency - false - false - true - true - false - true - true - false - false - false - - - decimal - 7 - 19 - System.Decimal - decimal - false - false - true - true - false - true - true - false - false - true - - - numeric - 7 - 19 - System.Decimal - numeric - false - false - true - true - false - true - true - false - false - false - - - bit - 3 - 1 - System.Boolean - bit - false - false - true - false - false - true - true - false - true - - - yesno - 3 - 1 - System.Boolean - yesno - false - false - true - false - false - true - true - false - false - - - logical - 3 - 1 - System.Boolean - logical - false - false - true - false - false - true - true - false - false - - - bool - 3 - 1 - System.Boolean - bool - false - false - true - false - false - true - true - false - false - - - boolean - 3 - 1 - System.Boolean - boolean - false - false - true - false - false - true - true - false - false - - - tinyint - 2 - 3 - System.Byte - tinyint - false - false - true - true - false - true - true - false - true - true - - - integer - 12 - 19 - System.Int64 - integer - true - false - true - true - false - true - true - false - false - true - - - counter - 12 - 19 - System.Int64 - counter - true - false - true - true - false - true - true - false - false - false - - - autoincrement - 12 - 19 - System.Int64 - autoincrement - true - false - true - true - false - true - true - false - false - false - - - identity - 12 - 19 - System.Int64 - identity - true - false - true - true - false - true - true - false - false - false - - - long - 12 - 19 - System.Int64 - long - true - false - true - true - false - true - true - false - false - false - - - bigint - 12 - 19 - System.Int64 - bigint - true - false - true - true - false - true - true - false - false - false - - - binary - 1 - 2147483647 - System.Byte[] - binary - false - false - false - false - false - true - false - false - X' - ' - true - - - varbinary - 1 - 2147483647 - System.Byte[] - varbinary - false - false - false - false - false - true - false - false - X' - ' - false - - - blob - 1 - 2147483647 - System.Byte[] - blob - false - false - false - false - false - true - false - false - X' - ' - false - - - image - 1 - 2147483647 - System.Byte[] - image - false - false - false - false - false - true - false - false - X' - ' - false - - - general - 1 - 2147483647 - System.Byte[] - general - false - false - false - false - false - true - false - false - X' - ' - false - - - oleobject - 1 - 2147483647 - System.Byte[] - oleobject - false - false - false - false - false - true - false - false - X' - ' - false - - - varchar - 16 - 2147483647 - max length - System.String - varchar({0}) - false - false - false - false - false - true - true - true - ' - ' - true - - - nvarchar - 16 - 2147483647 - max length - System.String - nvarchar({0}) - false - false - false - false - false - true - true - true - ' - ' - true - - - memo - 16 - 2147483647 - max length - System.String - memo({0}) - false - false - false - false - false - true - true - true - ' - ' - false - - - longtext - 16 - 2147483647 - max length - System.String - longtext({0}) - false - false - false - false - false - true - true - true - ' - ' - false - - - note - 16 - 2147483647 - max length - System.String - note({0}) - false - false - false - false - false - true - true - true - ' - ' - false - - - text - 16 - 2147483647 - max length - System.String - text({0}) - false - false - false - false - false - true - true - true - ' - ' - false - - - ntext - 16 - 2147483647 - max length - System.String - ntext({0}) - false - false - false - false - false - true - true - true - ' - ' - false - - - string - 16 - 2147483647 - max length - System.String - string({0}) - false - false - false - false - false - true - true - true - ' - ' - false - - - char - 16 - 2147483647 - max length - System.String - char({0}) - false - false - false - false - false - true - true - true - ' - ' - false - - - nchar - 16 - 2147483647 - max length - System.String - char({0}) - false - false - false - false - false - true - true - true - ' - ' - false - - - datetime - 6 - 23 - System.DateTime - datetime - false - false - true - false - false - true - true - true - ' - ' - true - - - smalldate - 6 - 23 - System.DateTime - smalldate - false - false - true - false - false - true - true - true - ' - ' - false - - - timestamp - 6 - 23 - System.DateTime - timestamp - false - false - true - false - false - true - true - true - ' - ' - false - - - date - 6 - 23 - System.DateTime - date - false - false - true - false - false - true - true - true - ' - ' - false - - - time - 6 - 23 - System.DateTime - time - false - false - true - false - false - true - true - true - ' - ' - false - - - uniqueidentifier - 9 - 16 - System.Guid - uniqueidentifier - false - false - true - false - false - true - true - false - ' - ' - true - - - guid - 9 - 16 - System.Guid - guid - false - false - true - false - false - true - true - false - ' - ' - false - - + + + + smallint + 10 + 5 + System.Int16 + smallint + false + false + true + true + false + true + true + false + false + true + + + int + 11 + 10 + System.Int32 + int + false + false + true + true + false + true + true + false + false + true + + + real + 15 + 7 + System.Single + real + false + false + true + false + false + true + true + false + false + true + + + float + 8 + 6 + System.Double + float + false + false + true + false + false + true + true + false + false + true + + + double + 8 + 6 + System.Double + double + false + false + true + false + false + true + true + false + false + false + + + money + 7 + 19 + System.Decimal + money + false + false + true + true + false + true + true + false + false + true + + + currency + 7 + 19 + System.Decimal + currency + false + false + true + true + false + true + true + false + false + false + + + decimal + 7 + 19 + System.Decimal + decimal + false + false + true + true + false + true + true + false + false + true + + + numeric + 7 + 19 + System.Decimal + numeric + false + false + true + true + false + true + true + false + false + false + + + bit + 3 + 1 + System.Boolean + bit + false + false + true + false + false + true + true + false + true + + + yesno + 3 + 1 + System.Boolean + yesno + false + false + true + false + false + true + true + false + false + + + logical + 3 + 1 + System.Boolean + logical + false + false + true + false + false + true + true + false + false + + + bool + 3 + 1 + System.Boolean + bool + false + false + true + false + false + true + true + false + false + + + boolean + 3 + 1 + System.Boolean + boolean + false + false + true + false + false + true + true + false + false + + + tinyint + 2 + 3 + System.Byte + tinyint + false + false + true + true + false + true + true + false + true + true + + + integer + 12 + 19 + System.Int64 + integer + true + false + true + true + false + true + true + false + false + true + + + counter + 12 + 19 + System.Int64 + counter + true + false + true + true + false + true + true + false + false + false + + + autoincrement + 12 + 19 + System.Int64 + autoincrement + true + false + true + true + false + true + true + false + false + false + + + identity + 12 + 19 + System.Int64 + identity + true + false + true + true + false + true + true + false + false + false + + + long + 12 + 19 + System.Int64 + long + true + false + true + true + false + true + true + false + false + false + + + bigint + 12 + 19 + System.Int64 + bigint + true + false + true + true + false + true + true + false + false + false + + + binary + 1 + 2147483647 + System.Byte[] + binary + false + false + false + false + false + true + false + false + X' + ' + true + + + varbinary + 1 + 2147483647 + System.Byte[] + varbinary + false + false + false + false + false + true + false + false + X' + ' + false + + + blob + 1 + 2147483647 + System.Byte[] + blob + false + false + false + false + false + true + false + false + X' + ' + false + + + image + 1 + 2147483647 + System.Byte[] + image + false + false + false + false + false + true + false + false + X' + ' + false + + + general + 1 + 2147483647 + System.Byte[] + general + false + false + false + false + false + true + false + false + X' + ' + false + + + oleobject + 1 + 2147483647 + System.Byte[] + oleobject + false + false + false + false + false + true + false + false + X' + ' + false + + + varchar + 16 + 2147483647 + max length + System.String + varchar({0}) + false + false + false + false + false + true + true + true + ' + ' + true + + + nvarchar + 16 + 2147483647 + max length + System.String + nvarchar({0}) + false + false + false + false + false + true + true + true + ' + ' + true + + + memo + 16 + 2147483647 + max length + System.String + memo({0}) + false + false + false + false + false + true + true + true + ' + ' + false + + + longtext + 16 + 2147483647 + max length + System.String + longtext({0}) + false + false + false + false + false + true + true + true + ' + ' + false + + + note + 16 + 2147483647 + max length + System.String + note({0}) + false + false + false + false + false + true + true + true + ' + ' + false + + + text + 16 + 2147483647 + max length + System.String + text({0}) + false + false + false + false + false + true + true + true + ' + ' + false + + + ntext + 16 + 2147483647 + max length + System.String + ntext({0}) + false + false + false + false + false + true + true + true + ' + ' + false + + + string + 16 + 2147483647 + max length + System.String + string({0}) + false + false + false + false + false + true + true + true + ' + ' + false + + + char + 16 + 2147483647 + max length + System.String + char({0}) + false + false + false + false + false + true + true + true + ' + ' + false + + + nchar + 16 + 2147483647 + max length + System.String + char({0}) + false + false + false + false + false + true + true + true + ' + ' + false + + + datetime + 6 + 23 + System.DateTime + datetime + false + false + true + false + false + true + true + true + ' + ' + true + + + smalldate + 6 + 23 + System.DateTime + smalldate + false + false + true + false + false + true + true + true + ' + ' + false + + + timestamp + 6 + 23 + System.DateTime + timestamp + false + false + true + false + false + true + true + true + ' + ' + false + + + date + 6 + 23 + System.DateTime + date + false + false + true + false + false + true + true + true + ' + ' + false + + + time + 6 + 23 + System.DateTime + time + false + false + true + false + false + true + true + true + ' + ' + false + + + uniqueidentifier + 4 + 16 + System.Guid + uniqueidentifier + false + false + true + false + false + true + true + false + ' + ' + true + + + guid + 4 + 16 + System.Guid + guid + false + false + true + false + false + true + true + false + ' + ' + false + + Index: System.Data.SQLite/LINQ/SQLiteFactory_Linq.cs ================================================================== --- System.Data.SQLite/LINQ/SQLiteFactory_Linq.cs +++ System.Data.SQLite/LINQ/SQLiteFactory_Linq.cs @@ -1,58 +1,58 @@ -/******************************************************** - * ADO.NET 2.0 Data Provider for SQLite Version 3.X - * Written by Robert Simpson (robert@blackcastlesoft.com) - * - * Released to the public domain, use at your own risk! - ********************************************************/ - -namespace System.Data.SQLite -{ - using System; - using System.Data.Common; - using System.Reflection; - using System.Security.Permissions; - - /// - /// SQLite implementation of DbProviderFactory. - /// - public sealed partial class SQLiteFactory : IServiceProvider - { - private static Type _dbProviderServicesType; - private static object _sqliteServices; - - static SQLiteFactory() - { - _dbProviderServicesType = Type.GetType("System.Data.Common.DbProviderServices, System.Data.Entity, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089", false); - } - - /// - /// Will provide a DbProviderServices object in .NET 3.5 - /// - /// The class or interface type to query for - /// - object IServiceProvider.GetService(Type serviceType) - { - if (serviceType == typeof(ISQLiteSchemaExtensions) || - (_dbProviderServicesType != null && serviceType == _dbProviderServicesType)) - { - return GetSQLiteProviderServicesInstance(); - } - return null; - } - - [ReflectionPermission(SecurityAction.Assert, MemberAccess = true)] - private object GetSQLiteProviderServicesInstance() - { - if (_sqliteServices == null) - { - Type type = Type.GetType("System.Data.SQLite.SQLiteProviderServices, System.Data.SQLite.Linq, Version=2.0.38.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139", false); - if (type != null) - { - FieldInfo field = type.GetField("Instance", BindingFlags.NonPublic | BindingFlags.Static | BindingFlags.Instance); - _sqliteServices = field.GetValue(null); - } - } - return _sqliteServices; - } - } -} +/******************************************************** + * ADO.NET 2.0 Data Provider for SQLite Version 3.X + * Written by Robert Simpson (robert@blackcastlesoft.com) + * + * Released to the public domain, use at your own risk! + ********************************************************/ + +namespace System.Data.SQLite +{ + using System; + using System.Data.Common; + using System.Reflection; + using System.Security.Permissions; + + /// + /// SQLite implementation of DbProviderFactory. + /// + public sealed partial class SQLiteFactory : IServiceProvider + { + private static Type _dbProviderServicesType; + private static object _sqliteServices; + + static SQLiteFactory() + { + _dbProviderServicesType = Type.GetType("System.Data.Common.DbProviderServices, System.Data.Entity, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089", false); + } + + /// + /// Will provide a DbProviderServices object in .NET 3.5 + /// + /// The class or interface type to query for + /// + object IServiceProvider.GetService(Type serviceType) + { + if (serviceType == typeof(ISQLiteSchemaExtensions) || + (_dbProviderServicesType != null && serviceType == _dbProviderServicesType)) + { + return GetSQLiteProviderServicesInstance(); + } + return null; + } + + [ReflectionPermission(SecurityAction.Assert, MemberAccess = true)] + private object GetSQLiteProviderServicesInstance() + { + if (_sqliteServices == null) + { + Type type = Type.GetType("System.Data.SQLite.SQLiteProviderServices, System.Data.SQLite.Linq, Version=1.0.38.1, Culture=neutral, PublicKeyToken=db937bc2d44ff139", false); + if (type != null) + { + FieldInfo field = type.GetField("Instance", BindingFlags.NonPublic | BindingFlags.Static | BindingFlags.Instance); + _sqliteServices = field.GetValue(null); + } + } + return _sqliteServices; + } + } +} Index: System.Data.SQLite/SQLite3.cs ================================================================== --- System.Data.SQLite/SQLite3.cs +++ System.Data.SQLite/SQLite3.cs @@ -1,968 +1,973 @@ -/******************************************************** - * ADO.NET 2.0 Data Provider for SQLite Version 3.X - * Written by Robert Simpson (robert@blackcastlesoft.com) - * - * Released to the public domain, use at your own risk! - ********************************************************/ - -namespace System.Data.SQLite -{ - using System; - using System.Runtime.InteropServices; - using System.Collections.Generic; - using System.Globalization; - - /// - /// This class implements SQLiteBase completely, and is the guts of the code that interop's SQLite with .NET - /// - internal class SQLite3 : SQLiteBase - { - /// - /// The opaque pointer returned to us by the sqlite provider - /// - protected SQLiteConnectionHandle _sql; - protected string _fileName; - protected bool _usePool; - protected int _poolVersion; - -#if !PLATFORM_COMPACTFRAMEWORK - private bool _buildingSchema; -#endif - /// - /// The user-defined functions registered on this connection - /// - protected SQLiteFunction[] _functionsArray; - - internal SQLite3(SQLiteDateFormats fmt) - : base(fmt) - { - } - - protected override void Dispose(bool bDisposing) - { - if (bDisposing) - Close(); - } - - // It isn't necessary to cleanup any functions we've registered. If the connection - // goes to the pool and is resurrected later, re-registered functions will overwrite the - // previous functions. The SQLiteFunctionCookieHandle will take care of freeing unmanaged - // resources belonging to the previously-registered functions. - internal override void Close() - { - if (_sql != null) - { - if (_usePool) - { - SQLiteBase.ResetConnection(_sql); - SQLiteConnectionPool.Add(_fileName, _sql, _poolVersion); - } - else - _sql.Dispose(); - } - - _sql = null; - } - - internal override void Cancel() - { - UnsafeNativeMethods.sqlite3_interrupt(_sql); - } - - internal override string Version - { - get - { - return SQLite3.SQLiteVersion; - } - } - - internal static string SQLiteVersion - { - get - { - return UTF8ToString(UnsafeNativeMethods.sqlite3_libversion(), -1); - } - } - - internal override bool AutoCommit - { - get - { - return IsAutocommit(_sql); - } - } - - internal override int Changes - { - get - { - return UnsafeNativeMethods.sqlite3_changes(_sql); - } - } - - internal override void Open(string strFilename, SQLiteOpenFlagsEnum flags, int maxPoolSize, bool usePool) - { - if (_sql != null) return; - - _usePool = usePool; - if (usePool) - { - _fileName = strFilename; - _sql = SQLiteConnectionPool.Remove(strFilename, maxPoolSize, out _poolVersion); - } - - if (_sql == null) - { - IntPtr db; - -#if !SQLITE_STANDARD - int n = UnsafeNativeMethods.sqlite3_open_interop(ToUTF8(strFilename), (int)flags, out db); -#else - int n = UnsafeNativeMethods.sqlite3_open_v2(ToUTF8(strFilename), out db, (int)flags, IntPtr.Zero); -#endif - if (n > 0) throw new SQLiteException(n, null); - - _sql = db; - } - // Bind functions to this connection. If any previous functions of the same name - // were already bound, then the new bindings replace the old. - _functionsArray = SQLiteFunction.BindFunctions(this); - SetTimeout(0); - } - - internal override void ClearPool() - { - SQLiteConnectionPool.ClearPool(_fileName); - } - - internal override void SetTimeout(int nTimeoutMS) - { - int n = UnsafeNativeMethods.sqlite3_busy_timeout(_sql, nTimeoutMS); - if (n > 0) throw new SQLiteException(n, SQLiteLastError()); - } - - internal override bool Step(SQLiteStatement stmt) - { - int n; - Random rnd = null; - uint starttick = (uint)Environment.TickCount; - uint timeout = (uint)(stmt._command._commandTimeout * 1000); - - while (true) - { - n = UnsafeNativeMethods.sqlite3_step(stmt._sqlite_stmt); - - if (n == 100) return true; - if (n == 101) return false; - - if (n > 0) - { - int r; - - // An error occurred, attempt to reset the statement. If the reset worked because the - // schema has changed, re-try the step again. If it errored our because the database - // is locked, then keep retrying until the command timeout occurs. - r = Reset(stmt); - - if (r == 0) - throw new SQLiteException(n, SQLiteLastError()); - - else if ((r == 6 || r == 5) && stmt._command != null) // SQLITE_LOCKED || SQLITE_BUSY - { - // Keep trying - if (rnd == null) // First time we've encountered the lock - rnd = new Random(); - - // If we've exceeded the command's timeout, give up and throw an error - if ((uint)Environment.TickCount - starttick > timeout) - { - throw new SQLiteException(r, SQLiteLastError()); - } - else - { - // Otherwise sleep for a random amount of time up to 150ms - System.Threading.Thread.Sleep(rnd.Next(1, 150)); - } - } - } - } - } - - internal override int Reset(SQLiteStatement stmt) - { - int n; - -#if !SQLITE_STANDARD - n = UnsafeNativeMethods.sqlite3_reset_interop(stmt._sqlite_stmt); -#else - n = UnsafeNativeMethods.sqlite3_reset(stmt._sqlite_stmt); -#endif - - // If the schema changed, try and re-prepare it - if (n == 17) // SQLITE_SCHEMA - { - // Recreate a dummy statement - string str; - using (SQLiteStatement tmp = Prepare(null, stmt._sqlStatement, null, (uint)(stmt._command._commandTimeout * 1000), out str)) - { - // Finalize the existing statement - stmt._sqlite_stmt.Dispose(); - // Reassign a new statement pointer to the old statement and clear the temporary one - stmt._sqlite_stmt = tmp._sqlite_stmt; - tmp._sqlite_stmt = null; - - // Reapply parameters - stmt.BindParameters(); - } - return -1; // Reset was OK, with schema change - } - else if (n == 6 || n == 5) // SQLITE_LOCKED || SQLITE_BUSY - return n; - - if (n > 0) - throw new SQLiteException(n, SQLiteLastError()); - - return 0; // We reset OK, no schema changes - } - - internal override string SQLiteLastError() - { - return SQLiteBase.SQLiteLastError(_sql); - } - - internal override SQLiteStatement Prepare(SQLiteConnection cnn, string strSql, SQLiteStatement previous, uint timeoutMS, out string strRemain) - { - IntPtr stmt = IntPtr.Zero; - IntPtr ptr = IntPtr.Zero; - int len = 0; - int n = 17; - int retries = 0; - byte[] b = ToUTF8(strSql); - string typedefs = null; - SQLiteStatement cmd = null; - Random rnd = null; - uint starttick = (uint)Environment.TickCount; - - GCHandle handle = GCHandle.Alloc(b, GCHandleType.Pinned); - IntPtr psql = handle.AddrOfPinnedObject(); - try - { - while ((n == 17 || n == 6 || n == 5) && retries < 3) - { -#if !SQLITE_STANDARD - n = UnsafeNativeMethods.sqlite3_prepare_interop(_sql, psql, b.Length - 1, out stmt, out ptr, out len); -#else - n = UnsafeNativeMethods.sqlite3_prepare(_sql, psql, b.Length - 1, out stmt, out ptr); - len = -1; -#endif - - if (n == 17) - retries++; - else if (n == 1) - { - if (String.Compare(SQLiteLastError(), "near \"TYPES\": syntax error", StringComparison.OrdinalIgnoreCase) == 0) - { - int pos = strSql.IndexOf(';'); - if (pos == -1) pos = strSql.Length - 1; - - typedefs = strSql.Substring(0, pos + 1); - strSql = strSql.Substring(pos + 1); - - strRemain = ""; - - while (cmd == null && strSql.Length > 0) - { - cmd = Prepare(cnn, strSql, previous, timeoutMS, out strRemain); - strSql = strRemain; - } - - if (cmd != null) - cmd.SetTypes(typedefs); - - return cmd; - } -#if !PLATFORM_COMPACTFRAMEWORK - else if (_buildingSchema == false && String.Compare(SQLiteLastError(), 0, "no such table: TEMP.SCHEMA", 0, 26, StringComparison.OrdinalIgnoreCase) == 0) - { - strRemain = ""; - _buildingSchema = true; - try - { - ISQLiteSchemaExtensions ext = ((IServiceProvider)SQLiteFactory.Instance).GetService(typeof(ISQLiteSchemaExtensions)) as ISQLiteSchemaExtensions; - - if (ext != null) - ext.BuildTempSchema(cnn); - - while (cmd == null && strSql.Length > 0) - { - cmd = Prepare(cnn, strSql, previous, timeoutMS, out strRemain); - strSql = strRemain; - } - - return cmd; - } - finally - { - _buildingSchema = false; - } - } -#endif - } - else if (n == 6 || n == 5) // Locked -- delay a small amount before retrying - { - // Keep trying - if (rnd == null) // First time we've encountered the lock - rnd = new Random(); - - // If we've exceeded the command's timeout, give up and throw an error - if ((uint)Environment.TickCount - starttick > timeoutMS) - { - throw new SQLiteException(n, SQLiteLastError()); - } - else - { - // Otherwise sleep for a random amount of time up to 150ms - System.Threading.Thread.Sleep(rnd.Next(1, 150)); - } - } - } - - if (n > 0) throw new SQLiteException(n, SQLiteLastError()); - - strRemain = UTF8ToString(ptr, len); - - if (stmt != IntPtr.Zero) cmd = new SQLiteStatement(this, stmt, strSql.Substring(0, strSql.Length - strRemain.Length), previous); - - return cmd; - } - finally - { - handle.Free(); - } - } - - internal override void Bind_Double(SQLiteStatement stmt, int index, double value) - { -#if !PLATFORM_COMPACTFRAMEWORK - int n = UnsafeNativeMethods.sqlite3_bind_double(stmt._sqlite_stmt, index, value); -#else - int n = UnsafeNativeMethods.sqlite3_bind_double_interop(stmt._sqlite_stmt, index, ref value); -#endif - if (n > 0) throw new SQLiteException(n, SQLiteLastError()); - } - - internal override void Bind_Int32(SQLiteStatement stmt, int index, int value) - { - int n = UnsafeNativeMethods.sqlite3_bind_int(stmt._sqlite_stmt, index, value); - if (n > 0) throw new SQLiteException(n, SQLiteLastError()); - } - - internal override void Bind_Int64(SQLiteStatement stmt, int index, long value) - { -#if !PLATFORM_COMPACTFRAMEWORK - int n = UnsafeNativeMethods.sqlite3_bind_int64(stmt._sqlite_stmt, index, value); -#else - int n = UnsafeNativeMethods.sqlite3_bind_int64_interop(stmt._sqlite_stmt, index, ref value); -#endif - if (n > 0) throw new SQLiteException(n, SQLiteLastError()); - } - - internal override void Bind_Text(SQLiteStatement stmt, int index, string value) - { - byte[] b = ToUTF8(value); - int n = UnsafeNativeMethods.sqlite3_bind_text(stmt._sqlite_stmt, index, b, b.Length - 1, (IntPtr)(-1)); - if (n > 0) throw new SQLiteException(n, SQLiteLastError()); - } - - internal override void Bind_DateTime(SQLiteStatement stmt, int index, DateTime dt) - { - byte[] b = ToUTF8(dt); - int n = UnsafeNativeMethods.sqlite3_bind_text(stmt._sqlite_stmt, index, b, b.Length - 1, (IntPtr)(-1)); - if (n > 0) throw new SQLiteException(n, SQLiteLastError()); - } - - internal override void Bind_Blob(SQLiteStatement stmt, int index, byte[] blobData) - { - int n = UnsafeNativeMethods.sqlite3_bind_blob(stmt._sqlite_stmt, index, blobData, blobData.Length, (IntPtr)(-1)); - if (n > 0) throw new SQLiteException(n, SQLiteLastError()); - } - - internal override void Bind_Null(SQLiteStatement stmt, int index) - { - int n = UnsafeNativeMethods.sqlite3_bind_null(stmt._sqlite_stmt, index); - if (n > 0) throw new SQLiteException(n, SQLiteLastError()); - } - - internal override int Bind_ParamCount(SQLiteStatement stmt) - { - return UnsafeNativeMethods.sqlite3_bind_parameter_count(stmt._sqlite_stmt); - } - - internal override string Bind_ParamName(SQLiteStatement stmt, int index) - { -#if !SQLITE_STANDARD - int len; - return UTF8ToString(UnsafeNativeMethods.sqlite3_bind_parameter_name_interop(stmt._sqlite_stmt, index, out len), len); -#else - return UTF8ToString(UnsafeNativeMethods.sqlite3_bind_parameter_name(stmt._sqlite_stmt, index), -1); -#endif - } - - internal override int Bind_ParamIndex(SQLiteStatement stmt, string paramName) - { - return UnsafeNativeMethods.sqlite3_bind_parameter_index(stmt._sqlite_stmt, ToUTF8(paramName)); - } - - internal override int ColumnCount(SQLiteStatement stmt) - { - return UnsafeNativeMethods.sqlite3_column_count(stmt._sqlite_stmt); - } - - internal override string ColumnName(SQLiteStatement stmt, int index) - { -#if !SQLITE_STANDARD - int len; - return UTF8ToString(UnsafeNativeMethods.sqlite3_column_name_interop(stmt._sqlite_stmt, index, out len), len); -#else - return UTF8ToString(UnsafeNativeMethods.sqlite3_column_name(stmt._sqlite_stmt, index), -1); -#endif - } - - internal override TypeAffinity ColumnAffinity(SQLiteStatement stmt, int index) - { - return UnsafeNativeMethods.sqlite3_column_type(stmt._sqlite_stmt, index); - } - - internal override string ColumnType(SQLiteStatement stmt, int index, out TypeAffinity nAffinity) - { - int len; -#if !SQLITE_STANDARD - IntPtr p = UnsafeNativeMethods.sqlite3_column_decltype_interop(stmt._sqlite_stmt, index, out len); -#else - len = -1; - IntPtr p = UnsafeNativeMethods.sqlite3_column_decltype(stmt._sqlite_stmt, index); -#endif - nAffinity = ColumnAffinity(stmt, index); - - if (p != IntPtr.Zero) return UTF8ToString(p, len); - else - { - string[] ar = stmt.TypeDefinitions; - if (ar != null) - { - if (index < ar.Length && ar[index] != null) - return ar[index]; - } - return String.Empty; - - //switch (nAffinity) - //{ - // case TypeAffinity.Int64: - // return "BIGINT"; - // case TypeAffinity.Double: - // return "DOUBLE"; - // case TypeAffinity.Blob: - // return "BLOB"; - // default: - // return "TEXT"; - //} - } - } - - internal override int ColumnIndex(SQLiteStatement stmt, string columnName) - { - int x = ColumnCount(stmt); - - for (int n = 0; n < x; n++) - { - if (String.Compare(columnName, ColumnName(stmt, n), StringComparison.OrdinalIgnoreCase) == 0) - return n; - } - return -1; - } - - internal override string ColumnOriginalName(SQLiteStatement stmt, int index) - { -#if !SQLITE_STANDARD - int len; - return UTF8ToString(UnsafeNativeMethods.sqlite3_column_origin_name_interop(stmt._sqlite_stmt, index, out len), len); -#else - return UTF8ToString(UnsafeNativeMethods.sqlite3_column_origin_name(stmt._sqlite_stmt, index), -1); -#endif - } - - internal override string ColumnDatabaseName(SQLiteStatement stmt, int index) - { -#if !SQLITE_STANDARD - int len; - return UTF8ToString(UnsafeNativeMethods.sqlite3_column_database_name_interop(stmt._sqlite_stmt, index, out len), len); -#else - return UTF8ToString(UnsafeNativeMethods.sqlite3_column_database_name(stmt._sqlite_stmt, index), -1); -#endif - } - - internal override string ColumnTableName(SQLiteStatement stmt, int index) - { -#if !SQLITE_STANDARD - int len; - return UTF8ToString(UnsafeNativeMethods.sqlite3_column_table_name_interop(stmt._sqlite_stmt, index, out len), len); -#else - return UTF8ToString(UnsafeNativeMethods.sqlite3_column_table_name(stmt._sqlite_stmt, index), -1); -#endif - } - - internal override void ColumnMetaData(string dataBase, string table, string column, out string dataType, out string collateSequence, out bool notNull, out bool primaryKey, out bool autoIncrement) - { - IntPtr dataTypePtr; - IntPtr collSeqPtr; - int nnotNull; - int nprimaryKey; - int nautoInc; - int n; - int dtLen; - int csLen; - -#if !SQLITE_STANDARD - n = UnsafeNativeMethods.sqlite3_table_column_metadata_interop(_sql, ToUTF8(dataBase), ToUTF8(table), ToUTF8(column), out dataTypePtr, out collSeqPtr, out nnotNull, out nprimaryKey, out nautoInc, out dtLen, out csLen); -#else - dtLen = -1; - csLen = -1; - - n = UnsafeNativeMethods.sqlite3_table_column_metadata(_sql, ToUTF8(dataBase), ToUTF8(table), ToUTF8(column), out dataTypePtr, out collSeqPtr, out nnotNull, out nprimaryKey, out nautoInc); -#endif - if (n > 0) throw new SQLiteException(n, SQLiteLastError()); - - dataType = UTF8ToString(dataTypePtr, dtLen); - collateSequence = UTF8ToString(collSeqPtr, csLen); - - notNull = (nnotNull == 1); - primaryKey = (nprimaryKey == 1); - autoIncrement = (nautoInc == 1); - } - - internal override double GetDouble(SQLiteStatement stmt, int index) - { - double value; -#if !PLATFORM_COMPACTFRAMEWORK - value = UnsafeNativeMethods.sqlite3_column_double(stmt._sqlite_stmt, index); -#else - UnsafeNativeMethods.sqlite3_column_double_interop(stmt._sqlite_stmt, index, out value); -#endif - return value; - } - - internal override int GetInt32(SQLiteStatement stmt, int index) - { - return UnsafeNativeMethods.sqlite3_column_int(stmt._sqlite_stmt, index); - } - - internal override long GetInt64(SQLiteStatement stmt, int index) - { - long value; -#if !PLATFORM_COMPACTFRAMEWORK - value = UnsafeNativeMethods.sqlite3_column_int64(stmt._sqlite_stmt, index); -#else - UnsafeNativeMethods.sqlite3_column_int64_interop(stmt._sqlite_stmt, index, out value); -#endif - return value; - } - - internal override string GetText(SQLiteStatement stmt, int index) - { -#if !SQLITE_STANDARD - int len; - return UTF8ToString(UnsafeNativeMethods.sqlite3_column_text_interop(stmt._sqlite_stmt, index, out len), len); -#else - return UTF8ToString(UnsafeNativeMethods.sqlite3_column_text(stmt._sqlite_stmt, index), -1); -#endif - } - - internal override DateTime GetDateTime(SQLiteStatement stmt, int index) - { -#if !SQLITE_STANDARD - int len; - return ToDateTime(UnsafeNativeMethods.sqlite3_column_text_interop(stmt._sqlite_stmt, index, out len), len); -#else - return ToDateTime(UnsafeNativeMethods.sqlite3_column_text(stmt._sqlite_stmt, index), -1); -#endif - } - - internal override long GetBytes(SQLiteStatement stmt, int index, int nDataOffset, byte[] bDest, int nStart, int nLength) - { - IntPtr ptr; - int nlen; - int nCopied = nLength; - - nlen = UnsafeNativeMethods.sqlite3_column_bytes(stmt._sqlite_stmt, index); - ptr = UnsafeNativeMethods.sqlite3_column_blob(stmt._sqlite_stmt, index); - - if (bDest == null) return nlen; - - if (nCopied + nStart > bDest.Length) nCopied = bDest.Length - nStart; - if (nCopied + nDataOffset > nlen) nCopied = nlen - nDataOffset; - - if (nCopied > 0) - Marshal.Copy((IntPtr)(ptr.ToInt64() + nDataOffset), bDest, nStart, nCopied); - else nCopied = 0; - - return nCopied; - } - - internal override long GetChars(SQLiteStatement stmt, int index, int nDataOffset, char[] bDest, int nStart, int nLength) - { - int nlen; - int nCopied = nLength; - - string str = GetText(stmt, index); - nlen = str.Length; - - if (bDest == null) return nlen; - - if (nCopied + nStart > bDest.Length) nCopied = bDest.Length - nStart; - if (nCopied + nDataOffset > nlen) nCopied = nlen - nDataOffset; - - if (nCopied > 0) - str.CopyTo(nDataOffset, bDest, nStart, nCopied); - else nCopied = 0; - - return nCopied; - } - - internal override bool IsNull(SQLiteStatement stmt, int index) - { - return (ColumnAffinity(stmt, index) == TypeAffinity.Null); - } - - internal override int AggregateCount(IntPtr context) - { - return UnsafeNativeMethods.sqlite3_aggregate_count(context); - } - - internal override void CreateFunction(string strFunction, int nArgs, bool needCollSeq, SQLiteCallback func, SQLiteCallback funcstep, SQLiteFinalCallback funcfinal) - { - int n; - -#if !SQLITE_STANDARD - n = UnsafeNativeMethods.sqlite3_create_function_interop(_sql, ToUTF8(strFunction), nArgs, 4, IntPtr.Zero, func, funcstep, funcfinal, (needCollSeq == true) ? 1 : 0); - if (n == 0) n = UnsafeNativeMethods.sqlite3_create_function_interop(_sql, ToUTF8(strFunction), nArgs, 1, IntPtr.Zero, func, funcstep, funcfinal, (needCollSeq == true) ? 1 : 0); -#else - n = UnsafeNativeMethods.sqlite3_create_function(_sql, ToUTF8(strFunction), nArgs, 4, IntPtr.Zero, func, funcstep, funcfinal); - if (n == 0) n = UnsafeNativeMethods.sqlite3_create_function(_sql, ToUTF8(strFunction), nArgs, 1, IntPtr.Zero, func, funcstep, funcfinal); -#endif - if (n > 0) throw new SQLiteException(n, SQLiteLastError()); - } - - internal override void CreateCollation(string strCollation, SQLiteCollation func, SQLiteCollation func16) - { - int n = UnsafeNativeMethods.sqlite3_create_collation(_sql, ToUTF8(strCollation), 2, IntPtr.Zero, func16); - if (n == 0) n = UnsafeNativeMethods.sqlite3_create_collation(_sql, ToUTF8(strCollation), 1, IntPtr.Zero, func); - if (n > 0) throw new SQLiteException(n, SQLiteLastError()); - } - - internal override int ContextCollateCompare(CollationEncodingEnum enc, IntPtr context, string s1, string s2) - { -#if !SQLITE_STANDARD - byte[] b1; - byte[] b2; - System.Text.Encoding converter = null; - - switch (enc) - { - case CollationEncodingEnum.UTF8: - converter = System.Text.Encoding.UTF8; - break; - case CollationEncodingEnum.UTF16LE: - converter = System.Text.Encoding.Unicode; - break; - case CollationEncodingEnum.UTF16BE: - converter = System.Text.Encoding.BigEndianUnicode; - break; - } - - b1 = converter.GetBytes(s1); - b2 = converter.GetBytes(s2); - - return UnsafeNativeMethods.sqlite3_context_collcompare(context, b1, b1.Length, b2, b2.Length); -#else - throw new NotImplementedException(); -#endif - } - - internal override int ContextCollateCompare(CollationEncodingEnum enc, IntPtr context, char[] c1, char[] c2) - { -#if !SQLITE_STANDARD - byte[] b1; - byte[] b2; - System.Text.Encoding converter = null; - - switch (enc) - { - case CollationEncodingEnum.UTF8: - converter = System.Text.Encoding.UTF8; - break; - case CollationEncodingEnum.UTF16LE: - converter = System.Text.Encoding.Unicode; - break; - case CollationEncodingEnum.UTF16BE: - converter = System.Text.Encoding.BigEndianUnicode; - break; - } - - b1 = converter.GetBytes(c1); - b2 = converter.GetBytes(c2); - - return UnsafeNativeMethods.sqlite3_context_collcompare(context, b1, b1.Length, b2, b2.Length); -#else - throw new NotImplementedException(); -#endif - } - - internal override CollationSequence GetCollationSequence(SQLiteFunction func, IntPtr context) - { -#if !SQLITE_STANDARD - CollationSequence seq = new CollationSequence(); - int len; - int type; - int enc; - IntPtr p = UnsafeNativeMethods.sqlite3_context_collseq(context, out type, out enc, out len); - - if (p != null) seq.Name = UTF8ToString(p, len); - seq.Type = (CollationTypeEnum)type; - seq._func = func; - seq.Encoding = (CollationEncodingEnum)enc; - - return seq; -#else - throw new NotImplementedException(); -#endif - } - - internal override long GetParamValueBytes(IntPtr p, int nDataOffset, byte[] bDest, int nStart, int nLength) - { - IntPtr ptr; - int nlen; - int nCopied = nLength; - - nlen = UnsafeNativeMethods.sqlite3_value_bytes(p); - ptr = UnsafeNativeMethods.sqlite3_value_blob(p); - - if (bDest == null) return nlen; - - if (nCopied + nStart > bDest.Length) nCopied = bDest.Length - nStart; - if (nCopied + nDataOffset > nlen) nCopied = nlen - nDataOffset; - - if (nCopied > 0) - Marshal.Copy((IntPtr)(ptr.ToInt32() + nDataOffset), bDest, nStart, nCopied); - else nCopied = 0; - - return nCopied; - } - - internal override double GetParamValueDouble(IntPtr ptr) - { - double value; -#if !PLATFORM_COMPACTFRAMEWORK - value = UnsafeNativeMethods.sqlite3_value_double(ptr); -#else - UnsafeNativeMethods.sqlite3_value_double_interop(ptr, out value); -#endif - return value; - } - - internal override int GetParamValueInt32(IntPtr ptr) - { - return UnsafeNativeMethods.sqlite3_value_int(ptr); - } - - internal override long GetParamValueInt64(IntPtr ptr) - { - Int64 value; -#if !PLATFORM_COMPACTFRAMEWORK - value = UnsafeNativeMethods.sqlite3_value_int64(ptr); -#else - UnsafeNativeMethods.sqlite3_value_int64_interop(ptr, out value); -#endif - return value; - } - - internal override string GetParamValueText(IntPtr ptr) - { -#if !SQLITE_STANDARD - int len; - return UTF8ToString(UnsafeNativeMethods.sqlite3_value_text_interop(ptr, out len), len); -#else - return UTF8ToString(UnsafeNativeMethods.sqlite3_value_text(ptr), -1); -#endif - } - - internal override TypeAffinity GetParamValueType(IntPtr ptr) - { - return UnsafeNativeMethods.sqlite3_value_type(ptr); - } - - internal override void ReturnBlob(IntPtr context, byte[] value) - { - UnsafeNativeMethods.sqlite3_result_blob(context, value, value.Length, (IntPtr)(-1)); - } - - internal override void ReturnDouble(IntPtr context, double value) - { -#if !PLATFORM_COMPACTFRAMEWORK - UnsafeNativeMethods.sqlite3_result_double(context, value); -#else - UnsafeNativeMethods.sqlite3_result_double_interop(context, ref value); -#endif - } - - internal override void ReturnError(IntPtr context, string value) - { - UnsafeNativeMethods.sqlite3_result_error(context, ToUTF8(value), value.Length); - } - - internal override void ReturnInt32(IntPtr context, int value) - { - UnsafeNativeMethods.sqlite3_result_int(context, value); - } - - internal override void ReturnInt64(IntPtr context, long value) - { -#if !PLATFORM_COMPACTFRAMEWORK - UnsafeNativeMethods.sqlite3_result_int64(context, value); -#else - UnsafeNativeMethods.sqlite3_result_int64_interop(context, ref value); -#endif - } - - internal override void ReturnNull(IntPtr context) - { - UnsafeNativeMethods.sqlite3_result_null(context); - } - - internal override void ReturnText(IntPtr context, string value) - { - byte[] b = ToUTF8(value); - UnsafeNativeMethods.sqlite3_result_text(context, ToUTF8(value), b.Length - 1, (IntPtr)(-1)); - } - - internal override IntPtr AggregateContext(IntPtr context) - { - return UnsafeNativeMethods.sqlite3_aggregate_context(context, 1); - } - - internal override void SetPassword(byte[] passwordBytes) - { - int n = UnsafeNativeMethods.sqlite3_key(_sql, passwordBytes, passwordBytes.Length); - if (n > 0) throw new SQLiteException(n, SQLiteLastError()); - } - - internal override void ChangePassword(byte[] newPasswordBytes) - { - int n = UnsafeNativeMethods.sqlite3_rekey(_sql, newPasswordBytes, (newPasswordBytes == null) ? 0 : newPasswordBytes.Length); - if (n > 0) throw new SQLiteException(n, SQLiteLastError()); - } - - internal override void SetUpdateHook(SQLiteUpdateCallback func) - { - UnsafeNativeMethods.sqlite3_update_hook(_sql, func, IntPtr.Zero); - } - - internal override void SetCommitHook(SQLiteCommitCallback func) - { - UnsafeNativeMethods.sqlite3_commit_hook(_sql, func, IntPtr.Zero); - } - - internal override void SetRollbackHook(SQLiteRollbackCallback func) - { - UnsafeNativeMethods.sqlite3_rollback_hook(_sql, func, IntPtr.Zero); - } - - /// - /// Helper function to retrieve a column of data from an active statement. - /// - /// The statement being step()'d through - /// The column index to retrieve - /// The type of data contained in the column. If Uninitialized, this function will retrieve the datatype information. - /// Returns the data in the column - internal override object GetValue(SQLiteStatement stmt, int index, SQLiteType typ) - { - if (IsNull(stmt, index)) return DBNull.Value; - TypeAffinity aff = typ.Affinity; - Type t = null; - - if (typ.Type != DbType.Object) - { - t = SQLiteConvert.SQLiteTypeToType(typ); - aff = TypeToAffinity(t); - } - - switch (aff) - { - case TypeAffinity.Blob: - if (typ.Type == DbType.Guid && typ.Affinity == TypeAffinity.Text) - return new Guid(GetText(stmt, index)); - - int n = (int)GetBytes(stmt, index, 0, null, 0, 0); - byte[] b = new byte[n]; - GetBytes(stmt, index, 0, b, 0, n); - - if (typ.Type == DbType.Guid && n == 16) - return new Guid(b); - - return b; - case TypeAffinity.DateTime: - return GetDateTime(stmt, index); - case TypeAffinity.Double: - if (t == null) return GetDouble(stmt, index); - else - return Convert.ChangeType(GetDouble(stmt, index), t, null); - case TypeAffinity.Int64: - if (t == null) return GetInt64(stmt, index); - else - return Convert.ChangeType(GetInt64(stmt, index), t, null); - default: - return GetText(stmt, index); - } - } - - internal override int GetCursorForTable(SQLiteStatement stmt, int db, int rootPage) - { -#if !SQLITE_STANDARD - return UnsafeNativeMethods.sqlite3_table_cursor(stmt._sqlite_stmt, db, rootPage); -#else - return -1; -#endif - } - - internal override long GetRowIdForCursor(SQLiteStatement stmt, int cursor) - { -#if !SQLITE_STANDARD - long rowid; - int rc = UnsafeNativeMethods.sqlite3_cursor_rowid(stmt._sqlite_stmt, cursor, out rowid); - if (rc == 0) return rowid; - - return 0; -#else - return 0; -#endif - } - - internal override void GetIndexColumnExtendedInfo(string database, string index, string column, out int sortMode, out int onError, out string collationSequence) - { -#if !SQLITE_STANDARD - IntPtr coll; - int colllen; - int rc; - - rc = UnsafeNativeMethods.sqlite3_index_column_info_interop(_sql, ToUTF8(database), ToUTF8(index), ToUTF8(column), out sortMode, out onError, out coll, out colllen); - if (rc != 0) throw new SQLiteException(rc, ""); - - collationSequence = UTF8ToString(coll, colllen); -#else - sortMode = 0; - onError = 2; - collationSequence = "BINARY"; -#endif - } - } -} +/******************************************************** + * ADO.NET 2.0 Data Provider for SQLite Version 3.X + * Written by Robert Simpson (robert@blackcastlesoft.com) + * + * Released to the public domain, use at your own risk! + ********************************************************/ + +namespace System.Data.SQLite +{ + using System; + using System.Runtime.InteropServices; + using System.Collections.Generic; + using System.Globalization; + + /// + /// This class implements SQLiteBase completely, and is the guts of the code that interop's SQLite with .NET + /// + internal class SQLite3 : SQLiteBase + { + /// + /// The opaque pointer returned to us by the sqlite provider + /// + protected SQLiteConnectionHandle _sql; + protected string _fileName; + protected bool _usePool; + protected int _poolVersion; + +#if !PLATFORM_COMPACTFRAMEWORK + private bool _buildingSchema; +#endif + /// + /// The user-defined functions registered on this connection + /// + protected SQLiteFunction[] _functionsArray; + + internal SQLite3(SQLiteDateFormats fmt) + : base(fmt) + { + } + + protected override void Dispose(bool bDisposing) + { + if (bDisposing) + Close(); + } + + // It isn't necessary to cleanup any functions we've registered. If the connection + // goes to the pool and is resurrected later, re-registered functions will overwrite the + // previous functions. The SQLiteFunctionCookieHandle will take care of freeing unmanaged + // resources belonging to the previously-registered functions. + internal override void Close() + { + if (_sql != null) + { + if (_usePool) + { + SQLiteBase.ResetConnection(_sql); + SQLiteConnectionPool.Add(_fileName, _sql, _poolVersion); + } + else + _sql.Dispose(); + } + + _sql = null; + } + + internal override void Cancel() + { + UnsafeNativeMethods.sqlite3_interrupt(_sql); + } + + internal override string Version + { + get + { + return SQLite3.SQLiteVersion; + } + } + + internal static string SQLiteVersion + { + get + { + return UTF8ToString(UnsafeNativeMethods.sqlite3_libversion(), -1); + } + } + + internal override bool AutoCommit + { + get + { + return IsAutocommit(_sql); + } + } + + internal override int Changes + { + get + { + return UnsafeNativeMethods.sqlite3_changes(_sql); + } + } + + internal override void Open(string strFilename, SQLiteOpenFlagsEnum flags, int maxPoolSize, bool usePool) + { + if (_sql != null) return; + + _usePool = usePool; + if (usePool) + { + _fileName = strFilename; + _sql = SQLiteConnectionPool.Remove(strFilename, maxPoolSize, out _poolVersion); + } + + if (_sql == null) + { + IntPtr db; + +#if !SQLITE_STANDARD + int n = UnsafeNativeMethods.sqlite3_open_interop(ToUTF8(strFilename), (int)flags, out db); +#else + int n = UnsafeNativeMethods.sqlite3_open_v2(ToUTF8(strFilename), out db, (int)flags, IntPtr.Zero); +#endif + if (n > 0) throw new SQLiteException(n, null); + + _sql = db; + } + // Bind functions to this connection. If any previous functions of the same name + // were already bound, then the new bindings replace the old. + _functionsArray = SQLiteFunction.BindFunctions(this); + SetTimeout(0); + } + + internal override void ClearPool() + { + SQLiteConnectionPool.ClearPool(_fileName); + } + + internal override void SetTimeout(int nTimeoutMS) + { + int n = UnsafeNativeMethods.sqlite3_busy_timeout(_sql, nTimeoutMS); + if (n > 0) throw new SQLiteException(n, SQLiteLastError()); + } + + internal override bool Step(SQLiteStatement stmt) + { + int n; + Random rnd = null; + uint starttick = (uint)Environment.TickCount; + uint timeout = (uint)(stmt._command._commandTimeout * 1000); + + while (true) + { + n = UnsafeNativeMethods.sqlite3_step(stmt._sqlite_stmt); + + if (n == 100) return true; + if (n == 101) return false; + + if (n > 0) + { + int r; + + // An error occurred, attempt to reset the statement. If the reset worked because the + // schema has changed, re-try the step again. If it errored our because the database + // is locked, then keep retrying until the command timeout occurs. + r = Reset(stmt); + + if (r == 0) + throw new SQLiteException(n, SQLiteLastError()); + + else if ((r == 6 || r == 5) && stmt._command != null) // SQLITE_LOCKED || SQLITE_BUSY + { + // Keep trying + if (rnd == null) // First time we've encountered the lock + rnd = new Random(); + + // If we've exceeded the command's timeout, give up and throw an error + if ((uint)Environment.TickCount - starttick > timeout) + { + throw new SQLiteException(r, SQLiteLastError()); + } + else + { + // Otherwise sleep for a random amount of time up to 150ms + System.Threading.Thread.Sleep(rnd.Next(1, 150)); + } + } + } + } + } + + internal override int Reset(SQLiteStatement stmt) + { + int n; + +#if !SQLITE_STANDARD + n = UnsafeNativeMethods.sqlite3_reset_interop(stmt._sqlite_stmt); +#else + n = UnsafeNativeMethods.sqlite3_reset(stmt._sqlite_stmt); +#endif + + // If the schema changed, try and re-prepare it + if (n == 17) // SQLITE_SCHEMA + { + // Recreate a dummy statement + string str; + using (SQLiteStatement tmp = Prepare(null, stmt._sqlStatement, null, (uint)(stmt._command._commandTimeout * 1000), out str)) + { + // Finalize the existing statement + stmt._sqlite_stmt.Dispose(); + // Reassign a new statement pointer to the old statement and clear the temporary one + stmt._sqlite_stmt = tmp._sqlite_stmt; + tmp._sqlite_stmt = null; + + // Reapply parameters + stmt.BindParameters(); + } + return -1; // Reset was OK, with schema change + } + else if (n == 6 || n == 5) // SQLITE_LOCKED || SQLITE_BUSY + return n; + + if (n > 0) + throw new SQLiteException(n, SQLiteLastError()); + + return 0; // We reset OK, no schema changes + } + + internal override string SQLiteLastError() + { + return SQLiteBase.SQLiteLastError(_sql); + } + + internal override SQLiteStatement Prepare(SQLiteConnection cnn, string strSql, SQLiteStatement previous, uint timeoutMS, out string strRemain) + { + IntPtr stmt = IntPtr.Zero; + IntPtr ptr = IntPtr.Zero; + int len = 0; + int n = 17; + int retries = 0; + byte[] b = ToUTF8(strSql); + string typedefs = null; + SQLiteStatement cmd = null; + Random rnd = null; + uint starttick = (uint)Environment.TickCount; + + GCHandle handle = GCHandle.Alloc(b, GCHandleType.Pinned); + IntPtr psql = handle.AddrOfPinnedObject(); + try + { + while ((n == 17 || n == 6 || n == 5) && retries < 3) + { +#if !SQLITE_STANDARD + n = UnsafeNativeMethods.sqlite3_prepare_interop(_sql, psql, b.Length - 1, out stmt, out ptr, out len); +#else + n = UnsafeNativeMethods.sqlite3_prepare(_sql, psql, b.Length - 1, out stmt, out ptr); + len = -1; +#endif + + if (n == 17) + retries++; + else if (n == 1) + { + if (String.Compare(SQLiteLastError(), "near \"TYPES\": syntax error", StringComparison.OrdinalIgnoreCase) == 0) + { + int pos = strSql.IndexOf(';'); + if (pos == -1) pos = strSql.Length - 1; + + typedefs = strSql.Substring(0, pos + 1); + strSql = strSql.Substring(pos + 1); + + strRemain = ""; + + while (cmd == null && strSql.Length > 0) + { + cmd = Prepare(cnn, strSql, previous, timeoutMS, out strRemain); + strSql = strRemain; + } + + if (cmd != null) + cmd.SetTypes(typedefs); + + return cmd; + } +#if !PLATFORM_COMPACTFRAMEWORK + else if (_buildingSchema == false && String.Compare(SQLiteLastError(), 0, "no such table: TEMP.SCHEMA", 0, 26, StringComparison.OrdinalIgnoreCase) == 0) + { + strRemain = ""; + _buildingSchema = true; + try + { + ISQLiteSchemaExtensions ext = ((IServiceProvider)SQLiteFactory.Instance).GetService(typeof(ISQLiteSchemaExtensions)) as ISQLiteSchemaExtensions; + + if (ext != null) + ext.BuildTempSchema(cnn); + + while (cmd == null && strSql.Length > 0) + { + cmd = Prepare(cnn, strSql, previous, timeoutMS, out strRemain); + strSql = strRemain; + } + + return cmd; + } + finally + { + _buildingSchema = false; + } + } +#endif + } + else if (n == 6 || n == 5) // Locked -- delay a small amount before retrying + { + // Keep trying + if (rnd == null) // First time we've encountered the lock + rnd = new Random(); + + // If we've exceeded the command's timeout, give up and throw an error + if ((uint)Environment.TickCount - starttick > timeoutMS) + { + throw new SQLiteException(n, SQLiteLastError()); + } + else + { + // Otherwise sleep for a random amount of time up to 150ms + System.Threading.Thread.Sleep(rnd.Next(1, 150)); + } + } + } + + if (n > 0) throw new SQLiteException(n, SQLiteLastError()); + + strRemain = UTF8ToString(ptr, len); + + if (stmt != IntPtr.Zero) cmd = new SQLiteStatement(this, stmt, strSql.Substring(0, strSql.Length - strRemain.Length), previous); + + return cmd; + } + finally + { + handle.Free(); + } + } + + internal override void Bind_Double(SQLiteStatement stmt, int index, double value) + { +#if !PLATFORM_COMPACTFRAMEWORK + int n = UnsafeNativeMethods.sqlite3_bind_double(stmt._sqlite_stmt, index, value); +#else + int n = UnsafeNativeMethods.sqlite3_bind_double_interop(stmt._sqlite_stmt, index, ref value); +#endif + if (n > 0) throw new SQLiteException(n, SQLiteLastError()); + } + + internal override void Bind_Int32(SQLiteStatement stmt, int index, int value) + { + int n = UnsafeNativeMethods.sqlite3_bind_int(stmt._sqlite_stmt, index, value); + if (n > 0) throw new SQLiteException(n, SQLiteLastError()); + } + + internal override void Bind_Int64(SQLiteStatement stmt, int index, long value) + { +#if !PLATFORM_COMPACTFRAMEWORK + int n = UnsafeNativeMethods.sqlite3_bind_int64(stmt._sqlite_stmt, index, value); +#else + int n = UnsafeNativeMethods.sqlite3_bind_int64_interop(stmt._sqlite_stmt, index, ref value); +#endif + if (n > 0) throw new SQLiteException(n, SQLiteLastError()); + } + + internal override void Bind_Text(SQLiteStatement stmt, int index, string value) + { + byte[] b = ToUTF8(value); + int n = UnsafeNativeMethods.sqlite3_bind_text(stmt._sqlite_stmt, index, b, b.Length - 1, (IntPtr)(-1)); + if (n > 0) throw new SQLiteException(n, SQLiteLastError()); + } + + internal override void Bind_DateTime(SQLiteStatement stmt, int index, DateTime dt) + { + byte[] b = ToUTF8(dt); + int n = UnsafeNativeMethods.sqlite3_bind_text(stmt._sqlite_stmt, index, b, b.Length - 1, (IntPtr)(-1)); + if (n > 0) throw new SQLiteException(n, SQLiteLastError()); + } + + internal override void Bind_Blob(SQLiteStatement stmt, int index, byte[] blobData) + { + int n = UnsafeNativeMethods.sqlite3_bind_blob(stmt._sqlite_stmt, index, blobData, blobData.Length, (IntPtr)(-1)); + if (n > 0) throw new SQLiteException(n, SQLiteLastError()); + } + + internal override void Bind_Null(SQLiteStatement stmt, int index) + { + int n = UnsafeNativeMethods.sqlite3_bind_null(stmt._sqlite_stmt, index); + if (n > 0) throw new SQLiteException(n, SQLiteLastError()); + } + + internal override int Bind_ParamCount(SQLiteStatement stmt) + { + return UnsafeNativeMethods.sqlite3_bind_parameter_count(stmt._sqlite_stmt); + } + + internal override string Bind_ParamName(SQLiteStatement stmt, int index) + { +#if !SQLITE_STANDARD + int len; + return UTF8ToString(UnsafeNativeMethods.sqlite3_bind_parameter_name_interop(stmt._sqlite_stmt, index, out len), len); +#else + return UTF8ToString(UnsafeNativeMethods.sqlite3_bind_parameter_name(stmt._sqlite_stmt, index), -1); +#endif + } + + internal override int Bind_ParamIndex(SQLiteStatement stmt, string paramName) + { + return UnsafeNativeMethods.sqlite3_bind_parameter_index(stmt._sqlite_stmt, ToUTF8(paramName)); + } + + internal override int ColumnCount(SQLiteStatement stmt) + { + return UnsafeNativeMethods.sqlite3_column_count(stmt._sqlite_stmt); + } + + internal override string ColumnName(SQLiteStatement stmt, int index) + { +#if !SQLITE_STANDARD + int len; + return UTF8ToString(UnsafeNativeMethods.sqlite3_column_name_interop(stmt._sqlite_stmt, index, out len), len); +#else + return UTF8ToString(UnsafeNativeMethods.sqlite3_column_name(stmt._sqlite_stmt, index), -1); +#endif + } + + internal override TypeAffinity ColumnAffinity(SQLiteStatement stmt, int index) + { + return UnsafeNativeMethods.sqlite3_column_type(stmt._sqlite_stmt, index); + } + + internal override string ColumnType(SQLiteStatement stmt, int index, out TypeAffinity nAffinity) + { + int len; +#if !SQLITE_STANDARD + IntPtr p = UnsafeNativeMethods.sqlite3_column_decltype_interop(stmt._sqlite_stmt, index, out len); +#else + len = -1; + IntPtr p = UnsafeNativeMethods.sqlite3_column_decltype(stmt._sqlite_stmt, index); +#endif + nAffinity = ColumnAffinity(stmt, index); + + if (p != IntPtr.Zero) return UTF8ToString(p, len); + else + { + string[] ar = stmt.TypeDefinitions; + if (ar != null) + { + if (index < ar.Length && ar[index] != null) + return ar[index]; + } + return String.Empty; + + //switch (nAffinity) + //{ + // case TypeAffinity.Int64: + // return "BIGINT"; + // case TypeAffinity.Double: + // return "DOUBLE"; + // case TypeAffinity.Blob: + // return "BLOB"; + // default: + // return "TEXT"; + //} + } + } + + internal override int ColumnIndex(SQLiteStatement stmt, string columnName) + { + int x = ColumnCount(stmt); + + for (int n = 0; n < x; n++) + { + if (String.Compare(columnName, ColumnName(stmt, n), StringComparison.OrdinalIgnoreCase) == 0) + return n; + } + return -1; + } + + internal override string ColumnOriginalName(SQLiteStatement stmt, int index) + { +#if !SQLITE_STANDARD + int len; + return UTF8ToString(UnsafeNativeMethods.sqlite3_column_origin_name_interop(stmt._sqlite_stmt, index, out len), len); +#else + return UTF8ToString(UnsafeNativeMethods.sqlite3_column_origin_name(stmt._sqlite_stmt, index), -1); +#endif + } + + internal override string ColumnDatabaseName(SQLiteStatement stmt, int index) + { +#if !SQLITE_STANDARD + int len; + return UTF8ToString(UnsafeNativeMethods.sqlite3_column_database_name_interop(stmt._sqlite_stmt, index, out len), len); +#else + return UTF8ToString(UnsafeNativeMethods.sqlite3_column_database_name(stmt._sqlite_stmt, index), -1); +#endif + } + + internal override string ColumnTableName(SQLiteStatement stmt, int index) + { +#if !SQLITE_STANDARD + int len; + return UTF8ToString(UnsafeNativeMethods.sqlite3_column_table_name_interop(stmt._sqlite_stmt, index, out len), len); +#else + return UTF8ToString(UnsafeNativeMethods.sqlite3_column_table_name(stmt._sqlite_stmt, index), -1); +#endif + } + + internal override void ColumnMetaData(string dataBase, string table, string column, out string dataType, out string collateSequence, out bool notNull, out bool primaryKey, out bool autoIncrement) + { + IntPtr dataTypePtr; + IntPtr collSeqPtr; + int nnotNull; + int nprimaryKey; + int nautoInc; + int n; + int dtLen; + int csLen; + +#if !SQLITE_STANDARD + n = UnsafeNativeMethods.sqlite3_table_column_metadata_interop(_sql, ToUTF8(dataBase), ToUTF8(table), ToUTF8(column), out dataTypePtr, out collSeqPtr, out nnotNull, out nprimaryKey, out nautoInc, out dtLen, out csLen); +#else + dtLen = -1; + csLen = -1; + + n = UnsafeNativeMethods.sqlite3_table_column_metadata(_sql, ToUTF8(dataBase), ToUTF8(table), ToUTF8(column), out dataTypePtr, out collSeqPtr, out nnotNull, out nprimaryKey, out nautoInc); +#endif + if (n > 0) throw new SQLiteException(n, SQLiteLastError()); + + dataType = UTF8ToString(dataTypePtr, dtLen); + collateSequence = UTF8ToString(collSeqPtr, csLen); + + notNull = (nnotNull == 1); + primaryKey = (nprimaryKey == 1); + autoIncrement = (nautoInc == 1); + } + + internal override double GetDouble(SQLiteStatement stmt, int index) + { + double value; +#if !PLATFORM_COMPACTFRAMEWORK + value = UnsafeNativeMethods.sqlite3_column_double(stmt._sqlite_stmt, index); +#else + UnsafeNativeMethods.sqlite3_column_double_interop(stmt._sqlite_stmt, index, out value); +#endif + return value; + } + + internal override int GetInt32(SQLiteStatement stmt, int index) + { + return UnsafeNativeMethods.sqlite3_column_int(stmt._sqlite_stmt, index); + } + + internal override long GetInt64(SQLiteStatement stmt, int index) + { + long value; +#if !PLATFORM_COMPACTFRAMEWORK + value = UnsafeNativeMethods.sqlite3_column_int64(stmt._sqlite_stmt, index); +#else + UnsafeNativeMethods.sqlite3_column_int64_interop(stmt._sqlite_stmt, index, out value); +#endif + return value; + } + + internal override string GetText(SQLiteStatement stmt, int index) + { +#if !SQLITE_STANDARD + int len; + return UTF8ToString(UnsafeNativeMethods.sqlite3_column_text_interop(stmt._sqlite_stmt, index, out len), len); +#else + return UTF8ToString(UnsafeNativeMethods.sqlite3_column_text(stmt._sqlite_stmt, index), -1); +#endif + } + + internal override DateTime GetDateTime(SQLiteStatement stmt, int index) + { +#if !SQLITE_STANDARD + int len; + return ToDateTime(UnsafeNativeMethods.sqlite3_column_text_interop(stmt._sqlite_stmt, index, out len), len); +#else + return ToDateTime(UnsafeNativeMethods.sqlite3_column_text(stmt._sqlite_stmt, index), -1); +#endif + } + + internal override long GetBytes(SQLiteStatement stmt, int index, int nDataOffset, byte[] bDest, int nStart, int nLength) + { + IntPtr ptr; + int nlen; + int nCopied = nLength; + + nlen = UnsafeNativeMethods.sqlite3_column_bytes(stmt._sqlite_stmt, index); + ptr = UnsafeNativeMethods.sqlite3_column_blob(stmt._sqlite_stmt, index); + + if (bDest == null) return nlen; + + if (nCopied + nStart > bDest.Length) nCopied = bDest.Length - nStart; + if (nCopied + nDataOffset > nlen) nCopied = nlen - nDataOffset; + + if (nCopied > 0) + Marshal.Copy((IntPtr)(ptr.ToInt64() + nDataOffset), bDest, nStart, nCopied); + else nCopied = 0; + + return nCopied; + } + + internal override long GetChars(SQLiteStatement stmt, int index, int nDataOffset, char[] bDest, int nStart, int nLength) + { + int nlen; + int nCopied = nLength; + + string str = GetText(stmt, index); + nlen = str.Length; + + if (bDest == null) return nlen; + + if (nCopied + nStart > bDest.Length) nCopied = bDest.Length - nStart; + if (nCopied + nDataOffset > nlen) nCopied = nlen - nDataOffset; + + if (nCopied > 0) + str.CopyTo(nDataOffset, bDest, nStart, nCopied); + else nCopied = 0; + + return nCopied; + } + + internal override bool IsNull(SQLiteStatement stmt, int index) + { + return (ColumnAffinity(stmt, index) == TypeAffinity.Null); + } + + internal override int AggregateCount(IntPtr context) + { + return UnsafeNativeMethods.sqlite3_aggregate_count(context); + } + + internal override void CreateFunction(string strFunction, int nArgs, bool needCollSeq, SQLiteCallback func, SQLiteCallback funcstep, SQLiteFinalCallback funcfinal) + { + int n; + +#if !SQLITE_STANDARD + n = UnsafeNativeMethods.sqlite3_create_function_interop(_sql, ToUTF8(strFunction), nArgs, 4, IntPtr.Zero, func, funcstep, funcfinal, (needCollSeq == true) ? 1 : 0); + if (n == 0) n = UnsafeNativeMethods.sqlite3_create_function_interop(_sql, ToUTF8(strFunction), nArgs, 1, IntPtr.Zero, func, funcstep, funcfinal, (needCollSeq == true) ? 1 : 0); +#else + n = UnsafeNativeMethods.sqlite3_create_function(_sql, ToUTF8(strFunction), nArgs, 4, IntPtr.Zero, func, funcstep, funcfinal); + if (n == 0) n = UnsafeNativeMethods.sqlite3_create_function(_sql, ToUTF8(strFunction), nArgs, 1, IntPtr.Zero, func, funcstep, funcfinal); +#endif + if (n > 0) throw new SQLiteException(n, SQLiteLastError()); + } + + internal override void CreateCollation(string strCollation, SQLiteCollation func, SQLiteCollation func16) + { + int n = UnsafeNativeMethods.sqlite3_create_collation(_sql, ToUTF8(strCollation), 2, IntPtr.Zero, func16); + if (n == 0) n = UnsafeNativeMethods.sqlite3_create_collation(_sql, ToUTF8(strCollation), 1, IntPtr.Zero, func); + if (n > 0) throw new SQLiteException(n, SQLiteLastError()); + } + + internal override int ContextCollateCompare(CollationEncodingEnum enc, IntPtr context, string s1, string s2) + { +#if !SQLITE_STANDARD + byte[] b1; + byte[] b2; + System.Text.Encoding converter = null; + + switch (enc) + { + case CollationEncodingEnum.UTF8: + converter = System.Text.Encoding.UTF8; + break; + case CollationEncodingEnum.UTF16LE: + converter = System.Text.Encoding.Unicode; + break; + case CollationEncodingEnum.UTF16BE: + converter = System.Text.Encoding.BigEndianUnicode; + break; + } + + b1 = converter.GetBytes(s1); + b2 = converter.GetBytes(s2); + + return UnsafeNativeMethods.sqlite3_context_collcompare(context, b1, b1.Length, b2, b2.Length); +#else + throw new NotImplementedException(); +#endif + } + + internal override int ContextCollateCompare(CollationEncodingEnum enc, IntPtr context, char[] c1, char[] c2) + { +#if !SQLITE_STANDARD + byte[] b1; + byte[] b2; + System.Text.Encoding converter = null; + + switch (enc) + { + case CollationEncodingEnum.UTF8: + converter = System.Text.Encoding.UTF8; + break; + case CollationEncodingEnum.UTF16LE: + converter = System.Text.Encoding.Unicode; + break; + case CollationEncodingEnum.UTF16BE: + converter = System.Text.Encoding.BigEndianUnicode; + break; + } + + b1 = converter.GetBytes(c1); + b2 = converter.GetBytes(c2); + + return UnsafeNativeMethods.sqlite3_context_collcompare(context, b1, b1.Length, b2, b2.Length); +#else + throw new NotImplementedException(); +#endif + } + + internal override CollationSequence GetCollationSequence(SQLiteFunction func, IntPtr context) + { +#if !SQLITE_STANDARD + CollationSequence seq = new CollationSequence(); + int len; + int type; + int enc; + IntPtr p = UnsafeNativeMethods.sqlite3_context_collseq(context, out type, out enc, out len); + + if (p != null) seq.Name = UTF8ToString(p, len); + seq.Type = (CollationTypeEnum)type; + seq._func = func; + seq.Encoding = (CollationEncodingEnum)enc; + + return seq; +#else + throw new NotImplementedException(); +#endif + } + + internal override long GetParamValueBytes(IntPtr p, int nDataOffset, byte[] bDest, int nStart, int nLength) + { + IntPtr ptr; + int nlen; + int nCopied = nLength; + + nlen = UnsafeNativeMethods.sqlite3_value_bytes(p); + ptr = UnsafeNativeMethods.sqlite3_value_blob(p); + + if (bDest == null) return nlen; + + if (nCopied + nStart > bDest.Length) nCopied = bDest.Length - nStart; + if (nCopied + nDataOffset > nlen) nCopied = nlen - nDataOffset; + + if (nCopied > 0) + Marshal.Copy((IntPtr)(ptr.ToInt32() + nDataOffset), bDest, nStart, nCopied); + else nCopied = 0; + + return nCopied; + } + + internal override double GetParamValueDouble(IntPtr ptr) + { + double value; +#if !PLATFORM_COMPACTFRAMEWORK + value = UnsafeNativeMethods.sqlite3_value_double(ptr); +#else + UnsafeNativeMethods.sqlite3_value_double_interop(ptr, out value); +#endif + return value; + } + + internal override int GetParamValueInt32(IntPtr ptr) + { + return UnsafeNativeMethods.sqlite3_value_int(ptr); + } + + internal override long GetParamValueInt64(IntPtr ptr) + { + Int64 value; +#if !PLATFORM_COMPACTFRAMEWORK + value = UnsafeNativeMethods.sqlite3_value_int64(ptr); +#else + UnsafeNativeMethods.sqlite3_value_int64_interop(ptr, out value); +#endif + return value; + } + + internal override string GetParamValueText(IntPtr ptr) + { +#if !SQLITE_STANDARD + int len; + return UTF8ToString(UnsafeNativeMethods.sqlite3_value_text_interop(ptr, out len), len); +#else + return UTF8ToString(UnsafeNativeMethods.sqlite3_value_text(ptr), -1); +#endif + } + + internal override TypeAffinity GetParamValueType(IntPtr ptr) + { + return UnsafeNativeMethods.sqlite3_value_type(ptr); + } + + internal override void ReturnBlob(IntPtr context, byte[] value) + { + UnsafeNativeMethods.sqlite3_result_blob(context, value, value.Length, (IntPtr)(-1)); + } + + internal override void ReturnDouble(IntPtr context, double value) + { +#if !PLATFORM_COMPACTFRAMEWORK + UnsafeNativeMethods.sqlite3_result_double(context, value); +#else + UnsafeNativeMethods.sqlite3_result_double_interop(context, ref value); +#endif + } + + internal override void ReturnError(IntPtr context, string value) + { + UnsafeNativeMethods.sqlite3_result_error(context, ToUTF8(value), value.Length); + } + + internal override void ReturnInt32(IntPtr context, int value) + { + UnsafeNativeMethods.sqlite3_result_int(context, value); + } + + internal override void ReturnInt64(IntPtr context, long value) + { +#if !PLATFORM_COMPACTFRAMEWORK + UnsafeNativeMethods.sqlite3_result_int64(context, value); +#else + UnsafeNativeMethods.sqlite3_result_int64_interop(context, ref value); +#endif + } + + internal override void ReturnNull(IntPtr context) + { + UnsafeNativeMethods.sqlite3_result_null(context); + } + + internal override void ReturnText(IntPtr context, string value) + { + byte[] b = ToUTF8(value); + UnsafeNativeMethods.sqlite3_result_text(context, ToUTF8(value), b.Length - 1, (IntPtr)(-1)); + } + + internal override IntPtr AggregateContext(IntPtr context) + { + return UnsafeNativeMethods.sqlite3_aggregate_context(context, 1); + } + + internal override void SetPassword(byte[] passwordBytes) + { + int n = UnsafeNativeMethods.sqlite3_key(_sql, passwordBytes, passwordBytes.Length); + if (n > 0) throw new SQLiteException(n, SQLiteLastError()); + } + + internal override void ChangePassword(byte[] newPasswordBytes) + { + int n = UnsafeNativeMethods.sqlite3_rekey(_sql, newPasswordBytes, (newPasswordBytes == null) ? 0 : newPasswordBytes.Length); + if (n > 0) throw new SQLiteException(n, SQLiteLastError()); + } + + internal override void SetUpdateHook(SQLiteUpdateCallback func) + { + UnsafeNativeMethods.sqlite3_update_hook(_sql, func, IntPtr.Zero); + } + + internal override void SetCommitHook(SQLiteCommitCallback func) + { + UnsafeNativeMethods.sqlite3_commit_hook(_sql, func, IntPtr.Zero); + } + + internal override void SetTraceCallback(SQLiteTraceCallback func) + { + UnsafeNativeMethods.sqlite3_trace(_sql, func, IntPtr.Zero); + } + + internal override void SetRollbackHook(SQLiteRollbackCallback func) + { + UnsafeNativeMethods.sqlite3_rollback_hook(_sql, func, IntPtr.Zero); + } + + /// + /// Helper function to retrieve a column of data from an active statement. + /// + /// The statement being step()'d through + /// The column index to retrieve + /// The type of data contained in the column. If Uninitialized, this function will retrieve the datatype information. + /// Returns the data in the column + internal override object GetValue(SQLiteStatement stmt, int index, SQLiteType typ) + { + if (IsNull(stmt, index)) return DBNull.Value; + TypeAffinity aff = typ.Affinity; + Type t = null; + + if (typ.Type != DbType.Object) + { + t = SQLiteConvert.SQLiteTypeToType(typ); + aff = TypeToAffinity(t); + } + + switch (aff) + { + case TypeAffinity.Blob: + if (typ.Type == DbType.Guid && typ.Affinity == TypeAffinity.Text) + return new Guid(GetText(stmt, index)); + + int n = (int)GetBytes(stmt, index, 0, null, 0, 0); + byte[] b = new byte[n]; + GetBytes(stmt, index, 0, b, 0, n); + + if (typ.Type == DbType.Guid && n == 16) + return new Guid(b); + + return b; + case TypeAffinity.DateTime: + return GetDateTime(stmt, index); + case TypeAffinity.Double: + if (t == null) return GetDouble(stmt, index); + else + return Convert.ChangeType(GetDouble(stmt, index), t, null); + case TypeAffinity.Int64: + if (t == null) return GetInt64(stmt, index); + else + return Convert.ChangeType(GetInt64(stmt, index), t, null); + default: + return GetText(stmt, index); + } + } + + internal override int GetCursorForTable(SQLiteStatement stmt, int db, int rootPage) + { +#if !SQLITE_STANDARD + return UnsafeNativeMethods.sqlite3_table_cursor(stmt._sqlite_stmt, db, rootPage); +#else + return -1; +#endif + } + + internal override long GetRowIdForCursor(SQLiteStatement stmt, int cursor) + { +#if !SQLITE_STANDARD + long rowid; + int rc = UnsafeNativeMethods.sqlite3_cursor_rowid(stmt._sqlite_stmt, cursor, out rowid); + if (rc == 0) return rowid; + + return 0; +#else + return 0; +#endif + } + + internal override void GetIndexColumnExtendedInfo(string database, string index, string column, out int sortMode, out int onError, out string collationSequence) + { +#if !SQLITE_STANDARD + IntPtr coll; + int colllen; + int rc; + + rc = UnsafeNativeMethods.sqlite3_index_column_info_interop(_sql, ToUTF8(database), ToUTF8(index), ToUTF8(column), out sortMode, out onError, out coll, out colllen); + if (rc != 0) throw new SQLiteException(rc, ""); + + collationSequence = UTF8ToString(coll, colllen); +#else + sortMode = 0; + onError = 2; + collationSequence = "BINARY"; +#endif + } + } +} Index: System.Data.SQLite/SQLiteBase.cs ================================================================== --- System.Data.SQLite/SQLiteBase.cs +++ System.Data.SQLite/SQLiteBase.cs @@ -1,270 +1,271 @@ -/******************************************************** - * ADO.NET 2.0 Data Provider for SQLite Version 3.X - * Written by Robert Simpson (robert@blackcastlesoft.com) - * - * Released to the public domain, use at your own risk! - ********************************************************/ - -namespace System.Data.SQLite -{ - using System; - using System.Data; - using System.Runtime.InteropServices; - using System.Collections.Generic; - - /// - /// This internal class provides the foundation of SQLite support. It defines all the abstract members needed to implement - /// a SQLite data provider, and inherits from SQLiteConvert which allows for simple translations of string to and from SQLite. - /// - internal abstract class SQLiteBase : SQLiteConvert, IDisposable - { - internal SQLiteBase(SQLiteDateFormats fmt) - : base(fmt) { } - - static internal object _lock = new object(); - - /// - /// Returns a string representing the active version of SQLite - /// - internal abstract string Version { get; } - /// - /// Returns the number of changes the last executing insert/update caused. - /// - internal abstract int Changes { get; } - /// - /// Opens a database. - /// - /// - /// Implementers should call SQLiteFunction.BindFunctions() and save the array after opening a connection - /// to bind all attributed user-defined functions and collating sequences to the new connection. - /// - /// The filename of the database to open. SQLite automatically creates it if it doesn't exist. - /// The open flags to use when creating the connection - /// The maximum size of the pool for the given filename - /// If true, the connection can be pulled from the connection pool - internal abstract void Open(string strFilename, SQLiteOpenFlagsEnum flags, int maxPoolSize, bool usePool); - /// - /// Closes the currently-open database. - /// - /// - /// After the database has been closed implemeters should call SQLiteFunction.UnbindFunctions() to deallocate all interop allocated - /// memory associated with the user-defined functions and collating sequences tied to the closed connection. - /// - internal abstract void Close(); - /// - /// Sets the busy timeout on the connection. SQLiteCommand will call this before executing any command. - /// - /// The number of milliseconds to wait before returning SQLITE_BUSY - internal abstract void SetTimeout(int nTimeoutMS); - /// - /// Returns the text of the last error issued by SQLite - /// - /// - internal abstract string SQLiteLastError(); - - /// - /// When pooling is enabled, force this connection to be disposed rather than returned to the pool - /// - internal abstract void ClearPool(); - - /// - /// Prepares a SQL statement for execution. - /// - /// The source connection preparing the command. Can be null for any caller except LINQ - /// The SQL command text to prepare - /// The previous statement in a multi-statement command, or null if no previous statement exists - /// The timeout to wait before aborting the prepare - /// The remainder of the statement that was not processed. Each call to prepare parses the - /// SQL up to to either the end of the text or to the first semi-colon delimiter. The remaining text is returned - /// here for a subsequent call to Prepare() until all the text has been processed. - /// Returns an initialized SQLiteStatement. - internal abstract SQLiteStatement Prepare(SQLiteConnection cnn, string strSql, SQLiteStatement previous, uint timeoutMS, out string strRemain); - /// - /// Steps through a prepared statement. - /// - /// The SQLiteStatement to step through - /// True if a row was returned, False if not. - internal abstract bool Step(SQLiteStatement stmt); - /// - /// Resets a prepared statement so it can be executed again. If the error returned is SQLITE_SCHEMA, - /// transparently attempt to rebuild the SQL statement and throw an error if that was not possible. - /// - /// The statement to reset - /// Returns -1 if the schema changed while resetting, 0 if the reset was sucessful or 6 (SQLITE_LOCKED) if the reset failed due to a lock - internal abstract int Reset(SQLiteStatement stmt); - internal abstract void Cancel(); - - internal abstract void Bind_Double(SQLiteStatement stmt, int index, double value); - internal abstract void Bind_Int32(SQLiteStatement stmt, int index, Int32 value); - internal abstract void Bind_Int64(SQLiteStatement stmt, int index, Int64 value); - internal abstract void Bind_Text(SQLiteStatement stmt, int index, string value); - internal abstract void Bind_Blob(SQLiteStatement stmt, int index, byte[] blobData); - internal abstract void Bind_DateTime(SQLiteStatement stmt, int index, DateTime dt); - internal abstract void Bind_Null(SQLiteStatement stmt, int index); - - internal abstract int Bind_ParamCount(SQLiteStatement stmt); - internal abstract string Bind_ParamName(SQLiteStatement stmt, int index); - internal abstract int Bind_ParamIndex(SQLiteStatement stmt, string paramName); - - internal abstract int ColumnCount(SQLiteStatement stmt); - internal abstract string ColumnName(SQLiteStatement stmt, int index); - internal abstract TypeAffinity ColumnAffinity(SQLiteStatement stmt, int index); - internal abstract string ColumnType(SQLiteStatement stmt, int index, out TypeAffinity nAffinity); - internal abstract int ColumnIndex(SQLiteStatement stmt, string columnName); - internal abstract string ColumnOriginalName(SQLiteStatement stmt, int index); - internal abstract string ColumnDatabaseName(SQLiteStatement stmt, int index); - internal abstract string ColumnTableName(SQLiteStatement stmt, int index); - internal abstract void ColumnMetaData(string dataBase, string table, string column, out string dataType, out string collateSequence, out bool notNull, out bool primaryKey, out bool autoIncrement); - internal abstract void GetIndexColumnExtendedInfo(string database, string index, string column, out int sortMode, out int onError, out string collationSequence); - - internal abstract double GetDouble(SQLiteStatement stmt, int index); - internal abstract Int32 GetInt32(SQLiteStatement stmt, int index); - internal abstract Int64 GetInt64(SQLiteStatement stmt, int index); - internal abstract string GetText(SQLiteStatement stmt, int index); - internal abstract long GetBytes(SQLiteStatement stmt, int index, int nDataoffset, byte[] bDest, int nStart, int nLength); - internal abstract long GetChars(SQLiteStatement stmt, int index, int nDataoffset, char[] bDest, int nStart, int nLength); - internal abstract DateTime GetDateTime(SQLiteStatement stmt, int index); - internal abstract bool IsNull(SQLiteStatement stmt, int index); - - internal abstract void CreateCollation(string strCollation, SQLiteCollation func, SQLiteCollation func16); - internal abstract void CreateFunction(string strFunction, int nArgs, bool needCollSeq, SQLiteCallback func, SQLiteCallback funcstep, SQLiteFinalCallback funcfinal); - internal abstract CollationSequence GetCollationSequence(SQLiteFunction func, IntPtr context); - internal abstract int ContextCollateCompare(CollationEncodingEnum enc, IntPtr context, string s1, string s2); - internal abstract int ContextCollateCompare(CollationEncodingEnum enc, IntPtr context, char[] c1, char[] c2); - - internal abstract int AggregateCount(IntPtr context); - internal abstract IntPtr AggregateContext(IntPtr context); - - internal abstract long GetParamValueBytes(IntPtr ptr, int nDataOffset, byte[] bDest, int nStart, int nLength); - internal abstract double GetParamValueDouble(IntPtr ptr); - internal abstract int GetParamValueInt32(IntPtr ptr); - internal abstract Int64 GetParamValueInt64(IntPtr ptr); - internal abstract string GetParamValueText(IntPtr ptr); - internal abstract TypeAffinity GetParamValueType(IntPtr ptr); - - internal abstract void ReturnBlob(IntPtr context, byte[] value); - internal abstract void ReturnDouble(IntPtr context, double value); - internal abstract void ReturnError(IntPtr context, string value); - internal abstract void ReturnInt32(IntPtr context, Int32 value); - internal abstract void ReturnInt64(IntPtr context, Int64 value); - internal abstract void ReturnNull(IntPtr context); - internal abstract void ReturnText(IntPtr context, string value); - - internal abstract void SetPassword(byte[] passwordBytes); - internal abstract void ChangePassword(byte[] newPasswordBytes); - - internal abstract void SetUpdateHook(SQLiteUpdateCallback func); - internal abstract void SetCommitHook(SQLiteCommitCallback func); - internal abstract void SetRollbackHook(SQLiteRollbackCallback func); - - internal abstract int GetCursorForTable(SQLiteStatement stmt, int database, int rootPage); - internal abstract long GetRowIdForCursor(SQLiteStatement stmt, int cursor); - - internal abstract object GetValue(SQLiteStatement stmt, int index, SQLiteType typ); - - internal abstract bool AutoCommit - { - get; - } - - protected virtual void Dispose(bool bDisposing) - { - } - - public void Dispose() - { - Dispose(true); - GC.SuppressFinalize(this); - } - - // These statics are here for lack of a better place to put them. - // They exist here because they are called during the finalization of - // a SQLiteStatementHandle, SQLiteConnectionHandle, and SQLiteFunctionCookieHandle. - // Therefore these functions have to be static, and have to be low-level. - - internal static string SQLiteLastError(SQLiteConnectionHandle db) - { -#if !SQLITE_STANDARD - int len; - return UTF8ToString(UnsafeNativeMethods.sqlite3_errmsg_interop(db, out len), len); -#else - return UTF8ToString(UnsafeNativeMethods.sqlite3_errmsg(db), -1); -#endif - } - - internal static void FinalizeStatement(SQLiteStatementHandle stmt) - { - lock (_lock) - { -#if !SQLITE_STANDARD - int n = UnsafeNativeMethods.sqlite3_finalize_interop(stmt); -#else - int n = UnsafeNativeMethods.sqlite3_finalize(stmt); -#endif - if (n > 0) throw new SQLiteException(n, null); - } - } - - internal static void CloseConnection(SQLiteConnectionHandle db) - { - lock (_lock) - { -#if !SQLITE_STANDARD - int n = UnsafeNativeMethods.sqlite3_close_interop(db); -#else - ResetConnection(db); - int n = UnsafeNativeMethods.sqlite3_close(db); -#endif - if (n > 0) throw new SQLiteException(n, SQLiteLastError(db)); - } - } - - internal static void ResetConnection(SQLiteConnectionHandle db) - { - lock (_lock) - { - IntPtr stmt = IntPtr.Zero; - int n; - do - { - stmt = UnsafeNativeMethods.sqlite3_next_stmt(db, stmt); - if (stmt != IntPtr.Zero) - { -#if !SQLITE_STANDARD - n = UnsafeNativeMethods.sqlite3_reset_interop(stmt); -#else - n = UnsafeNativeMethods.sqlite3_reset(stmt); -#endif - } - } while (stmt != IntPtr.Zero); - - if (IsAutocommit(db) == false) // a transaction is pending on the connection - { - n = UnsafeNativeMethods.sqlite3_exec(db, ToUTF8("ROLLBACK"), IntPtr.Zero, IntPtr.Zero, out stmt); - if (n > 0) throw new SQLiteException(n, SQLiteLastError(db)); - } - } - } - - internal static bool IsAutocommit(SQLiteConnectionHandle hdl) - { - return (UnsafeNativeMethods.sqlite3_get_autocommit(hdl) == 1); - } - } - - internal interface ISQLiteSchemaExtensions - { - void BuildTempSchema(SQLiteConnection cnn); - } - - [Flags] - internal enum SQLiteOpenFlagsEnum - { - None = 0, - ReadOnly = 0x01, - ReadWrite = 0x02, - Create = 0x04, - SharedCache = 0x01000000, - Default = 0x06, - } -} +/******************************************************** + * ADO.NET 2.0 Data Provider for SQLite Version 3.X + * Written by Robert Simpson (robert@blackcastlesoft.com) + * + * Released to the public domain, use at your own risk! + ********************************************************/ + +namespace System.Data.SQLite +{ + using System; + using System.Data; + using System.Runtime.InteropServices; + using System.Collections.Generic; + + /// + /// This internal class provides the foundation of SQLite support. It defines all the abstract members needed to implement + /// a SQLite data provider, and inherits from SQLiteConvert which allows for simple translations of string to and from SQLite. + /// + internal abstract class SQLiteBase : SQLiteConvert, IDisposable + { + internal SQLiteBase(SQLiteDateFormats fmt) + : base(fmt) { } + + static internal object _lock = new object(); + + /// + /// Returns a string representing the active version of SQLite + /// + internal abstract string Version { get; } + /// + /// Returns the number of changes the last executing insert/update caused. + /// + internal abstract int Changes { get; } + /// + /// Opens a database. + /// + /// + /// Implementers should call SQLiteFunction.BindFunctions() and save the array after opening a connection + /// to bind all attributed user-defined functions and collating sequences to the new connection. + /// + /// The filename of the database to open. SQLite automatically creates it if it doesn't exist. + /// The open flags to use when creating the connection + /// The maximum size of the pool for the given filename + /// If true, the connection can be pulled from the connection pool + internal abstract void Open(string strFilename, SQLiteOpenFlagsEnum flags, int maxPoolSize, bool usePool); + /// + /// Closes the currently-open database. + /// + /// + /// After the database has been closed implemeters should call SQLiteFunction.UnbindFunctions() to deallocate all interop allocated + /// memory associated with the user-defined functions and collating sequences tied to the closed connection. + /// + internal abstract void Close(); + /// + /// Sets the busy timeout on the connection. SQLiteCommand will call this before executing any command. + /// + /// The number of milliseconds to wait before returning SQLITE_BUSY + internal abstract void SetTimeout(int nTimeoutMS); + /// + /// Returns the text of the last error issued by SQLite + /// + /// + internal abstract string SQLiteLastError(); + + /// + /// When pooling is enabled, force this connection to be disposed rather than returned to the pool + /// + internal abstract void ClearPool(); + + /// + /// Prepares a SQL statement for execution. + /// + /// The source connection preparing the command. Can be null for any caller except LINQ + /// The SQL command text to prepare + /// The previous statement in a multi-statement command, or null if no previous statement exists + /// The timeout to wait before aborting the prepare + /// The remainder of the statement that was not processed. Each call to prepare parses the + /// SQL up to to either the end of the text or to the first semi-colon delimiter. The remaining text is returned + /// here for a subsequent call to Prepare() until all the text has been processed. + /// Returns an initialized SQLiteStatement. + internal abstract SQLiteStatement Prepare(SQLiteConnection cnn, string strSql, SQLiteStatement previous, uint timeoutMS, out string strRemain); + /// + /// Steps through a prepared statement. + /// + /// The SQLiteStatement to step through + /// True if a row was returned, False if not. + internal abstract bool Step(SQLiteStatement stmt); + /// + /// Resets a prepared statement so it can be executed again. If the error returned is SQLITE_SCHEMA, + /// transparently attempt to rebuild the SQL statement and throw an error if that was not possible. + /// + /// The statement to reset + /// Returns -1 if the schema changed while resetting, 0 if the reset was sucessful or 6 (SQLITE_LOCKED) if the reset failed due to a lock + internal abstract int Reset(SQLiteStatement stmt); + internal abstract void Cancel(); + + internal abstract void Bind_Double(SQLiteStatement stmt, int index, double value); + internal abstract void Bind_Int32(SQLiteStatement stmt, int index, Int32 value); + internal abstract void Bind_Int64(SQLiteStatement stmt, int index, Int64 value); + internal abstract void Bind_Text(SQLiteStatement stmt, int index, string value); + internal abstract void Bind_Blob(SQLiteStatement stmt, int index, byte[] blobData); + internal abstract void Bind_DateTime(SQLiteStatement stmt, int index, DateTime dt); + internal abstract void Bind_Null(SQLiteStatement stmt, int index); + + internal abstract int Bind_ParamCount(SQLiteStatement stmt); + internal abstract string Bind_ParamName(SQLiteStatement stmt, int index); + internal abstract int Bind_ParamIndex(SQLiteStatement stmt, string paramName); + + internal abstract int ColumnCount(SQLiteStatement stmt); + internal abstract string ColumnName(SQLiteStatement stmt, int index); + internal abstract TypeAffinity ColumnAffinity(SQLiteStatement stmt, int index); + internal abstract string ColumnType(SQLiteStatement stmt, int index, out TypeAffinity nAffinity); + internal abstract int ColumnIndex(SQLiteStatement stmt, string columnName); + internal abstract string ColumnOriginalName(SQLiteStatement stmt, int index); + internal abstract string ColumnDatabaseName(SQLiteStatement stmt, int index); + internal abstract string ColumnTableName(SQLiteStatement stmt, int index); + internal abstract void ColumnMetaData(string dataBase, string table, string column, out string dataType, out string collateSequence, out bool notNull, out bool primaryKey, out bool autoIncrement); + internal abstract void GetIndexColumnExtendedInfo(string database, string index, string column, out int sortMode, out int onError, out string collationSequence); + + internal abstract double GetDouble(SQLiteStatement stmt, int index); + internal abstract Int32 GetInt32(SQLiteStatement stmt, int index); + internal abstract Int64 GetInt64(SQLiteStatement stmt, int index); + internal abstract string GetText(SQLiteStatement stmt, int index); + internal abstract long GetBytes(SQLiteStatement stmt, int index, int nDataoffset, byte[] bDest, int nStart, int nLength); + internal abstract long GetChars(SQLiteStatement stmt, int index, int nDataoffset, char[] bDest, int nStart, int nLength); + internal abstract DateTime GetDateTime(SQLiteStatement stmt, int index); + internal abstract bool IsNull(SQLiteStatement stmt, int index); + + internal abstract void CreateCollation(string strCollation, SQLiteCollation func, SQLiteCollation func16); + internal abstract void CreateFunction(string strFunction, int nArgs, bool needCollSeq, SQLiteCallback func, SQLiteCallback funcstep, SQLiteFinalCallback funcfinal); + internal abstract CollationSequence GetCollationSequence(SQLiteFunction func, IntPtr context); + internal abstract int ContextCollateCompare(CollationEncodingEnum enc, IntPtr context, string s1, string s2); + internal abstract int ContextCollateCompare(CollationEncodingEnum enc, IntPtr context, char[] c1, char[] c2); + + internal abstract int AggregateCount(IntPtr context); + internal abstract IntPtr AggregateContext(IntPtr context); + + internal abstract long GetParamValueBytes(IntPtr ptr, int nDataOffset, byte[] bDest, int nStart, int nLength); + internal abstract double GetParamValueDouble(IntPtr ptr); + internal abstract int GetParamValueInt32(IntPtr ptr); + internal abstract Int64 GetParamValueInt64(IntPtr ptr); + internal abstract string GetParamValueText(IntPtr ptr); + internal abstract TypeAffinity GetParamValueType(IntPtr ptr); + + internal abstract void ReturnBlob(IntPtr context, byte[] value); + internal abstract void ReturnDouble(IntPtr context, double value); + internal abstract void ReturnError(IntPtr context, string value); + internal abstract void ReturnInt32(IntPtr context, Int32 value); + internal abstract void ReturnInt64(IntPtr context, Int64 value); + internal abstract void ReturnNull(IntPtr context); + internal abstract void ReturnText(IntPtr context, string value); + + internal abstract void SetPassword(byte[] passwordBytes); + internal abstract void ChangePassword(byte[] newPasswordBytes); + + internal abstract void SetUpdateHook(SQLiteUpdateCallback func); + internal abstract void SetCommitHook(SQLiteCommitCallback func); + internal abstract void SetTraceCallback(SQLiteTraceCallback func); + internal abstract void SetRollbackHook(SQLiteRollbackCallback func); + + internal abstract int GetCursorForTable(SQLiteStatement stmt, int database, int rootPage); + internal abstract long GetRowIdForCursor(SQLiteStatement stmt, int cursor); + + internal abstract object GetValue(SQLiteStatement stmt, int index, SQLiteType typ); + + internal abstract bool AutoCommit + { + get; + } + + protected virtual void Dispose(bool bDisposing) + { + } + + public void Dispose() + { + Dispose(true); + GC.SuppressFinalize(this); + } + + // These statics are here for lack of a better place to put them. + // They exist here because they are called during the finalization of + // a SQLiteStatementHandle, SQLiteConnectionHandle, and SQLiteFunctionCookieHandle. + // Therefore these functions have to be static, and have to be low-level. + + internal static string SQLiteLastError(SQLiteConnectionHandle db) + { +#if !SQLITE_STANDARD + int len; + return UTF8ToString(UnsafeNativeMethods.sqlite3_errmsg_interop(db, out len), len); +#else + return UTF8ToString(UnsafeNativeMethods.sqlite3_errmsg(db), -1); +#endif + } + + internal static void FinalizeStatement(SQLiteStatementHandle stmt) + { + lock (_lock) + { +#if !SQLITE_STANDARD + int n = UnsafeNativeMethods.sqlite3_finalize_interop(stmt); +#else + int n = UnsafeNativeMethods.sqlite3_finalize(stmt); +#endif + if (n > 0) throw new SQLiteException(n, null); + } + } + + internal static void CloseConnection(SQLiteConnectionHandle db) + { + lock (_lock) + { +#if !SQLITE_STANDARD + int n = UnsafeNativeMethods.sqlite3_close_interop(db); +#else + ResetConnection(db); + int n = UnsafeNativeMethods.sqlite3_close(db); +#endif + if (n > 0) throw new SQLiteException(n, SQLiteLastError(db)); + } + } + + internal static void ResetConnection(SQLiteConnectionHandle db) + { + lock (_lock) + { + IntPtr stmt = IntPtr.Zero; + int n; + do + { + stmt = UnsafeNativeMethods.sqlite3_next_stmt(db, stmt); + if (stmt != IntPtr.Zero) + { +#if !SQLITE_STANDARD + n = UnsafeNativeMethods.sqlite3_reset_interop(stmt); +#else + n = UnsafeNativeMethods.sqlite3_reset(stmt); +#endif + } + } while (stmt != IntPtr.Zero); + + if (IsAutocommit(db) == false) // a transaction is pending on the connection + { + n = UnsafeNativeMethods.sqlite3_exec(db, ToUTF8("ROLLBACK"), IntPtr.Zero, IntPtr.Zero, out stmt); + if (n > 0) throw new SQLiteException(n, SQLiteLastError(db)); + } + } + } + + internal static bool IsAutocommit(SQLiteConnectionHandle hdl) + { + return (UnsafeNativeMethods.sqlite3_get_autocommit(hdl) == 1); + } + } + + internal interface ISQLiteSchemaExtensions + { + void BuildTempSchema(SQLiteConnection cnn); + } + + [Flags] + internal enum SQLiteOpenFlagsEnum + { + None = 0, + ReadOnly = 0x01, + ReadWrite = 0x02, + Create = 0x04, + SharedCache = 0x01000000, + Default = 0x06, + } +} Index: System.Data.SQLite/SQLiteCommand.cs ================================================================== --- System.Data.SQLite/SQLiteCommand.cs +++ System.Data.SQLite/SQLiteCommand.cs @@ -1,640 +1,640 @@ -/******************************************************** - * ADO.NET 2.0 Data Provider for SQLite Version 3.X - * Written by Robert Simpson (robert@blackcastlesoft.com) - * - * Released to the public domain, use at your own risk! - ********************************************************/ - -namespace System.Data.SQLite -{ - using System; - using System.Data; - using System.Data.Common; - using System.Collections.Generic; - using System.ComponentModel; - - /// - /// SQLite implementation of DbCommand. - /// -#if !PLATFORM_COMPACTFRAMEWORK - [Designer("SQLite.Designer.SQLiteCommandDesigner, SQLite.Designer, Version=1.0.37.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139"), ToolboxItem(true)] -#endif - public sealed class SQLiteCommand : DbCommand, ICloneable - { - /// - /// The command text this command is based on - /// - private string _commandText; - /// - /// The connection the command is associated with - /// - private SQLiteConnection _cnn; - /// - /// The version of the connection the command is associated with - /// - private long _version; - /// - /// Indicates whether or not a DataReader is active on the command. - /// - private WeakReference _activeReader; - /// - /// The timeout for the command, kludged because SQLite doesn't support per-command timeout values - /// - internal int _commandTimeout; - /// - /// Designer support - /// - private bool _designTimeVisible; - /// - /// Used by DbDataAdapter to determine updating behavior - /// - private UpdateRowSource _updateRowSource; - /// - /// The collection of parameters for the command - /// - private SQLiteParameterCollection _parameterCollection; - /// - /// The SQL command text, broken into individual SQL statements as they are executed - /// - internal List _statementList; - /// - /// Unprocessed SQL text that has not been executed - /// - internal string _remainingText; - /// - /// Transaction associated with this command - /// - private SQLiteTransaction _transaction; - - /// - /// Constructs a new SQLiteCommand - /// - /// - /// Default constructor - /// - public SQLiteCommand() :this(null, null) - { - } - - /// - /// Initializes the command with the given command text - /// - /// The SQL command text - public SQLiteCommand(string commandText) - : this(commandText, null, null) - { - } - - /// - /// Initializes the command with the given SQL command text and attach the command to the specified - /// connection. - /// - /// The SQL command text - /// The connection to associate with the command - public SQLiteCommand(string commandText, SQLiteConnection connection) - : this(commandText, connection, null) - { - } - - /// - /// Initializes the command and associates it with the specified connection. - /// - /// The connection to associate with the command - public SQLiteCommand(SQLiteConnection connection) - : this(null, connection, null) - { - } - - private SQLiteCommand(SQLiteCommand source) : this(source.CommandText, source.Connection, source.Transaction) - { - CommandTimeout = source.CommandTimeout; - DesignTimeVisible = source.DesignTimeVisible; - UpdatedRowSource = source.UpdatedRowSource; - - foreach (SQLiteParameter param in source._parameterCollection) - { - Parameters.Add(param.Clone()); - } - } - - /// - /// Initializes a command with the given SQL, connection and transaction - /// - /// The SQL command text - /// The connection to associate with the command - /// The transaction the command should be associated with - public SQLiteCommand(string commandText, SQLiteConnection connection, SQLiteTransaction transaction) - { - _commandTimeout = 30; - _parameterCollection = new SQLiteParameterCollection(this); - _designTimeVisible = true; - _updateRowSource = UpdateRowSource.None; - - if (commandText != null) - CommandText = commandText; - - if (connection != null) - { - DbConnection = connection; - _commandTimeout = connection.DefaultTimeout; - } - - if (transaction != null) - Transaction = transaction; - } - - /// - /// Disposes of the command and clears all member variables - /// - /// Whether or not the class is being explicitly or implicitly disposed - protected override void Dispose(bool disposing) - { - base.Dispose(disposing); - - if (disposing) - { - // If a reader is active on this command, don't destroy the command, instead let the reader do it - SQLiteDataReader reader = null; - if (_activeReader != null) - { - try - { - reader = _activeReader.Target as SQLiteDataReader; - } - catch(InvalidOperationException) - { - } - } - - if (reader != null) - { - reader._disposeCommand = true; - _activeReader = null; - return; - } - - Connection = null; - _parameterCollection.Clear(); - _commandText = null; - } - } - - /// - /// Clears and destroys all statements currently prepared - /// - internal void ClearCommands() - { - if (_activeReader != null) - { - SQLiteDataReader reader = null; - try - { - reader = _activeReader.Target as SQLiteDataReader; - } - catch(InvalidOperationException) - { - } - - if (reader != null) - reader.Close(); - - _activeReader = null; - } - - if (_statementList == null) return; - - int x = _statementList.Count; - for (int n = 0; n < x; n++) - _statementList[n].Dispose(); - - _statementList = null; - - _parameterCollection.Unbind(); - } - - /// - /// Builds an array of prepared statements for each complete SQL statement in the command text - /// - internal SQLiteStatement BuildNextCommand() - { - SQLiteStatement stmt = null; - - try - { - if (_statementList == null) - _remainingText = _commandText; - - stmt = _cnn._sql.Prepare(_cnn, _remainingText, (_statementList == null) ? null : _statementList[_statementList.Count - 1], (uint)(_commandTimeout * 1000), out _remainingText); - if (stmt != null) - { - stmt._command = this; - if (_statementList == null) - _statementList = new List(); - - _statementList.Add(stmt); - - _parameterCollection.MapParameters(stmt); - stmt.BindParameters(); - } - return stmt; - } - catch (Exception) - { - if (stmt != null) - { - if (_statementList.Contains(stmt)) - _statementList.Remove(stmt); - - stmt.Dispose(); - } - - // If we threw an error compiling the statement, we cannot continue on so set the remaining text to null. - _remainingText = null; - - throw; - } - } - - internal SQLiteStatement GetStatement(int index) - { - // Haven't built any statements yet - if (_statementList == null) return BuildNextCommand(); - - // If we're at the last built statement and want the next unbuilt statement, then build it - if (index == _statementList.Count) - { - if (String.IsNullOrEmpty(_remainingText) == false) return BuildNextCommand(); - else return null; // No more commands - } - - SQLiteStatement stmt = _statementList[index]; - stmt.BindParameters(); - - return stmt; - } - - /// - /// Not implemented - /// - public override void Cancel() - { - if (_activeReader != null) - { - SQLiteDataReader reader = _activeReader.Target as SQLiteDataReader; - if (reader != null) - reader.Cancel(); - } - } - - /// - /// The SQL command text associated with the command - /// -#if !PLATFORM_COMPACTFRAMEWORK - [DefaultValue(""), RefreshProperties(RefreshProperties.All), Editor("Microsoft.VSDesigner.Data.SQL.Design.SqlCommandTextEditor, Microsoft.VSDesigner, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", "System.Drawing.Design.UITypeEditor, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")] -#endif - public override string CommandText - { - get - { - return _commandText; - } - set - { - if (_commandText == value) return; - - if (_activeReader != null && _activeReader.IsAlive) - { - throw new InvalidOperationException("Cannot set CommandText while a DataReader is active"); - } - - ClearCommands(); - _commandText = value; - - if (_cnn == null) return; - } - } - - /// - /// The amount of time to wait for the connection to become available before erroring out - /// -#if !PLATFORM_COMPACTFRAMEWORK - [DefaultValue((int)30)] -#endif - public override int CommandTimeout - { - get - { - return _commandTimeout; - } - set - { - _commandTimeout = value; - } - } - - /// - /// The type of the command. SQLite only supports CommandType.Text - /// -#if !PLATFORM_COMPACTFRAMEWORK - [RefreshProperties(RefreshProperties.All), DefaultValue(CommandType.Text)] -#endif - public override CommandType CommandType - { - get - { - return CommandType.Text; - } - set - { - if (value != CommandType.Text) - { - throw new NotSupportedException(); - } - } - } - - /// - /// Forwards to the local CreateParameter() function - /// - /// - protected override DbParameter CreateDbParameter() - { - return CreateParameter(); - } - - /// - /// Create a new parameter - /// - /// - public new SQLiteParameter CreateParameter() - { - return new SQLiteParameter(); - } - - /// - /// The connection associated with this command - /// -#if !PLATFORM_COMPACTFRAMEWORK - [DefaultValue((string)null), Editor("Microsoft.VSDesigner.Data.Design.DbConnectionEditor, Microsoft.VSDesigner, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", "System.Drawing.Design.UITypeEditor, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")] -#endif - public new SQLiteConnection Connection - { - get { return _cnn; } - set - { - if (_activeReader != null && _activeReader.IsAlive) - throw new InvalidOperationException("Cannot set Connection while a DataReader is active"); - - if (_cnn != null) - { - ClearCommands(); - //_cnn.RemoveCommand(this); - } - - _cnn = value; - if (_cnn != null) - _version = _cnn._version; - - //if (_cnn != null) - // _cnn.AddCommand(this); - } - } - - /// - /// Forwards to the local Connection property - /// - protected override DbConnection DbConnection - { - get - { - return Connection; - } - set - { - Connection = (SQLiteConnection)value; - } - } - - /// - /// Returns the SQLiteParameterCollection for the given command - /// -#if !PLATFORM_COMPACTFRAMEWORK - [DesignerSerializationVisibility(DesignerSerializationVisibility.Content)] -#endif - public new SQLiteParameterCollection Parameters - { - get { return _parameterCollection; } - } - - /// - /// Forwards to the local Parameters property - /// - protected override DbParameterCollection DbParameterCollection - { - get - { - return Parameters; - } - } - - /// - /// The transaction associated with this command. SQLite only supports one transaction per connection, so this property forwards to the - /// command's underlying connection. - /// -#if !PLATFORM_COMPACTFRAMEWORK - [Browsable(false), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] -#endif - public new SQLiteTransaction Transaction - { - get { return _transaction; } - set - { - if (_cnn != null) - { - if (_activeReader != null && _activeReader.IsAlive) - throw new InvalidOperationException("Cannot set Transaction while a DataReader is active"); - - if (value != null) - { - if (value._cnn != _cnn) - throw new ArgumentException("Transaction is not associated with the command's connection"); - } - _transaction = value; - } - else - { - if (value != null) Connection = value.Connection; - _transaction = value; - } - } - } - - /// - /// Forwards to the local Transaction property - /// - protected override DbTransaction DbTransaction - { - get - { - return Transaction; - } - set - { - Transaction = (SQLiteTransaction)value; - } - } - - /// - /// This function ensures there are no active readers, that we have a valid connection, - /// that the connection is open, that all statements are prepared and all parameters are assigned - /// in preparation for allocating a data reader. - /// - private void InitializeForReader() - { - if (_activeReader != null && _activeReader.IsAlive) - throw new InvalidOperationException("DataReader already active on this command"); - - if (_cnn == null) - throw new InvalidOperationException("No connection associated with this command"); - - if (_cnn.State != ConnectionState.Open) - throw new InvalidOperationException("Database is not open"); - - // If the version of the connection has changed, clear out any previous commands before starting - if (_cnn._version != _version) - { - _version = _cnn._version; - ClearCommands(); - } - - // Map all parameters for statements already built - _parameterCollection.MapParameters(null); - - //// Set the default command timeout - //_cnn._sql.SetTimeout(_commandTimeout * 1000); - } - - /// - /// Creates a new SQLiteDataReader to execute/iterate the array of SQLite prepared statements - /// - /// The behavior the data reader should adopt - /// Returns a SQLiteDataReader object - protected override DbDataReader ExecuteDbDataReader(CommandBehavior behavior) - { - return ExecuteReader(behavior); - } - - /// - /// Overrides the default behavior to return a SQLiteDataReader specialization class - /// - /// The flags to be associated with the reader - /// A SQLiteDataReader - public new SQLiteDataReader ExecuteReader(CommandBehavior behavior) - { - InitializeForReader(); - - SQLiteDataReader rd = new SQLiteDataReader(this, behavior); - _activeReader = new WeakReference(rd, false); - - return rd; - } - - /// - /// Overrides the default behavior of DbDataReader to return a specialized SQLiteDataReader class - /// - /// A SQLiteDataReader - public new SQLiteDataReader ExecuteReader() - { - return ExecuteReader(CommandBehavior.Default); - } - - /// - /// Called by the SQLiteDataReader when the data reader is closed. - /// - internal void ClearDataReader() - { - _activeReader = null; - } - - /// - /// Execute the command and return the number of rows inserted/updated affected by it. - /// - /// - public override int ExecuteNonQuery() - { - using (SQLiteDataReader reader = ExecuteReader(CommandBehavior.SingleRow | CommandBehavior.SingleResult)) - { - while (reader.NextResult()) ; - return reader.RecordsAffected; - } - } - - /// - /// Execute the command and return the first column of the first row of the resultset - /// (if present), or null if no resultset was returned. - /// - /// The first column of the first row of the first resultset from the query - public override object ExecuteScalar() - { - using (SQLiteDataReader reader = ExecuteReader(CommandBehavior.SingleRow | CommandBehavior.SingleResult)) - { - if (reader.Read()) - return reader[0]; - } - return null; - } - - /// - /// Does nothing. Commands are prepared as they are executed the first time, and kept in prepared state afterwards. - /// - public override void Prepare() - { - } - - /// - /// Sets the method the SQLiteCommandBuilder uses to determine how to update inserted or updated rows in a DataTable. - /// - [DefaultValue(UpdateRowSource.None)] - public override UpdateRowSource UpdatedRowSource - { - get - { - return _updateRowSource; - } - set - { - _updateRowSource = value; - } - } - - /// - /// Determines if the command is visible at design time. Defaults to True. - /// -#if !PLATFORM_COMPACTFRAMEWORK - [DesignOnly(true), Browsable(false), DefaultValue(true), EditorBrowsable(EditorBrowsableState.Never)] -#endif - public override bool DesignTimeVisible - { - get - { - return _designTimeVisible; - } - set - { - _designTimeVisible = value; -#if !PLATFORM_COMPACTFRAMEWORK - TypeDescriptor.Refresh(this); -#endif - } - } - - /// - /// Clones a command, including all its parameters - /// - /// A new SQLiteCommand with the same commandtext, connection and parameters - public object Clone() - { - return new SQLiteCommand(this); - } - } +/******************************************************** + * ADO.NET 2.0 Data Provider for SQLite Version 3.X + * Written by Robert Simpson (robert@blackcastlesoft.com) + * + * Released to the public domain, use at your own risk! + ********************************************************/ + +namespace System.Data.SQLite +{ + using System; + using System.Data; + using System.Data.Common; + using System.Collections.Generic; + using System.ComponentModel; + + /// + /// SQLite implementation of DbCommand. + /// +#if !PLATFORM_COMPACTFRAMEWORK + [Designer("SQLite.Designer.SQLiteCommandDesigner, SQLite.Designer, Version=1.0.38.1, Culture=neutral, PublicKeyToken=db937bc2d44ff139"), ToolboxItem(true)] +#endif + public sealed class SQLiteCommand : DbCommand, ICloneable + { + /// + /// The command text this command is based on + /// + private string _commandText; + /// + /// The connection the command is associated with + /// + private SQLiteConnection _cnn; + /// + /// The version of the connection the command is associated with + /// + private long _version; + /// + /// Indicates whether or not a DataReader is active on the command. + /// + private WeakReference _activeReader; + /// + /// The timeout for the command, kludged because SQLite doesn't support per-command timeout values + /// + internal int _commandTimeout; + /// + /// Designer support + /// + private bool _designTimeVisible; + /// + /// Used by DbDataAdapter to determine updating behavior + /// + private UpdateRowSource _updateRowSource; + /// + /// The collection of parameters for the command + /// + private SQLiteParameterCollection _parameterCollection; + /// + /// The SQL command text, broken into individual SQL statements as they are executed + /// + internal List _statementList; + /// + /// Unprocessed SQL text that has not been executed + /// + internal string _remainingText; + /// + /// Transaction associated with this command + /// + private SQLiteTransaction _transaction; + + /// + /// Constructs a new SQLiteCommand + /// + /// + /// Default constructor + /// + public SQLiteCommand() :this(null, null) + { + } + + /// + /// Initializes the command with the given command text + /// + /// The SQL command text + public SQLiteCommand(string commandText) + : this(commandText, null, null) + { + } + + /// + /// Initializes the command with the given SQL command text and attach the command to the specified + /// connection. + /// + /// The SQL command text + /// The connection to associate with the command + public SQLiteCommand(string commandText, SQLiteConnection connection) + : this(commandText, connection, null) + { + } + + /// + /// Initializes the command and associates it with the specified connection. + /// + /// The connection to associate with the command + public SQLiteCommand(SQLiteConnection connection) + : this(null, connection, null) + { + } + + private SQLiteCommand(SQLiteCommand source) : this(source.CommandText, source.Connection, source.Transaction) + { + CommandTimeout = source.CommandTimeout; + DesignTimeVisible = source.DesignTimeVisible; + UpdatedRowSource = source.UpdatedRowSource; + + foreach (SQLiteParameter param in source._parameterCollection) + { + Parameters.Add(param.Clone()); + } + } + + /// + /// Initializes a command with the given SQL, connection and transaction + /// + /// The SQL command text + /// The connection to associate with the command + /// The transaction the command should be associated with + public SQLiteCommand(string commandText, SQLiteConnection connection, SQLiteTransaction transaction) + { + _commandTimeout = 30; + _parameterCollection = new SQLiteParameterCollection(this); + _designTimeVisible = true; + _updateRowSource = UpdateRowSource.None; + + if (commandText != null) + CommandText = commandText; + + if (connection != null) + { + DbConnection = connection; + _commandTimeout = connection.DefaultTimeout; + } + + if (transaction != null) + Transaction = transaction; + } + + /// + /// Disposes of the command and clears all member variables + /// + /// Whether or not the class is being explicitly or implicitly disposed + protected override void Dispose(bool disposing) + { + base.Dispose(disposing); + + if (disposing) + { + // If a reader is active on this command, don't destroy the command, instead let the reader do it + SQLiteDataReader reader = null; + if (_activeReader != null) + { + try + { + reader = _activeReader.Target as SQLiteDataReader; + } + catch(InvalidOperationException) + { + } + } + + if (reader != null) + { + reader._disposeCommand = true; + _activeReader = null; + return; + } + + Connection = null; + _parameterCollection.Clear(); + _commandText = null; + } + } + + /// + /// Clears and destroys all statements currently prepared + /// + internal void ClearCommands() + { + if (_activeReader != null) + { + SQLiteDataReader reader = null; + try + { + reader = _activeReader.Target as SQLiteDataReader; + } + catch(InvalidOperationException) + { + } + + if (reader != null) + reader.Close(); + + _activeReader = null; + } + + if (_statementList == null) return; + + int x = _statementList.Count; + for (int n = 0; n < x; n++) + _statementList[n].Dispose(); + + _statementList = null; + + _parameterCollection.Unbind(); + } + + /// + /// Builds an array of prepared statements for each complete SQL statement in the command text + /// + internal SQLiteStatement BuildNextCommand() + { + SQLiteStatement stmt = null; + + try + { + if (_statementList == null) + _remainingText = _commandText; + + stmt = _cnn._sql.Prepare(_cnn, _remainingText, (_statementList == null) ? null : _statementList[_statementList.Count - 1], (uint)(_commandTimeout * 1000), out _remainingText); + if (stmt != null) + { + stmt._command = this; + if (_statementList == null) + _statementList = new List(); + + _statementList.Add(stmt); + + _parameterCollection.MapParameters(stmt); + stmt.BindParameters(); + } + return stmt; + } + catch (Exception) + { + if (stmt != null) + { + if (_statementList.Contains(stmt)) + _statementList.Remove(stmt); + + stmt.Dispose(); + } + + // If we threw an error compiling the statement, we cannot continue on so set the remaining text to null. + _remainingText = null; + + throw; + } + } + + internal SQLiteStatement GetStatement(int index) + { + // Haven't built any statements yet + if (_statementList == null) return BuildNextCommand(); + + // If we're at the last built statement and want the next unbuilt statement, then build it + if (index == _statementList.Count) + { + if (String.IsNullOrEmpty(_remainingText) == false) return BuildNextCommand(); + else return null; // No more commands + } + + SQLiteStatement stmt = _statementList[index]; + stmt.BindParameters(); + + return stmt; + } + + /// + /// Not implemented + /// + public override void Cancel() + { + if (_activeReader != null) + { + SQLiteDataReader reader = _activeReader.Target as SQLiteDataReader; + if (reader != null) + reader.Cancel(); + } + } + + /// + /// The SQL command text associated with the command + /// +#if !PLATFORM_COMPACTFRAMEWORK + [DefaultValue(""), RefreshProperties(RefreshProperties.All), Editor("Microsoft.VSDesigner.Data.SQL.Design.SqlCommandTextEditor, Microsoft.VSDesigner, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", "System.Drawing.Design.UITypeEditor, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")] +#endif + public override string CommandText + { + get + { + return _commandText; + } + set + { + if (_commandText == value) return; + + if (_activeReader != null && _activeReader.IsAlive) + { + throw new InvalidOperationException("Cannot set CommandText while a DataReader is active"); + } + + ClearCommands(); + _commandText = value; + + if (_cnn == null) return; + } + } + + /// + /// The amount of time to wait for the connection to become available before erroring out + /// +#if !PLATFORM_COMPACTFRAMEWORK + [DefaultValue((int)30)] +#endif + public override int CommandTimeout + { + get + { + return _commandTimeout; + } + set + { + _commandTimeout = value; + } + } + + /// + /// The type of the command. SQLite only supports CommandType.Text + /// +#if !PLATFORM_COMPACTFRAMEWORK + [RefreshProperties(RefreshProperties.All), DefaultValue(CommandType.Text)] +#endif + public override CommandType CommandType + { + get + { + return CommandType.Text; + } + set + { + if (value != CommandType.Text) + { + throw new NotSupportedException(); + } + } + } + + /// + /// Forwards to the local CreateParameter() function + /// + /// + protected override DbParameter CreateDbParameter() + { + return CreateParameter(); + } + + /// + /// Create a new parameter + /// + /// + public new SQLiteParameter CreateParameter() + { + return new SQLiteParameter(); + } + + /// + /// The connection associated with this command + /// +#if !PLATFORM_COMPACTFRAMEWORK + [DefaultValue((string)null), Editor("Microsoft.VSDesigner.Data.Design.DbConnectionEditor, Microsoft.VSDesigner, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", "System.Drawing.Design.UITypeEditor, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")] +#endif + public new SQLiteConnection Connection + { + get { return _cnn; } + set + { + if (_activeReader != null && _activeReader.IsAlive) + throw new InvalidOperationException("Cannot set Connection while a DataReader is active"); + + if (_cnn != null) + { + ClearCommands(); + //_cnn.RemoveCommand(this); + } + + _cnn = value; + if (_cnn != null) + _version = _cnn._version; + + //if (_cnn != null) + // _cnn.AddCommand(this); + } + } + + /// + /// Forwards to the local Connection property + /// + protected override DbConnection DbConnection + { + get + { + return Connection; + } + set + { + Connection = (SQLiteConnection)value; + } + } + + /// + /// Returns the SQLiteParameterCollection for the given command + /// +#if !PLATFORM_COMPACTFRAMEWORK + [DesignerSerializationVisibility(DesignerSerializationVisibility.Content)] +#endif + public new SQLiteParameterCollection Parameters + { + get { return _parameterCollection; } + } + + /// + /// Forwards to the local Parameters property + /// + protected override DbParameterCollection DbParameterCollection + { + get + { + return Parameters; + } + } + + /// + /// The transaction associated with this command. SQLite only supports one transaction per connection, so this property forwards to the + /// command's underlying connection. + /// +#if !PLATFORM_COMPACTFRAMEWORK + [Browsable(false), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] +#endif + public new SQLiteTransaction Transaction + { + get { return _transaction; } + set + { + if (_cnn != null) + { + if (_activeReader != null && _activeReader.IsAlive) + throw new InvalidOperationException("Cannot set Transaction while a DataReader is active"); + + if (value != null) + { + if (value._cnn != _cnn) + throw new ArgumentException("Transaction is not associated with the command's connection"); + } + _transaction = value; + } + else + { + if (value != null) Connection = value.Connection; + _transaction = value; + } + } + } + + /// + /// Forwards to the local Transaction property + /// + protected override DbTransaction DbTransaction + { + get + { + return Transaction; + } + set + { + Transaction = (SQLiteTransaction)value; + } + } + + /// + /// This function ensures there are no active readers, that we have a valid connection, + /// that the connection is open, that all statements are prepared and all parameters are assigned + /// in preparation for allocating a data reader. + /// + private void InitializeForReader() + { + if (_activeReader != null && _activeReader.IsAlive) + throw new InvalidOperationException("DataReader already active on this command"); + + if (_cnn == null) + throw new InvalidOperationException("No connection associated with this command"); + + if (_cnn.State != ConnectionState.Open) + throw new InvalidOperationException("Database is not open"); + + // If the version of the connection has changed, clear out any previous commands before starting + if (_cnn._version != _version) + { + _version = _cnn._version; + ClearCommands(); + } + + // Map all parameters for statements already built + _parameterCollection.MapParameters(null); + + //// Set the default command timeout + //_cnn._sql.SetTimeout(_commandTimeout * 1000); + } + + /// + /// Creates a new SQLiteDataReader to execute/iterate the array of SQLite prepared statements + /// + /// The behavior the data reader should adopt + /// Returns a SQLiteDataReader object + protected override DbDataReader ExecuteDbDataReader(CommandBehavior behavior) + { + return ExecuteReader(behavior); + } + + /// + /// Overrides the default behavior to return a SQLiteDataReader specialization class + /// + /// The flags to be associated with the reader + /// A SQLiteDataReader + public new SQLiteDataReader ExecuteReader(CommandBehavior behavior) + { + InitializeForReader(); + + SQLiteDataReader rd = new SQLiteDataReader(this, behavior); + _activeReader = new WeakReference(rd, false); + + return rd; + } + + /// + /// Overrides the default behavior of DbDataReader to return a specialized SQLiteDataReader class + /// + /// A SQLiteDataReader + public new SQLiteDataReader ExecuteReader() + { + return ExecuteReader(CommandBehavior.Default); + } + + /// + /// Called by the SQLiteDataReader when the data reader is closed. + /// + internal void ClearDataReader() + { + _activeReader = null; + } + + /// + /// Execute the command and return the number of rows inserted/updated affected by it. + /// + /// + public override int ExecuteNonQuery() + { + using (SQLiteDataReader reader = ExecuteReader(CommandBehavior.SingleRow | CommandBehavior.SingleResult)) + { + while (reader.NextResult()) ; + return reader.RecordsAffected; + } + } + + /// + /// Execute the command and return the first column of the first row of the resultset + /// (if present), or null if no resultset was returned. + /// + /// The first column of the first row of the first resultset from the query + public override object ExecuteScalar() + { + using (SQLiteDataReader reader = ExecuteReader(CommandBehavior.SingleRow | CommandBehavior.SingleResult)) + { + if (reader.Read()) + return reader[0]; + } + return null; + } + + /// + /// Does nothing. Commands are prepared as they are executed the first time, and kept in prepared state afterwards. + /// + public override void Prepare() + { + } + + /// + /// Sets the method the SQLiteCommandBuilder uses to determine how to update inserted or updated rows in a DataTable. + /// + [DefaultValue(UpdateRowSource.None)] + public override UpdateRowSource UpdatedRowSource + { + get + { + return _updateRowSource; + } + set + { + _updateRowSource = value; + } + } + + /// + /// Determines if the command is visible at design time. Defaults to True. + /// +#if !PLATFORM_COMPACTFRAMEWORK + [DesignOnly(true), Browsable(false), DefaultValue(true), EditorBrowsable(EditorBrowsableState.Never)] +#endif + public override bool DesignTimeVisible + { + get + { + return _designTimeVisible; + } + set + { + _designTimeVisible = value; +#if !PLATFORM_COMPACTFRAMEWORK + TypeDescriptor.Refresh(this); +#endif + } + } + + /// + /// Clones a command, including all its parameters + /// + /// A new SQLiteCommand with the same commandtext, connection and parameters + public object Clone() + { + return new SQLiteCommand(this); + } + } } Index: System.Data.SQLite/SQLiteConnection.cs ================================================================== --- System.Data.SQLite/SQLiteConnection.cs +++ System.Data.SQLite/SQLiteConnection.cs @@ -1,2375 +1,2430 @@ -/******************************************************** - * ADO.NET 2.0 Data Provider for SQLite Version 3.X - * Written by Robert Simpson (robert@blackcastlesoft.com) - * - * Released to the public domain, use at your own risk! - ********************************************************/ - -namespace System.Data.SQLite -{ - using System; - using System.Data; - using System.Data.Common; - using System.Collections.Generic; - using System.Globalization; - using System.ComponentModel; - using System.Text; - using System.Runtime.InteropServices; - using System.IO; - - /// - /// SQLite implentation of DbConnection. - /// - /// - /// The ConnectionString property of the SQLiteConnection class can contain the following parameter(s), delimited with a semi-colon: - /// - /// - /// Parameter - /// Values - /// Required - /// Default - /// - /// - /// Data Source - /// {filename} - /// Y - /// - /// - /// - /// Version - /// 3 - /// N - /// 3 - /// - /// - /// UseUTF16Encoding - /// True
False
- /// N - /// False - ///
- /// - /// DateTimeFormat - /// Ticks - Use DateTime.Ticks
ISO8601 - Use ISO8601 DateTime format
- /// N - /// ISO8601 - ///
- /// - /// BinaryGUID - /// True - Store GUID columns in binary form
False - Store GUID columns as text
- /// N - /// True - ///
- /// - /// Cache Size - /// {size in bytes} - /// N - /// 2000 - /// - /// - /// Synchronous - /// Normal - Normal file flushing behavior
Full - Full flushing after all writes
Off - Underlying OS flushes I/O's
- /// N - /// Normal - ///
- /// - /// Page Size - /// {size in bytes} - /// N - /// 1024 - /// - /// - /// Password - /// {password} - /// N - /// - /// - /// - /// Enlist - /// Y - Automatically enlist in distributed transactions
N - No automatic enlistment
- /// N - /// Y - ///
- /// - /// Pooling - /// True - Use connection pooling
False - Do not use connection pooling
- /// N - /// False - ///
- /// - /// FailIfMissing - /// True - Don't create the database if it does not exist, throw an error instead
False - Automatically create the database if it does not exist
- /// N - /// False - ///
- /// - /// Max Page Count - /// {size in pages} - Limits the maximum number of pages (limits the size) of the database - /// N - /// 0 - /// - /// - /// Legacy Format - /// True - Use the more compatible legacy 3.x database format
False - Use the newer 3.3x database format which compresses numbers more effectively
- /// N - /// False - ///
- /// - /// Default Timeout - /// {time in seconds}
The default command timeout
- /// N - /// 30 - ///
- /// - /// Journal Mode - /// Delete - Delete the journal file after a commit
Persist - Zero out and leave the journal file on disk after a commit
Off - Disable the rollback journal entirely
- /// N - /// Delete - ///
- /// - /// Read Only - /// True - Open the database for read only access
False - Open the database for normal read/write access
- /// N - /// False - ///
- /// - /// Max Pool Size - /// The maximum number of connections for the given connection string that can be in the connection pool - /// N - /// 100 - /// - /// - /// Default IsolationLevel - /// The default transaciton isolation level - /// N - /// Serializable - /// - /// - /// Foreign Keys - /// True - Enables foreign key enforcement
False - Disables foreign key enforcement
- /// N - /// False - ///
- ///
- ///
- public sealed partial class SQLiteConnection : DbConnection, ICloneable - { - private const string _dataDirectory = "|DataDirectory|"; - private const string _masterdb = "sqlite_master"; - private const string _tempmasterdb = "sqlite_temp_master"; - - /// - /// State of the current connection - /// - private ConnectionState _connectionState; - /// - /// The connection string - /// - private string _connectionString; - /// - /// Nesting level of the transactions open on the connection - /// - internal int _transactionLevel; - - /// - /// The default isolation level for new transactions - /// - private IsolationLevel _defaultIsolation; - -#if !PLATFORM_COMPACTFRAMEWORK - /// - /// Whether or not the connection is enlisted in a distrubuted transaction - /// - internal SQLiteEnlistment _enlistment; -#endif - /// - /// The base SQLite object to interop with - /// - internal SQLiteBase _sql; - /// - /// The database filename minus path and extension - /// - private string _dataSource; - /// - /// Temporary password storage, emptied after the database has been opened - /// - private byte[] _password; - - /// - /// Default command timeout - /// - private int _defaultTimeout = 30; - - internal bool _binaryGuid; - - internal long _version; - - private event SQLiteUpdateEventHandler _updateHandler; - private event SQLiteCommitHandler _commitHandler; - private event EventHandler _rollbackHandler; - - private SQLiteUpdateCallback _updateCallback; - private SQLiteCommitCallback _commitCallback; - private SQLiteRollbackCallback _rollbackCallback; - - /// - /// This event is raised whenever the database is opened or closed. - /// - public override event StateChangeEventHandler StateChange; - - /// - /// Constructs a new SQLiteConnection object - /// - /// - /// Default constructor - /// - public SQLiteConnection() - : this("") - { - } - - /// - /// Initializes the connection with the specified connection string - /// - /// The connection string to use on the connection - public SQLiteConnection(string connectionString) - { - _connectionState = ConnectionState.Closed; - _connectionString = ""; - //_commandList = new List(); - - if (connectionString != null) - ConnectionString = connectionString; - } - - /// - /// Clones the settings and connection string from an existing connection. If the existing connection is already open, this - /// function will open its own connection, enumerate any attached databases of the original connection, and automatically - /// attach to them. - /// - /// - public SQLiteConnection(SQLiteConnection connection) - : this(connection.ConnectionString) - { - string str; - - if (connection.State == ConnectionState.Open) - { - Open(); - - // Reattach all attached databases from the existing connection - using (DataTable tbl = connection.GetSchema("Catalogs")) - { - foreach (DataRow row in tbl.Rows) - { - str = row[0].ToString(); - if (String.Compare(str, "main", StringComparison.OrdinalIgnoreCase) != 0 - && String.Compare(str, "temp", StringComparison.OrdinalIgnoreCase) != 0) - { - using (SQLiteCommand cmd = CreateCommand()) - { - cmd.CommandText = String.Format(CultureInfo.InvariantCulture, "ATTACH DATABASE '{0}' AS [{1}]", row[1], row[0]); - cmd.ExecuteNonQuery(); - } - } - } - } - } - } - -#if PLATFORM_COMPACTFRAMEWORK - /// - /// Obsolete - /// - public override int ConnectionTimeout - { - get - { - return 30; - } - } -#endif - - /// - /// Creates a clone of the connection. All attached databases and user-defined functions are cloned. If the existing connection is open, the cloned connection - /// will also be opened. - /// - /// - public object Clone() - { - return new SQLiteConnection(this); - } - - /// - /// Disposes of the SQLiteConnection, closing it if it is active. - /// - /// True if the connection is being explicitly closed. - protected override void Dispose(bool disposing) - { - base.Dispose(disposing); - - if (disposing) - Close(); - } - - /// - /// Creates a database file. This just creates a zero-byte file which SQLite - /// will turn into a database when the file is opened properly. - /// - /// The file to create - static public void CreateFile(string databaseFileName) - { - FileStream fs = File.Create(databaseFileName); - fs.Close(); - } - - /// - /// Raises the state change event when the state of the connection changes - /// - /// The new state. If it is different from the previous state, an event is raised. - internal void OnStateChange(ConnectionState newState) - { - ConnectionState oldState = _connectionState; - _connectionState = newState; - - if (StateChange != null && oldState != newState) - { - StateChangeEventArgs e = new StateChangeEventArgs(oldState, newState); - StateChange(this, e); - } - } - - /// - /// OBSOLETE. Creates a new SQLiteTransaction if one isn't already active on the connection. - /// - /// This parameter is ignored. - /// When TRUE, SQLite defers obtaining a write lock until a write operation is requested. - /// When FALSE, a writelock is obtained immediately. The default is TRUE, but in a multi-threaded multi-writer - /// environment, one may instead choose to lock the database immediately to avoid any possible writer deadlock. - /// Returns a SQLiteTransaction object. - [Obsolete("Use one of the standard BeginTransaction methods, this one will be removed soon")] - public SQLiteTransaction BeginTransaction(IsolationLevel isolationLevel, bool deferredLock) - { - return (SQLiteTransaction)BeginDbTransaction(deferredLock == false ? IsolationLevel.Serializable : IsolationLevel.ReadCommitted); - } - - /// - /// OBSOLETE. Creates a new SQLiteTransaction if one isn't already active on the connection. - /// - /// When TRUE, SQLite defers obtaining a write lock until a write operation is requested. - /// When FALSE, a writelock is obtained immediately. The default is false, but in a multi-threaded multi-writer - /// environment, one may instead choose to lock the database immediately to avoid any possible writer deadlock. - /// Returns a SQLiteTransaction object. - [Obsolete("Use one of the standard BeginTransaction methods, this one will be removed soon")] - public SQLiteTransaction BeginTransaction(bool deferredLock) - { - return (SQLiteTransaction)BeginDbTransaction(deferredLock == false ? IsolationLevel.Serializable : IsolationLevel.ReadCommitted); - } - - /// - /// Creates a new SQLiteTransaction if one isn't already active on the connection. - /// - /// Supported isolation levels are Serializable, ReadCommitted and Unspecified. - /// - /// Unspecified will use the default isolation level specified in the connection string. If no isolation level is specified in the - /// connection string, Serializable is used. - /// Serializable transactions are the default. In this mode, the engine gets an immediate lock on the database, and no other threads - /// may begin a transaction. Other threads may read from the database, but not write. - /// With a ReadCommitted isolation level, locks are deferred and elevated as needed. It is possible for multiple threads to start - /// a transaction in ReadCommitted mode, but if a thread attempts to commit a transaction while another thread - /// has a ReadCommitted lock, it may timeout or cause a deadlock on both threads until both threads' CommandTimeout's are reached. - /// - /// Returns a SQLiteTransaction object. - public new SQLiteTransaction BeginTransaction(IsolationLevel isolationLevel) - { - return (SQLiteTransaction)BeginDbTransaction(isolationLevel); - } - - /// - /// Creates a new SQLiteTransaction if one isn't already active on the connection. - /// - /// Returns a SQLiteTransaction object. - public new SQLiteTransaction BeginTransaction() - { - return (SQLiteTransaction)BeginDbTransaction(_defaultIsolation); - } - - /// - /// Forwards to the local BeginTransaction() function - /// - /// Supported isolation levels are Unspecified, Serializable, and ReadCommitted - /// - protected override DbTransaction BeginDbTransaction(IsolationLevel isolationLevel) - { - if (_connectionState != ConnectionState.Open) - throw new InvalidOperationException(); - - if (isolationLevel == IsolationLevel.Unspecified) isolationLevel = _defaultIsolation; - - if (isolationLevel != IsolationLevel.Serializable && isolationLevel != IsolationLevel.ReadCommitted) - throw new ArgumentException("isolationLevel"); - - return new SQLiteTransaction(this, isolationLevel != IsolationLevel.Serializable); - } - - /// - /// Not implemented - /// - /// - public override void ChangeDatabase(string databaseName) - { - throw new NotImplementedException(); - } - - /// - /// When the database connection is closed, all commands linked to this connection are automatically reset. - /// - public override void Close() - { - if (_sql != null) - { -#if !PLATFORM_COMPACTFRAMEWORK - if (_enlistment != null) - { - // If the connection is enlisted in a transaction scope and the scope is still active, - // we cannot truly shut down this connection until the scope has completed. Therefore make a - // hidden connection temporarily to hold open the connection until the scope has completed. - SQLiteConnection cnn = new SQLiteConnection(); - cnn._sql = _sql; - cnn._transactionLevel = _transactionLevel; - cnn._enlistment = _enlistment; - cnn._connectionState = _connectionState; - cnn._version = _version; - - cnn._enlistment._transaction._cnn = cnn; - cnn._enlistment._disposeConnection = true; - _sql = null; - _enlistment = null; - } -#endif - if (_sql != null) - { - _sql.Close(); - } - _sql = null; - _transactionLevel = 0; - } - OnStateChange(ConnectionState.Closed); - } - - /// - /// Clears the connection pool associated with the connection. Any other active connections using the same database file - /// will be discarded instead of returned to the pool when they are closed. - /// - /// - public static void ClearPool(SQLiteConnection connection) - { - if (connection._sql == null) return; - connection._sql.ClearPool(); - } - - /// - /// Clears all connection pools. Any active connections will be discarded instead of sent to the pool when they are closed. - /// - public static void ClearAllPools() - { - SQLiteConnectionPool.ClearAllPools(); - } - - /// - /// The connection string containing the parameters for the connection - /// - /// - /// - /// - /// Parameter - /// Values - /// Required - /// Default - /// - /// - /// Data Source - /// {filename} - /// Y - /// - /// - /// - /// Version - /// 3 - /// N - /// 3 - /// - /// - /// UseUTF16Encoding - /// True
False
- /// N - /// False - ///
- /// - /// DateTimeFormat - /// Ticks - Use DateTime.Ticks
ISO8601 - Use ISO8601 DateTime format
JulianDay - Use JulianDay format
- /// N - /// ISO8601 - ///
- /// - /// BinaryGUID - /// Yes/On/1 - Store GUID columns in binary form
No/Off/0 - Store GUID columns as text
- /// N - /// On - ///
- /// - /// Cache Size - /// {size in bytes} - /// N - /// 2000 - /// - /// - /// Synchronous - /// Normal - Normal file flushing behavior
Full - Full flushing after all writes
Off - Underlying OS flushes I/O's
- /// N - /// Normal - ///
- /// - /// Page Size - /// {size in bytes} - /// N - /// 1024 - /// - /// - /// Password - /// {password} - /// N - /// - /// - /// - /// Enlist - /// Y - Automatically enlist in distributed transactions
N - No automatic enlistment
- /// N - /// Y - ///
- /// - /// Pooling - /// True - Use connection pooling
False - Do not use connection pooling
- /// N - /// False - ///
- /// - /// FailIfMissing - /// True - Don't create the database if it does not exist, throw an error instead
False - Automatically create the database if it does not exist
- /// N - /// False - ///
- /// - /// Max Page Count - /// {size in pages} - Limits the maximum number of pages (limits the size) of the database - /// N - /// 0 - /// - /// - /// Legacy Format - /// True - Use the more compatible legacy 3.x database format
False - Use the newer 3.3x database format which compresses numbers more effectively
- /// N - /// False - ///
- /// - /// Default Timeout - /// {time in seconds}
The default command timeout
- /// N - /// 30 - ///
- /// - /// Journal Mode - /// Delete - Delete the journal file after a commit
Persist - Zero out and leave the journal file on disk after a commit
Off - Disable the rollback journal entirely
- /// N - /// Delete - ///
- /// - /// Read Only - /// True - Open the database for read only access
False - Open the database for normal read/write access
- /// N - /// False - ///
- /// - /// Max Pool Size - /// The maximum number of connections for the given connection string that can be in the connection pool - /// N - /// 100 - /// - /// - /// Default IsolationLevel - /// The default transaciton isolation level - /// N - /// Serializable - /// - /// - /// Foreign Keys - /// True - Enables foreign key enforcement
False - Disables foreign key enforcement
- /// N - /// False - ///
- ///
- ///
-#if !PLATFORM_COMPACTFRAMEWORK - [RefreshProperties(RefreshProperties.All), DefaultValue("")] - [Editor("SQLite.Designer.SQLiteConnectionStringEditor, SQLite.Designer, Version=1.0.37.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139", "System.Drawing.Design.UITypeEditor, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")] -#endif - public override string ConnectionString - { - get - { - return _connectionString; - } - set - { - if (value == null) - throw new ArgumentNullException(); - - else if (_connectionState != ConnectionState.Closed) - throw new InvalidOperationException(); - - _connectionString = value; - } - } - - /// - /// Create a new SQLiteCommand and associate it with this connection. - /// - /// Returns an instantiated SQLiteCommand object already assigned to this connection. - public new SQLiteCommand CreateCommand() - { - return new SQLiteCommand(this); - } - - /// - /// Forwards to the local CreateCommand() function - /// - /// - protected override DbCommand CreateDbCommand() - { - return CreateCommand(); - } - - /// - /// Returns the filename without extension or path - /// -#if !PLATFORM_COMPACTFRAMEWORK - [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] -#endif - public override string DataSource - { - get - { - return _dataSource; - } - } - - /// - /// Returns an empty string - /// -#if !PLATFORM_COMPACTFRAMEWORK - [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] -#endif - public override string Database - { - get - { - return "main"; - } - } - - internal static string MapUriPath(string path) - { - if (path.StartsWith ("file://", StringComparison.OrdinalIgnoreCase)) - return path.Substring (7); - else if (path.StartsWith ("file:", StringComparison.OrdinalIgnoreCase)) - return path.Substring (5); - else if (path.StartsWith ("/", StringComparison.OrdinalIgnoreCase)) - return path; - else - throw new InvalidOperationException ("Invalid connection string: invalid URI"); - } - - /// - /// Parses the connection string into component parts - /// - /// The connection string to parse - /// An array of key-value pairs representing each parameter of the connection string - internal static SortedList ParseConnectionString(string connectionString) - { - string s = connectionString; - int n; - SortedList ls = new SortedList(StringComparer.OrdinalIgnoreCase); - - // First split into semi-colon delimited values. The Split() function of SQLiteBase accounts for and properly - // skips semi-colons in quoted strings - string[] arParts = SQLiteConvert.Split(s, ';'); - string[] arPiece; - - int x = arParts.Length; - // For each semi-colon piece, split into key and value pairs by the presence of the = sign - for (n = 0; n < x; n++) - { - arPiece = SQLiteConvert.Split(arParts[n], '='); - if (arPiece.Length == 2) - { - ls.Add(arPiece[0], arPiece[1]); - } - else throw new ArgumentException(String.Format(CultureInfo.CurrentCulture, "Invalid ConnectionString format for parameter \"{0}\"", (arPiece.Length > 0) ? arPiece[0] : "null")); - } - return ls; - } - -#if !PLATFORM_COMPACTFRAMEWORK - /// - /// Manual distributed transaction enlistment support - /// - /// The distributed transaction to enlist in - public override void EnlistTransaction(System.Transactions.Transaction transaction) - { - if (_transactionLevel > 0 && transaction != null) - throw new ArgumentException("Unable to enlist in transaction, a local transaction already exists"); - - if (_enlistment != null && transaction == _enlistment._scope) - return; - else if (_enlistment != null) - throw new ArgumentException("Already enlisted in a transaction"); - - _enlistment = new SQLiteEnlistment(this, transaction); - } -#endif - - /// - /// Looks for a key in the array of key/values of the parameter string. If not found, return the specified default value - /// - /// The list to look in - /// The key to find - /// The default value to return if the key is not found - /// The value corresponding to the specified key, or the default value if not found. - static internal string FindKey(SortedList items, string key, string defValue) - { - string ret; - - if (items.TryGetValue(key, out ret)) return ret; - - return defValue; - } - - /// - /// Opens the connection using the parameters found in the ConnectionString - /// - public override void Open() - { - if (_connectionState != ConnectionState.Closed) - throw new InvalidOperationException(); - - Close(); - - SortedList opts = ParseConnectionString(_connectionString); - string fileName; - - if (Convert.ToInt32(FindKey(opts, "Version", "3"), CultureInfo.InvariantCulture) != 3) - throw new NotSupportedException("Only SQLite Version 3 is supported at this time"); - - fileName = FindKey(opts, "Data Source", ""); - - if (String.IsNullOrEmpty(fileName)) - { - fileName = FindKey(opts, "Uri", ""); - if (String.IsNullOrEmpty(fileName)) - throw new ArgumentException("Data Source cannot be empty. Use :memory: to open an in-memory database"); - else - fileName = MapUriPath(fileName); - } - - if (String.Compare(fileName, ":MEMORY:", StringComparison.OrdinalIgnoreCase) == 0) - fileName = ":memory:"; - else - { -#if PLATFORM_COMPACTFRAMEWORK - if (fileName.StartsWith(".\\")) - fileName = Path.GetDirectoryName(System.Reflection.Assembly.GetCallingAssembly().GetName().CodeBase) + fileName.Substring(1); -#endif - fileName = ExpandFileName(fileName); - } - try - { - bool usePooling = (SQLiteConvert.ToBoolean(FindKey(opts, "Pooling", Boolean.FalseString)) == true); - bool bUTF16 = (SQLiteConvert.ToBoolean(FindKey(opts, "UseUTF16Encoding", Boolean.FalseString)) == true); - int maxPoolSize = Convert.ToInt32(FindKey(opts, "Max Pool Size", "100"), CultureInfo.InvariantCulture); - - _defaultTimeout = Convert.ToInt32(FindKey(opts, "Default Timeout", "30"), CultureInfo.CurrentCulture); - - _defaultIsolation = (IsolationLevel)Enum.Parse(typeof(IsolationLevel), FindKey(opts, "Default IsolationLevel", "Serializable"), true); - if (_defaultIsolation != IsolationLevel.Serializable && _defaultIsolation != IsolationLevel.ReadCommitted) - throw new NotSupportedException("Invalid Default IsolationLevel specified"); - - SQLiteDateFormats dateFormat = (SQLiteDateFormats)Enum.Parse(typeof(SQLiteDateFormats), FindKey(opts, "DateTimeFormat", "ISO8601"), true); - //string temp = FindKey(opts, "DateTimeFormat", "ISO8601"); - //if (String.Compare(temp, "ticks", StringComparison.OrdinalIgnoreCase) == 0) dateFormat = SQLiteDateFormats.Ticks; - //else if (String.Compare(temp, "julianday", StringComparison.OrdinalIgnoreCase) == 0) dateFormat = SQLiteDateFormats.JulianDay; - - if (bUTF16) // SQLite automatically sets the encoding of the database to UTF16 if called from sqlite3_open16() - _sql = new SQLite3_UTF16(dateFormat); - else - _sql = new SQLite3(dateFormat); - - SQLiteOpenFlagsEnum flags = SQLiteOpenFlagsEnum.None; - - if (SQLiteConvert.ToBoolean(FindKey(opts, "FailIfMissing", Boolean.FalseString)) == false) - flags |= SQLiteOpenFlagsEnum.Create; - - if (SQLiteConvert.ToBoolean(FindKey(opts, "Read Only", Boolean.FalseString)) == true) - flags |= SQLiteOpenFlagsEnum.ReadOnly; - else - flags |= SQLiteOpenFlagsEnum.ReadWrite; - - _sql.Open(fileName, flags, maxPoolSize, usePooling); - - _binaryGuid = (SQLiteConvert.ToBoolean(FindKey(opts, "BinaryGUID", Boolean.TrueString)) == true); - - string password = FindKey(opts, "Password", null); - - if (String.IsNullOrEmpty(password) == false) - _sql.SetPassword(System.Text.UTF8Encoding.UTF8.GetBytes(password)); - else if (_password != null) - _sql.SetPassword(_password); - _password = null; - - _dataSource = Path.GetFileNameWithoutExtension(fileName); - - _version++; - - ConnectionState oldstate = _connectionState; - _connectionState = ConnectionState.Open; - try - { - using (SQLiteCommand cmd = CreateCommand()) - { - string defValue; - - if (fileName != ":memory:") - { - defValue = FindKey(opts, "Page Size", "1024"); - if (Convert.ToInt32(defValue, CultureInfo.InvariantCulture) != 1024) - { - cmd.CommandText = String.Format(CultureInfo.InvariantCulture, "PRAGMA page_size={0}", defValue); - cmd.ExecuteNonQuery(); - } - } - - defValue = FindKey(opts, "Max Page Count", "0"); - if (Convert.ToInt32(defValue, CultureInfo.InvariantCulture) != 0) - { - cmd.CommandText = String.Format(CultureInfo.InvariantCulture, "PRAGMA max_page_count={0}", defValue); - cmd.ExecuteNonQuery(); - } - - defValue = FindKey(opts, "Legacy Format", Boolean.FalseString); - cmd.CommandText = String.Format(CultureInfo.InvariantCulture, "PRAGMA legacy_file_format={0}", SQLiteConvert.ToBoolean(defValue) == true ? "ON" : "OFF"); - cmd.ExecuteNonQuery(); - - defValue = FindKey(opts, "Synchronous", "Normal"); - if (String.Compare(defValue, "Full", StringComparison.OrdinalIgnoreCase) != 0) - { - cmd.CommandText = String.Format(CultureInfo.InvariantCulture, "PRAGMA synchronous={0}", defValue); - cmd.ExecuteNonQuery(); - } - - defValue = FindKey(opts, "Cache Size", "2000"); - if (Convert.ToInt32(defValue, CultureInfo.InvariantCulture) != 2000) - { - cmd.CommandText = String.Format(CultureInfo.InvariantCulture, "PRAGMA cache_size={0}", defValue); - cmd.ExecuteNonQuery(); - } - - defValue = FindKey(opts, "Journal Mode", "Delete"); - if (String.Compare(defValue, "Delete", StringComparison.OrdinalIgnoreCase) != 0) - { - cmd.CommandText = String.Format(CultureInfo.InvariantCulture, "PRAGMA journal_mode={0}", defValue); - cmd.ExecuteNonQuery(); - } - - defValue = FindKey(opts, "Foreign Keys", Boolean.FalseString); - cmd.CommandText = String.Format(CultureInfo.InvariantCulture, "PRAGMA foreign_keys={0}", SQLiteConvert.ToBoolean(defValue) == true ? "ON" : "OFF"); - cmd.ExecuteNonQuery(); - } - - if (_commitHandler != null) - _sql.SetCommitHook(_commitCallback); - - if (_updateHandler != null) - _sql.SetUpdateHook(_updateCallback); - - if (_rollbackHandler != null) - _sql.SetRollbackHook(_rollbackCallback); - -#if !PLATFORM_COMPACTFRAMEWORK - if (Transactions.Transaction.Current != null && SQLiteConvert.ToBoolean(FindKey(opts, "Enlist", Boolean.TrueString)) == true) - EnlistTransaction(Transactions.Transaction.Current); -#endif - - _connectionState = oldstate; - OnStateChange(ConnectionState.Open); - } - catch - { - _connectionState = oldstate; - throw; - } - } - catch (SQLiteException) - { - Close(); - throw; - } - } - - /// - /// Gets/sets the default command timeout for newly-created commands. This is especially useful for - /// commands used internally such as inside a SQLiteTransaction, where setting the timeout is not possible. - /// This can also be set in the ConnectionString with "Default Timeout" - /// - public int DefaultTimeout - { - get { return _defaultTimeout; } - set { _defaultTimeout = value; } - } - - /// - /// Returns the version of the underlying SQLite database engine - /// -#if !PLATFORM_COMPACTFRAMEWORK - [Browsable(false), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] -#endif - public override string ServerVersion - { - get - { - return SQLiteVersion; - //if (_connectionState != ConnectionState.Open) - // throw new InvalidOperationException(); - - //return _sql.Version; - } - } - - /// - /// Returns the version of the underlying SQLite database engine - /// - public static string SQLiteVersion - { - get { return SQLite3.SQLiteVersion; } - } - - /// - /// Returns the state of the connection. - /// -#if !PLATFORM_COMPACTFRAMEWORK - [Browsable(false), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] -#endif - public override ConnectionState State - { - get - { - return _connectionState; - } - } - - /// - /// Change the password (or assign a password) to an open database. - /// - /// - /// No readers or writers may be active for this process. The database must already be open - /// and if it already was password protected, the existing password must already have been supplied. - /// - /// The new password to assign to the database - public void ChangePassword(string newPassword) - { - ChangePassword(String.IsNullOrEmpty(newPassword) ? null : System.Text.UTF8Encoding.UTF8.GetBytes(newPassword)); - } - - /// - /// Change the password (or assign a password) to an open database. - /// - /// - /// No readers or writers may be active for this process. The database must already be open - /// and if it already was password protected, the existing password must already have been supplied. - /// - /// The new password to assign to the database - public void ChangePassword(byte[] newPassword) - { - if (_connectionState != ConnectionState.Open) - throw new InvalidOperationException("Database must be opened before changing the password."); - - _sql.ChangePassword(newPassword); - } - - /// - /// Sets the password for a password-protected database. A password-protected database is - /// unusable for any operation until the password has been set. - /// - /// The password for the database - public void SetPassword(string databasePassword) - { - SetPassword(String.IsNullOrEmpty(databasePassword) ? null : System.Text.UTF8Encoding.UTF8.GetBytes(databasePassword)); - } - - /// - /// Sets the password for a password-protected database. A password-protected database is - /// unusable for any operation until the password has been set. - /// - /// The password for the database - public void SetPassword(byte[] databasePassword) - { - if (_connectionState != ConnectionState.Closed) - throw new InvalidOperationException("Password can only be set before the database is opened."); - - if (databasePassword != null) - if (databasePassword.Length == 0) databasePassword = null; - - _password = databasePassword; - } - - /// - /// Expand the filename of the data source, resolving the |DataDirectory| macro as appropriate. - /// - /// The database filename to expand - /// The expanded path and filename of the filename - private string ExpandFileName(string sourceFile) - { - if (String.IsNullOrEmpty(sourceFile)) return sourceFile; - - if (sourceFile.StartsWith(_dataDirectory, StringComparison.OrdinalIgnoreCase)) - { - string dataDirectory; - -#if PLATFORM_COMPACTFRAMEWORK - dataDirectory = Path.GetDirectoryName(System.Reflection.Assembly.GetCallingAssembly().GetName().CodeBase); -#else - dataDirectory = AppDomain.CurrentDomain.GetData("DataDirectory") as string; - if (String.IsNullOrEmpty(dataDirectory)) - dataDirectory = AppDomain.CurrentDomain.BaseDirectory; -#endif - - if (sourceFile.Length > _dataDirectory.Length) - { - if (sourceFile[_dataDirectory.Length] == Path.DirectorySeparatorChar || - sourceFile[_dataDirectory.Length] == Path.AltDirectorySeparatorChar) - sourceFile = sourceFile.Remove(_dataDirectory.Length, 1); - } - sourceFile = Path.Combine(dataDirectory, sourceFile.Substring(_dataDirectory.Length)); - } - -#if !PLATFORM_COMPACTFRAMEWORK - sourceFile = Path.GetFullPath(sourceFile); -#endif - - return sourceFile; - } - - /// - /// The following commands are used to extract schema information out of the database. Valid schema types are: - /// - /// - /// MetaDataCollections - /// - /// - /// DataSourceInformation - /// - /// - /// Catalogs - /// - /// - /// Columns - /// - /// - /// ForeignKeys - /// - /// - /// Indexes - /// - /// - /// IndexColumns - /// - /// - /// Tables - /// - /// - /// Views - /// - /// - /// ViewColumns - /// - /// - /// - /// - /// Returns the MetaDataCollections schema - /// - /// A DataTable of the MetaDataCollections schema - public override DataTable GetSchema() - { - return GetSchema("MetaDataCollections", null); - } - - /// - /// Returns schema information of the specified collection - /// - /// The schema collection to retrieve - /// A DataTable of the specified collection - public override DataTable GetSchema(string collectionName) - { - return GetSchema(collectionName, new string[0]); - } - - /// - /// Retrieves schema information using the specified constraint(s) for the specified collection - /// - /// The collection to retrieve - /// The restrictions to impose - /// A DataTable of the specified collection - public override DataTable GetSchema(string collectionName, string[] restrictionValues) - { - if (_connectionState != ConnectionState.Open) - throw new InvalidOperationException(); - - string[] parms = new string[5]; - - if (restrictionValues == null) restrictionValues = new string[0]; - restrictionValues.CopyTo(parms, 0); - - switch (collectionName.ToUpper(CultureInfo.InvariantCulture)) - { - case "METADATACOLLECTIONS": - return Schema_MetaDataCollections(); - case "DATASOURCEINFORMATION": - return Schema_DataSourceInformation(); - case "DATATYPES": - return Schema_DataTypes(); - case "COLUMNS": - case "TABLECOLUMNS": - return Schema_Columns(parms[0], parms[2], parms[3]); - case "INDEXES": - return Schema_Indexes(parms[0], parms[2], parms[3]); - case "TRIGGERS": - return Schema_Triggers(parms[0], parms[2], parms[3]); - case "INDEXCOLUMNS": - return Schema_IndexColumns(parms[0], parms[2], parms[3], parms[4]); - case "TABLES": - return Schema_Tables(parms[0], parms[2], parms[3]); - case "VIEWS": - return Schema_Views(parms[0], parms[2]); - case "VIEWCOLUMNS": - return Schema_ViewColumns(parms[0], parms[2], parms[3]); - case "FOREIGNKEYS": - return Schema_ForeignKeys(parms[0], parms[2], parms[3]); - case "CATALOGS": - return Schema_Catalogs(parms[0]); - case "RESERVEDWORDS": - return Schema_ReservedWords(); - } - throw new NotSupportedException(); - } - - private static DataTable Schema_ReservedWords() - { - DataTable tbl = new DataTable("ReservedWords"); - - tbl.Locale = CultureInfo.InvariantCulture; - tbl.Columns.Add("ReservedWord", typeof(string)); - tbl.Columns.Add("MaximumVersion", typeof(string)); - tbl.Columns.Add("MinimumVersion", typeof(string)); - - tbl.BeginLoadData(); - DataRow row; - foreach (string word in SR.Keywords.Split(new char[] { ',' })) - { - row = tbl.NewRow(); - row[0] = word; - tbl.Rows.Add(row); - } - - tbl.AcceptChanges(); - tbl.EndLoadData(); - - return tbl; - } - - /// - /// Builds a MetaDataCollections schema datatable - /// - /// DataTable - private static DataTable Schema_MetaDataCollections() - { - DataTable tbl = new DataTable("MetaDataCollections"); - - tbl.Locale = CultureInfo.InvariantCulture; - tbl.Columns.Add("CollectionName", typeof(string)); - tbl.Columns.Add("NumberOfRestrictions", typeof(int)); - tbl.Columns.Add("NumberOfIdentifierParts", typeof(int)); - - tbl.BeginLoadData(); - - StringReader reader = new StringReader(SR.MetaDataCollections); - tbl.ReadXml(reader); - reader.Close(); - - tbl.AcceptChanges(); - tbl.EndLoadData(); - - return tbl; - } - - /// - /// Builds a DataSourceInformation datatable - /// - /// DataTable - private DataTable Schema_DataSourceInformation() - { - DataTable tbl = new DataTable("DataSourceInformation"); - DataRow row; - - tbl.Locale = CultureInfo.InvariantCulture; - tbl.Columns.Add(DbMetaDataColumnNames.CompositeIdentifierSeparatorPattern, typeof(string)); - tbl.Columns.Add(DbMetaDataColumnNames.DataSourceProductName, typeof(string)); - tbl.Columns.Add(DbMetaDataColumnNames.DataSourceProductVersion, typeof(string)); - tbl.Columns.Add(DbMetaDataColumnNames.DataSourceProductVersionNormalized, typeof(string)); - tbl.Columns.Add(DbMetaDataColumnNames.GroupByBehavior, typeof(int)); - tbl.Columns.Add(DbMetaDataColumnNames.IdentifierPattern, typeof(string)); - tbl.Columns.Add(DbMetaDataColumnNames.IdentifierCase, typeof(int)); - tbl.Columns.Add(DbMetaDataColumnNames.OrderByColumnsInSelect, typeof(bool)); - tbl.Columns.Add(DbMetaDataColumnNames.ParameterMarkerFormat, typeof(string)); - tbl.Columns.Add(DbMetaDataColumnNames.ParameterMarkerPattern, typeof(string)); - tbl.Columns.Add(DbMetaDataColumnNames.ParameterNameMaxLength, typeof(int)); - tbl.Columns.Add(DbMetaDataColumnNames.ParameterNamePattern, typeof(string)); - tbl.Columns.Add(DbMetaDataColumnNames.QuotedIdentifierPattern, typeof(string)); - tbl.Columns.Add(DbMetaDataColumnNames.QuotedIdentifierCase, typeof(int)); - tbl.Columns.Add(DbMetaDataColumnNames.StatementSeparatorPattern, typeof(string)); - tbl.Columns.Add(DbMetaDataColumnNames.StringLiteralPattern, typeof(string)); - tbl.Columns.Add(DbMetaDataColumnNames.SupportedJoinOperators, typeof(int)); - - tbl.BeginLoadData(); - - row = tbl.NewRow(); - row.ItemArray = new object[] { - null, - "SQLite", - _sql.Version, - _sql.Version, - 3, - @"(^\[\p{Lo}\p{Lu}\p{Ll}_@#][\p{Lo}\p{Lu}\p{Ll}\p{Nd}@$#_]*$)|(^\[[^\]\0]|\]\]+\]$)|(^\""[^\""\0]|\""\""+\""$)", - 1, - false, - "{0}", - @"@[\p{Lo}\p{Lu}\p{Ll}\p{Lm}_@#][\p{Lo}\p{Lu}\p{Ll}\p{Lm}\p{Nd}\uff3f_@#\$]*(?=\s+|$)", - 255, - @"^[\p{Lo}\p{Lu}\p{Ll}\p{Lm}_@#][\p{Lo}\p{Lu}\p{Ll}\p{Lm}\p{Nd}\uff3f_@#\$]*(?=\s+|$)", - @"(([^\[]|\]\])*)", - 1, - ";", - @"'(([^']|'')*)'", - 15 - }; - tbl.Rows.Add(row); - - tbl.AcceptChanges(); - tbl.EndLoadData(); - - return tbl; - } - - /// - /// Build a Columns schema - /// - /// The catalog (attached database) to query, can be null - /// The table to retrieve schema information for, must not be null - /// The column to retrieve schema information for, can be null - /// DataTable - private DataTable Schema_Columns(string strCatalog, string strTable, string strColumn) - { - DataTable tbl = new DataTable("Columns"); - DataRow row; - - tbl.Locale = CultureInfo.InvariantCulture; - tbl.Columns.Add("TABLE_CATALOG", typeof(string)); - tbl.Columns.Add("TABLE_SCHEMA", typeof(string)); - tbl.Columns.Add("TABLE_NAME", typeof(string)); - tbl.Columns.Add("COLUMN_NAME", typeof(string)); - tbl.Columns.Add("COLUMN_GUID", typeof(Guid)); - tbl.Columns.Add("COLUMN_PROPID", typeof(long)); - tbl.Columns.Add("ORDINAL_POSITION", typeof(int)); - tbl.Columns.Add("COLUMN_HASDEFAULT", typeof(bool)); - tbl.Columns.Add("COLUMN_DEFAULT", typeof(string)); - tbl.Columns.Add("COLUMN_FLAGS", typeof(long)); - tbl.Columns.Add("IS_NULLABLE", typeof(bool)); - tbl.Columns.Add("DATA_TYPE", typeof(string)); - tbl.Columns.Add("TYPE_GUID", typeof(Guid)); - tbl.Columns.Add("CHARACTER_MAXIMUM_LENGTH", typeof(int)); - tbl.Columns.Add("CHARACTER_OCTET_LENGTH", typeof(int)); - tbl.Columns.Add("NUMERIC_PRECISION", typeof(int)); - tbl.Columns.Add("NUMERIC_SCALE", typeof(int)); - tbl.Columns.Add("DATETIME_PRECISION", typeof(long)); - tbl.Columns.Add("CHARACTER_SET_CATALOG", typeof(string)); - tbl.Columns.Add("CHARACTER_SET_SCHEMA", typeof(string)); - tbl.Columns.Add("CHARACTER_SET_NAME", typeof(string)); - tbl.Columns.Add("COLLATION_CATALOG", typeof(string)); - tbl.Columns.Add("COLLATION_SCHEMA", typeof(string)); - tbl.Columns.Add("COLLATION_NAME", typeof(string)); - tbl.Columns.Add("DOMAIN_CATALOG", typeof(string)); - tbl.Columns.Add("DOMAIN_NAME", typeof(string)); - tbl.Columns.Add("DESCRIPTION", typeof(string)); - tbl.Columns.Add("PRIMARY_KEY", typeof(bool)); - tbl.Columns.Add("EDM_TYPE", typeof(string)); - tbl.Columns.Add("AUTOINCREMENT", typeof(bool)); - tbl.Columns.Add("UNIQUE", typeof(bool)); - - tbl.BeginLoadData(); - - if (String.IsNullOrEmpty(strCatalog)) strCatalog = "main"; - - string master = (String.Compare(strCatalog, "temp", StringComparison.OrdinalIgnoreCase) == 0) ? _tempmasterdb : _masterdb; - - using (SQLiteCommand cmdTables = new SQLiteCommand(String.Format(CultureInfo.InvariantCulture, "SELECT * FROM [{0}].[{1}] WHERE [type] LIKE 'table' OR [type] LIKE 'view'", strCatalog, master), this)) - using (SQLiteDataReader rdTables = cmdTables.ExecuteReader()) - { - while (rdTables.Read()) - { - if (String.IsNullOrEmpty(strTable) || String.Compare(strTable, rdTables.GetString(2), StringComparison.OrdinalIgnoreCase) == 0) - { - try - { - using (SQLiteCommand cmd = new SQLiteCommand(String.Format(CultureInfo.InvariantCulture, "SELECT * FROM [{0}].[{1}]", strCatalog, rdTables.GetString(2)), this)) - using (SQLiteDataReader rd = (SQLiteDataReader)cmd.ExecuteReader(CommandBehavior.SchemaOnly)) - using (DataTable tblSchema = rd.GetSchemaTable(true, true)) - { - foreach (DataRow schemaRow in tblSchema.Rows) - { - if (String.Compare(schemaRow[SchemaTableColumn.ColumnName].ToString(), strColumn, StringComparison.OrdinalIgnoreCase) == 0 - || strColumn == null) - { - row = tbl.NewRow(); - - row["NUMERIC_PRECISION"] = schemaRow[SchemaTableColumn.NumericPrecision]; - row["NUMERIC_SCALE"] = schemaRow[SchemaTableColumn.NumericScale]; - row["TABLE_NAME"] = rdTables.GetString(2); - row["COLUMN_NAME"] = schemaRow[SchemaTableColumn.ColumnName]; - row["TABLE_CATALOG"] = strCatalog; - row["ORDINAL_POSITION"] = schemaRow[SchemaTableColumn.ColumnOrdinal]; - row["COLUMN_HASDEFAULT"] = (schemaRow[SchemaTableOptionalColumn.DefaultValue] != DBNull.Value); - row["COLUMN_DEFAULT"] = schemaRow[SchemaTableOptionalColumn.DefaultValue]; - row["IS_NULLABLE"] = schemaRow[SchemaTableColumn.AllowDBNull]; - row["DATA_TYPE"] = schemaRow["DataTypeName"].ToString().ToLower(CultureInfo.InvariantCulture); - row["EDM_TYPE"] = SQLiteConvert.DbTypeToTypeName((DbType)schemaRow[SchemaTableColumn.ProviderType]).ToString().ToLower(CultureInfo.InvariantCulture); - row["CHARACTER_MAXIMUM_LENGTH"] = schemaRow[SchemaTableColumn.ColumnSize]; - row["TABLE_SCHEMA"] = schemaRow[SchemaTableColumn.BaseSchemaName]; - row["PRIMARY_KEY"] = schemaRow[SchemaTableColumn.IsKey]; - row["AUTOINCREMENT"] = schemaRow[SchemaTableOptionalColumn.IsAutoIncrement]; - row["COLLATION_NAME"] = schemaRow["CollationType"]; - row["UNIQUE"] = schemaRow[SchemaTableColumn.IsUnique]; - tbl.Rows.Add(row); - } - } - } - } - catch(SQLiteException) - { - } - } - } - } - - tbl.AcceptChanges(); - tbl.EndLoadData(); - - return tbl; - } - - /// - /// Returns index information for the given database and catalog - /// - /// The catalog (attached database) to query, can be null - /// The name of the index to retrieve information for, can be null - /// The table to retrieve index information for, can be null - /// DataTable - private DataTable Schema_Indexes(string strCatalog, string strTable, string strIndex) - { - DataTable tbl = new DataTable("Indexes"); - DataRow row; - List primaryKeys = new List(); - bool maybeRowId; - - tbl.Locale = CultureInfo.InvariantCulture; - tbl.Columns.Add("TABLE_CATALOG", typeof(string)); - tbl.Columns.Add("TABLE_SCHEMA", typeof(string)); - tbl.Columns.Add("TABLE_NAME", typeof(string)); - tbl.Columns.Add("INDEX_CATALOG", typeof(string)); - tbl.Columns.Add("INDEX_SCHEMA", typeof(string)); - tbl.Columns.Add("INDEX_NAME", typeof(string)); - tbl.Columns.Add("PRIMARY_KEY", typeof(bool)); - tbl.Columns.Add("UNIQUE", typeof(bool)); - tbl.Columns.Add("CLUSTERED", typeof(bool)); - tbl.Columns.Add("TYPE", typeof(int)); - tbl.Columns.Add("FILL_FACTOR", typeof(int)); - tbl.Columns.Add("INITIAL_SIZE", typeof(int)); - tbl.Columns.Add("NULLS", typeof(int)); - tbl.Columns.Add("SORT_BOOKMARKS", typeof(bool)); - tbl.Columns.Add("AUTO_UPDATE", typeof(bool)); - tbl.Columns.Add("NULL_COLLATION", typeof(int)); - tbl.Columns.Add("ORDINAL_POSITION", typeof(int)); - tbl.Columns.Add("COLUMN_NAME", typeof(string)); - tbl.Columns.Add("COLUMN_GUID", typeof(Guid)); - tbl.Columns.Add("COLUMN_PROPID", typeof(long)); - tbl.Columns.Add("COLLATION", typeof(short)); - tbl.Columns.Add("CARDINALITY", typeof(Decimal)); - tbl.Columns.Add("PAGES", typeof(int)); - tbl.Columns.Add("FILTER_CONDITION", typeof(string)); - tbl.Columns.Add("INTEGRATED", typeof(bool)); - tbl.Columns.Add("INDEX_DEFINITION", typeof(string)); - - tbl.BeginLoadData(); - - if (String.IsNullOrEmpty(strCatalog)) strCatalog = "main"; - - string master = (String.Compare(strCatalog, "temp", StringComparison.OrdinalIgnoreCase) == 0) ? _tempmasterdb : _masterdb; - - using (SQLiteCommand cmdTables = new SQLiteCommand(String.Format(CultureInfo.InvariantCulture, "SELECT * FROM [{0}].[{1}] WHERE [type] LIKE 'table'", strCatalog, master), this)) - using (SQLiteDataReader rdTables = cmdTables.ExecuteReader()) - { - while (rdTables.Read()) - { - maybeRowId = false; - primaryKeys.Clear(); - if (String.IsNullOrEmpty(strTable) || String.Compare(rdTables.GetString(2), strTable, StringComparison.OrdinalIgnoreCase) == 0) - { - // First, look for any rowid indexes -- which sqlite defines are INTEGER PRIMARY KEY columns. - // Such indexes are not listed in the indexes list but count as indexes just the same. - try - { - using (SQLiteCommand cmdTable = new SQLiteCommand(String.Format(CultureInfo.InvariantCulture, "PRAGMA [{0}].table_info([{1}])", strCatalog, rdTables.GetString(2)), this)) - using (SQLiteDataReader rdTable = cmdTable.ExecuteReader()) - { - while (rdTable.Read()) - { - if (rdTable.GetInt32(5) == 1) - { - primaryKeys.Add(rdTable.GetInt32(0)); - - // If the primary key is of type INTEGER, then its a rowid and we need to make a fake index entry for it. - if (String.Compare(rdTable.GetString(2), "INTEGER", StringComparison.OrdinalIgnoreCase) == 0) - maybeRowId = true; - } - } - } - } - catch (SQLiteException) - { - } - if (primaryKeys.Count == 1 && maybeRowId == true) - { - row = tbl.NewRow(); - - row["TABLE_CATALOG"] = strCatalog; - row["TABLE_NAME"] = rdTables.GetString(2); - row["INDEX_CATALOG"] = strCatalog; - row["PRIMARY_KEY"] = true; - row["INDEX_NAME"] = String.Format(CultureInfo.InvariantCulture, "{1}_PK_{0}", rdTables.GetString(2), master); - row["UNIQUE"] = true; - - if (String.Compare((string)row["INDEX_NAME"], strIndex, StringComparison.OrdinalIgnoreCase) == 0 - || strIndex == null) - { - tbl.Rows.Add(row); - } - - primaryKeys.Clear(); - } - - // Now fetch all the rest of the indexes. - try - { - using (SQLiteCommand cmd = new SQLiteCommand(String.Format(CultureInfo.InvariantCulture, "PRAGMA [{0}].index_list([{1}])", strCatalog, rdTables.GetString(2)), this)) - using (SQLiteDataReader rd = (SQLiteDataReader)cmd.ExecuteReader()) - { - while (rd.Read()) - { - if (String.Compare(rd.GetString(1), strIndex, StringComparison.OrdinalIgnoreCase) == 0 - || strIndex == null) - { - row = tbl.NewRow(); - - row["TABLE_CATALOG"] = strCatalog; - row["TABLE_NAME"] = rdTables.GetString(2); - row["INDEX_CATALOG"] = strCatalog; - row["INDEX_NAME"] = rd.GetString(1); - row["UNIQUE"] = rd.GetBoolean(2); - row["PRIMARY_KEY"] = false; - - // get the index definition - using (SQLiteCommand cmdIndexes = new SQLiteCommand(String.Format(CultureInfo.InvariantCulture, "SELECT * FROM [{0}].[{2}] WHERE [type] LIKE 'index' AND [name] LIKE '{1}'", strCatalog, rd.GetString(1).Replace("'", "''"), master), this)) - using (SQLiteDataReader rdIndexes = cmdIndexes.ExecuteReader()) - { - while (rdIndexes.Read()) - { - if (rdIndexes.IsDBNull(4) == false) - row["INDEX_DEFINITION"] = rdIndexes.GetString(4); - break; - } - } - - // Now for the really hard work. Figure out which index is the primary key index. - // The only way to figure it out is to check if the index was an autoindex and if we have a non-rowid - // primary key, and all the columns in the given index match the primary key columns - if (primaryKeys.Count > 0 && rd.GetString(1).StartsWith("sqlite_autoindex_" + rdTables.GetString(2), StringComparison.InvariantCultureIgnoreCase) == true) - { - using (SQLiteCommand cmdDetails = new SQLiteCommand(String.Format(CultureInfo.InvariantCulture, "PRAGMA [{0}].index_info([{1}])", strCatalog, rd.GetString(1)), this)) - using (SQLiteDataReader rdDetails = cmdDetails.ExecuteReader()) - { - int nMatches = 0; - while (rdDetails.Read()) - { - if (primaryKeys.Contains(rdDetails.GetInt32(1)) == false) - { - nMatches = 0; - break; - } - nMatches++; - } - if (nMatches == primaryKeys.Count) - { - row["PRIMARY_KEY"] = true; - primaryKeys.Clear(); - } - } - } - - tbl.Rows.Add(row); - } - } - } - } - catch (SQLiteException) - { - } - } - } - } - - tbl.AcceptChanges(); - tbl.EndLoadData(); - - return tbl; - } - - private DataTable Schema_Triggers(string catalog, string table, string triggerName) - { - DataTable tbl = new DataTable("Triggers"); - DataRow row; - - tbl.Locale = CultureInfo.InvariantCulture; - tbl.Columns.Add("TABLE_CATALOG", typeof(string)); - tbl.Columns.Add("TABLE_SCHEMA", typeof(string)); - tbl.Columns.Add("TABLE_NAME", typeof(string)); - tbl.Columns.Add("TRIGGER_NAME", typeof(string)); - tbl.Columns.Add("TRIGGER_DEFINITION", typeof(string)); - - tbl.BeginLoadData(); - - if (String.IsNullOrEmpty(table)) table = null; - if (String.IsNullOrEmpty(catalog)) catalog = "main"; - string master = (String.Compare(catalog, "temp", StringComparison.OrdinalIgnoreCase) == 0) ? _tempmasterdb : _masterdb; - - using (SQLiteCommand cmd = new SQLiteCommand(String.Format(CultureInfo.InvariantCulture, "SELECT [type], [name], [tbl_name], [rootpage], [sql], [rowid] FROM [{0}].[{1}] WHERE [type] LIKE 'trigger'", catalog, master), this)) - using (SQLiteDataReader rd = (SQLiteDataReader)cmd.ExecuteReader()) - { - while (rd.Read()) - { - if (String.Compare(rd.GetString(1), triggerName, StringComparison.OrdinalIgnoreCase) == 0 - || triggerName == null) - { - if (table == null || String.Compare(table, rd.GetString(2), StringComparison.OrdinalIgnoreCase) == 0) - { - row = tbl.NewRow(); - - row["TABLE_CATALOG"] = catalog; - row["TABLE_NAME"] = rd.GetString(2); - row["TRIGGER_NAME"] = rd.GetString(1); - row["TRIGGER_DEFINITION"] = rd.GetString(4); - - tbl.Rows.Add(row); - } - } - } - } - tbl.AcceptChanges(); - tbl.EndLoadData(); - - return tbl; - } - - /// - /// Retrieves table schema information for the database and catalog - /// - /// The catalog (attached database) to retrieve tables on - /// The table to retrieve, can be null - /// The table type, can be null - /// DataTable - private DataTable Schema_Tables(string strCatalog, string strTable, string strType) - { - DataTable tbl = new DataTable("Tables"); - DataRow row; - string strItem; - - tbl.Locale = CultureInfo.InvariantCulture; - tbl.Columns.Add("TABLE_CATALOG", typeof(string)); - tbl.Columns.Add("TABLE_SCHEMA", typeof(string)); - tbl.Columns.Add("TABLE_NAME", typeof(string)); - tbl.Columns.Add("TABLE_TYPE", typeof(string)); - tbl.Columns.Add("TABLE_ID", typeof(long)); - tbl.Columns.Add("TABLE_ROOTPAGE", typeof(int)); - tbl.Columns.Add("TABLE_DEFINITION", typeof(string)); - tbl.BeginLoadData(); - - if (String.IsNullOrEmpty(strCatalog)) strCatalog = "main"; - - string master = (String.Compare(strCatalog, "temp", StringComparison.OrdinalIgnoreCase) == 0) ? _tempmasterdb : _masterdb; - - using (SQLiteCommand cmd = new SQLiteCommand(String.Format(CultureInfo.InvariantCulture, "SELECT [type], [name], [tbl_name], [rootpage], [sql], [rowid] FROM [{0}].[{1}] WHERE [type] LIKE 'table'", strCatalog, master), this)) - using (SQLiteDataReader rd = (SQLiteDataReader)cmd.ExecuteReader()) - { - while (rd.Read()) - { - strItem = rd.GetString(0); - if (String.Compare(rd.GetString(2), 0, "SQLITE_", 0, 7, StringComparison.OrdinalIgnoreCase) == 0) - strItem = "SYSTEM_TABLE"; - - if (String.Compare(strType, strItem, StringComparison.OrdinalIgnoreCase) == 0 - || strType == null) - { - if (String.Compare(rd.GetString(2), strTable, StringComparison.OrdinalIgnoreCase) == 0 - || strTable == null) - { - row = tbl.NewRow(); - - row["TABLE_CATALOG"] = strCatalog; - row["TABLE_NAME"] = rd.GetString(2); - row["TABLE_TYPE"] = strItem; - row["TABLE_ID"] = rd.GetInt64(5); - row["TABLE_ROOTPAGE"] = rd.GetInt32(3); - row["TABLE_DEFINITION"] = rd.GetString(4); - - tbl.Rows.Add(row); - } - } - } - } - - tbl.AcceptChanges(); - tbl.EndLoadData(); - - return tbl; - } - - /// - /// Retrieves view schema information for the database - /// - /// The catalog (attached database) to retrieve views on - /// The view name, can be null - /// DataTable - private DataTable Schema_Views(string strCatalog, string strView) - { - DataTable tbl = new DataTable("Views"); - DataRow row; - string strItem; - int nPos; - - tbl.Locale = CultureInfo.InvariantCulture; - tbl.Columns.Add("TABLE_CATALOG", typeof(string)); - tbl.Columns.Add("TABLE_SCHEMA", typeof(string)); - tbl.Columns.Add("TABLE_NAME", typeof(string)); - tbl.Columns.Add("VIEW_DEFINITION", typeof(string)); - tbl.Columns.Add("CHECK_OPTION", typeof(bool)); - tbl.Columns.Add("IS_UPDATABLE", typeof(bool)); - tbl.Columns.Add("DESCRIPTION", typeof(string)); - tbl.Columns.Add("DATE_CREATED", typeof(DateTime)); - tbl.Columns.Add("DATE_MODIFIED", typeof(DateTime)); - - tbl.BeginLoadData(); - - if (String.IsNullOrEmpty(strCatalog)) strCatalog = "main"; - - string master = (String.Compare(strCatalog, "temp", StringComparison.OrdinalIgnoreCase) == 0) ? _tempmasterdb : _masterdb; - - using (SQLiteCommand cmd = new SQLiteCommand(String.Format(CultureInfo.InvariantCulture, "SELECT * FROM [{0}].[{1}] WHERE [type] LIKE 'view'", strCatalog, master), this)) - using (SQLiteDataReader rd = (SQLiteDataReader)cmd.ExecuteReader()) - { - while (rd.Read()) - { - if (String.Compare(rd.GetString(1), strView, StringComparison.OrdinalIgnoreCase) == 0 - || String.IsNullOrEmpty(strView)) - { - strItem = rd.GetString(4).Replace('\r', ' ').Replace('\n', ' ').Replace('\t', ' '); - nPos = CultureInfo.InvariantCulture.CompareInfo.IndexOf(strItem, " AS ", CompareOptions.IgnoreCase); - if (nPos > -1) - { - strItem = strItem.Substring(nPos + 4).Trim(); - row = tbl.NewRow(); - - row["TABLE_CATALOG"] = strCatalog; - row["TABLE_NAME"] = rd.GetString(2); - row["IS_UPDATABLE"] = false; - row["VIEW_DEFINITION"] = strItem; - - tbl.Rows.Add(row); - } - } - } - } - - tbl.AcceptChanges(); - tbl.EndLoadData(); - - return tbl; - } - - /// - /// Retrieves catalog (attached databases) schema information for the database - /// - /// The catalog to retrieve, can be null - /// DataTable - private DataTable Schema_Catalogs(string strCatalog) - { - DataTable tbl = new DataTable("Catalogs"); - DataRow row; - - tbl.Locale = CultureInfo.InvariantCulture; - tbl.Columns.Add("CATALOG_NAME", typeof(string)); - tbl.Columns.Add("DESCRIPTION", typeof(string)); - tbl.Columns.Add("ID", typeof(long)); - - tbl.BeginLoadData(); - - using (SQLiteCommand cmd = new SQLiteCommand("PRAGMA database_list", this)) - using (SQLiteDataReader rd = (SQLiteDataReader)cmd.ExecuteReader()) - { - while (rd.Read()) - { - if (String.Compare(rd.GetString(1), strCatalog, StringComparison.OrdinalIgnoreCase) == 0 - || strCatalog == null) - { - row = tbl.NewRow(); - - row["CATALOG_NAME"] = rd.GetString(1); - row["DESCRIPTION"] = rd.GetString(2); - row["ID"] = rd.GetInt64(0); - - tbl.Rows.Add(row); - } - } - } - - tbl.AcceptChanges(); - tbl.EndLoadData(); - - return tbl; - } - - private DataTable Schema_DataTypes() - { - DataTable tbl = new DataTable("DataTypes"); - - tbl.Locale = CultureInfo.InvariantCulture; - tbl.Columns.Add("TypeName", typeof(String)); - tbl.Columns.Add("ProviderDbType", typeof(int)); - tbl.Columns.Add("ColumnSize", typeof(long)); - tbl.Columns.Add("CreateFormat", typeof(String)); - tbl.Columns.Add("CreateParameters", typeof(String)); - tbl.Columns.Add("DataType", typeof(String)); - tbl.Columns.Add("IsAutoIncrementable", typeof(bool)); - tbl.Columns.Add("IsBestMatch", typeof(bool)); - tbl.Columns.Add("IsCaseSensitive", typeof(bool)); - tbl.Columns.Add("IsFixedLength", typeof(bool)); - tbl.Columns.Add("IsFixedPrecisionScale", typeof(bool)); - tbl.Columns.Add("IsLong", typeof(bool)); - tbl.Columns.Add("IsNullable", typeof(bool)); - tbl.Columns.Add("IsSearchable", typeof(bool)); - tbl.Columns.Add("IsSearchableWithLike", typeof(bool)); - tbl.Columns.Add("IsLiteralSupported", typeof(bool)); - tbl.Columns.Add("LiteralPrefix", typeof(String)); - tbl.Columns.Add("LiteralSuffix", typeof(String)); - tbl.Columns.Add("IsUnsigned", typeof(bool)); - tbl.Columns.Add("MaximumScale", typeof(short)); - tbl.Columns.Add("MinimumScale", typeof(short)); - tbl.Columns.Add("IsConcurrencyType", typeof(bool)); - - tbl.BeginLoadData(); - - StringReader reader = new StringReader(SR.DataTypes); - tbl.ReadXml(reader); - reader.Close(); - - tbl.AcceptChanges(); - tbl.EndLoadData(); - - return tbl; - } - - /// - /// Returns the base column information for indexes in a database - /// - /// The catalog to retrieve indexes for (can be null) - /// The table to restrict index information by (can be null) - /// The index to restrict index information by (can be null) - /// The source column to restrict index information by (can be null) - /// A DataTable containing the results - private DataTable Schema_IndexColumns(string strCatalog, string strTable, string strIndex, string strColumn) - { - DataTable tbl = new DataTable("IndexColumns"); - DataRow row; - List> primaryKeys = new List>(); - bool maybeRowId; - - tbl.Locale = CultureInfo.InvariantCulture; - tbl.Columns.Add("CONSTRAINT_CATALOG", typeof(string)); - tbl.Columns.Add("CONSTRAINT_SCHEMA", typeof(string)); - tbl.Columns.Add("CONSTRAINT_NAME", typeof(string)); - tbl.Columns.Add("TABLE_CATALOG", typeof(string)); - tbl.Columns.Add("TABLE_SCHEMA", typeof(string)); - tbl.Columns.Add("TABLE_NAME", typeof(string)); - tbl.Columns.Add("COLUMN_NAME", typeof(string)); - tbl.Columns.Add("ORDINAL_POSITION", typeof(int)); - tbl.Columns.Add("INDEX_NAME", typeof(string)); - tbl.Columns.Add("COLLATION_NAME", typeof(string)); - tbl.Columns.Add("SORT_MODE", typeof(string)); - tbl.Columns.Add("CONFLICT_OPTION", typeof(int)); - - if (String.IsNullOrEmpty(strCatalog)) strCatalog = "main"; - - string master = (String.Compare(strCatalog, "temp", StringComparison.OrdinalIgnoreCase) == 0) ? _tempmasterdb : _masterdb; - - tbl.BeginLoadData(); - - using (SQLiteCommand cmdTables = new SQLiteCommand(String.Format(CultureInfo.InvariantCulture, "SELECT * FROM [{0}].[{1}] WHERE [type] LIKE 'table'", strCatalog, master), this)) - using (SQLiteDataReader rdTables = cmdTables.ExecuteReader()) - { - while (rdTables.Read()) - { - maybeRowId = false; - primaryKeys.Clear(); - if (String.IsNullOrEmpty(strTable) || String.Compare(rdTables.GetString(2), strTable, StringComparison.OrdinalIgnoreCase) == 0) - { - try - { - using (SQLiteCommand cmdTable = new SQLiteCommand(String.Format(CultureInfo.InvariantCulture, "PRAGMA [{0}].table_info([{1}])", strCatalog, rdTables.GetString(2)), this)) - using (SQLiteDataReader rdTable = cmdTable.ExecuteReader()) - { - while (rdTable.Read()) - { - if (rdTable.GetInt32(5) == 1) // is a primary key - { - primaryKeys.Add(new KeyValuePair(rdTable.GetInt32(0), rdTable.GetString(1))); - // Is an integer -- could be a rowid if no other primary keys exist in the table - if (String.Compare(rdTable.GetString(2), "INTEGER", StringComparison.OrdinalIgnoreCase) == 0) - maybeRowId = true; - } - } - } - } - catch (SQLiteException) - { - } - // This is a rowid row - if (primaryKeys.Count == 1 && maybeRowId == true) - { - row = tbl.NewRow(); - row["CONSTRAINT_CATALOG"] = strCatalog; - row["CONSTRAINT_NAME"] = String.Format(CultureInfo.InvariantCulture, "{1}_PK_{0}", rdTables.GetString(2), master); - row["TABLE_CATALOG"] = strCatalog; - row["TABLE_NAME"] = rdTables.GetString(2); - row["COLUMN_NAME"] = primaryKeys[0].Value; - row["INDEX_NAME"] = row["CONSTRAINT_NAME"]; - row["ORDINAL_POSITION"] = 0; // primaryKeys[0].Key; - row["COLLATION_NAME"] = "BINARY"; - row["SORT_MODE"] = "ASC"; - row["CONFLICT_OPTION"] = 2; - - if (String.IsNullOrEmpty(strIndex) || String.Compare(strIndex, (string)row["INDEX_NAME"], StringComparison.OrdinalIgnoreCase) == 0) - tbl.Rows.Add(row); - } - - using (SQLiteCommand cmdIndexes = new SQLiteCommand(String.Format(CultureInfo.InvariantCulture, "SELECT * FROM [{0}].[{2}] WHERE [type] LIKE 'index' AND [tbl_name] LIKE '{1}'", strCatalog, rdTables.GetString(2).Replace("'", "''"), master), this)) - using (SQLiteDataReader rdIndexes = cmdIndexes.ExecuteReader()) - { - while (rdIndexes.Read()) - { - int ordinal = 0; - if (String.IsNullOrEmpty(strIndex) || String.Compare(strIndex, rdIndexes.GetString(1), StringComparison.OrdinalIgnoreCase) == 0) - { - try - { - using (SQLiteCommand cmdIndex = new SQLiteCommand(String.Format(CultureInfo.InvariantCulture, "PRAGMA [{0}].index_info([{1}])", strCatalog, rdIndexes.GetString(1)), this)) - using (SQLiteDataReader rdIndex = cmdIndex.ExecuteReader()) - { - while (rdIndex.Read()) - { - row = tbl.NewRow(); - row["CONSTRAINT_CATALOG"] = strCatalog; - row["CONSTRAINT_NAME"] = rdIndexes.GetString(1); - row["TABLE_CATALOG"] = strCatalog; - row["TABLE_NAME"] = rdIndexes.GetString(2); - row["COLUMN_NAME"] = rdIndex.GetString(2); - row["INDEX_NAME"] = rdIndexes.GetString(1); - row["ORDINAL_POSITION"] = ordinal; // rdIndex.GetInt32(1); - - string collationSequence; - int sortMode; - int onError; - _sql.GetIndexColumnExtendedInfo(strCatalog, rdIndexes.GetString(1), rdIndex.GetString(2), out sortMode, out onError, out collationSequence); - - if (String.IsNullOrEmpty(collationSequence) == false) - row["COLLATION_NAME"] = collationSequence; - - row["SORT_MODE"] = (sortMode == 0) ? "ASC" : "DESC"; - row["CONFLICT_OPTION"] = onError; - - ordinal++; - - if (String.IsNullOrEmpty(strColumn) || String.Compare(strColumn, row["COLUMN_NAME"].ToString(), StringComparison.OrdinalIgnoreCase) == 0) - tbl.Rows.Add(row); - } - } - } - catch (SQLiteException) - { - } - } - } - } - } - } - } - - tbl.EndLoadData(); - tbl.AcceptChanges(); - - return tbl; - } - - /// - /// Returns detailed column information for a specified view - /// - /// The catalog to retrieve columns for (can be null) - /// The view to restrict column information by (can be null) - /// The source column to restrict column information by (can be null) - /// A DataTable containing the results - private DataTable Schema_ViewColumns(string strCatalog, string strView, string strColumn) - { - DataTable tbl = new DataTable("ViewColumns"); - DataRow row; - string strSql; - int n; - DataRow schemaRow; - DataRow viewRow; - - tbl.Locale = CultureInfo.InvariantCulture; - tbl.Columns.Add("VIEW_CATALOG", typeof(string)); - tbl.Columns.Add("VIEW_SCHEMA", typeof(string)); - tbl.Columns.Add("VIEW_NAME", typeof(string)); - tbl.Columns.Add("VIEW_COLUMN_NAME", typeof(String)); - tbl.Columns.Add("TABLE_CATALOG", typeof(string)); - tbl.Columns.Add("TABLE_SCHEMA", typeof(string)); - tbl.Columns.Add("TABLE_NAME", typeof(string)); - tbl.Columns.Add("COLUMN_NAME", typeof(string)); - tbl.Columns.Add("ORDINAL_POSITION", typeof(int)); - tbl.Columns.Add("COLUMN_HASDEFAULT", typeof(bool)); - tbl.Columns.Add("COLUMN_DEFAULT", typeof(string)); - tbl.Columns.Add("COLUMN_FLAGS", typeof(long)); - tbl.Columns.Add("IS_NULLABLE", typeof(bool)); - tbl.Columns.Add("DATA_TYPE", typeof(string)); - tbl.Columns.Add("CHARACTER_MAXIMUM_LENGTH", typeof(int)); - tbl.Columns.Add("NUMERIC_PRECISION", typeof(int)); - tbl.Columns.Add("NUMERIC_SCALE", typeof(int)); - tbl.Columns.Add("DATETIME_PRECISION", typeof(long)); - tbl.Columns.Add("CHARACTER_SET_CATALOG", typeof(string)); - tbl.Columns.Add("CHARACTER_SET_SCHEMA", typeof(string)); - tbl.Columns.Add("CHARACTER_SET_NAME", typeof(string)); - tbl.Columns.Add("COLLATION_CATALOG", typeof(string)); - tbl.Columns.Add("COLLATION_SCHEMA", typeof(string)); - tbl.Columns.Add("COLLATION_NAME", typeof(string)); - tbl.Columns.Add("PRIMARY_KEY", typeof(bool)); - tbl.Columns.Add("EDM_TYPE", typeof(string)); - tbl.Columns.Add("AUTOINCREMENT", typeof(bool)); - tbl.Columns.Add("UNIQUE", typeof(bool)); - - if (String.IsNullOrEmpty(strCatalog)) strCatalog = "main"; - - string master = (String.Compare(strCatalog, "temp", StringComparison.OrdinalIgnoreCase) == 0) ? _tempmasterdb : _masterdb; - - tbl.BeginLoadData(); - - using (SQLiteCommand cmdViews = new SQLiteCommand(String.Format(CultureInfo.InvariantCulture, "SELECT * FROM [{0}].[{1}] WHERE [type] LIKE 'view'", strCatalog, master), this)) - using (SQLiteDataReader rdViews = cmdViews.ExecuteReader()) - { - while (rdViews.Read()) - { - if (String.IsNullOrEmpty(strView) || String.Compare(strView, rdViews.GetString(2), StringComparison.OrdinalIgnoreCase) == 0) - { - using (SQLiteCommand cmdViewSelect = new SQLiteCommand(String.Format(CultureInfo.InvariantCulture, "SELECT * FROM [{0}].[{1}]", strCatalog, rdViews.GetString(2)), this)) - { - strSql = rdViews.GetString(4).Replace('\r', ' ').Replace('\n', ' ').Replace('\t', ' '); - n = CultureInfo.InvariantCulture.CompareInfo.IndexOf(strSql, " AS ", CompareOptions.IgnoreCase); - if (n < 0) - continue; - - strSql = strSql.Substring(n + 4); - - using (SQLiteCommand cmd = new SQLiteCommand(strSql, this)) - using (SQLiteDataReader rdViewSelect = cmdViewSelect.ExecuteReader(CommandBehavior.SchemaOnly)) - using (SQLiteDataReader rd = (SQLiteDataReader)cmd.ExecuteReader(CommandBehavior.SchemaOnly)) - using (DataTable tblSchemaView = rdViewSelect.GetSchemaTable(false, false)) - using (DataTable tblSchema = rd.GetSchemaTable(false, false)) - { - for (n = 0; n < tblSchema.Rows.Count; n++) - { - viewRow = tblSchemaView.Rows[n]; - schemaRow = tblSchema.Rows[n]; - - if (String.Compare(viewRow[SchemaTableColumn.ColumnName].ToString(), strColumn, StringComparison.OrdinalIgnoreCase) == 0 - || strColumn == null) - { - row = tbl.NewRow(); - - row["VIEW_CATALOG"] = strCatalog; - row["VIEW_NAME"] = rdViews.GetString(2); - row["TABLE_CATALOG"] = strCatalog; - row["TABLE_SCHEMA"] = schemaRow[SchemaTableColumn.BaseSchemaName]; - row["TABLE_NAME"] = schemaRow[SchemaTableColumn.BaseTableName]; - row["COLUMN_NAME"] = schemaRow[SchemaTableColumn.BaseColumnName]; - row["VIEW_COLUMN_NAME"] = viewRow[SchemaTableColumn.ColumnName]; - row["COLUMN_HASDEFAULT"] = (viewRow[SchemaTableOptionalColumn.DefaultValue] != DBNull.Value); - row["COLUMN_DEFAULT"] = viewRow[SchemaTableOptionalColumn.DefaultValue]; - row["ORDINAL_POSITION"] = viewRow[SchemaTableColumn.ColumnOrdinal]; - row["IS_NULLABLE"] = viewRow[SchemaTableColumn.AllowDBNull]; - row["DATA_TYPE"] = viewRow["DataTypeName"]; // SQLiteConvert.DbTypeToType((DbType)viewRow[SchemaTableColumn.ProviderType]).ToString(); - row["EDM_TYPE"] = SQLiteConvert.DbTypeToTypeName((DbType)viewRow[SchemaTableColumn.ProviderType]).ToString().ToLower(CultureInfo.InvariantCulture); - row["CHARACTER_MAXIMUM_LENGTH"] = viewRow[SchemaTableColumn.ColumnSize]; - row["TABLE_SCHEMA"] = viewRow[SchemaTableColumn.BaseSchemaName]; - row["PRIMARY_KEY"] = viewRow[SchemaTableColumn.IsKey]; - row["AUTOINCREMENT"] = viewRow[SchemaTableOptionalColumn.IsAutoIncrement]; - row["COLLATION_NAME"] = viewRow["CollationType"]; - row["UNIQUE"] = viewRow[SchemaTableColumn.IsUnique]; - tbl.Rows.Add(row); - } - } - } - } - } - } - } - - tbl.EndLoadData(); - tbl.AcceptChanges(); - - return tbl; - } - - /// - /// Retrieves foreign key information from the specified set of filters - /// - /// An optional catalog to restrict results on - /// An optional table to restrict results on - /// An optional foreign key name to restrict results on - /// A DataTable with the results of the query - private DataTable Schema_ForeignKeys(string strCatalog, string strTable, string strKeyName) - { - DataTable tbl = new DataTable("ForeignKeys"); - DataRow row; - - tbl.Locale = CultureInfo.InvariantCulture; - tbl.Columns.Add("CONSTRAINT_CATALOG", typeof(string)); - tbl.Columns.Add("CONSTRAINT_SCHEMA", typeof(string)); - tbl.Columns.Add("CONSTRAINT_NAME", typeof(string)); - tbl.Columns.Add("TABLE_CATALOG", typeof(string)); - tbl.Columns.Add("TABLE_SCHEMA", typeof(string)); - tbl.Columns.Add("TABLE_NAME", typeof(string)); - tbl.Columns.Add("CONSTRAINT_TYPE", typeof(string)); - tbl.Columns.Add("IS_DEFERRABLE", typeof(bool)); - tbl.Columns.Add("INITIALLY_DEFERRED", typeof(bool)); - tbl.Columns.Add("FKEY_FROM_COLUMN", typeof(string)); - tbl.Columns.Add("FKEY_FROM_ORDINAL_POSITION", typeof(int)); - tbl.Columns.Add("FKEY_TO_CATALOG", typeof(string)); - tbl.Columns.Add("FKEY_TO_SCHEMA", typeof(string)); - tbl.Columns.Add("FKEY_TO_TABLE", typeof(string)); - tbl.Columns.Add("FKEY_TO_COLUMN", typeof(string)); - - if (String.IsNullOrEmpty(strCatalog)) strCatalog = "main"; - - string master = (String.Compare(strCatalog, "temp", StringComparison.OrdinalIgnoreCase) == 0) ? _tempmasterdb : _masterdb; - - tbl.BeginLoadData(); - - using (SQLiteCommand cmdTables = new SQLiteCommand(String.Format(CultureInfo.InvariantCulture, "SELECT * FROM [{0}].[{1}] WHERE [type] LIKE 'table'", strCatalog, master), this)) - using (SQLiteDataReader rdTables = cmdTables.ExecuteReader()) - { - while (rdTables.Read()) - { - if (String.IsNullOrEmpty(strTable) || String.Compare(strTable, rdTables.GetString(2), StringComparison.OrdinalIgnoreCase) == 0) - { - try - { - using (SQLiteCommandBuilder builder = new SQLiteCommandBuilder()) - //using (SQLiteCommand cmdTable = new SQLiteCommand(String.Format(CultureInfo.InvariantCulture, "SELECT * FROM [{0}].[{1}]", strCatalog, rdTables.GetString(2)), this)) - //using (SQLiteDataReader rdTable = cmdTable.ExecuteReader(CommandBehavior.SchemaOnly)) - using (SQLiteCommand cmdKey = new SQLiteCommand(String.Format(CultureInfo.InvariantCulture, "PRAGMA [{0}].foreign_key_list([{1}])", strCatalog, rdTables.GetString(2)), this)) - using (SQLiteDataReader rdKey = cmdKey.ExecuteReader()) - { - while (rdKey.Read()) - { - row = tbl.NewRow(); - row["CONSTRAINT_CATALOG"] = strCatalog; - row["CONSTRAINT_NAME"] = String.Format(CultureInfo.InvariantCulture, "FK_{0}_{1}", rdTables[2], rdKey.GetInt32(0)); - row["TABLE_CATALOG"] = strCatalog; - row["TABLE_NAME"] = builder.UnquoteIdentifier(rdTables.GetString(2)); - row["CONSTRAINT_TYPE"] = "FOREIGN KEY"; - row["IS_DEFERRABLE"] = false; - row["INITIALLY_DEFERRED"] = false; - row["FKEY_FROM_COLUMN"] = builder.UnquoteIdentifier(rdKey[3].ToString()); - row["FKEY_TO_CATALOG"] = strCatalog; - row["FKEY_TO_TABLE"] = builder.UnquoteIdentifier(rdKey[2].ToString()); - row["FKEY_TO_COLUMN"] = builder.UnquoteIdentifier(rdKey[4].ToString()); - row["FKEY_FROM_ORDINAL_POSITION"] = rdKey[1]; - - if (String.IsNullOrEmpty(strKeyName) || String.Compare(strKeyName, row["CONSTRAINT_NAME"].ToString(), StringComparison.OrdinalIgnoreCase) == 0) - tbl.Rows.Add(row); - } - } - } - catch (SQLiteException) - { - } - } - } - } - - tbl.EndLoadData(); - tbl.AcceptChanges(); - - return tbl; - } - - /// - /// This event is raised whenever SQLite makes an update/delete/insert into the database on - /// this connection. It only applies to the given connection. - /// - public event SQLiteUpdateEventHandler Update - { - add - { - if (_updateHandler == null) - { - _updateCallback = new SQLiteUpdateCallback(UpdateCallback); - if (_sql != null) _sql.SetUpdateHook(_updateCallback); - } - _updateHandler += value; - } - remove - { - _updateHandler -= value; - if (_updateHandler == null) - { - if (_sql != null) _sql.SetUpdateHook(null); - _updateCallback = null; - } - } - } - - private void UpdateCallback(IntPtr puser, int type, IntPtr database, IntPtr table, Int64 rowid) - { - _updateHandler(this, new UpdateEventArgs( - SQLiteBase.UTF8ToString(database, -1), - SQLiteBase.UTF8ToString(table, -1), - (UpdateEventType)type, - rowid)); - } - - /// - /// This event is raised whenever SQLite is committing a transaction. - /// Return non-zero to trigger a rollback - /// - public event SQLiteCommitHandler Commit - { - add - { - if (_commitHandler == null) - { - _commitCallback = new SQLiteCommitCallback(CommitCallback); - if (_sql != null) _sql.SetCommitHook(_commitCallback); - } - _commitHandler += value; - } - remove - { - _commitHandler -= value; - if (_commitHandler == null) - { - if (_sql != null) _sql.SetCommitHook(null); - _commitCallback = null; - } - } - } - - /// - /// This event is raised whenever SQLite is committing a transaction. - /// Return non-zero to trigger a rollback - /// - public event EventHandler RollBack - { - add - { - if (_rollbackHandler == null) - { - _rollbackCallback = new SQLiteRollbackCallback(RollbackCallback); - if (_sql != null) _sql.SetRollbackHook(_rollbackCallback); - } - _rollbackHandler += value; - } - remove - { - _rollbackHandler -= value; - if (_rollbackHandler == null) - { - if (_sql != null) _sql.SetRollbackHook(null); - _rollbackCallback = null; - } - } - } - - - private int CommitCallback(IntPtr parg) - { - CommitEventArgs e = new CommitEventArgs(); - _commitHandler(this, e); - return (e.AbortTransaction == true) ? 1 : 0; - } - - private void RollbackCallback(IntPtr parg) - { - _rollbackHandler(this, EventArgs.Empty); - } - } - - /// - /// The I/O file cache flushing behavior for the connection - /// - public enum SynchronizationModes - { - /// - /// Normal file flushing at critical sections of the code - /// - Normal = 0, - /// - /// Full file flushing after every write operation - /// - Full = 1, - /// - /// Use the default operating system's file flushing, SQLite does not explicitly flush the file buffers after writing - /// - Off = 2, - } - -#if !PLATFORM_COMPACTFRAMEWORK - [UnmanagedFunctionPointer(CallingConvention.Cdecl)] -#endif - internal delegate void SQLiteUpdateCallback(IntPtr puser, int type, IntPtr database, IntPtr table, Int64 rowid); -#if !PLATFORM_COMPACTFRAMEWORK - [UnmanagedFunctionPointer(CallingConvention.Cdecl)] -#endif - internal delegate int SQLiteCommitCallback(IntPtr puser); -#if !PLATFORM_COMPACTFRAMEWORK - [UnmanagedFunctionPointer(CallingConvention.Cdecl)] -#endif - internal delegate void SQLiteRollbackCallback(IntPtr puser); - - /// - /// Raised when a transaction is about to be committed. To roll back a transaction, set the - /// rollbackTrans boolean value to true. - /// - /// The connection committing the transaction - /// Event arguments on the transaction - public delegate void SQLiteCommitHandler(object sender, CommitEventArgs e); - - /// - /// Raised when data is inserted, updated and deleted on a given connection - /// - /// The connection committing the transaction - /// The event parameters which triggered the event - public delegate void SQLiteUpdateEventHandler(object sender, UpdateEventArgs e); - - /// - /// Whenever an update event is triggered on a connection, this enum will indicate - /// exactly what type of operation is being performed. - /// - public enum UpdateEventType - { - /// - /// A row is being deleted from the given database and table - /// - Delete = 9, - /// - /// A row is being inserted into the table. - /// - Insert = 18, - /// - /// A row is being updated in the table. - /// - Update = 23, - } - - /// - /// Passed during an Update callback, these event arguments detail the type of update operation being performed - /// on the given connection. - /// - public class UpdateEventArgs : EventArgs - { - /// - /// The name of the database being updated (usually "main" but can be any attached or temporary database) - /// - public readonly string Database; - - /// - /// The name of the table being updated - /// - public readonly string Table; - - /// - /// The type of update being performed (insert/update/delete) - /// - public readonly UpdateEventType Event; - - /// - /// The RowId affected by this update. - /// - public readonly Int64 RowId; - - internal UpdateEventArgs(string database, string table, UpdateEventType eventType, Int64 rowid) - { - Database = database; - Table = table; - Event = eventType; - RowId = rowid; - } - } - - /// - /// Event arguments raised when a transaction is being committed - /// - public class CommitEventArgs : EventArgs - { - internal CommitEventArgs() - { - } - - /// - /// Set to true to abort the transaction and trigger a rollback - /// - public bool AbortTransaction; - } - -} +/******************************************************** + * ADO.NET 2.0 Data Provider for SQLite Version 3.X + * Written by Robert Simpson (robert@blackcastlesoft.com) + * + * Released to the public domain, use at your own risk! + ********************************************************/ + +namespace System.Data.SQLite +{ + using System; + using System.Data; + using System.Data.Common; + using System.Collections.Generic; + using System.Globalization; + using System.ComponentModel; + using System.Text; + using System.Runtime.InteropServices; + using System.IO; + + /// + /// SQLite implentation of DbConnection. + /// + /// + /// The ConnectionString property of the SQLiteConnection class can contain the following parameter(s), delimited with a semi-colon: + /// + /// + /// Parameter + /// Values + /// Required + /// Default + /// + /// + /// Data Source + /// {filename} + /// Y + /// + /// + /// + /// Version + /// 3 + /// N + /// 3 + /// + /// + /// UseUTF16Encoding + /// True
False
+ /// N + /// False + ///
+ /// + /// DateTimeFormat + /// Ticks - Use DateTime.Ticks
ISO8601 - Use ISO8601 DateTime format
+ /// N + /// ISO8601 + ///
+ /// + /// BinaryGUID + /// True - Store GUID columns in binary form
False - Store GUID columns as text
+ /// N + /// True + ///
+ /// + /// Cache Size + /// {size in bytes} + /// N + /// 2000 + /// + /// + /// Synchronous + /// Normal - Normal file flushing behavior
Full - Full flushing after all writes
Off - Underlying OS flushes I/O's
+ /// N + /// Normal + ///
+ /// + /// Page Size + /// {size in bytes} + /// N + /// 1024 + /// + /// + /// Password + /// {password} + /// N + /// + /// + /// + /// Enlist + /// Y - Automatically enlist in distributed transactions
N - No automatic enlistment
+ /// N + /// Y + ///
+ /// + /// Pooling + /// True - Use connection pooling
False - Do not use connection pooling
+ /// N + /// False + ///
+ /// + /// FailIfMissing + /// True - Don't create the database if it does not exist, throw an error instead
False - Automatically create the database if it does not exist
+ /// N + /// False + ///
+ /// + /// Max Page Count + /// {size in pages} - Limits the maximum number of pages (limits the size) of the database + /// N + /// 0 + /// + /// + /// Legacy Format + /// True - Use the more compatible legacy 3.x database format
False - Use the newer 3.3x database format which compresses numbers more effectively
+ /// N + /// False + ///
+ /// + /// Default Timeout + /// {time in seconds}
The default command timeout
+ /// N + /// 30 + ///
+ /// + /// Journal Mode + /// Delete - Delete the journal file after a commit
Persist - Zero out and leave the journal file on disk after a commit
Off - Disable the rollback journal entirely
+ /// N + /// Delete + ///
+ /// + /// Read Only + /// True - Open the database for read only access
False - Open the database for normal read/write access
+ /// N + /// False + ///
+ /// + /// Max Pool Size + /// The maximum number of connections for the given connection string that can be in the connection pool + /// N + /// 100 + /// + /// + /// Default IsolationLevel + /// The default transaciton isolation level + /// N + /// Serializable + /// + /// + /// Foreign Keys + /// Enable foreign key constraints + /// N + /// False + /// + ///
+ ///
+ public sealed partial class SQLiteConnection : DbConnection, ICloneable + { + private const string _dataDirectory = "|DataDirectory|"; + private const string _masterdb = "sqlite_master"; + private const string _tempmasterdb = "sqlite_temp_master"; + + /// + /// State of the current connection + /// + private ConnectionState _connectionState; + /// + /// The connection string + /// + private string _connectionString; + /// + /// Nesting level of the transactions open on the connection + /// + internal int _transactionLevel; + + /// + /// The default isolation level for new transactions + /// + private IsolationLevel _defaultIsolation; + +#if !PLATFORM_COMPACTFRAMEWORK + /// + /// Whether or not the connection is enlisted in a distrubuted transaction + /// + internal SQLiteEnlistment _enlistment; +#endif + /// + /// The base SQLite object to interop with + /// + internal SQLiteBase _sql; + /// + /// The database filename minus path and extension + /// + private string _dataSource; + /// + /// Temporary password storage, emptied after the database has been opened + /// + private byte[] _password; + + /// + /// Default command timeout + /// + private int _defaultTimeout = 30; + + internal bool _binaryGuid; + + internal long _version; + + private event SQLiteUpdateEventHandler _updateHandler; + private event SQLiteCommitHandler _commitHandler; + private event SQLiteTraceEventHandler _traceHandler; + private event EventHandler _rollbackHandler; + + private SQLiteUpdateCallback _updateCallback; + private SQLiteCommitCallback _commitCallback; + private SQLiteTraceCallback _traceCallback; + private SQLiteRollbackCallback _rollbackCallback; + + /// + /// This event is raised whenever the database is opened or closed. + /// + public override event StateChangeEventHandler StateChange; + + /// + /// Constructs a new SQLiteConnection object + /// + /// + /// Default constructor + /// + public SQLiteConnection() + : this("") + { + } + + /// + /// Initializes the connection with the specified connection string + /// + /// The connection string to use on the connection + public SQLiteConnection(string connectionString) + { + _connectionState = ConnectionState.Closed; + _connectionString = ""; + //_commandList = new List(); + + if (connectionString != null) + ConnectionString = connectionString; + } + + /// + /// Clones the settings and connection string from an existing connection. If the existing connection is already open, this + /// function will open its own connection, enumerate any attached databases of the original connection, and automatically + /// attach to them. + /// + /// + public SQLiteConnection(SQLiteConnection connection) + : this(connection.ConnectionString) + { + string str; + + if (connection.State == ConnectionState.Open) + { + Open(); + + // Reattach all attached databases from the existing connection + using (DataTable tbl = connection.GetSchema("Catalogs")) + { + foreach (DataRow row in tbl.Rows) + { + str = row[0].ToString(); + if (String.Compare(str, "main", StringComparison.OrdinalIgnoreCase) != 0 + && String.Compare(str, "temp", StringComparison.OrdinalIgnoreCase) != 0) + { + using (SQLiteCommand cmd = CreateCommand()) + { + cmd.CommandText = String.Format(CultureInfo.InvariantCulture, "ATTACH DATABASE '{0}' AS [{1}]", row[1], row[0]); + cmd.ExecuteNonQuery(); + } + } + } + } + } + } + +#if PLATFORM_COMPACTFRAMEWORK + /// + /// Obsolete + /// + public override int ConnectionTimeout + { + get + { + return 30; + } + } +#endif + + /// + /// Creates a clone of the connection. All attached databases and user-defined functions are cloned. If the existing connection is open, the cloned connection + /// will also be opened. + /// + /// + public object Clone() + { + return new SQLiteConnection(this); + } + + /// + /// Disposes of the SQLiteConnection, closing it if it is active. + /// + /// True if the connection is being explicitly closed. + protected override void Dispose(bool disposing) + { + base.Dispose(disposing); + + if (disposing) + Close(); + } + + /// + /// Creates a database file. This just creates a zero-byte file which SQLite + /// will turn into a database when the file is opened properly. + /// + /// The file to create + static public void CreateFile(string databaseFileName) + { + FileStream fs = File.Create(databaseFileName); + fs.Close(); + } + + /// + /// Raises the state change event when the state of the connection changes + /// + /// The new state. If it is different from the previous state, an event is raised. + internal void OnStateChange(ConnectionState newState) + { + ConnectionState oldState = _connectionState; + _connectionState = newState; + + if (StateChange != null && oldState != newState) + { + StateChangeEventArgs e = new StateChangeEventArgs(oldState, newState); + StateChange(this, e); + } + } + + /// + /// OBSOLETE. Creates a new SQLiteTransaction if one isn't already active on the connection. + /// + /// This parameter is ignored. + /// When TRUE, SQLite defers obtaining a write lock until a write operation is requested. + /// When FALSE, a writelock is obtained immediately. The default is TRUE, but in a multi-threaded multi-writer + /// environment, one may instead choose to lock the database immediately to avoid any possible writer deadlock. + /// Returns a SQLiteTransaction object. + [Obsolete("Use one of the standard BeginTransaction methods, this one will be removed soon")] + public SQLiteTransaction BeginTransaction(IsolationLevel isolationLevel, bool deferredLock) + { + return (SQLiteTransaction)BeginDbTransaction(deferredLock == false ? IsolationLevel.Serializable : IsolationLevel.ReadCommitted); + } + + /// + /// OBSOLETE. Creates a new SQLiteTransaction if one isn't already active on the connection. + /// + /// When TRUE, SQLite defers obtaining a write lock until a write operation is requested. + /// When FALSE, a writelock is obtained immediately. The default is false, but in a multi-threaded multi-writer + /// environment, one may instead choose to lock the database immediately to avoid any possible writer deadlock. + /// Returns a SQLiteTransaction object. + [Obsolete("Use one of the standard BeginTransaction methods, this one will be removed soon")] + public SQLiteTransaction BeginTransaction(bool deferredLock) + { + return (SQLiteTransaction)BeginDbTransaction(deferredLock == false ? IsolationLevel.Serializable : IsolationLevel.ReadCommitted); + } + + /// + /// Creates a new SQLiteTransaction if one isn't already active on the connection. + /// + /// Supported isolation levels are Serializable, ReadCommitted and Unspecified. + /// + /// Unspecified will use the default isolation level specified in the connection string. If no isolation level is specified in the + /// connection string, Serializable is used. + /// Serializable transactions are the default. In this mode, the engine gets an immediate lock on the database, and no other threads + /// may begin a transaction. Other threads may read from the database, but not write. + /// With a ReadCommitted isolation level, locks are deferred and elevated as needed. It is possible for multiple threads to start + /// a transaction in ReadCommitted mode, but if a thread attempts to commit a transaction while another thread + /// has a ReadCommitted lock, it may timeout or cause a deadlock on both threads until both threads' CommandTimeout's are reached. + /// + /// Returns a SQLiteTransaction object. + public new SQLiteTransaction BeginTransaction(IsolationLevel isolationLevel) + { + return (SQLiteTransaction)BeginDbTransaction(isolationLevel); + } + + /// + /// Creates a new SQLiteTransaction if one isn't already active on the connection. + /// + /// Returns a SQLiteTransaction object. + public new SQLiteTransaction BeginTransaction() + { + return (SQLiteTransaction)BeginDbTransaction(_defaultIsolation); + } + + /// + /// Forwards to the local BeginTransaction() function + /// + /// Supported isolation levels are Unspecified, Serializable, and ReadCommitted + /// + protected override DbTransaction BeginDbTransaction(IsolationLevel isolationLevel) + { + if (_connectionState != ConnectionState.Open) + throw new InvalidOperationException(); + + if (isolationLevel == IsolationLevel.Unspecified) isolationLevel = _defaultIsolation; + + if (isolationLevel != IsolationLevel.Serializable && isolationLevel != IsolationLevel.ReadCommitted) + throw new ArgumentException("isolationLevel"); + + return new SQLiteTransaction(this, isolationLevel != IsolationLevel.Serializable); + } + + /// + /// Not implemented + /// + /// + public override void ChangeDatabase(string databaseName) + { + throw new NotImplementedException(); + } + + /// + /// When the database connection is closed, all commands linked to this connection are automatically reset. + /// + public override void Close() + { + if (_sql != null) + { +#if !PLATFORM_COMPACTFRAMEWORK + if (_enlistment != null) + { + // If the connection is enlisted in a transaction scope and the scope is still active, + // we cannot truly shut down this connection until the scope has completed. Therefore make a + // hidden connection temporarily to hold open the connection until the scope has completed. + SQLiteConnection cnn = new SQLiteConnection(); + cnn._sql = _sql; + cnn._transactionLevel = _transactionLevel; + cnn._enlistment = _enlistment; + cnn._connectionState = _connectionState; + cnn._version = _version; + + cnn._enlistment._transaction._cnn = cnn; + cnn._enlistment._disposeConnection = true; + _sql = null; + _enlistment = null; + } +#endif + if (_sql != null) + { + _sql.Close(); + } + _sql = null; + _transactionLevel = 0; + } + OnStateChange(ConnectionState.Closed); + } + + /// + /// Clears the connection pool associated with the connection. Any other active connections using the same database file + /// will be discarded instead of returned to the pool when they are closed. + /// + /// + public static void ClearPool(SQLiteConnection connection) + { + if (connection._sql == null) return; + connection._sql.ClearPool(); + } + + /// + /// Clears all connection pools. Any active connections will be discarded instead of sent to the pool when they are closed. + /// + public static void ClearAllPools() + { + SQLiteConnectionPool.ClearAllPools(); + } + + /// + /// The connection string containing the parameters for the connection + /// + /// + /// + /// + /// Parameter + /// Values + /// Required + /// Default + /// + /// + /// Data Source + /// {filename} + /// Y + /// + /// + /// + /// Version + /// 3 + /// N + /// 3 + /// + /// + /// UseUTF16Encoding + /// True
False
+ /// N + /// False + ///
+ /// + /// DateTimeFormat + /// Ticks - Use DateTime.Ticks
ISO8601 - Use ISO8601 DateTime format
JulianDay - Use JulianDay format
+ /// N + /// ISO8601 + ///
+ /// + /// BinaryGUID + /// Yes/On/1 - Store GUID columns in binary form
No/Off/0 - Store GUID columns as text
+ /// N + /// On + ///
+ /// + /// Cache Size + /// {size in bytes} + /// N + /// 2000 + /// + /// + /// Synchronous + /// Normal - Normal file flushing behavior
Full - Full flushing after all writes
Off - Underlying OS flushes I/O's
+ /// N + /// Normal + ///
+ /// + /// Page Size + /// {size in bytes} + /// N + /// 1024 + /// + /// + /// Password + /// {password} + /// N + /// + /// + /// + /// Enlist + /// Y - Automatically enlist in distributed transactions
N - No automatic enlistment
+ /// N + /// Y + ///
+ /// + /// Pooling + /// True - Use connection pooling
False - Do not use connection pooling
+ /// N + /// False + ///
+ /// + /// FailIfMissing + /// True - Don't create the database if it does not exist, throw an error instead
False - Automatically create the database if it does not exist
+ /// N + /// False + ///
+ /// + /// Max Page Count + /// {size in pages} - Limits the maximum number of pages (limits the size) of the database + /// N + /// 0 + /// + /// + /// Legacy Format + /// True - Use the more compatible legacy 3.x database format
False - Use the newer 3.3x database format which compresses numbers more effectively
+ /// N + /// False + ///
+ /// + /// Default Timeout + /// {time in seconds}
The default command timeout
+ /// N + /// 30 + ///
+ /// + /// Journal Mode + /// Delete - Delete the journal file after a commit
Persist - Zero out and leave the journal file on disk after a commit
Off - Disable the rollback journal entirely
+ /// N + /// Delete + ///
+ /// + /// Read Only + /// True - Open the database for read only access
False - Open the database for normal read/write access
+ /// N + /// False + ///
+ /// + /// Max Pool Size + /// The maximum number of connections for the given connection string that can be in the connection pool + /// N + /// 100 + /// + /// + /// Default IsolationLevel + /// The default transaciton isolation level + /// N + /// Serializable + /// + ///
+ ///
+#if !PLATFORM_COMPACTFRAMEWORK + [RefreshProperties(RefreshProperties.All), DefaultValue("")] + [Editor("SQLite.Designer.SQLiteConnectionStringEditor, SQLite.Designer, Version=1.0.38.1, Culture=neutral, PublicKeyToken=db937bc2d44ff139", "System.Drawing.Design.UITypeEditor, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")] +#endif + public override string ConnectionString + { + get + { + return _connectionString; + } + set + { + if (value == null) + throw new ArgumentNullException(); + + else if (_connectionState != ConnectionState.Closed) + throw new InvalidOperationException(); + + _connectionString = value; + } + } + + /// + /// Create a new SQLiteCommand and associate it with this connection. + /// + /// Returns an instantiated SQLiteCommand object already assigned to this connection. + public new SQLiteCommand CreateCommand() + { + return new SQLiteCommand(this); + } + + /// + /// Forwards to the local CreateCommand() function + /// + /// + protected override DbCommand CreateDbCommand() + { + return CreateCommand(); + } + + /// + /// Returns the filename without extension or path + /// +#if !PLATFORM_COMPACTFRAMEWORK + [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] +#endif + public override string DataSource + { + get + { + return _dataSource; + } + } + + /// + /// Returns an empty string + /// +#if !PLATFORM_COMPACTFRAMEWORK + [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] +#endif + public override string Database + { + get + { + return "main"; + } + } + + internal static string MapUriPath(string path) + { + if (path.StartsWith ("file://", StringComparison.OrdinalIgnoreCase)) + return path.Substring (7); + else if (path.StartsWith ("file:", StringComparison.OrdinalIgnoreCase)) + return path.Substring (5); + else if (path.StartsWith ("/", StringComparison.OrdinalIgnoreCase)) + return path; + else + throw new InvalidOperationException ("Invalid connection string: invalid URI"); + } + + /// + /// Parses the connection string into component parts + /// + /// The connection string to parse + /// An array of key-value pairs representing each parameter of the connection string + internal static SortedList ParseConnectionString(string connectionString) + { + string s = connectionString; + int n; + SortedList ls = new SortedList(StringComparer.OrdinalIgnoreCase); + + // First split into semi-colon delimited values. The Split() function of SQLiteBase accounts for and properly + // skips semi-colons in quoted strings + string[] arParts = SQLiteConvert.Split(s, ';'); + string[] arPiece; + + int x = arParts.Length; + // For each semi-colon piece, split into key and value pairs by the presence of the = sign + for (n = 0; n < x; n++) + { + arPiece = SQLiteConvert.Split(arParts[n], '='); + if (arPiece.Length == 2) + { + ls.Add(arPiece[0], arPiece[1]); + } + else throw new ArgumentException(String.Format(CultureInfo.CurrentCulture, "Invalid ConnectionString format for parameter \"{0}\"", (arPiece.Length > 0) ? arPiece[0] : "null")); + } + return ls; + } + +#if !PLATFORM_COMPACTFRAMEWORK + /// + /// Manual distributed transaction enlistment support + /// + /// The distributed transaction to enlist in + public override void EnlistTransaction(System.Transactions.Transaction transaction) + { + if (_transactionLevel > 0 && transaction != null) + throw new ArgumentException("Unable to enlist in transaction, a local transaction already exists"); + + if (_enlistment != null && transaction == _enlistment._scope) + return; + else if (_enlistment != null) + throw new ArgumentException("Already enlisted in a transaction"); + + _enlistment = new SQLiteEnlistment(this, transaction); + } +#endif + + /// + /// Looks for a key in the array of key/values of the parameter string. If not found, return the specified default value + /// + /// The list to look in + /// The key to find + /// The default value to return if the key is not found + /// The value corresponding to the specified key, or the default value if not found. + static internal string FindKey(SortedList items, string key, string defValue) + { + string ret; + + if (items.TryGetValue(key, out ret)) return ret; + + return defValue; + } + + /// + /// Opens the connection using the parameters found in the ConnectionString + /// + public override void Open() + { + if (_connectionState != ConnectionState.Closed) + throw new InvalidOperationException(); + + Close(); + + SortedList opts = ParseConnectionString(_connectionString); + string fileName; + + if (Convert.ToInt32(FindKey(opts, "Version", "3"), CultureInfo.InvariantCulture) != 3) + throw new NotSupportedException("Only SQLite Version 3 is supported at this time"); + + fileName = FindKey(opts, "Data Source", ""); + + if (String.IsNullOrEmpty(fileName)) + { + fileName = FindKey(opts, "Uri", ""); + if (String.IsNullOrEmpty(fileName)) + throw new ArgumentException("Data Source cannot be empty. Use :memory: to open an in-memory database"); + else + fileName = MapUriPath(fileName); + } + + if (String.Compare(fileName, ":MEMORY:", StringComparison.OrdinalIgnoreCase) == 0) + fileName = ":memory:"; + else + { +#if PLATFORM_COMPACTFRAMEWORK + if (fileName.StartsWith(".\\")) + fileName = Path.GetDirectoryName(System.Reflection.Assembly.GetCallingAssembly().GetName().CodeBase) + fileName.Substring(1); +#endif + fileName = ExpandFileName(fileName); + } + try + { + bool usePooling = (SQLiteConvert.ToBoolean(FindKey(opts, "Pooling", Boolean.FalseString)) == true); + bool bUTF16 = (SQLiteConvert.ToBoolean(FindKey(opts, "UseUTF16Encoding", Boolean.FalseString)) == true); + int maxPoolSize = Convert.ToInt32(FindKey(opts, "Max Pool Size", "100"), CultureInfo.InvariantCulture); + + _defaultTimeout = Convert.ToInt32(FindKey(opts, "Default Timeout", "30"), CultureInfo.CurrentCulture); + + _defaultIsolation = (IsolationLevel)Enum.Parse(typeof(IsolationLevel), FindKey(opts, "Default IsolationLevel", "Serializable"), true); + if (_defaultIsolation != IsolationLevel.Serializable && _defaultIsolation != IsolationLevel.ReadCommitted) + throw new NotSupportedException("Invalid Default IsolationLevel specified"); + + SQLiteDateFormats dateFormat = (SQLiteDateFormats)Enum.Parse(typeof(SQLiteDateFormats), FindKey(opts, "DateTimeFormat", "ISO8601"), true); + //string temp = FindKey(opts, "DateTimeFormat", "ISO8601"); + //if (String.Compare(temp, "ticks", StringComparison.OrdinalIgnoreCase) == 0) dateFormat = SQLiteDateFormats.Ticks; + //else if (String.Compare(temp, "julianday", StringComparison.OrdinalIgnoreCase) == 0) dateFormat = SQLiteDateFormats.JulianDay; + + if (bUTF16) // SQLite automatically sets the encoding of the database to UTF16 if called from sqlite3_open16() + _sql = new SQLite3_UTF16(dateFormat); + else + _sql = new SQLite3(dateFormat); + + SQLiteOpenFlagsEnum flags = SQLiteOpenFlagsEnum.None; + + if (SQLiteConvert.ToBoolean(FindKey(opts, "FailIfMissing", Boolean.FalseString)) == false) + flags |= SQLiteOpenFlagsEnum.Create; + + if (SQLiteConvert.ToBoolean(FindKey(opts, "Read Only", Boolean.FalseString)) == true) + flags |= SQLiteOpenFlagsEnum.ReadOnly; + else + flags |= SQLiteOpenFlagsEnum.ReadWrite; + + _sql.Open(fileName, flags, maxPoolSize, usePooling); + + _binaryGuid = (SQLiteConvert.ToBoolean(FindKey(opts, "BinaryGUID", Boolean.TrueString)) == true); + + string password = FindKey(opts, "Password", null); + + if (String.IsNullOrEmpty(password) == false) + _sql.SetPassword(System.Text.UTF8Encoding.UTF8.GetBytes(password)); + else if (_password != null) + _sql.SetPassword(_password); + _password = null; + + _dataSource = Path.GetFileNameWithoutExtension(fileName); + + _version++; + + ConnectionState oldstate = _connectionState; + _connectionState = ConnectionState.Open; + try + { + using (SQLiteCommand cmd = CreateCommand()) + { + string defValue; + + if (fileName != ":memory:") + { + defValue = FindKey(opts, "Page Size", "1024"); + if (Convert.ToInt32(defValue, CultureInfo.InvariantCulture) != 1024) + { + cmd.CommandText = String.Format(CultureInfo.InvariantCulture, "PRAGMA page_size={0}", defValue); + cmd.ExecuteNonQuery(); + } + } + + defValue = FindKey(opts, "Max Page Count", "0"); + if (Convert.ToInt32(defValue, CultureInfo.InvariantCulture) != 0) + { + cmd.CommandText = String.Format(CultureInfo.InvariantCulture, "PRAGMA max_page_count={0}", defValue); + cmd.ExecuteNonQuery(); + } + + defValue = FindKey(opts, "Legacy Format", Boolean.FalseString); + cmd.CommandText = String.Format(CultureInfo.InvariantCulture, "PRAGMA legacy_file_format={0}", SQLiteConvert.ToBoolean(defValue) == true ? "ON" : "OFF"); + cmd.ExecuteNonQuery(); + + defValue = FindKey(opts, "Synchronous", "Normal"); + if (String.Compare(defValue, "Full", StringComparison.OrdinalIgnoreCase) != 0) + { + cmd.CommandText = String.Format(CultureInfo.InvariantCulture, "PRAGMA synchronous={0}", defValue); + cmd.ExecuteNonQuery(); + } + + defValue = FindKey(opts, "Cache Size", "2000"); + if (Convert.ToInt32(defValue, CultureInfo.InvariantCulture) != 2000) + { + cmd.CommandText = String.Format(CultureInfo.InvariantCulture, "PRAGMA cache_size={0}", defValue); + cmd.ExecuteNonQuery(); + } + + defValue = FindKey(opts, "Journal Mode", "Delete"); + if (String.Compare(defValue, "Default", StringComparison.OrdinalIgnoreCase) != 0) + { + cmd.CommandText = String.Format(CultureInfo.InvariantCulture, "PRAGMA journal_mode={0}", defValue); + cmd.ExecuteNonQuery(); + } + + defValue = FindKey(opts, "Foreign Keys", Boolean.FalseString); + cmd.CommandText = String.Format(CultureInfo.InvariantCulture, "PRAGMA foreign_keys={0}", SQLiteConvert.ToBoolean(defValue) == true ? "ON" : "OFF"); + cmd.ExecuteNonQuery(); + } + + if (_commitHandler != null) + _sql.SetCommitHook(_commitCallback); + + if (_updateHandler != null) + _sql.SetUpdateHook(_updateCallback); + + if (_rollbackHandler != null) + _sql.SetRollbackHook(_rollbackCallback); + +#if !PLATFORM_COMPACTFRAMEWORK + if (Transactions.Transaction.Current != null && SQLiteConvert.ToBoolean(FindKey(opts, "Enlist", Boolean.TrueString)) == true) + EnlistTransaction(Transactions.Transaction.Current); +#endif + + _connectionState = oldstate; + OnStateChange(ConnectionState.Open); + } + catch + { + _connectionState = oldstate; + throw; + } + } + catch (SQLiteException) + { + Close(); + throw; + } + } + + /// + /// Gets/sets the default command timeout for newly-created commands. This is especially useful for + /// commands used internally such as inside a SQLiteTransaction, where setting the timeout is not possible. + /// This can also be set in the ConnectionString with "Default Timeout" + /// + public int DefaultTimeout + { + get { return _defaultTimeout; } + set { _defaultTimeout = value; } + } + + /// + /// Returns the version of the underlying SQLite database engine + /// +#if !PLATFORM_COMPACTFRAMEWORK + [Browsable(false), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] +#endif + public override string ServerVersion + { + get + { + return SQLiteVersion; + //if (_connectionState != ConnectionState.Open) + // throw new InvalidOperationException(); + + //return _sql.Version; + } + } + + /// + /// Returns the version of the underlying SQLite database engine + /// + public static string SQLiteVersion + { + get { return SQLite3.SQLiteVersion; } + } + + /// + /// Returns the state of the connection. + /// +#if !PLATFORM_COMPACTFRAMEWORK + [Browsable(false), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] +#endif + public override ConnectionState State + { + get + { + return _connectionState; + } + } + + /// + /// Change the password (or assign a password) to an open database. + /// + /// + /// No readers or writers may be active for this process. The database must already be open + /// and if it already was password protected, the existing password must already have been supplied. + /// + /// The new password to assign to the database + public void ChangePassword(string newPassword) + { + ChangePassword(String.IsNullOrEmpty(newPassword) ? null : System.Text.UTF8Encoding.UTF8.GetBytes(newPassword)); + } + + /// + /// Change the password (or assign a password) to an open database. + /// + /// + /// No readers or writers may be active for this process. The database must already be open + /// and if it already was password protected, the existing password must already have been supplied. + /// + /// The new password to assign to the database + public void ChangePassword(byte[] newPassword) + { + if (_connectionState != ConnectionState.Open) + throw new InvalidOperationException("Database must be opened before changing the password."); + + _sql.ChangePassword(newPassword); + } + + /// + /// Sets the password for a password-protected database. A password-protected database is + /// unusable for any operation until the password has been set. + /// + /// The password for the database + public void SetPassword(string databasePassword) + { + SetPassword(String.IsNullOrEmpty(databasePassword) ? null : System.Text.UTF8Encoding.UTF8.GetBytes(databasePassword)); + } + + /// + /// Sets the password for a password-protected database. A password-protected database is + /// unusable for any operation until the password has been set. + /// + /// The password for the database + public void SetPassword(byte[] databasePassword) + { + if (_connectionState != ConnectionState.Closed) + throw new InvalidOperationException("Password can only be set before the database is opened."); + + if (databasePassword != null) + if (databasePassword.Length == 0) databasePassword = null; + + _password = databasePassword; + } + + /// + /// Expand the filename of the data source, resolving the |DataDirectory| macro as appropriate. + /// + /// The database filename to expand + /// The expanded path and filename of the filename + private string ExpandFileName(string sourceFile) + { + if (String.IsNullOrEmpty(sourceFile)) return sourceFile; + + if (sourceFile.StartsWith(_dataDirectory, StringComparison.OrdinalIgnoreCase)) + { + string dataDirectory; + +#if PLATFORM_COMPACTFRAMEWORK + dataDirectory = Path.GetDirectoryName(System.Reflection.Assembly.GetCallingAssembly().GetName().CodeBase); +#else + dataDirectory = AppDomain.CurrentDomain.GetData("DataDirectory") as string; + if (String.IsNullOrEmpty(dataDirectory)) + dataDirectory = AppDomain.CurrentDomain.BaseDirectory; +#endif + + if (sourceFile.Length > _dataDirectory.Length) + { + if (sourceFile[_dataDirectory.Length] == Path.DirectorySeparatorChar || + sourceFile[_dataDirectory.Length] == Path.AltDirectorySeparatorChar) + sourceFile = sourceFile.Remove(_dataDirectory.Length, 1); + } + sourceFile = Path.Combine(dataDirectory, sourceFile.Substring(_dataDirectory.Length)); + } + +#if !PLATFORM_COMPACTFRAMEWORK + sourceFile = Path.GetFullPath(sourceFile); +#endif + + return sourceFile; + } + + /// + /// The following commands are used to extract schema information out of the database. Valid schema types are: + /// + /// + /// MetaDataCollections + /// + /// + /// DataSourceInformation + /// + /// + /// Catalogs + /// + /// + /// Columns + /// + /// + /// ForeignKeys + /// + /// + /// Indexes + /// + /// + /// IndexColumns + /// + /// + /// Tables + /// + /// + /// Views + /// + /// + /// ViewColumns + /// + /// + /// + /// + /// Returns the MetaDataCollections schema + /// + /// A DataTable of the MetaDataCollections schema + public override DataTable GetSchema() + { + return GetSchema("MetaDataCollections", null); + } + + /// + /// Returns schema information of the specified collection + /// + /// The schema collection to retrieve + /// A DataTable of the specified collection + public override DataTable GetSchema(string collectionName) + { + return GetSchema(collectionName, new string[0]); + } + + /// + /// Retrieves schema information using the specified constraint(s) for the specified collection + /// + /// The collection to retrieve + /// The restrictions to impose + /// A DataTable of the specified collection + public override DataTable GetSchema(string collectionName, string[] restrictionValues) + { + if (_connectionState != ConnectionState.Open) + throw new InvalidOperationException(); + + string[] parms = new string[5]; + + if (restrictionValues == null) restrictionValues = new string[0]; + restrictionValues.CopyTo(parms, 0); + + switch (collectionName.ToUpper(CultureInfo.InvariantCulture)) + { + case "METADATACOLLECTIONS": + return Schema_MetaDataCollections(); + case "DATASOURCEINFORMATION": + return Schema_DataSourceInformation(); + case "DATATYPES": + return Schema_DataTypes(); + case "COLUMNS": + case "TABLECOLUMNS": + return Schema_Columns(parms[0], parms[2], parms[3]); + case "INDEXES": + return Schema_Indexes(parms[0], parms[2], parms[3]); + case "TRIGGERS": + return Schema_Triggers(parms[0], parms[2], parms[3]); + case "INDEXCOLUMNS": + return Schema_IndexColumns(parms[0], parms[2], parms[3], parms[4]); + case "TABLES": + return Schema_Tables(parms[0], parms[2], parms[3]); + case "VIEWS": + return Schema_Views(parms[0], parms[2]); + case "VIEWCOLUMNS": + return Schema_ViewColumns(parms[0], parms[2], parms[3]); + case "FOREIGNKEYS": + return Schema_ForeignKeys(parms[0], parms[2], parms[3]); + case "CATALOGS": + return Schema_Catalogs(parms[0]); + case "RESERVEDWORDS": + return Schema_ReservedWords(); + } + throw new NotSupportedException(); + } + + private static DataTable Schema_ReservedWords() + { + DataTable tbl = new DataTable("MetaDataCollections"); + + tbl.Locale = CultureInfo.InvariantCulture; + tbl.Columns.Add("ReservedWord", typeof(string)); + tbl.Columns.Add("MaximumVersion", typeof(string)); + tbl.Columns.Add("MinimumVersion", typeof(string)); + + tbl.BeginLoadData(); + DataRow row; + foreach (string word in SR.Keywords.Split(new char[] { ',' })) + { + row = tbl.NewRow(); + row[0] = word; + tbl.Rows.Add(row); + } + + tbl.AcceptChanges(); + tbl.EndLoadData(); + + return tbl; + } + + /// + /// Builds a MetaDataCollections schema datatable + /// + /// DataTable + private static DataTable Schema_MetaDataCollections() + { + DataTable tbl = new DataTable("MetaDataCollections"); + + tbl.Locale = CultureInfo.InvariantCulture; + tbl.Columns.Add("CollectionName", typeof(string)); + tbl.Columns.Add("NumberOfRestrictions", typeof(int)); + tbl.Columns.Add("NumberOfIdentifierParts", typeof(int)); + + tbl.BeginLoadData(); + + StringReader reader = new StringReader(SR.MetaDataCollections); + tbl.ReadXml(reader); + reader.Close(); + + tbl.AcceptChanges(); + tbl.EndLoadData(); + + return tbl; + } + + /// + /// Builds a DataSourceInformation datatable + /// + /// DataTable + private DataTable Schema_DataSourceInformation() + { + DataTable tbl = new DataTable("DataSourceInformation"); + DataRow row; + + tbl.Locale = CultureInfo.InvariantCulture; + tbl.Columns.Add(DbMetaDataColumnNames.CompositeIdentifierSeparatorPattern, typeof(string)); + tbl.Columns.Add(DbMetaDataColumnNames.DataSourceProductName, typeof(string)); + tbl.Columns.Add(DbMetaDataColumnNames.DataSourceProductVersion, typeof(string)); + tbl.Columns.Add(DbMetaDataColumnNames.DataSourceProductVersionNormalized, typeof(string)); + tbl.Columns.Add(DbMetaDataColumnNames.GroupByBehavior, typeof(int)); + tbl.Columns.Add(DbMetaDataColumnNames.IdentifierPattern, typeof(string)); + tbl.Columns.Add(DbMetaDataColumnNames.IdentifierCase, typeof(int)); + tbl.Columns.Add(DbMetaDataColumnNames.OrderByColumnsInSelect, typeof(bool)); + tbl.Columns.Add(DbMetaDataColumnNames.ParameterMarkerFormat, typeof(string)); + tbl.Columns.Add(DbMetaDataColumnNames.ParameterMarkerPattern, typeof(string)); + tbl.Columns.Add(DbMetaDataColumnNames.ParameterNameMaxLength, typeof(int)); + tbl.Columns.Add(DbMetaDataColumnNames.ParameterNamePattern, typeof(string)); + tbl.Columns.Add(DbMetaDataColumnNames.QuotedIdentifierPattern, typeof(string)); + tbl.Columns.Add(DbMetaDataColumnNames.QuotedIdentifierCase, typeof(int)); + tbl.Columns.Add(DbMetaDataColumnNames.StatementSeparatorPattern, typeof(string)); + tbl.Columns.Add(DbMetaDataColumnNames.StringLiteralPattern, typeof(string)); + tbl.Columns.Add(DbMetaDataColumnNames.SupportedJoinOperators, typeof(int)); + + tbl.BeginLoadData(); + + row = tbl.NewRow(); + row.ItemArray = new object[] { + null, + "SQLite", + _sql.Version, + _sql.Version, + 3, + @"(^\[\p{Lo}\p{Lu}\p{Ll}_@#][\p{Lo}\p{Lu}\p{Ll}\p{Nd}@$#_]*$)|(^\[[^\]\0]|\]\]+\]$)|(^\""[^\""\0]|\""\""+\""$)", + 1, + false, + "{0}", + @"@[\p{Lo}\p{Lu}\p{Ll}\p{Lm}_@#][\p{Lo}\p{Lu}\p{Ll}\p{Lm}\p{Nd}\uff3f_@#\$]*(?=\s+|$)", + 255, + @"^[\p{Lo}\p{Lu}\p{Ll}\p{Lm}_@#][\p{Lo}\p{Lu}\p{Ll}\p{Lm}\p{Nd}\uff3f_@#\$]*(?=\s+|$)", + @"(([^\[]|\]\])*)", + 1, + ";", + @"'(([^']|'')*)'", + 15 + }; + tbl.Rows.Add(row); + + tbl.AcceptChanges(); + tbl.EndLoadData(); + + return tbl; + } + + /// + /// Build a Columns schema + /// + /// The catalog (attached database) to query, can be null + /// The table to retrieve schema information for, must not be null + /// The column to retrieve schema information for, can be null + /// DataTable + private DataTable Schema_Columns(string strCatalog, string strTable, string strColumn) + { + DataTable tbl = new DataTable("Columns"); + DataRow row; + + tbl.Locale = CultureInfo.InvariantCulture; + tbl.Columns.Add("TABLE_CATALOG", typeof(string)); + tbl.Columns.Add("TABLE_SCHEMA", typeof(string)); + tbl.Columns.Add("TABLE_NAME", typeof(string)); + tbl.Columns.Add("COLUMN_NAME", typeof(string)); + tbl.Columns.Add("COLUMN_GUID", typeof(Guid)); + tbl.Columns.Add("COLUMN_PROPID", typeof(long)); + tbl.Columns.Add("ORDINAL_POSITION", typeof(int)); + tbl.Columns.Add("COLUMN_HASDEFAULT", typeof(bool)); + tbl.Columns.Add("COLUMN_DEFAULT", typeof(string)); + tbl.Columns.Add("COLUMN_FLAGS", typeof(long)); + tbl.Columns.Add("IS_NULLABLE", typeof(bool)); + tbl.Columns.Add("DATA_TYPE", typeof(string)); + tbl.Columns.Add("TYPE_GUID", typeof(Guid)); + tbl.Columns.Add("CHARACTER_MAXIMUM_LENGTH", typeof(int)); + tbl.Columns.Add("CHARACTER_OCTET_LENGTH", typeof(int)); + tbl.Columns.Add("NUMERIC_PRECISION", typeof(int)); + tbl.Columns.Add("NUMERIC_SCALE", typeof(int)); + tbl.Columns.Add("DATETIME_PRECISION", typeof(long)); + tbl.Columns.Add("CHARACTER_SET_CATALOG", typeof(string)); + tbl.Columns.Add("CHARACTER_SET_SCHEMA", typeof(string)); + tbl.Columns.Add("CHARACTER_SET_NAME", typeof(string)); + tbl.Columns.Add("COLLATION_CATALOG", typeof(string)); + tbl.Columns.Add("COLLATION_SCHEMA", typeof(string)); + tbl.Columns.Add("COLLATION_NAME", typeof(string)); + tbl.Columns.Add("DOMAIN_CATALOG", typeof(string)); + tbl.Columns.Add("DOMAIN_NAME", typeof(string)); + tbl.Columns.Add("DESCRIPTION", typeof(string)); + tbl.Columns.Add("PRIMARY_KEY", typeof(bool)); + tbl.Columns.Add("EDM_TYPE", typeof(string)); + tbl.Columns.Add("AUTOINCREMENT", typeof(bool)); + tbl.Columns.Add("UNIQUE", typeof(bool)); + + tbl.BeginLoadData(); + + if (String.IsNullOrEmpty(strCatalog)) strCatalog = "main"; + + string master = (String.Compare(strCatalog, "temp", StringComparison.OrdinalIgnoreCase) == 0) ? _tempmasterdb : _masterdb; + + using (SQLiteCommand cmdTables = new SQLiteCommand(String.Format(CultureInfo.InvariantCulture, "SELECT * FROM [{0}].[{1}] WHERE [type] LIKE 'table' OR [type] LIKE 'view'", strCatalog, master), this)) + using (SQLiteDataReader rdTables = cmdTables.ExecuteReader()) + { + while (rdTables.Read()) + { + if (String.IsNullOrEmpty(strTable) || String.Compare(strTable, rdTables.GetString(2), StringComparison.OrdinalIgnoreCase) == 0) + { + try + { + using (SQLiteCommand cmd = new SQLiteCommand(String.Format(CultureInfo.InvariantCulture, "SELECT * FROM [{0}].[{1}]", strCatalog, rdTables.GetString(2)), this)) + using (SQLiteDataReader rd = (SQLiteDataReader)cmd.ExecuteReader(CommandBehavior.SchemaOnly)) + using (DataTable tblSchema = rd.GetSchemaTable(true, true)) + { + foreach (DataRow schemaRow in tblSchema.Rows) + { + if (String.Compare(schemaRow[SchemaTableColumn.ColumnName].ToString(), strColumn, StringComparison.OrdinalIgnoreCase) == 0 + || strColumn == null) + { + row = tbl.NewRow(); + + row["NUMERIC_PRECISION"] = schemaRow[SchemaTableColumn.NumericPrecision]; + row["NUMERIC_SCALE"] = schemaRow[SchemaTableColumn.NumericScale]; + row["TABLE_NAME"] = rdTables.GetString(2); + row["COLUMN_NAME"] = schemaRow[SchemaTableColumn.ColumnName]; + row["TABLE_CATALOG"] = strCatalog; + row["ORDINAL_POSITION"] = schemaRow[SchemaTableColumn.ColumnOrdinal]; + row["COLUMN_HASDEFAULT"] = (schemaRow[SchemaTableOptionalColumn.DefaultValue] != DBNull.Value); + row["COLUMN_DEFAULT"] = schemaRow[SchemaTableOptionalColumn.DefaultValue]; + row["IS_NULLABLE"] = schemaRow[SchemaTableColumn.AllowDBNull]; + row["DATA_TYPE"] = schemaRow["DataTypeName"].ToString().ToLower(CultureInfo.InvariantCulture); + row["EDM_TYPE"] = SQLiteConvert.DbTypeToTypeName((DbType)schemaRow[SchemaTableColumn.ProviderType]).ToString().ToLower(CultureInfo.InvariantCulture); + row["CHARACTER_MAXIMUM_LENGTH"] = schemaRow[SchemaTableColumn.ColumnSize]; + row["TABLE_SCHEMA"] = schemaRow[SchemaTableColumn.BaseSchemaName]; + row["PRIMARY_KEY"] = schemaRow[SchemaTableColumn.IsKey]; + row["AUTOINCREMENT"] = schemaRow[SchemaTableOptionalColumn.IsAutoIncrement]; + row["COLLATION_NAME"] = schemaRow["CollationType"]; + row["UNIQUE"] = schemaRow[SchemaTableColumn.IsUnique]; + tbl.Rows.Add(row); + } + } + } + } + catch(SQLiteException) + { + } + } + } + } + + tbl.AcceptChanges(); + tbl.EndLoadData(); + + return tbl; + } + + /// + /// Returns index information for the given database and catalog + /// + /// The catalog (attached database) to query, can be null + /// The name of the index to retrieve information for, can be null + /// The table to retrieve index information for, can be null + /// DataTable + private DataTable Schema_Indexes(string strCatalog, string strTable, string strIndex) + { + DataTable tbl = new DataTable("Indexes"); + DataRow row; + List primaryKeys = new List(); + bool maybeRowId; + + tbl.Locale = CultureInfo.InvariantCulture; + tbl.Columns.Add("TABLE_CATALOG", typeof(string)); + tbl.Columns.Add("TABLE_SCHEMA", typeof(string)); + tbl.Columns.Add("TABLE_NAME", typeof(string)); + tbl.Columns.Add("INDEX_CATALOG", typeof(string)); + tbl.Columns.Add("INDEX_SCHEMA", typeof(string)); + tbl.Columns.Add("INDEX_NAME", typeof(string)); + tbl.Columns.Add("PRIMARY_KEY", typeof(bool)); + tbl.Columns.Add("UNIQUE", typeof(bool)); + tbl.Columns.Add("CLUSTERED", typeof(bool)); + tbl.Columns.Add("TYPE", typeof(int)); + tbl.Columns.Add("FILL_FACTOR", typeof(int)); + tbl.Columns.Add("INITIAL_SIZE", typeof(int)); + tbl.Columns.Add("NULLS", typeof(int)); + tbl.Columns.Add("SORT_BOOKMARKS", typeof(bool)); + tbl.Columns.Add("AUTO_UPDATE", typeof(bool)); + tbl.Columns.Add("NULL_COLLATION", typeof(int)); + tbl.Columns.Add("ORDINAL_POSITION", typeof(int)); + tbl.Columns.Add("COLUMN_NAME", typeof(string)); + tbl.Columns.Add("COLUMN_GUID", typeof(Guid)); + tbl.Columns.Add("COLUMN_PROPID", typeof(long)); + tbl.Columns.Add("COLLATION", typeof(short)); + tbl.Columns.Add("CARDINALITY", typeof(Decimal)); + tbl.Columns.Add("PAGES", typeof(int)); + tbl.Columns.Add("FILTER_CONDITION", typeof(string)); + tbl.Columns.Add("INTEGRATED", typeof(bool)); + tbl.Columns.Add("INDEX_DEFINITION", typeof(string)); + + tbl.BeginLoadData(); + + if (String.IsNullOrEmpty(strCatalog)) strCatalog = "main"; + + string master = (String.Compare(strCatalog, "temp", StringComparison.OrdinalIgnoreCase) == 0) ? _tempmasterdb : _masterdb; + + using (SQLiteCommand cmdTables = new SQLiteCommand(String.Format(CultureInfo.InvariantCulture, "SELECT * FROM [{0}].[{1}] WHERE [type] LIKE 'table'", strCatalog, master), this)) + using (SQLiteDataReader rdTables = cmdTables.ExecuteReader()) + { + while (rdTables.Read()) + { + maybeRowId = false; + primaryKeys.Clear(); + if (String.IsNullOrEmpty(strTable) || String.Compare(rdTables.GetString(2), strTable, StringComparison.OrdinalIgnoreCase) == 0) + { + // First, look for any rowid indexes -- which sqlite defines are INTEGER PRIMARY KEY columns. + // Such indexes are not listed in the indexes list but count as indexes just the same. + try + { + using (SQLiteCommand cmdTable = new SQLiteCommand(String.Format(CultureInfo.InvariantCulture, "PRAGMA [{0}].table_info([{1}])", strCatalog, rdTables.GetString(2)), this)) + using (SQLiteDataReader rdTable = cmdTable.ExecuteReader()) + { + while (rdTable.Read()) + { + if (rdTable.GetInt32(5) == 1) + { + primaryKeys.Add(rdTable.GetInt32(0)); + + // If the primary key is of type INTEGER, then its a rowid and we need to make a fake index entry for it. + if (String.Compare(rdTable.GetString(2), "INTEGER", StringComparison.OrdinalIgnoreCase) == 0) + maybeRowId = true; + } + } + } + } + catch (SQLiteException) + { + } + if (primaryKeys.Count == 1 && maybeRowId == true) + { + row = tbl.NewRow(); + + row["TABLE_CATALOG"] = strCatalog; + row["TABLE_NAME"] = rdTables.GetString(2); + row["INDEX_CATALOG"] = strCatalog; + row["PRIMARY_KEY"] = true; + row["INDEX_NAME"] = String.Format(CultureInfo.InvariantCulture, "{1}_PK_{0}", rdTables.GetString(2), master); + row["UNIQUE"] = true; + + if (String.Compare((string)row["INDEX_NAME"], strIndex, StringComparison.OrdinalIgnoreCase) == 0 + || strIndex == null) + { + tbl.Rows.Add(row); + } + + primaryKeys.Clear(); + } + + // Now fetch all the rest of the indexes. + try + { + using (SQLiteCommand cmd = new SQLiteCommand(String.Format(CultureInfo.InvariantCulture, "PRAGMA [{0}].index_list([{1}])", strCatalog, rdTables.GetString(2)), this)) + using (SQLiteDataReader rd = (SQLiteDataReader)cmd.ExecuteReader()) + { + while (rd.Read()) + { + if (String.Compare(rd.GetString(1), strIndex, StringComparison.OrdinalIgnoreCase) == 0 + || strIndex == null) + { + row = tbl.NewRow(); + + row["TABLE_CATALOG"] = strCatalog; + row["TABLE_NAME"] = rdTables.GetString(2); + row["INDEX_CATALOG"] = strCatalog; + row["INDEX_NAME"] = rd.GetString(1); + row["UNIQUE"] = rd.GetBoolean(2); + row["PRIMARY_KEY"] = false; + + // get the index definition + using (SQLiteCommand cmdIndexes = new SQLiteCommand(String.Format(CultureInfo.InvariantCulture, "SELECT * FROM [{0}].[{2}] WHERE [type] LIKE 'index' AND [name] LIKE '{1}'", strCatalog, rd.GetString(1).Replace("'", "''"), master), this)) + using (SQLiteDataReader rdIndexes = cmdIndexes.ExecuteReader()) + { + while (rdIndexes.Read()) + { + if (rdIndexes.IsDBNull(4) == false) + row["INDEX_DEFINITION"] = rdIndexes.GetString(4); + break; + } + } + + // Now for the really hard work. Figure out which index is the primary key index. + // The only way to figure it out is to check if the index was an autoindex and if we have a non-rowid + // primary key, and all the columns in the given index match the primary key columns + if (primaryKeys.Count > 0 && rd.GetString(1).StartsWith("sqlite_autoindex_" + rdTables.GetString(2), StringComparison.InvariantCultureIgnoreCase) == true) + { + using (SQLiteCommand cmdDetails = new SQLiteCommand(String.Format(CultureInfo.InvariantCulture, "PRAGMA [{0}].index_info([{1}])", strCatalog, rd.GetString(1)), this)) + using (SQLiteDataReader rdDetails = cmdDetails.ExecuteReader()) + { + int nMatches = 0; + while (rdDetails.Read()) + { + if (primaryKeys.Contains(rdDetails.GetInt32(1)) == false) + { + nMatches = 0; + break; + } + nMatches++; + } + if (nMatches == primaryKeys.Count) + { + row["PRIMARY_KEY"] = true; + primaryKeys.Clear(); + } + } + } + + tbl.Rows.Add(row); + } + } + } + } + catch (SQLiteException) + { + } + } + } + } + + tbl.AcceptChanges(); + tbl.EndLoadData(); + + return tbl; + } + + private DataTable Schema_Triggers(string catalog, string table, string triggerName) + { + DataTable tbl = new DataTable("Triggers"); + DataRow row; + + tbl.Locale = CultureInfo.InvariantCulture; + tbl.Columns.Add("TABLE_CATALOG", typeof(string)); + tbl.Columns.Add("TABLE_SCHEMA", typeof(string)); + tbl.Columns.Add("TABLE_NAME", typeof(string)); + tbl.Columns.Add("TRIGGER_NAME", typeof(string)); + tbl.Columns.Add("TRIGGER_DEFINITION", typeof(string)); + + tbl.BeginLoadData(); + + if (String.IsNullOrEmpty(table)) table = null; + if (String.IsNullOrEmpty(catalog)) catalog = "main"; + string master = (String.Compare(catalog, "temp", StringComparison.OrdinalIgnoreCase) == 0) ? _tempmasterdb : _masterdb; + + using (SQLiteCommand cmd = new SQLiteCommand(String.Format(CultureInfo.InvariantCulture, "SELECT [type], [name], [tbl_name], [rootpage], [sql], [rowid] FROM [{0}].[{1}] WHERE [type] LIKE 'trigger'", catalog, master), this)) + using (SQLiteDataReader rd = (SQLiteDataReader)cmd.ExecuteReader()) + { + while (rd.Read()) + { + if (String.Compare(rd.GetString(1), triggerName, StringComparison.OrdinalIgnoreCase) == 0 + || triggerName == null) + { + if (table == null || String.Compare(table, rd.GetString(2), StringComparison.OrdinalIgnoreCase) == 0) + { + row = tbl.NewRow(); + + row["TABLE_CATALOG"] = catalog; + row["TABLE_NAME"] = rd.GetString(2); + row["TRIGGER_NAME"] = rd.GetString(1); + row["TRIGGER_DEFINITION"] = rd.GetString(4); + + tbl.Rows.Add(row); + } + } + } + } + tbl.AcceptChanges(); + tbl.EndLoadData(); + + return tbl; + } + + /// + /// Retrieves table schema information for the database and catalog + /// + /// The catalog (attached database) to retrieve tables on + /// The table to retrieve, can be null + /// The table type, can be null + /// DataTable + private DataTable Schema_Tables(string strCatalog, string strTable, string strType) + { + DataTable tbl = new DataTable("Tables"); + DataRow row; + string strItem; + + tbl.Locale = CultureInfo.InvariantCulture; + tbl.Columns.Add("TABLE_CATALOG", typeof(string)); + tbl.Columns.Add("TABLE_SCHEMA", typeof(string)); + tbl.Columns.Add("TABLE_NAME", typeof(string)); + tbl.Columns.Add("TABLE_TYPE", typeof(string)); + tbl.Columns.Add("TABLE_ID", typeof(long)); + tbl.Columns.Add("TABLE_ROOTPAGE", typeof(int)); + tbl.Columns.Add("TABLE_DEFINITION", typeof(string)); + tbl.BeginLoadData(); + + if (String.IsNullOrEmpty(strCatalog)) strCatalog = "main"; + + string master = (String.Compare(strCatalog, "temp", StringComparison.OrdinalIgnoreCase) == 0) ? _tempmasterdb : _masterdb; + + using (SQLiteCommand cmd = new SQLiteCommand(String.Format(CultureInfo.InvariantCulture, "SELECT [type], [name], [tbl_name], [rootpage], [sql], [rowid] FROM [{0}].[{1}] WHERE [type] LIKE 'table'", strCatalog, master), this)) + using (SQLiteDataReader rd = (SQLiteDataReader)cmd.ExecuteReader()) + { + while (rd.Read()) + { + strItem = rd.GetString(0); + if (String.Compare(rd.GetString(2), 0, "SQLITE_", 0, 7, StringComparison.OrdinalIgnoreCase) == 0) + strItem = "SYSTEM_TABLE"; + + if (String.Compare(strType, strItem, StringComparison.OrdinalIgnoreCase) == 0 + || strType == null) + { + if (String.Compare(rd.GetString(2), strTable, StringComparison.OrdinalIgnoreCase) == 0 + || strTable == null) + { + row = tbl.NewRow(); + + row["TABLE_CATALOG"] = strCatalog; + row["TABLE_NAME"] = rd.GetString(2); + row["TABLE_TYPE"] = strItem; + row["TABLE_ID"] = rd.GetInt64(5); + row["TABLE_ROOTPAGE"] = rd.GetInt32(3); + row["TABLE_DEFINITION"] = rd.GetString(4); + + tbl.Rows.Add(row); + } + } + } + } + + tbl.AcceptChanges(); + tbl.EndLoadData(); + + return tbl; + } + + /// + /// Retrieves view schema information for the database + /// + /// The catalog (attached database) to retrieve views on + /// The view name, can be null + /// DataTable + private DataTable Schema_Views(string strCatalog, string strView) + { + DataTable tbl = new DataTable("Views"); + DataRow row; + string strItem; + int nPos; + + tbl.Locale = CultureInfo.InvariantCulture; + tbl.Columns.Add("TABLE_CATALOG", typeof(string)); + tbl.Columns.Add("TABLE_SCHEMA", typeof(string)); + tbl.Columns.Add("TABLE_NAME", typeof(string)); + tbl.Columns.Add("VIEW_DEFINITION", typeof(string)); + tbl.Columns.Add("CHECK_OPTION", typeof(bool)); + tbl.Columns.Add("IS_UPDATABLE", typeof(bool)); + tbl.Columns.Add("DESCRIPTION", typeof(string)); + tbl.Columns.Add("DATE_CREATED", typeof(DateTime)); + tbl.Columns.Add("DATE_MODIFIED", typeof(DateTime)); + + tbl.BeginLoadData(); + + if (String.IsNullOrEmpty(strCatalog)) strCatalog = "main"; + + string master = (String.Compare(strCatalog, "temp", StringComparison.OrdinalIgnoreCase) == 0) ? _tempmasterdb : _masterdb; + + using (SQLiteCommand cmd = new SQLiteCommand(String.Format(CultureInfo.InvariantCulture, "SELECT * FROM [{0}].[{1}] WHERE [type] LIKE 'view'", strCatalog, master), this)) + using (SQLiteDataReader rd = (SQLiteDataReader)cmd.ExecuteReader()) + { + while (rd.Read()) + { + if (String.Compare(rd.GetString(1), strView, StringComparison.OrdinalIgnoreCase) == 0 + || String.IsNullOrEmpty(strView)) + { + strItem = rd.GetString(4).Replace('\r', ' ').Replace('\n', ' ').Replace('\t', ' '); + nPos = CultureInfo.InvariantCulture.CompareInfo.IndexOf(strItem, " AS ", CompareOptions.IgnoreCase); + if (nPos > -1) + { + strItem = strItem.Substring(nPos + 4).Trim(); + row = tbl.NewRow(); + + row["TABLE_CATALOG"] = strCatalog; + row["TABLE_NAME"] = rd.GetString(2); + row["IS_UPDATABLE"] = false; + row["VIEW_DEFINITION"] = strItem; + + tbl.Rows.Add(row); + } + } + } + } + + tbl.AcceptChanges(); + tbl.EndLoadData(); + + return tbl; + } + + /// + /// Retrieves catalog (attached databases) schema information for the database + /// + /// The catalog to retrieve, can be null + /// DataTable + private DataTable Schema_Catalogs(string strCatalog) + { + DataTable tbl = new DataTable("Catalogs"); + DataRow row; + + tbl.Locale = CultureInfo.InvariantCulture; + tbl.Columns.Add("CATALOG_NAME", typeof(string)); + tbl.Columns.Add("DESCRIPTION", typeof(string)); + tbl.Columns.Add("ID", typeof(long)); + + tbl.BeginLoadData(); + + using (SQLiteCommand cmd = new SQLiteCommand("PRAGMA database_list", this)) + using (SQLiteDataReader rd = (SQLiteDataReader)cmd.ExecuteReader()) + { + while (rd.Read()) + { + if (String.Compare(rd.GetString(1), strCatalog, StringComparison.OrdinalIgnoreCase) == 0 + || strCatalog == null) + { + row = tbl.NewRow(); + + row["CATALOG_NAME"] = rd.GetString(1); + row["DESCRIPTION"] = rd.GetString(2); + row["ID"] = rd.GetInt64(0); + + tbl.Rows.Add(row); + } + } + } + + tbl.AcceptChanges(); + tbl.EndLoadData(); + + return tbl; + } + + private DataTable Schema_DataTypes() + { + DataTable tbl = new DataTable("DataTypes"); + + tbl.Locale = CultureInfo.InvariantCulture; + tbl.Columns.Add("TypeName", typeof(String)); + tbl.Columns.Add("ProviderDbType", typeof(int)); + tbl.Columns.Add("ColumnSize", typeof(long)); + tbl.Columns.Add("CreateFormat", typeof(String)); + tbl.Columns.Add("CreateParameters", typeof(String)); + tbl.Columns.Add("DataType", typeof(String)); + tbl.Columns.Add("IsAutoIncrementable", typeof(bool)); + tbl.Columns.Add("IsBestMatch", typeof(bool)); + tbl.Columns.Add("IsCaseSensitive", typeof(bool)); + tbl.Columns.Add("IsFixedLength", typeof(bool)); + tbl.Columns.Add("IsFixedPrecisionScale", typeof(bool)); + tbl.Columns.Add("IsLong", typeof(bool)); + tbl.Columns.Add("IsNullable", typeof(bool)); + tbl.Columns.Add("IsSearchable", typeof(bool)); + tbl.Columns.Add("IsSearchableWithLike", typeof(bool)); + tbl.Columns.Add("IsLiteralSupported", typeof(bool)); + tbl.Columns.Add("LiteralPrefix", typeof(String)); + tbl.Columns.Add("LiteralSuffix", typeof(String)); + tbl.Columns.Add("IsUnsigned", typeof(bool)); + tbl.Columns.Add("MaximumScale", typeof(short)); + tbl.Columns.Add("MinimumScale", typeof(short)); + tbl.Columns.Add("IsConcurrencyType", typeof(bool)); + + tbl.BeginLoadData(); + + StringReader reader = new StringReader(SR.DataTypes); + tbl.ReadXml(reader); + reader.Close(); + + tbl.AcceptChanges(); + tbl.EndLoadData(); + + return tbl; + } + + /// + /// Returns the base column information for indexes in a database + /// + /// The catalog to retrieve indexes for (can be null) + /// The table to restrict index information by (can be null) + /// The index to restrict index information by (can be null) + /// The source column to restrict index information by (can be null) + /// A DataTable containing the results + private DataTable Schema_IndexColumns(string strCatalog, string strTable, string strIndex, string strColumn) + { + DataTable tbl = new DataTable("IndexColumns"); + DataRow row; + List> primaryKeys = new List>(); + bool maybeRowId; + + tbl.Locale = CultureInfo.InvariantCulture; + tbl.Columns.Add("CONSTRAINT_CATALOG", typeof(string)); + tbl.Columns.Add("CONSTRAINT_SCHEMA", typeof(string)); + tbl.Columns.Add("CONSTRAINT_NAME", typeof(string)); + tbl.Columns.Add("TABLE_CATALOG", typeof(string)); + tbl.Columns.Add("TABLE_SCHEMA", typeof(string)); + tbl.Columns.Add("TABLE_NAME", typeof(string)); + tbl.Columns.Add("COLUMN_NAME", typeof(string)); + tbl.Columns.Add("ORDINAL_POSITION", typeof(int)); + tbl.Columns.Add("INDEX_NAME", typeof(string)); + tbl.Columns.Add("COLLATION_NAME", typeof(string)); + tbl.Columns.Add("SORT_MODE", typeof(string)); + tbl.Columns.Add("CONFLICT_OPTION", typeof(int)); + + if (String.IsNullOrEmpty(strCatalog)) strCatalog = "main"; + + string master = (String.Compare(strCatalog, "temp", StringComparison.OrdinalIgnoreCase) == 0) ? _tempmasterdb : _masterdb; + + tbl.BeginLoadData(); + + using (SQLiteCommand cmdTables = new SQLiteCommand(String.Format(CultureInfo.InvariantCulture, "SELECT * FROM [{0}].[{1}] WHERE [type] LIKE 'table'", strCatalog, master), this)) + using (SQLiteDataReader rdTables = cmdTables.ExecuteReader()) + { + while (rdTables.Read()) + { + maybeRowId = false; + primaryKeys.Clear(); + if (String.IsNullOrEmpty(strTable) || String.Compare(rdTables.GetString(2), strTable, StringComparison.OrdinalIgnoreCase) == 0) + { + try + { + using (SQLiteCommand cmdTable = new SQLiteCommand(String.Format(CultureInfo.InvariantCulture, "PRAGMA [{0}].table_info([{1}])", strCatalog, rdTables.GetString(2)), this)) + using (SQLiteDataReader rdTable = cmdTable.ExecuteReader()) + { + while (rdTable.Read()) + { + if (rdTable.GetInt32(5) == 1) // is a primary key + { + primaryKeys.Add(new KeyValuePair(rdTable.GetInt32(0), rdTable.GetString(1))); + // Is an integer -- could be a rowid if no other primary keys exist in the table + if (String.Compare(rdTable.GetString(2), "INTEGER", StringComparison.OrdinalIgnoreCase) == 0) + maybeRowId = true; + } + } + } + } + catch (SQLiteException) + { + } + // This is a rowid row + if (primaryKeys.Count == 1 && maybeRowId == true) + { + row = tbl.NewRow(); + row["CONSTRAINT_CATALOG"] = strCatalog; + row["CONSTRAINT_NAME"] = String.Format(CultureInfo.InvariantCulture, "{1}_PK_{0}", rdTables.GetString(2), master); + row["TABLE_CATALOG"] = strCatalog; + row["TABLE_NAME"] = rdTables.GetString(2); + row["COLUMN_NAME"] = primaryKeys[0].Value; + row["INDEX_NAME"] = row["CONSTRAINT_NAME"]; + row["ORDINAL_POSITION"] = 0; // primaryKeys[0].Key; + row["COLLATION_NAME"] = "BINARY"; + row["SORT_MODE"] = "ASC"; + row["CONFLICT_OPTION"] = 2; + + if (String.IsNullOrEmpty(strIndex) || String.Compare(strIndex, (string)row["INDEX_NAME"], StringComparison.OrdinalIgnoreCase) == 0) + tbl.Rows.Add(row); + } + + using (SQLiteCommand cmdIndexes = new SQLiteCommand(String.Format(CultureInfo.InvariantCulture, "SELECT * FROM [{0}].[{2}] WHERE [type] LIKE 'index' AND [tbl_name] LIKE '{1}'", strCatalog, rdTables.GetString(2).Replace("'", "''"), master), this)) + using (SQLiteDataReader rdIndexes = cmdIndexes.ExecuteReader()) + { + while (rdIndexes.Read()) + { + int ordinal = 0; + if (String.IsNullOrEmpty(strIndex) || String.Compare(strIndex, rdIndexes.GetString(1), StringComparison.OrdinalIgnoreCase) == 0) + { + try + { + using (SQLiteCommand cmdIndex = new SQLiteCommand(String.Format(CultureInfo.InvariantCulture, "PRAGMA [{0}].index_info([{1}])", strCatalog, rdIndexes.GetString(1)), this)) + using (SQLiteDataReader rdIndex = cmdIndex.ExecuteReader()) + { + while (rdIndex.Read()) + { + row = tbl.NewRow(); + row["CONSTRAINT_CATALOG"] = strCatalog; + row["CONSTRAINT_NAME"] = rdIndexes.GetString(1); + row["TABLE_CATALOG"] = strCatalog; + row["TABLE_NAME"] = rdIndexes.GetString(2); + row["COLUMN_NAME"] = rdIndex.GetString(2); + row["INDEX_NAME"] = rdIndexes.GetString(1); + row["ORDINAL_POSITION"] = ordinal; // rdIndex.GetInt32(1); + + string collationSequence; + int sortMode; + int onError; + _sql.GetIndexColumnExtendedInfo(strCatalog, rdIndexes.GetString(1), rdIndex.GetString(2), out sortMode, out onError, out collationSequence); + + if (String.IsNullOrEmpty(collationSequence) == false) + row["COLLATION_NAME"] = collationSequence; + + row["SORT_MODE"] = (sortMode == 0) ? "ASC" : "DESC"; + row["CONFLICT_OPTION"] = onError; + + ordinal++; + + if (String.IsNullOrEmpty(strColumn) || String.Compare(strColumn, row["COLUMN_NAME"].ToString(), StringComparison.OrdinalIgnoreCase) == 0) + tbl.Rows.Add(row); + } + } + } + catch (SQLiteException) + { + } + } + } + } + } + } + } + + tbl.EndLoadData(); + tbl.AcceptChanges(); + + return tbl; + } + + /// + /// Returns detailed column information for a specified view + /// + /// The catalog to retrieve columns for (can be null) + /// The view to restrict column information by (can be null) + /// The source column to restrict column information by (can be null) + /// A DataTable containing the results + private DataTable Schema_ViewColumns(string strCatalog, string strView, string strColumn) + { + DataTable tbl = new DataTable("ViewColumns"); + DataRow row; + string strSql; + int n; + DataRow schemaRow; + DataRow viewRow; + + tbl.Locale = CultureInfo.InvariantCulture; + tbl.Columns.Add("VIEW_CATALOG", typeof(string)); + tbl.Columns.Add("VIEW_SCHEMA", typeof(string)); + tbl.Columns.Add("VIEW_NAME", typeof(string)); + tbl.Columns.Add("VIEW_COLUMN_NAME", typeof(String)); + tbl.Columns.Add("TABLE_CATALOG", typeof(string)); + tbl.Columns.Add("TABLE_SCHEMA", typeof(string)); + tbl.Columns.Add("TABLE_NAME", typeof(string)); + tbl.Columns.Add("COLUMN_NAME", typeof(string)); + tbl.Columns.Add("ORDINAL_POSITION", typeof(int)); + tbl.Columns.Add("COLUMN_HASDEFAULT", typeof(bool)); + tbl.Columns.Add("COLUMN_DEFAULT", typeof(string)); + tbl.Columns.Add("COLUMN_FLAGS", typeof(long)); + tbl.Columns.Add("IS_NULLABLE", typeof(bool)); + tbl.Columns.Add("DATA_TYPE", typeof(string)); + tbl.Columns.Add("CHARACTER_MAXIMUM_LENGTH", typeof(int)); + tbl.Columns.Add("NUMERIC_PRECISION", typeof(int)); + tbl.Columns.Add("NUMERIC_SCALE", typeof(int)); + tbl.Columns.Add("DATETIME_PRECISION", typeof(long)); + tbl.Columns.Add("CHARACTER_SET_CATALOG", typeof(string)); + tbl.Columns.Add("CHARACTER_SET_SCHEMA", typeof(string)); + tbl.Columns.Add("CHARACTER_SET_NAME", typeof(string)); + tbl.Columns.Add("COLLATION_CATALOG", typeof(string)); + tbl.Columns.Add("COLLATION_SCHEMA", typeof(string)); + tbl.Columns.Add("COLLATION_NAME", typeof(string)); + tbl.Columns.Add("PRIMARY_KEY", typeof(bool)); + tbl.Columns.Add("EDM_TYPE", typeof(string)); + tbl.Columns.Add("AUTOINCREMENT", typeof(bool)); + tbl.Columns.Add("UNIQUE", typeof(bool)); + + if (String.IsNullOrEmpty(strCatalog)) strCatalog = "main"; + + string master = (String.Compare(strCatalog, "temp", StringComparison.OrdinalIgnoreCase) == 0) ? _tempmasterdb : _masterdb; + + tbl.BeginLoadData(); + + using (SQLiteCommand cmdViews = new SQLiteCommand(String.Format(CultureInfo.InvariantCulture, "SELECT * FROM [{0}].[{1}] WHERE [type] LIKE 'view'", strCatalog, master), this)) + using (SQLiteDataReader rdViews = cmdViews.ExecuteReader()) + { + while (rdViews.Read()) + { + if (String.IsNullOrEmpty(strView) || String.Compare(strView, rdViews.GetString(2), StringComparison.OrdinalIgnoreCase) == 0) + { + using (SQLiteCommand cmdViewSelect = new SQLiteCommand(String.Format(CultureInfo.InvariantCulture, "SELECT * FROM [{0}].[{1}]", strCatalog, rdViews.GetString(2)), this)) + { + strSql = rdViews.GetString(4).Replace('\r', ' ').Replace('\n', ' ').Replace('\t', ' '); + n = CultureInfo.InvariantCulture.CompareInfo.IndexOf(strSql, " AS ", CompareOptions.IgnoreCase); + if (n < 0) + continue; + + strSql = strSql.Substring(n + 4); + + using (SQLiteCommand cmd = new SQLiteCommand(strSql, this)) + using (SQLiteDataReader rdViewSelect = cmdViewSelect.ExecuteReader(CommandBehavior.SchemaOnly)) + using (SQLiteDataReader rd = (SQLiteDataReader)cmd.ExecuteReader(CommandBehavior.SchemaOnly)) + using (DataTable tblSchemaView = rdViewSelect.GetSchemaTable(false, false)) + using (DataTable tblSchema = rd.GetSchemaTable(false, false)) + { + for (n = 0; n < tblSchema.Rows.Count; n++) + { + viewRow = tblSchemaView.Rows[n]; + schemaRow = tblSchema.Rows[n]; + + if (String.Compare(viewRow[SchemaTableColumn.ColumnName].ToString(), strColumn, StringComparison.OrdinalIgnoreCase) == 0 + || strColumn == null) + { + row = tbl.NewRow(); + + row["VIEW_CATALOG"] = strCatalog; + row["VIEW_NAME"] = rdViews.GetString(2); + row["TABLE_CATALOG"] = strCatalog; + row["TABLE_SCHEMA"] = schemaRow[SchemaTableColumn.BaseSchemaName]; + row["TABLE_NAME"] = schemaRow[SchemaTableColumn.BaseTableName]; + row["COLUMN_NAME"] = schemaRow[SchemaTableColumn.BaseColumnName]; + row["VIEW_COLUMN_NAME"] = viewRow[SchemaTableColumn.ColumnName]; + row["COLUMN_HASDEFAULT"] = (viewRow[SchemaTableOptionalColumn.DefaultValue] != DBNull.Value); + row["COLUMN_DEFAULT"] = viewRow[SchemaTableOptionalColumn.DefaultValue]; + row["ORDINAL_POSITION"] = viewRow[SchemaTableColumn.ColumnOrdinal]; + row["IS_NULLABLE"] = viewRow[SchemaTableColumn.AllowDBNull]; + row["DATA_TYPE"] = viewRow["DataTypeName"]; // SQLiteConvert.DbTypeToType((DbType)viewRow[SchemaTableColumn.ProviderType]).ToString(); + row["EDM_TYPE"] = SQLiteConvert.DbTypeToTypeName((DbType)viewRow[SchemaTableColumn.ProviderType]).ToString().ToLower(CultureInfo.InvariantCulture); + row["CHARACTER_MAXIMUM_LENGTH"] = viewRow[SchemaTableColumn.ColumnSize]; + row["TABLE_SCHEMA"] = viewRow[SchemaTableColumn.BaseSchemaName]; + row["PRIMARY_KEY"] = viewRow[SchemaTableColumn.IsKey]; + row["AUTOINCREMENT"] = viewRow[SchemaTableOptionalColumn.IsAutoIncrement]; + row["COLLATION_NAME"] = viewRow["CollationType"]; + row["UNIQUE"] = viewRow[SchemaTableColumn.IsUnique]; + tbl.Rows.Add(row); + } + } + } + } + } + } + } + + tbl.EndLoadData(); + tbl.AcceptChanges(); + + return tbl; + } + + /// + /// Retrieves foreign key information from the specified set of filters + /// + /// An optional catalog to restrict results on + /// An optional table to restrict results on + /// An optional foreign key name to restrict results on + /// A DataTable with the results of the query + private DataTable Schema_ForeignKeys(string strCatalog, string strTable, string strKeyName) + { + DataTable tbl = new DataTable("ForeignKeys"); + DataRow row; + + tbl.Locale = CultureInfo.InvariantCulture; + tbl.Columns.Add("CONSTRAINT_CATALOG", typeof(string)); + tbl.Columns.Add("CONSTRAINT_SCHEMA", typeof(string)); + tbl.Columns.Add("CONSTRAINT_NAME", typeof(string)); + tbl.Columns.Add("TABLE_CATALOG", typeof(string)); + tbl.Columns.Add("TABLE_SCHEMA", typeof(string)); + tbl.Columns.Add("TABLE_NAME", typeof(string)); + tbl.Columns.Add("CONSTRAINT_TYPE", typeof(string)); + tbl.Columns.Add("IS_DEFERRABLE", typeof(bool)); + tbl.Columns.Add("INITIALLY_DEFERRED", typeof(bool)); + tbl.Columns.Add("FKEY_FROM_COLUMN", typeof(string)); + tbl.Columns.Add("FKEY_FROM_ORDINAL_POSITION", typeof(int)); + tbl.Columns.Add("FKEY_TO_CATALOG", typeof(string)); + tbl.Columns.Add("FKEY_TO_SCHEMA", typeof(string)); + tbl.Columns.Add("FKEY_TO_TABLE", typeof(string)); + tbl.Columns.Add("FKEY_TO_COLUMN", typeof(string)); + + if (String.IsNullOrEmpty(strCatalog)) strCatalog = "main"; + + string master = (String.Compare(strCatalog, "temp", StringComparison.OrdinalIgnoreCase) == 0) ? _tempmasterdb : _masterdb; + + tbl.BeginLoadData(); + + using (SQLiteCommand cmdTables = new SQLiteCommand(String.Format(CultureInfo.InvariantCulture, "SELECT * FROM [{0}].[{1}] WHERE [type] LIKE 'table'", strCatalog, master), this)) + using (SQLiteDataReader rdTables = cmdTables.ExecuteReader()) + { + while (rdTables.Read()) + { + if (String.IsNullOrEmpty(strTable) || String.Compare(strTable, rdTables.GetString(2), StringComparison.OrdinalIgnoreCase) == 0) + { + try + { + using (SQLiteCommandBuilder builder = new SQLiteCommandBuilder()) + //using (SQLiteCommand cmdTable = new SQLiteCommand(String.Format(CultureInfo.InvariantCulture, "SELECT * FROM [{0}].[{1}]", strCatalog, rdTables.GetString(2)), this)) + //using (SQLiteDataReader rdTable = cmdTable.ExecuteReader(CommandBehavior.SchemaOnly)) + using (SQLiteCommand cmdKey = new SQLiteCommand(String.Format(CultureInfo.InvariantCulture, "PRAGMA [{0}].foreign_key_list([{1}])", strCatalog, rdTables.GetString(2)), this)) + using (SQLiteDataReader rdKey = cmdKey.ExecuteReader()) + { + while (rdKey.Read()) + { + row = tbl.NewRow(); + row["CONSTRAINT_CATALOG"] = strCatalog; + row["CONSTRAINT_NAME"] = String.Format(CultureInfo.InvariantCulture, "FK_{0}_{1}", rdTables[2], rdKey.GetInt32(0)); + row["TABLE_CATALOG"] = strCatalog; + row["TABLE_NAME"] = builder.UnquoteIdentifier(rdTables.GetString(2)); + row["CONSTRAINT_TYPE"] = "FOREIGN KEY"; + row["IS_DEFERRABLE"] = false; + row["INITIALLY_DEFERRED"] = false; + row["FKEY_FROM_COLUMN"] = builder.UnquoteIdentifier(rdKey[3].ToString()); + row["FKEY_TO_CATALOG"] = strCatalog; + row["FKEY_TO_TABLE"] = builder.UnquoteIdentifier(rdKey[2].ToString()); + row["FKEY_TO_COLUMN"] = builder.UnquoteIdentifier(rdKey[4].ToString()); + row["FKEY_FROM_ORDINAL_POSITION"] = rdKey[1]; + + if (String.IsNullOrEmpty(strKeyName) || String.Compare(strKeyName, row["CONSTRAINT_NAME"].ToString(), StringComparison.OrdinalIgnoreCase) == 0) + tbl.Rows.Add(row); + } + } + } + catch (SQLiteException) + { + } + } + } + } + + tbl.EndLoadData(); + tbl.AcceptChanges(); + + return tbl; + } + + /// + /// This event is raised whenever SQLite makes an update/delete/insert into the database on + /// this connection. It only applies to the given connection. + /// + public event SQLiteUpdateEventHandler Update + { + add + { + if (_updateHandler == null) + { + _updateCallback = new SQLiteUpdateCallback(UpdateCallback); + if (_sql != null) _sql.SetUpdateHook(_updateCallback); + } + _updateHandler += value; + } + remove + { + _updateHandler -= value; + if (_updateHandler == null) + { + if (_sql != null) _sql.SetUpdateHook(null); + _updateCallback = null; + } + } + } + + private void UpdateCallback(IntPtr puser, int type, IntPtr database, IntPtr table, Int64 rowid) + { + _updateHandler(this, new UpdateEventArgs( + SQLiteBase.UTF8ToString(database, -1), + SQLiteBase.UTF8ToString(table, -1), + (UpdateEventType)type, + rowid)); + } + + /// + /// This event is raised whenever SQLite is committing a transaction. + /// Return non-zero to trigger a rollback + /// + public event SQLiteCommitHandler Commit + { + add + { + if (_commitHandler == null) + { + _commitCallback = new SQLiteCommitCallback(CommitCallback); + if (_sql != null) _sql.SetCommitHook(_commitCallback); + } + _commitHandler += value; + } + remove + { + _commitHandler -= value; + if (_commitHandler == null) + { + if (_sql != null) _sql.SetCommitHook(null); + _commitCallback = null; + } + } + } + + /// + /// This event is raised whenever SQLite statement first begins executing on + /// this connection. It only applies to the given connection. + /// + public event SQLiteTraceEventHandler Trace + { + add + { + if (_traceHandler == null) + { + _traceCallback = new SQLiteTraceCallback(TraceCallback); + if (_sql != null) _sql.SetTraceCallback(_traceCallback); + } + _traceHandler += value; + } + remove + { + _traceHandler -= value; + if (_traceHandler == null) + { + if (_sql != null) _sql.SetTraceCallback(null); + _traceCallback = null; + } + } + } + + private void TraceCallback(IntPtr puser, IntPtr statement) + { + _traceHandler(this, new TraceEventArgs( + SQLiteBase.UTF8ToString(statement, -1))); + } + + /// + /// This event is raised whenever SQLite is committing a transaction. + /// Return non-zero to trigger a rollback + /// + public event EventHandler RollBack + { + add + { + if (_rollbackHandler == null) + { + _rollbackCallback = new SQLiteRollbackCallback(RollbackCallback); + if (_sql != null) _sql.SetRollbackHook(_rollbackCallback); + } + _rollbackHandler += value; + } + remove + { + _rollbackHandler -= value; + if (_rollbackHandler == null) + { + if (_sql != null) _sql.SetRollbackHook(null); + _rollbackCallback = null; + } + } + } + + + private int CommitCallback(IntPtr parg) + { + CommitEventArgs e = new CommitEventArgs(); + _commitHandler(this, e); + return (e.AbortTransaction == true) ? 1 : 0; + } + + private void RollbackCallback(IntPtr parg) + { + _rollbackHandler(this, EventArgs.Empty); + } + } + + /// + /// The I/O file cache flushing behavior for the connection + /// + public enum SynchronizationModes + { + /// + /// Normal file flushing at critical sections of the code + /// + Normal = 0, + /// + /// Full file flushing after every write operation + /// + Full = 1, + /// + /// Use the default operating system's file flushing, SQLite does not explicitly flush the file buffers after writing + /// + Off = 2, + } + +#if !PLATFORM_COMPACTFRAMEWORK + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] +#endif + internal delegate void SQLiteUpdateCallback(IntPtr puser, int type, IntPtr database, IntPtr table, Int64 rowid); +#if !PLATFORM_COMPACTFRAMEWORK + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] +#endif + internal delegate int SQLiteCommitCallback(IntPtr puser); +#if !PLATFORM_COMPACTFRAMEWORK + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] +#endif + internal delegate void SQLiteTraceCallback(IntPtr puser, IntPtr statement); +#if !PLATFORM_COMPACTFRAMEWORK + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] +#endif + internal delegate void SQLiteRollbackCallback(IntPtr puser); + + /// + /// Raised when a transaction is about to be committed. To roll back a transaction, set the + /// rollbackTrans boolean value to true. + /// + /// The connection committing the transaction + /// Event arguments on the transaction + public delegate void SQLiteCommitHandler(object sender, CommitEventArgs e); + + /// + /// Raised when data is inserted, updated and deleted on a given connection + /// + /// The connection committing the transaction + /// The event parameters which triggered the event + public delegate void SQLiteUpdateEventHandler(object sender, UpdateEventArgs e); + + /// + /// Raised when a statement first begins executing on a given connection + /// + /// The connection executing the statement + /// Event arguments on the trace + public delegate void SQLiteTraceEventHandler(object sender, TraceEventArgs e); + + /// + /// Whenever an update event is triggered on a connection, this enum will indicate + /// exactly what type of operation is being performed. + /// + public enum UpdateEventType + { + /// + /// A row is being deleted from the given database and table + /// + Delete = 9, + /// + /// A row is being inserted into the table. + /// + Insert = 18, + /// + /// A row is being updated in the table. + /// + Update = 23, + } + + /// + /// Passed during an Update callback, these event arguments detail the type of update operation being performed + /// on the given connection. + /// + public class UpdateEventArgs : EventArgs + { + /// + /// The name of the database being updated (usually "main" but can be any attached or temporary database) + /// + public readonly string Database; + + /// + /// The name of the table being updated + /// + public readonly string Table; + + /// + /// The type of update being performed (insert/update/delete) + /// + public readonly UpdateEventType Event; + + /// + /// The RowId affected by this update. + /// + public readonly Int64 RowId; + + internal UpdateEventArgs(string database, string table, UpdateEventType eventType, Int64 rowid) + { + Database = database; + Table = table; + Event = eventType; + RowId = rowid; + } + } + + /// + /// Event arguments raised when a transaction is being committed + /// + public class CommitEventArgs : EventArgs + { + internal CommitEventArgs() + { + } + + /// + /// Set to true to abort the transaction and trigger a rollback + /// + public bool AbortTransaction; + } + + /// + /// Passed during an Trace callback, these event arguments contain the UTF-8 rendering of the SQL statement text + /// + public class TraceEventArgs : EventArgs + { + /// + /// SQL statement text as the statement first begins executing + /// + public readonly string Statement; + + internal TraceEventArgs(string statement) + { + Statement = statement; + } + } + +} Index: System.Data.SQLite/SQLiteConvert.cs ================================================================== --- System.Data.SQLite/SQLiteConvert.cs +++ System.Data.SQLite/SQLiteConvert.cs @@ -1,819 +1,814 @@ -/******************************************************** - * ADO.NET 2.0 Data Provider for SQLite Version 3.X - * Written by Robert Simpson (robert@blackcastlesoft.com) - * - * Released to the public domain, use at your own risk! - ********************************************************/ - -namespace System.Data.SQLite -{ - using System; - using System.Runtime.InteropServices; - using System.Collections.Generic; - using System.ComponentModel; - using System.Globalization; - using System.Text; - -#if !PLATFORM_COMPACTFRAMEWORK - using System.ComponentModel.Design; -#endif - - /// - /// This base class provides datatype conversion services for the SQLite provider. - /// - public abstract class SQLiteConvert - { - /// - /// An array of ISO8601 datetime formats we support conversion from - /// - private static string[] _datetimeFormats = new string[] { - "THHmmss", - "THHmm", - "HH:mm:ss", - "HH:mm", - "HH:mm:ss.FFFFFFF", - "yy-MM-dd", - "yyyy-MM-dd", - "yyyy-MM-dd HH:mm:ss.FFFFFFF", - "yyyy-MM-dd HH:mm:ss", - "yyyy-MM-dd HH:mm", - "yyyy-MM-ddTHH:mm:ss.FFFFFFF", - "yyyy-MM-ddTHH:mm", - "yyyy-MM-ddTHH:mm:ss", - "yyyyMMddHHmmss", - "yyyyMMddHHmm", - "yyyyMMddTHHmmssFFFFFFF", - "yyyyMMdd" - }; - - /// - /// An UTF-8 Encoding instance, so we can convert strings to and from UTF-8 - /// - private static Encoding _utf8 = new UTF8Encoding(); - /// - /// The default DateTime format for this instance - /// - internal SQLiteDateFormats _datetimeFormat; - /// - /// Initializes the conversion class - /// - /// The default date/time format to use for this instance - internal SQLiteConvert(SQLiteDateFormats fmt) - { - _datetimeFormat = fmt; - } - - #region UTF-8 Conversion Functions - /// - /// Converts a string to a UTF-8 encoded byte array sized to include a null-terminating character. - /// - /// The string to convert to UTF-8 - /// A byte array containing the converted string plus an extra 0 terminating byte at the end of the array. - public static byte[] ToUTF8(string sourceText) - { - Byte[] byteArray; - int nlen = _utf8.GetByteCount(sourceText) + 1; - - byteArray = new byte[nlen]; - nlen = _utf8.GetBytes(sourceText, 0, sourceText.Length, byteArray, 0); - byteArray[nlen] = 0; - - return byteArray; - } - - /// - /// Convert a DateTime to a UTF-8 encoded, zero-terminated byte array. - /// - /// - /// This function is a convenience function, which first calls ToString() on the DateTime, and then calls ToUTF8() with the - /// string result. - /// - /// The DateTime to convert. - /// The UTF-8 encoded string, including a 0 terminating byte at the end of the array. - public byte[] ToUTF8(DateTime dateTimeValue) - { - return ToUTF8(ToString(dateTimeValue)); - } - - /// - /// Converts a UTF-8 encoded IntPtr of the specified length into a .NET string - /// - /// The pointer to the memory where the UTF-8 string is encoded - /// The number of bytes to decode - /// A string containing the translated character(s) - public virtual string ToString(IntPtr nativestring, int nativestringlen) - { - return UTF8ToString(nativestring, nativestringlen); - } - - /// - /// Converts a UTF-8 encoded IntPtr of the specified length into a .NET string - /// - /// The pointer to the memory where the UTF-8 string is encoded - /// The number of bytes to decode - /// A string containing the translated character(s) - public static string UTF8ToString(IntPtr nativestring, int nativestringlen) - { - if (nativestringlen == 0 || nativestring == IntPtr.Zero) return ""; - if (nativestringlen == -1) - { - do - { - nativestringlen++; - } while (Marshal.ReadByte(nativestring, nativestringlen) != 0); - } - - byte[] byteArray = new byte[nativestringlen]; - - Marshal.Copy(nativestring, byteArray, 0, nativestringlen); - - return _utf8.GetString(byteArray, 0, nativestringlen); - } - - - #endregion - - #region DateTime Conversion Functions - /// - /// Converts a string into a DateTime, using the current DateTimeFormat specified for the connection when it was opened. - /// - /// - /// Acceptable ISO8601 DateTime formats are: - /// yyyy-MM-dd HH:mm:ss - /// yyyyMMddHHmmss - /// yyyyMMddTHHmmssfffffff - /// yyyy-MM-dd - /// yy-MM-dd - /// yyyyMMdd - /// HH:mm:ss - /// THHmmss - /// - /// The string containing either a Tick value, a JulianDay double, or an ISO8601-format string - /// A DateTime value - public DateTime ToDateTime(string dateText) - { - switch (_datetimeFormat) - { - case SQLiteDateFormats.Ticks: - return new DateTime(Convert.ToInt64(dateText, CultureInfo.InvariantCulture)); - case SQLiteDateFormats.JulianDay: - return ToDateTime(Convert.ToDouble(dateText, CultureInfo.InvariantCulture)); - default: - return DateTime.ParseExact(dateText, _datetimeFormats, DateTimeFormatInfo.InvariantInfo, DateTimeStyles.None); - } - } - - /// - /// Converts a julianday value into a DateTime - /// - /// The value to convert - /// A .NET DateTime - public DateTime ToDateTime(double julianDay) - { - return DateTime.FromOADate(julianDay - 2415018.5); - } - - /// - /// Converts a DateTime struct to a JulianDay double - /// - /// The DateTime to convert - /// The JulianDay value the Datetime represents - public double ToJulianDay(DateTime value) - { - return value.ToOADate() + 2415018.5; - } - - /// - /// Converts a DateTime to a string value, using the current DateTimeFormat specified for the connection when it was opened. - /// - /// The DateTime value to convert - /// Either a string consisting of the tick count for DateTimeFormat.Ticks, a JulianDay double, or a date/time in ISO8601 format. - public string ToString(DateTime dateValue) - { - switch (_datetimeFormat) - { - case SQLiteDateFormats.Ticks: - return dateValue.Ticks.ToString(CultureInfo.InvariantCulture); - case SQLiteDateFormats.JulianDay: - return ToJulianDay(dateValue).ToString(CultureInfo.InvariantCulture); - default: - return dateValue.ToString(_datetimeFormats[7], CultureInfo.InvariantCulture); - } - } - - /// - /// Internal function to convert a UTF-8 encoded IntPtr of the specified length to a DateTime. - /// - /// - /// This is a convenience function, which first calls ToString() on the IntPtr to convert it to a string, then calls - /// ToDateTime() on the string to return a DateTime. - /// - /// A pointer to the UTF-8 encoded string - /// The length in bytes of the string - /// The parsed DateTime value - internal DateTime ToDateTime(IntPtr ptr, int len) - { - return ToDateTime(ToString(ptr, len)); - } - - #endregion - - /// - /// Smart method of splitting a string. Skips quoted elements, removes the quotes. - /// - /// - /// This split function works somewhat like the String.Split() function in that it breaks apart a string into - /// pieces and returns the pieces as an array. The primary differences are: - /// - /// Only one character can be provided as a separator character - /// Quoted text inside the string is skipped over when searching for the separator, and the quotes are removed. - /// - /// Thus, if splitting the following string looking for a comma:
- /// One,Two, "Three, Four", Five
- ///
- /// The resulting array would contain
- /// [0] One
- /// [1] Two
- /// [2] Three, Four
- /// [3] Five
- ///
- /// Note that the leading and trailing spaces were removed from each item during the split. - ///
- /// Source string to split apart - /// Separator character - /// A string array of the split up elements - public static string[] Split(string source, char separator) - { - char[] toks = new char[2] { '\"', separator }; - char[] quot = new char[1] { '\"' }; - int n = 0; - List ls = new List(); - string s; - - while (source.Length > 0) - { - n = source.IndexOfAny(toks, n); - if (n == -1) break; - if (source[n] == toks[0]) - { - //source = source.Remove(n, 1); - n = source.IndexOfAny(quot, n + 1); - if (n == -1) - { - //source = "\"" + source; - break; - } - n++; - //source = source.Remove(n, 1); - } - else - { - s = source.Substring(0, n).Trim(); - if (s.Length > 1 && s[0] == quot[0] && s[s.Length - 1] == s[0]) - s = s.Substring(1, s.Length - 2); - - source = source.Substring(n + 1).Trim(); - if (s.Length > 0) ls.Add(s); - n = 0; - } - } - if (source.Length > 0) - { - s = source.Trim(); - if (s.Length > 1 && s[0] == quot[0] && s[s.Length - 1] == s[0]) - s = s.Substring(1, s.Length - 2); - ls.Add(s); - } - - string[] ar = new string[ls.Count]; - ls.CopyTo(ar, 0); - - return ar; - } - - /// - /// Convert a value to true or false. - /// - /// A string or number representing true or false - /// - public static bool ToBoolean(object source) - { - if (source is bool) return (bool)source; - - return ToBoolean(source.ToString()); - } - - /// - /// Convert a string to true or false. - /// - /// A string representing true or false - /// - /// - /// "yes", "no", "y", "n", "0", "1", "on", "off" as well as Boolean.FalseString and Boolean.TrueString will all be - /// converted to a proper boolean value. - /// - public static bool ToBoolean(string source) - { - if (String.Compare(source, bool.TrueString, StringComparison.OrdinalIgnoreCase) == 0) return true; - else if (String.Compare(source, bool.FalseString, StringComparison.OrdinalIgnoreCase) == 0) return false; - - switch(source.ToLower(CultureInfo.InvariantCulture)) - { - case "yes": - case "y": - case "1": - case "on": - return true; - case "no": - case "n": - case "0": - case "off": - return false; - default: - throw new ArgumentException("source"); - } - } - - #region Type Conversions - /// - /// Determines the data type of a column in a statement - /// - /// The statement to retrieve information for - /// The column to retrieve type information on - /// The SQLiteType to receive the affinity for the given column - internal static void ColumnToType(SQLiteStatement stmt, int i, SQLiteType typ) - { - typ.Type = TypeNameToDbType(stmt._sql.ColumnType(stmt, i, out typ.Affinity)); - } - - /// - /// Converts a SQLiteType to a .NET Type object - /// - /// The SQLiteType to convert - /// Returns a .NET Type object - internal static Type SQLiteTypeToType(SQLiteType t) - { - if (t.Type == DbType.Object) - return _affinitytotype[(int)t.Affinity]; - else - return SQLiteConvert.DbTypeToType(t.Type); - } - - private static Type[] _affinitytotype = { - typeof(object), - typeof(Int64), - typeof(Double), - typeof(string), - typeof(byte[]), - typeof(object), - typeof(DateTime), - typeof(object) - }; - - /// - /// For a given intrinsic type, return a DbType - /// - /// The native type to convert - /// The corresponding (closest match) DbType - internal static DbType TypeToDbType(Type typ) - { - TypeCode tc = Type.GetTypeCode(typ); - if (tc == TypeCode.Object) - { - if (typ == typeof(byte[])) return DbType.Binary; - if (typ == typeof(Guid)) return DbType.Guid; - return DbType.String; - } - return _typetodbtype[(int)tc]; - } - - private static DbType[] _typetodbtype = { - DbType.Object, - DbType.Binary, - DbType.Object, - DbType.Boolean, - DbType.SByte, - DbType.SByte, - DbType.Byte, - DbType.Int16, // 7 - DbType.UInt16, - DbType.Int32, - DbType.UInt32, - DbType.Int64, // 11 - DbType.UInt64, - DbType.Single, - DbType.Double, - DbType.Decimal, - DbType.DateTime, - DbType.Object, - DbType.String, - }; - - /// - /// Returns the ColumnSize for the given DbType - /// - /// The DbType to get the size of - /// - internal static int DbTypeToColumnSize(DbType typ) - { - return _dbtypetocolumnsize[(int)typ]; - } - - private static int[] _dbtypetocolumnsize = { - 2147483647, // 0 - 2147483647, // 1 - 1, // 2 - 1, // 3 - 8, // 4 - 8, // 5 - 8, // 6 - 8, // 7 - 8, // 8 - 16, // 9 - 2, - 4, - 8, - 2147483647, - 1, - 4, - 2147483647, - 8, - 2, - 4, - 8, - 8, - 2147483647, - 2147483647, - 2147483647, - 2147483647, // 25 (Xml) - }; - - internal static object DbTypeToNumericPrecision(DbType typ) - { - return _dbtypetonumericprecision[(int)typ]; - } - - private static object[] _dbtypetonumericprecision = { - DBNull.Value, // 0 - DBNull.Value, // 1 - 3, - DBNull.Value, - 19, - DBNull.Value, // 5 - DBNull.Value, // 6 - 53, - 53, - DBNull.Value, - 5, - 10, - 19, - DBNull.Value, - 3, - 24, - DBNull.Value, - DBNull.Value, - 5, - 10, - 19, - 53, - DBNull.Value, - DBNull.Value, - DBNull.Value - }; - - internal static object DbTypeToNumericScale(DbType typ) - { - return _dbtypetonumericscale[(int)typ]; - } - - private static object[] _dbtypetonumericscale = { - DBNull.Value, // 0 - DBNull.Value, // 1 - 0, - DBNull.Value, - 4, - DBNull.Value, // 5 - DBNull.Value, // 6 - DBNull.Value, - DBNull.Value, - DBNull.Value, - 0, - 0, - 0, - DBNull.Value, - 0, - DBNull.Value, - DBNull.Value, - DBNull.Value, - 0, - 0, - 0, - 0, - DBNull.Value, - DBNull.Value, - DBNull.Value - }; - - internal static string DbTypeToTypeName(DbType typ) - { - for (int n = 0; n < _dbtypeNames.Length; n++) - { - if (_dbtypeNames[n].dataType == typ) - return _dbtypeNames[n].typeName; - } - - return String.Empty; - } - - private static SQLiteTypeNames[] _dbtypeNames = { - new SQLiteTypeNames("INTEGER", DbType.Int64), - new SQLiteTypeNames("TINYINT", DbType.Byte), - new SQLiteTypeNames("INT", DbType.Int32), - new SQLiteTypeNames("VARCHAR", DbType.AnsiString), - new SQLiteTypeNames("NVARCHAR", DbType.String), - new SQLiteTypeNames("CHAR", DbType.AnsiStringFixedLength), - new SQLiteTypeNames("NCHAR", DbType.StringFixedLength), - new SQLiteTypeNames("FLOAT", DbType.Double), - new SQLiteTypeNames("REAL", DbType.Single), - new SQLiteTypeNames("BIT", DbType.Boolean), - new SQLiteTypeNames("DECIMAL", DbType.Decimal), - new SQLiteTypeNames("DATETIME", DbType.DateTime), - new SQLiteTypeNames("BLOB", DbType.Binary), - new SQLiteTypeNames("UNIQUEIDENTIFIER", DbType.Guid), - new SQLiteTypeNames("SMALLINT", DbType.Int16), - }; - /// - /// Convert a DbType to a Type - /// - /// The DbType to convert from - /// The closest-match .NET type - internal static Type DbTypeToType(DbType typ) - { - return _dbtypeToType[(int)typ]; - } - - private static Type[] _dbtypeToType = { - typeof(string), // 0 - typeof(byte[]), // 1 - typeof(byte), // 2 - typeof(bool), // 3 - typeof(decimal), // 4 - typeof(DateTime), // 5 - typeof(DateTime), // 6 - typeof(decimal), // 7 - typeof(double), // 8 - typeof(Guid), // 9 - typeof(Int16), - typeof(Int32), - typeof(Int64), - typeof(object), - typeof(sbyte), - typeof(float), - typeof(string), - typeof(DateTime), - typeof(UInt16), - typeof(UInt32), - typeof(UInt64), - typeof(double), - typeof(string), - typeof(string), - typeof(string), - typeof(string), // 25 (Xml) - }; - - /// - /// For a given type, return the closest-match SQLite TypeAffinity, which only understands a very limited subset of types. - /// - /// The type to evaluate - /// The SQLite type affinity for that type. - internal static TypeAffinity TypeToAffinity(Type typ) - { - TypeCode tc = Type.GetTypeCode(typ); - if (tc == TypeCode.Object) - { - if (typ == typeof(byte[]) || typ == typeof(Guid)) - return TypeAffinity.Blob; - else - return TypeAffinity.Text; - } - return _typecodeAffinities[(int)tc]; - } - - private static TypeAffinity[] _typecodeAffinities = { - TypeAffinity.Null, - TypeAffinity.Blob, - TypeAffinity.Null, - TypeAffinity.Int64, - TypeAffinity.Int64, - TypeAffinity.Int64, - TypeAffinity.Int64, - TypeAffinity.Int64, // 7 - TypeAffinity.Int64, - TypeAffinity.Int64, - TypeAffinity.Int64, - TypeAffinity.Int64, // 11 - TypeAffinity.Int64, - TypeAffinity.Double, - TypeAffinity.Double, - TypeAffinity.Double, - TypeAffinity.DateTime, - TypeAffinity.Null, - TypeAffinity.Text, - }; - - /// - /// For a given type name, return a closest-match .NET type - /// - /// The name of the type to match - /// The .NET DBType the text evaluates to. - internal static DbType TypeNameToDbType(string Name) - { - if (String.IsNullOrEmpty(Name)) return DbType.Object; - - int x = _typeNames.Length; - for (int n = 0; n < x; n++) - { - if (String.Compare(Name, 0, _typeNames[n].typeName, 0, _typeNames[n].typeName.Length, StringComparison.OrdinalIgnoreCase) == 0) - return _typeNames[n].dataType; - } - return DbType.Object; - } - #endregion - - private static SQLiteTypeNames[] _typeNames = { - new SQLiteTypeNames("COUNTER", DbType.Int64), - new SQLiteTypeNames("AUTOINCREMENT", DbType.Int64), - new SQLiteTypeNames("IDENTITY", DbType.Int64), - new SQLiteTypeNames("LONGTEXT", DbType.String), - new SQLiteTypeNames("LONGCHAR", DbType.String), - new SQLiteTypeNames("LONGVARCHAR", DbType.String), - new SQLiteTypeNames("LONG", DbType.Int64), - new SQLiteTypeNames("TINYINT", DbType.Byte), - new SQLiteTypeNames("INTEGER", DbType.Int64), - new SQLiteTypeNames("INT", DbType.Int32), - new SQLiteTypeNames("VARCHAR", DbType.String), - new SQLiteTypeNames("NVARCHAR", DbType.String), - new SQLiteTypeNames("CHAR", DbType.String), - new SQLiteTypeNames("NCHAR", DbType.String), - new SQLiteTypeNames("TEXT", DbType.String), - new SQLiteTypeNames("NTEXT", DbType.String), - new SQLiteTypeNames("STRING", DbType.String), - new SQLiteTypeNames("DOUBLE", DbType.Double), - new SQLiteTypeNames("FLOAT", DbType.Double), - new SQLiteTypeNames("REAL", DbType.Single), - new SQLiteTypeNames("BIT", DbType.Boolean), - new SQLiteTypeNames("YESNO", DbType.Boolean), - new SQLiteTypeNames("LOGICAL", DbType.Boolean), - new SQLiteTypeNames("BOOL", DbType.Boolean), - new SQLiteTypeNames("NUMERIC", DbType.Decimal), - new SQLiteTypeNames("DECIMAL", DbType.Decimal), - new SQLiteTypeNames("MONEY", DbType.Decimal), - new SQLiteTypeNames("CURRENCY", DbType.Decimal), - new SQLiteTypeNames("TIME", DbType.DateTime), - new SQLiteTypeNames("DATE", DbType.DateTime), - new SQLiteTypeNames("SMALLDATE", DbType.DateTime), - new SQLiteTypeNames("BLOB", DbType.Binary), - new SQLiteTypeNames("BINARY", DbType.Binary), - new SQLiteTypeNames("VARBINARY", DbType.Binary), - new SQLiteTypeNames("IMAGE", DbType.Binary), - new SQLiteTypeNames("GENERAL", DbType.Binary), - new SQLiteTypeNames("OLEOBJECT", DbType.Binary), - new SQLiteTypeNames("GUID", DbType.Guid), - new SQLiteTypeNames("UNIQUEIDENTIFIER", DbType.Guid), - new SQLiteTypeNames("MEMO", DbType.String), - new SQLiteTypeNames("NOTE", DbType.String), - new SQLiteTypeNames("SMALLINT", DbType.Int16), - new SQLiteTypeNames("BIGINT", DbType.Int64), - }; - } - - /// - /// SQLite has very limited types, and is inherently text-based. The first 5 types below represent the sum of all types SQLite - /// understands. The DateTime extension to the spec is for internal use only. - /// - public enum TypeAffinity - { - /// - /// Not used - /// - Uninitialized = 0, - /// - /// All integers in SQLite default to Int64 - /// - Int64 = 1, - /// - /// All floating point numbers in SQLite default to double - /// - Double = 2, - /// - /// The default data type of SQLite is text - /// - Text = 3, - /// - /// Typically blob types are only seen when returned from a function - /// - Blob = 4, - /// - /// Null types can be returned from functions - /// - Null = 5, - /// - /// Used internally by this provider - /// - DateTime = 10, - /// - /// Used internally - /// - None = 11, - } - - /// - /// This implementation of SQLite for ADO.NET can process date/time fields in databases in only one of three formats. Ticks, ISO8601 - /// and JulianDay. - /// - /// - /// ISO8601 is more compatible, readable, fully-processable, but less accurate as it doesn't provide time down to fractions of a second. - /// JulianDay is the numeric format the SQLite uses internally and is arguably the most compatible with 3rd party tools. It is - /// not readable as text without post-processing. - /// Ticks less compatible with 3rd party tools that query the database, and renders the DateTime field unreadable as text without post-processing. - /// - /// The preferred order of choosing a datetime format is JulianDay, ISO8601, and then Ticks. Ticks is mainly present for legacy - /// code support. - /// - public enum SQLiteDateFormats - { - /// - /// Using ticks is not recommended and is not well supported with LINQ. - /// - Ticks = 0, - /// - /// The default format for this provider. - /// - ISO8601 = 1, - /// - /// JulianDay format, which is what SQLite uses internally - /// - JulianDay = 2 - } - - /// - /// This enum determines how SQLite treats its journal file. - /// - /// - /// By default SQLite will create and delete the journal file when needed during a transaction. - /// However, for some computers running certain filesystem monitoring tools, the rapid - /// creation and deletion of the journal file can cause those programs to fail, or to interfere with SQLite. - /// - /// If a program or virus scanner is interfering with SQLite's journal file, you may receive errors like "unable to open database file" - /// when starting a transaction. If this is happening, you may want to change the default journal mode to Persist. - /// - public enum SQLiteJournalModeEnum - { - /// - /// The default mode, this causes SQLite to create and destroy the journal file as-needed. - /// - Delete = 0, - /// - /// When this is set, SQLite will keep the journal file even after a transaction has completed. It's contents will be erased, - /// and the journal re-used as often as needed. If it is deleted, it will be recreated the next time it is needed. - /// - Persist = 1, - /// - /// This option disables the rollback journal entirely. Interrupted transactions or a program crash can cause database - /// corruption in this mode! - /// - Off = 2, - /// - /// This option commits transactions by truncating the rollback journal to zero-length instead of deleting it. On many systems, - /// truncating a file is much faster than deleting the file since the containing directory does not need to be changed. - /// - Truncate = 3, - } - - /// - /// Struct used internally to determine the datatype of a column in a resultset - /// - internal class SQLiteType - { - /// - /// The DbType of the column, or DbType.Object if it cannot be determined - /// - internal DbType Type; - /// - /// The affinity of a column, used for expressions or when Type is DbType.Object - /// - internal TypeAffinity Affinity; - } - - internal struct SQLiteTypeNames - { - internal SQLiteTypeNames(string newtypeName, DbType newdataType) - { - typeName = newtypeName; - dataType = newdataType; - } - - internal string typeName; - internal DbType dataType; - } -} +/******************************************************** + * ADO.NET 2.0 Data Provider for SQLite Version 3.X + * Written by Robert Simpson (robert@blackcastlesoft.com) + * + * Released to the public domain, use at your own risk! + ********************************************************/ + +namespace System.Data.SQLite +{ + using System; + using System.Runtime.InteropServices; + using System.Collections.Generic; + using System.ComponentModel; + using System.Globalization; + using System.Text; + +#if !PLATFORM_COMPACTFRAMEWORK + using System.ComponentModel.Design; +#endif + + /// + /// This base class provides datatype conversion services for the SQLite provider. + /// + public abstract class SQLiteConvert + { + /// + /// An array of ISO8601 datetime formats we support conversion from + /// + private static string[] _datetimeFormats = new string[] { + "THHmmss", + "THHmm", + "HH:mm:ss", + "HH:mm", + "HH:mm:ss.FFFFFFF", + "yy-MM-dd", + "yyyy-MM-dd", + "yyyy-MM-dd HH:mm:ss.FFFFFFF", + "yyyy-MM-dd HH:mm:ss", + "yyyy-MM-dd HH:mm", + "yyyy-MM-ddTHH:mm:ss.FFFFFFF", + "yyyy-MM-ddTHH:mm", + "yyyy-MM-ddTHH:mm:ss", + "yyyyMMddHHmmss", + "yyyyMMddHHmm", + "yyyyMMddTHHmmssFFFFFFF", + "yyyyMMdd" + }; + + /// + /// An UTF-8 Encoding instance, so we can convert strings to and from UTF-8 + /// + private static Encoding _utf8 = new UTF8Encoding(); + /// + /// The default DateTime format for this instance + /// + internal SQLiteDateFormats _datetimeFormat; + /// + /// Initializes the conversion class + /// + /// The default date/time format to use for this instance + internal SQLiteConvert(SQLiteDateFormats fmt) + { + _datetimeFormat = fmt; + } + + #region UTF-8 Conversion Functions + /// + /// Converts a string to a UTF-8 encoded byte array sized to include a null-terminating character. + /// + /// The string to convert to UTF-8 + /// A byte array containing the converted string plus an extra 0 terminating byte at the end of the array. + public static byte[] ToUTF8(string sourceText) + { + Byte[] byteArray; + int nlen = _utf8.GetByteCount(sourceText) + 1; + + byteArray = new byte[nlen]; + nlen = _utf8.GetBytes(sourceText, 0, sourceText.Length, byteArray, 0); + byteArray[nlen] = 0; + + return byteArray; + } + + /// + /// Convert a DateTime to a UTF-8 encoded, zero-terminated byte array. + /// + /// + /// This function is a convenience function, which first calls ToString() on the DateTime, and then calls ToUTF8() with the + /// string result. + /// + /// The DateTime to convert. + /// The UTF-8 encoded string, including a 0 terminating byte at the end of the array. + public byte[] ToUTF8(DateTime dateTimeValue) + { + return ToUTF8(ToString(dateTimeValue)); + } + + /// + /// Converts a UTF-8 encoded IntPtr of the specified length into a .NET string + /// + /// The pointer to the memory where the UTF-8 string is encoded + /// The number of bytes to decode + /// A string containing the translated character(s) + public virtual string ToString(IntPtr nativestring, int nativestringlen) + { + return UTF8ToString(nativestring, nativestringlen); + } + + /// + /// Converts a UTF-8 encoded IntPtr of the specified length into a .NET string + /// + /// The pointer to the memory where the UTF-8 string is encoded + /// The number of bytes to decode + /// A string containing the translated character(s) + public static string UTF8ToString(IntPtr nativestring, int nativestringlen) + { + if (nativestringlen == 0 || nativestring == IntPtr.Zero) return ""; + if (nativestringlen == -1) + { + do + { + nativestringlen++; + } while (Marshal.ReadByte(nativestring, nativestringlen) != 0); + } + + byte[] byteArray = new byte[nativestringlen]; + + Marshal.Copy(nativestring, byteArray, 0, nativestringlen); + + return _utf8.GetString(byteArray, 0, nativestringlen); + } + + + #endregion + + #region DateTime Conversion Functions + /// + /// Converts a string into a DateTime, using the current DateTimeFormat specified for the connection when it was opened. + /// + /// + /// Acceptable ISO8601 DateTime formats are: + /// yyyy-MM-dd HH:mm:ss + /// yyyyMMddHHmmss + /// yyyyMMddTHHmmssfffffff + /// yyyy-MM-dd + /// yy-MM-dd + /// yyyyMMdd + /// HH:mm:ss + /// THHmmss + /// + /// The string containing either a Tick value, a JulianDay double, or an ISO8601-format string + /// A DateTime value + public DateTime ToDateTime(string dateText) + { + switch (_datetimeFormat) + { + case SQLiteDateFormats.Ticks: + return new DateTime(Convert.ToInt64(dateText, CultureInfo.InvariantCulture)); + case SQLiteDateFormats.JulianDay: + return ToDateTime(Convert.ToDouble(dateText, CultureInfo.InvariantCulture)); + default: + return DateTime.ParseExact(dateText, _datetimeFormats, DateTimeFormatInfo.InvariantInfo, DateTimeStyles.None); + } + } + + /// + /// Converts a julianday value into a DateTime + /// + /// The value to convert + /// A .NET DateTime + public DateTime ToDateTime(double julianDay) + { + return DateTime.FromOADate(julianDay - 2415018.5); + } + + /// + /// Converts a DateTime struct to a JulianDay double + /// + /// The DateTime to convert + /// The JulianDay value the Datetime represents + public double ToJulianDay(DateTime value) + { + return value.ToOADate() + 2415018.5; + } + + /// + /// Converts a DateTime to a string value, using the current DateTimeFormat specified for the connection when it was opened. + /// + /// The DateTime value to convert + /// Either a string consisting of the tick count for DateTimeFormat.Ticks, a JulianDay double, or a date/time in ISO8601 format. + public string ToString(DateTime dateValue) + { + switch (_datetimeFormat) + { + case SQLiteDateFormats.Ticks: + return dateValue.Ticks.ToString(CultureInfo.InvariantCulture); + case SQLiteDateFormats.JulianDay: + return ToJulianDay(dateValue).ToString(CultureInfo.InvariantCulture); + default: + return dateValue.ToString(_datetimeFormats[7], CultureInfo.InvariantCulture); + } + } + + /// + /// Internal function to convert a UTF-8 encoded IntPtr of the specified length to a DateTime. + /// + /// + /// This is a convenience function, which first calls ToString() on the IntPtr to convert it to a string, then calls + /// ToDateTime() on the string to return a DateTime. + /// + /// A pointer to the UTF-8 encoded string + /// The length in bytes of the string + /// The parsed DateTime value + internal DateTime ToDateTime(IntPtr ptr, int len) + { + return ToDateTime(ToString(ptr, len)); + } + + #endregion + + /// + /// Smart method of splitting a string. Skips quoted elements, removes the quotes. + /// + /// + /// This split function works somewhat like the String.Split() function in that it breaks apart a string into + /// pieces and returns the pieces as an array. The primary differences are: + /// + /// Only one character can be provided as a separator character + /// Quoted text inside the string is skipped over when searching for the separator, and the quotes are removed. + /// + /// Thus, if splitting the following string looking for a comma:
+ /// One,Two, "Three, Four", Five
+ ///
+ /// The resulting array would contain
+ /// [0] One
+ /// [1] Two
+ /// [2] Three, Four
+ /// [3] Five
+ ///
+ /// Note that the leading and trailing spaces were removed from each item during the split. + ///
+ /// Source string to split apart + /// Separator character + /// A string array of the split up elements + public static string[] Split(string source, char separator) + { + char[] toks = new char[2] { '\"', separator }; + char[] quot = new char[1] { '\"' }; + int n = 0; + List ls = new List(); + string s; + + while (source.Length > 0) + { + n = source.IndexOfAny(toks, n); + if (n == -1) break; + if (source[n] == toks[0]) + { + //source = source.Remove(n, 1); + n = source.IndexOfAny(quot, n + 1); + if (n == -1) + { + //source = "\"" + source; + break; + } + n++; + //source = source.Remove(n, 1); + } + else + { + s = source.Substring(0, n).Trim(); + if (s.Length > 1 && s[0] == quot[0] && s[s.Length - 1] == s[0]) + s = s.Substring(1, s.Length - 2); + + source = source.Substring(n + 1).Trim(); + if (s.Length > 0) ls.Add(s); + n = 0; + } + } + if (source.Length > 0) + { + s = source.Trim(); + if (s.Length > 1 && s[0] == quot[0] && s[s.Length - 1] == s[0]) + s = s.Substring(1, s.Length - 2); + ls.Add(s); + } + + string[] ar = new string[ls.Count]; + ls.CopyTo(ar, 0); + + return ar; + } + + /// + /// Convert a value to true or false. + /// + /// A string or number representing true or false + /// + public static bool ToBoolean(object source) + { + if (source is bool) return (bool)source; + + return ToBoolean(source.ToString()); + } + + /// + /// Convert a string to true or false. + /// + /// A string representing true or false + /// + /// + /// "yes", "no", "y", "n", "0", "1", "on", "off" as well as Boolean.FalseString and Boolean.TrueString will all be + /// converted to a proper boolean value. + /// + public static bool ToBoolean(string source) + { + if (String.Compare(source, bool.TrueString, StringComparison.OrdinalIgnoreCase) == 0) return true; + else if (String.Compare(source, bool.FalseString, StringComparison.OrdinalIgnoreCase) == 0) return false; + + switch(source.ToLower(CultureInfo.InvariantCulture)) + { + case "yes": + case "y": + case "1": + case "on": + return true; + case "no": + case "n": + case "0": + case "off": + return false; + default: + throw new ArgumentException("source"); + } + } + + #region Type Conversions + /// + /// Determines the data type of a column in a statement + /// + /// The statement to retrieve information for + /// The column to retrieve type information on + /// The SQLiteType to receive the affinity for the given column + internal static void ColumnToType(SQLiteStatement stmt, int i, SQLiteType typ) + { + typ.Type = TypeNameToDbType(stmt._sql.ColumnType(stmt, i, out typ.Affinity)); + } + + /// + /// Converts a SQLiteType to a .NET Type object + /// + /// The SQLiteType to convert + /// Returns a .NET Type object + internal static Type SQLiteTypeToType(SQLiteType t) + { + if (t.Type == DbType.Object) + return _affinitytotype[(int)t.Affinity]; + else + return SQLiteConvert.DbTypeToType(t.Type); + } + + private static Type[] _affinitytotype = { + typeof(object), + typeof(Int64), + typeof(Double), + typeof(string), + typeof(byte[]), + typeof(object), + typeof(DateTime), + typeof(object) + }; + + /// + /// For a given intrinsic type, return a DbType + /// + /// The native type to convert + /// The corresponding (closest match) DbType + internal static DbType TypeToDbType(Type typ) + { + TypeCode tc = Type.GetTypeCode(typ); + if (tc == TypeCode.Object) + { + if (typ == typeof(byte[])) return DbType.Binary; + if (typ == typeof(Guid)) return DbType.Guid; + return DbType.String; + } + return _typetodbtype[(int)tc]; + } + + private static DbType[] _typetodbtype = { + DbType.Object, + DbType.Binary, + DbType.Object, + DbType.Boolean, + DbType.SByte, + DbType.SByte, + DbType.Byte, + DbType.Int16, // 7 + DbType.UInt16, + DbType.Int32, + DbType.UInt32, + DbType.Int64, // 11 + DbType.UInt64, + DbType.Single, + DbType.Double, + DbType.Decimal, + DbType.DateTime, + DbType.Object, + DbType.String, + }; + + /// + /// Returns the ColumnSize for the given DbType + /// + /// The DbType to get the size of + /// + internal static int DbTypeToColumnSize(DbType typ) + { + return _dbtypetocolumnsize[(int)typ]; + } + + private static int[] _dbtypetocolumnsize = { + 2147483647, // 0 + 2147483647, // 1 + 1, // 2 + 1, // 3 + 8, // 4 + 8, // 5 + 8, // 6 + 8, // 7 + 8, // 8 + 16, // 9 + 2, + 4, + 8, + 2147483647, + 1, + 4, + 2147483647, + 8, + 2, + 4, + 8, + 8, + 2147483647, + 2147483647, + 2147483647, + 2147483647, // 25 (Xml) + }; + + internal static object DbTypeToNumericPrecision(DbType typ) + { + return _dbtypetonumericprecision[(int)typ]; + } + + private static object[] _dbtypetonumericprecision = { + DBNull.Value, // 0 + DBNull.Value, // 1 + 3, + DBNull.Value, + 19, + DBNull.Value, // 5 + DBNull.Value, // 6 + 53, + 53, + DBNull.Value, + 5, + 10, + 19, + DBNull.Value, + 3, + 24, + DBNull.Value, + DBNull.Value, + 5, + 10, + 19, + 53, + DBNull.Value, + DBNull.Value, + DBNull.Value + }; + + internal static object DbTypeToNumericScale(DbType typ) + { + return _dbtypetonumericscale[(int)typ]; + } + + private static object[] _dbtypetonumericscale = { + DBNull.Value, // 0 + DBNull.Value, // 1 + 0, + DBNull.Value, + 4, + DBNull.Value, // 5 + DBNull.Value, // 6 + DBNull.Value, + DBNull.Value, + DBNull.Value, + 0, + 0, + 0, + DBNull.Value, + 0, + DBNull.Value, + DBNull.Value, + DBNull.Value, + 0, + 0, + 0, + 0, + DBNull.Value, + DBNull.Value, + DBNull.Value + }; + + internal static string DbTypeToTypeName(DbType typ) + { + for (int n = 0; n < _dbtypeNames.Length; n++) + { + if (_dbtypeNames[n].dataType == typ) + return _dbtypeNames[n].typeName; + } + + return String.Empty; + } + + private static SQLiteTypeNames[] _dbtypeNames = { + new SQLiteTypeNames("INTEGER", DbType.Int64), + new SQLiteTypeNames("TINYINT", DbType.Byte), + new SQLiteTypeNames("INT", DbType.Int32), + new SQLiteTypeNames("VARCHAR", DbType.AnsiString), + new SQLiteTypeNames("NVARCHAR", DbType.String), + new SQLiteTypeNames("CHAR", DbType.AnsiStringFixedLength), + new SQLiteTypeNames("NCHAR", DbType.StringFixedLength), + new SQLiteTypeNames("FLOAT", DbType.Double), + new SQLiteTypeNames("REAL", DbType.Single), + new SQLiteTypeNames("BIT", DbType.Boolean), + new SQLiteTypeNames("DECIMAL", DbType.Decimal), + new SQLiteTypeNames("DATETIME", DbType.DateTime), + new SQLiteTypeNames("BLOB", DbType.Binary), + new SQLiteTypeNames("UNIQUEIDENTIFIER", DbType.Guid), + new SQLiteTypeNames("SMALLINT", DbType.Int16), + }; + /// + /// Convert a DbType to a Type + /// + /// The DbType to convert from + /// The closest-match .NET type + internal static Type DbTypeToType(DbType typ) + { + return _dbtypeToType[(int)typ]; + } + + private static Type[] _dbtypeToType = { + typeof(string), // 0 + typeof(byte[]), // 1 + typeof(byte), // 2 + typeof(bool), // 3 + typeof(decimal), // 4 + typeof(DateTime), // 5 + typeof(DateTime), // 6 + typeof(decimal), // 7 + typeof(double), // 8 + typeof(Guid), // 9 + typeof(Int16), + typeof(Int32), + typeof(Int64), + typeof(object), + typeof(sbyte), + typeof(float), + typeof(string), + typeof(DateTime), + typeof(UInt16), + typeof(UInt32), + typeof(UInt64), + typeof(double), + typeof(string), + typeof(string), + typeof(string), + typeof(string), // 25 (Xml) + }; + + /// + /// For a given type, return the closest-match SQLite TypeAffinity, which only understands a very limited subset of types. + /// + /// The type to evaluate + /// The SQLite type affinity for that type. + internal static TypeAffinity TypeToAffinity(Type typ) + { + TypeCode tc = Type.GetTypeCode(typ); + if (tc == TypeCode.Object) + { + if (typ == typeof(byte[]) || typ == typeof(Guid)) + return TypeAffinity.Blob; + else + return TypeAffinity.Text; + } + return _typecodeAffinities[(int)tc]; + } + + private static TypeAffinity[] _typecodeAffinities = { + TypeAffinity.Null, + TypeAffinity.Blob, + TypeAffinity.Null, + TypeAffinity.Int64, + TypeAffinity.Int64, + TypeAffinity.Int64, + TypeAffinity.Int64, + TypeAffinity.Int64, // 7 + TypeAffinity.Int64, + TypeAffinity.Int64, + TypeAffinity.Int64, + TypeAffinity.Int64, // 11 + TypeAffinity.Int64, + TypeAffinity.Double, + TypeAffinity.Double, + TypeAffinity.Double, + TypeAffinity.DateTime, + TypeAffinity.Null, + TypeAffinity.Text, + }; + + /// + /// For a given type name, return a closest-match .NET type + /// + /// The name of the type to match + /// The .NET DBType the text evaluates to. + internal static DbType TypeNameToDbType(string Name) + { + if (String.IsNullOrEmpty(Name)) return DbType.Object; + + int x = _typeNames.Length; + for (int n = 0; n < x; n++) + { + if (String.Compare(Name, 0, _typeNames[n].typeName, 0, _typeNames[n].typeName.Length, StringComparison.OrdinalIgnoreCase) == 0) + return _typeNames[n].dataType; + } + return DbType.Object; + } + #endregion + + private static SQLiteTypeNames[] _typeNames = { + new SQLiteTypeNames("COUNTER", DbType.Int64), + new SQLiteTypeNames("AUTOINCREMENT", DbType.Int64), + new SQLiteTypeNames("IDENTITY", DbType.Int64), + new SQLiteTypeNames("LONGTEXT", DbType.String), + new SQLiteTypeNames("LONGCHAR", DbType.String), + new SQLiteTypeNames("LONGVARCHAR", DbType.String), + new SQLiteTypeNames("LONG", DbType.Int64), + new SQLiteTypeNames("TINYINT", DbType.Byte), + new SQLiteTypeNames("INTEGER", DbType.Int64), + new SQLiteTypeNames("INT", DbType.Int32), + new SQLiteTypeNames("VARCHAR", DbType.String), + new SQLiteTypeNames("NVARCHAR", DbType.String), + new SQLiteTypeNames("CHAR", DbType.String), + new SQLiteTypeNames("NCHAR", DbType.String), + new SQLiteTypeNames("TEXT", DbType.String), + new SQLiteTypeNames("NTEXT", DbType.String), + new SQLiteTypeNames("STRING", DbType.String), + new SQLiteTypeNames("DOUBLE", DbType.Double), + new SQLiteTypeNames("FLOAT", DbType.Double), + new SQLiteTypeNames("REAL", DbType.Single), + new SQLiteTypeNames("BIT", DbType.Boolean), + new SQLiteTypeNames("YESNO", DbType.Boolean), + new SQLiteTypeNames("LOGICAL", DbType.Boolean), + new SQLiteTypeNames("BOOL", DbType.Boolean), + new SQLiteTypeNames("NUMERIC", DbType.Decimal), + new SQLiteTypeNames("DECIMAL", DbType.Decimal), + new SQLiteTypeNames("MONEY", DbType.Decimal), + new SQLiteTypeNames("CURRENCY", DbType.Decimal), + new SQLiteTypeNames("TIME", DbType.DateTime), + new SQLiteTypeNames("DATE", DbType.DateTime), + new SQLiteTypeNames("SMALLDATE", DbType.DateTime), + new SQLiteTypeNames("BLOB", DbType.Binary), + new SQLiteTypeNames("BINARY", DbType.Binary), + new SQLiteTypeNames("VARBINARY", DbType.Binary), + new SQLiteTypeNames("IMAGE", DbType.Binary), + new SQLiteTypeNames("GENERAL", DbType.Binary), + new SQLiteTypeNames("OLEOBJECT", DbType.Binary), + new SQLiteTypeNames("GUID", DbType.Guid), + new SQLiteTypeNames("UNIQUEIDENTIFIER", DbType.Guid), + new SQLiteTypeNames("MEMO", DbType.String), + new SQLiteTypeNames("NOTE", DbType.String), + new SQLiteTypeNames("SMALLINT", DbType.Int16), + new SQLiteTypeNames("BIGINT", DbType.Int64), + }; + } + + /// + /// SQLite has very limited types, and is inherently text-based. The first 5 types below represent the sum of all types SQLite + /// understands. The DateTime extension to the spec is for internal use only. + /// + public enum TypeAffinity + { + /// + /// Not used + /// + Uninitialized = 0, + /// + /// All integers in SQLite default to Int64 + /// + Int64 = 1, + /// + /// All floating point numbers in SQLite default to double + /// + Double = 2, + /// + /// The default data type of SQLite is text + /// + Text = 3, + /// + /// Typically blob types are only seen when returned from a function + /// + Blob = 4, + /// + /// Null types can be returned from functions + /// + Null = 5, + /// + /// Used internally by this provider + /// + DateTime = 10, + /// + /// Used internally + /// + None = 11, + } + + /// + /// This implementation of SQLite for ADO.NET can process date/time fields in databases in only one of three formats. Ticks, ISO8601 + /// and JulianDay. + /// + /// + /// ISO8601 is more compatible, readable, fully-processable, but less accurate as it doesn't provide time down to fractions of a second. + /// JulianDay is the numeric format the SQLite uses internally and is arguably the most compatible with 3rd party tools. It is + /// not readable as text without post-processing. + /// Ticks less compatible with 3rd party tools that query the database, and renders the DateTime field unreadable as text without post-processing. + /// + /// The preferred order of choosing a datetime format is JulianDay, ISO8601, and then Ticks. Ticks is mainly present for legacy + /// code support. + /// + public enum SQLiteDateFormats + { + /// + /// Using ticks is not recommended and is not well supported with LINQ. + /// + Ticks = 0, + /// + /// The default format for this provider. + /// + ISO8601 = 1, + /// + /// JulianDay format, which is what SQLite uses internally + /// + JulianDay = 2 + } + + /// + /// This enum determines how SQLite treats its journal file. + /// + /// + /// By default SQLite will create and delete the journal file when needed during a transaction. + /// However, for some computers running certain filesystem monitoring tools, the rapid + /// creation and deletion of the journal file can cause those programs to fail, or to interfere with SQLite. + /// + /// If a program or virus scanner is interfering with SQLite's journal file, you may receive errors like "unable to open database file" + /// when starting a transaction. If this is happening, you may want to change the default journal mode to Persist. + /// + public enum SQLiteJournalModeEnum + { + /// + /// The default mode, this causes SQLite to create and destroy the journal file as-needed. + /// + Delete = 0, + /// + /// When this is set, SQLite will keep the journal file even after a transaction has completed. It's contents will be erased, + /// and the journal re-used as often as needed. If it is deleted, it will be recreated the next time it is needed. + /// + Persist = 1, + /// + /// This option disables the rollback journal entirely. Interrupted transactions or a program crash can cause database + /// corruption in this mode! + /// + Off = 2 + } + + /// + /// Struct used internally to determine the datatype of a column in a resultset + /// + internal class SQLiteType + { + /// + /// The DbType of the column, or DbType.Object if it cannot be determined + /// + internal DbType Type; + /// + /// The affinity of a column, used for expressions or when Type is DbType.Object + /// + internal TypeAffinity Affinity; + } + + internal struct SQLiteTypeNames + { + internal SQLiteTypeNames(string newtypeName, DbType newdataType) + { + typeName = newtypeName; + dataType = newdataType; + } + + internal string typeName; + internal DbType dataType; + } +} Index: System.Data.SQLite/SQLiteDataAdapter.cs ================================================================== --- System.Data.SQLite/SQLiteDataAdapter.cs +++ System.Data.SQLite/SQLiteDataAdapter.cs @@ -1,190 +1,190 @@ -/******************************************************** - * ADO.NET 2.0 Data Provider for SQLite Version 3.X - * Written by Robert Simpson (robert@blackcastlesoft.com) - * - * Released to the public domain, use at your own risk! - ********************************************************/ - -namespace System.Data.SQLite -{ - using System; - using System.Data; - using System.Data.Common; - using System.ComponentModel; - - /// - /// SQLite implementation of DbDataAdapter. - /// -#if !PLATFORM_COMPACTFRAMEWORK - [DefaultEvent("RowUpdated")] - [ToolboxItem("SQLite.Designer.SQLiteDataAdapterToolboxItem, SQLite.Designer, Version=1.0.37.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139")] - [Designer("Microsoft.VSDesigner.Data.VS.SqlDataAdapterDesigner, Microsoft.VSDesigner, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")] -#endif - public sealed class SQLiteDataAdapter : DbDataAdapter - { - private static object _updatingEventPH = new object(); - private static object _updatedEventPH = new object(); - - /// - /// This class is just a shell around the DbDataAdapter. Nothing from DbDataAdapter is overridden here, just a few constructors are defined. - /// - /// - /// Default constructor. - /// - public SQLiteDataAdapter() - { - } - - /// - /// Constructs a data adapter using the specified select command. - /// - /// The select command to associate with the adapter. - public SQLiteDataAdapter(SQLiteCommand cmd) - { - SelectCommand = cmd; - } - - /// - /// Constructs a data adapter with the supplied select command text and associated with the specified connection. - /// - /// The select command text to associate with the data adapter. - /// The connection to associate with the select command. - public SQLiteDataAdapter(string commandText, SQLiteConnection connection) - { - SelectCommand = new SQLiteCommand(commandText, connection); - } - - /// - /// Constructs a data adapter with the specified select command text, and using the specified database connection string. - /// - /// The select command text to use to construct a select command. - /// A connection string suitable for passing to a new SQLiteConnection, which is associated with the select command. - public SQLiteDataAdapter(string commandText, string connectionString) - { - SQLiteConnection cnn = new SQLiteConnection(connectionString); - SelectCommand = new SQLiteCommand(commandText, cnn); - } - - /// - /// Row updating event handler - /// - public event EventHandler RowUpdating - { - add - { -#if !PLATFORM_COMPACTFRAMEWORK - EventHandler previous = (EventHandler)base.Events[_updatingEventPH]; - if ((previous != null) && (value.Target is DbCommandBuilder)) - { - EventHandler handler = (EventHandler)FindBuilder(previous); - if (handler != null) - { - base.Events.RemoveHandler(_updatingEventPH, handler); - } - } -#endif - base.Events.AddHandler(_updatingEventPH, value); - } - remove { base.Events.RemoveHandler(_updatingEventPH, value); } - } - -#if !PLATFORM_COMPACTFRAMEWORK - internal static Delegate FindBuilder(MulticastDelegate mcd) - { - if (mcd != null) - { - Delegate[] invocationList = mcd.GetInvocationList(); - for (int i = 0; i < invocationList.Length; i++) - { - if (invocationList[i].Target is DbCommandBuilder) - { - return invocationList[i]; - } - } - } - return null; - } -#endif - - /// - /// Row updated event handler - /// - public event EventHandler RowUpdated - { - add { base.Events.AddHandler(_updatedEventPH, value); } - remove { base.Events.RemoveHandler(_updatedEventPH, value); } - } - - /// - /// Raised by the underlying DbDataAdapter when a row is being updated - /// - /// The event's specifics - protected override void OnRowUpdating(RowUpdatingEventArgs value) - { - EventHandler handler = base.Events[_updatingEventPH] as EventHandler; - - if (handler != null) - handler(this, value); - } - - /// - /// Raised by DbDataAdapter after a row is updated - /// - /// The event's specifics - protected override void OnRowUpdated(RowUpdatedEventArgs value) - { - EventHandler handler = base.Events[_updatedEventPH] as EventHandler; - - if (handler != null) - handler(this, value); - } - - /// - /// Gets/sets the select command for this DataAdapter - /// -#if !PLATFORM_COMPACTFRAMEWORK - [DefaultValue((string)null), Editor("Microsoft.VSDesigner.Data.Design.DBCommandEditor, Microsoft.VSDesigner, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", "System.Drawing.Design.UITypeEditor, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")] -#endif - public new SQLiteCommand SelectCommand - { - get { return (SQLiteCommand)base.SelectCommand; } - set { base.SelectCommand = value; } - } - - /// - /// Gets/sets the insert command for this DataAdapter - /// -#if !PLATFORM_COMPACTFRAMEWORK - [DefaultValue((string)null), Editor("Microsoft.VSDesigner.Data.Design.DBCommandEditor, Microsoft.VSDesigner, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", "System.Drawing.Design.UITypeEditor, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")] -#endif - public new SQLiteCommand InsertCommand - { - get { return (SQLiteCommand)base.InsertCommand; } - set { base.InsertCommand = value; } - } - - /// - /// Gets/sets the update command for this DataAdapter - /// -#if !PLATFORM_COMPACTFRAMEWORK - [DefaultValue((string)null), Editor("Microsoft.VSDesigner.Data.Design.DBCommandEditor, Microsoft.VSDesigner, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", "System.Drawing.Design.UITypeEditor, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")] -#endif - public new SQLiteCommand UpdateCommand - { - get { return (SQLiteCommand)base.UpdateCommand; } - set { base.UpdateCommand = value; } - } - - /// - /// Gets/sets the delete command for this DataAdapter - /// -#if !PLATFORM_COMPACTFRAMEWORK - [DefaultValue((string)null), Editor("Microsoft.VSDesigner.Data.Design.DBCommandEditor, Microsoft.VSDesigner, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", "System.Drawing.Design.UITypeEditor, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")] -#endif - public new SQLiteCommand DeleteCommand - { - get { return (SQLiteCommand)base.DeleteCommand; } - set { base.DeleteCommand = value; } - } - } -} +/******************************************************** + * ADO.NET 2.0 Data Provider for SQLite Version 3.X + * Written by Robert Simpson (robert@blackcastlesoft.com) + * + * Released to the public domain, use at your own risk! + ********************************************************/ + +namespace System.Data.SQLite +{ + using System; + using System.Data; + using System.Data.Common; + using System.ComponentModel; + + /// + /// SQLite implementation of DbDataAdapter. + /// +#if !PLATFORM_COMPACTFRAMEWORK + [DefaultEvent("RowUpdated")] + [ToolboxItem("SQLite.Designer.SQLiteDataAdapterToolboxItem, SQLite.Designer, Version=1.0.38.1, Culture=neutral, PublicKeyToken=db937bc2d44ff139")] + [Designer("Microsoft.VSDesigner.Data.VS.SqlDataAdapterDesigner, Microsoft.VSDesigner, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")] +#endif + public sealed class SQLiteDataAdapter : DbDataAdapter + { + private static object _updatingEventPH = new object(); + private static object _updatedEventPH = new object(); + + /// + /// This class is just a shell around the DbDataAdapter. Nothing from DbDataAdapter is overridden here, just a few constructors are defined. + /// + /// + /// Default constructor. + /// + public SQLiteDataAdapter() + { + } + + /// + /// Constructs a data adapter using the specified select command. + /// + /// The select command to associate with the adapter. + public SQLiteDataAdapter(SQLiteCommand cmd) + { + SelectCommand = cmd; + } + + /// + /// Constructs a data adapter with the supplied select command text and associated with the specified connection. + /// + /// The select command text to associate with the data adapter. + /// The connection to associate with the select command. + public SQLiteDataAdapter(string commandText, SQLiteConnection connection) + { + SelectCommand = new SQLiteCommand(commandText, connection); + } + + /// + /// Constructs a data adapter with the specified select command text, and using the specified database connection string. + /// + /// The select command text to use to construct a select command. + /// A connection string suitable for passing to a new SQLiteConnection, which is associated with the select command. + public SQLiteDataAdapter(string commandText, string connectionString) + { + SQLiteConnection cnn = new SQLiteConnection(connectionString); + SelectCommand = new SQLiteCommand(commandText, cnn); + } + + /// + /// Row updating event handler + /// + public event EventHandler RowUpdating + { + add + { +#if !PLATFORM_COMPACTFRAMEWORK + EventHandler previous = (EventHandler)base.Events[_updatingEventPH]; + if ((previous != null) && (value.Target is DbCommandBuilder)) + { + EventHandler handler = (EventHandler)FindBuilder(previous); + if (handler != null) + { + base.Events.RemoveHandler(_updatingEventPH, handler); + } + } +#endif + base.Events.AddHandler(_updatingEventPH, value); + } + remove { base.Events.RemoveHandler(_updatingEventPH, value); } + } + +#if !PLATFORM_COMPACTFRAMEWORK + internal static Delegate FindBuilder(MulticastDelegate mcd) + { + if (mcd != null) + { + Delegate[] invocationList = mcd.GetInvocationList(); + for (int i = 0; i < invocationList.Length; i++) + { + if (invocationList[i].Target is DbCommandBuilder) + { + return invocationList[i]; + } + } + } + return null; + } +#endif + + /// + /// Row updated event handler + /// + public event EventHandler RowUpdated + { + add { base.Events.AddHandler(_updatedEventPH, value); } + remove { base.Events.RemoveHandler(_updatedEventPH, value); } + } + + /// + /// Raised by the underlying DbDataAdapter when a row is being updated + /// + /// The event's specifics + protected override void OnRowUpdating(RowUpdatingEventArgs value) + { + EventHandler handler = base.Events[_updatingEventPH] as EventHandler; + + if (handler != null) + handler(this, value); + } + + /// + /// Raised by DbDataAdapter after a row is updated + /// + /// The event's specifics + protected override void OnRowUpdated(RowUpdatedEventArgs value) + { + EventHandler handler = base.Events[_updatedEventPH] as EventHandler; + + if (handler != null) + handler(this, value); + } + + /// + /// Gets/sets the select command for this DataAdapter + /// +#if !PLATFORM_COMPACTFRAMEWORK + [DefaultValue((string)null), Editor("Microsoft.VSDesigner.Data.Design.DBCommandEditor, Microsoft.VSDesigner, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", "System.Drawing.Design.UITypeEditor, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")] +#endif + public new SQLiteCommand SelectCommand + { + get { return (SQLiteCommand)base.SelectCommand; } + set { base.SelectCommand = value; } + } + + /// + /// Gets/sets the insert command for this DataAdapter + /// +#if !PLATFORM_COMPACTFRAMEWORK + [DefaultValue((string)null), Editor("Microsoft.VSDesigner.Data.Design.DBCommandEditor, Microsoft.VSDesigner, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", "System.Drawing.Design.UITypeEditor, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")] +#endif + public new SQLiteCommand InsertCommand + { + get { return (SQLiteCommand)base.InsertCommand; } + set { base.InsertCommand = value; } + } + + /// + /// Gets/sets the update command for this DataAdapter + /// +#if !PLATFORM_COMPACTFRAMEWORK + [DefaultValue((string)null), Editor("Microsoft.VSDesigner.Data.Design.DBCommandEditor, Microsoft.VSDesigner, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", "System.Drawing.Design.UITypeEditor, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")] +#endif + public new SQLiteCommand UpdateCommand + { + get { return (SQLiteCommand)base.UpdateCommand; } + set { base.UpdateCommand = value; } + } + + /// + /// Gets/sets the delete command for this DataAdapter + /// +#if !PLATFORM_COMPACTFRAMEWORK + [DefaultValue((string)null), Editor("Microsoft.VSDesigner.Data.Design.DBCommandEditor, Microsoft.VSDesigner, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", "System.Drawing.Design.UITypeEditor, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")] +#endif + public new SQLiteCommand DeleteCommand + { + get { return (SQLiteCommand)base.DeleteCommand; } + set { base.DeleteCommand = value; } + } + } +} Index: System.Data.SQLite/SR.Designer.cs ================================================================== --- System.Data.SQLite/SR.Designer.cs +++ System.Data.SQLite/SR.Designer.cs @@ -1,112 +1,115 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// Runtime Version:2.0.50727.3053 -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -namespace System.Data.SQLite { - using System; - - - /// - /// A strongly-typed resource class, for looking up localized strings, etc. - /// - // This class was auto-generated by the StronglyTypedResourceBuilder - // class via a tool like ResGen or Visual Studio. - // To add or remove a member, edit your .ResX file then rerun ResGen - // with the /str option, or rebuild your VS project. - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - internal class SR { - - private static global::System.Resources.ResourceManager resourceMan; - - private static global::System.Globalization.CultureInfo resourceCulture; - - internal SR() { - } - - /// - /// Returns the cached ResourceManager instance used by this class. - /// - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Resources.ResourceManager ResourceManager { - get { - if (object.ReferenceEquals(resourceMan, null)) { - global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("System.Data.SQLite.SR", typeof(SR).Assembly); - resourceMan = temp; - } - return resourceMan; - } - } - - /// - /// Overrides the current thread's CurrentUICulture property for all - /// resource lookups using this strongly typed resource class. - /// - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Globalization.CultureInfo Culture { - get { - return resourceCulture; - } - set { - resourceCulture = value; - } - } - - /// - /// Looks up a localized string similar to <?xml version="1.0" standalone="yes"?> - ///<DocumentElement> - /// <DataTypes> - /// <TypeName>smallint</TypeName> - /// <ProviderDbType>10</ProviderDbType> - /// <ColumnSize>5</ColumnSize> - /// <DataType>System.Int16</DataType> - /// <CreateFormat>smallint</CreateFormat> - /// <IsAutoIncrementable>false</IsAutoIncrementable> - /// <IsCaseSensitive>false</IsCaseSensitive> - /// <IsFixedLength>true</IsFixedLength> - /// <IsFixedPrecisionScale>true</IsFixedPrecisionScale> - /// <IsLong>false</IsLong> - /// <IsNullable>true</ [rest of string was truncated]";. - /// - internal static string DataTypes { - get { - return ResourceManager.GetString("DataTypes", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to ALL,ALTER,AND,AS,AUTOINCREMENT,BETWEEN,BY,CASE,CHECK,COLLATE,COMMIT,CONSTRAINT,CREATE,CROSS,DEFAULT,DEFERRABLE,DELETE,DISTINCT,DROP,ELSE,ESCAPE,EXCEPT,FOREIGN,FROM,FULL,GROUP,HAVING,IN,INDEX,INNER,INSERT,INTERSECT,INTO,IS,ISNULL,JOIN,LEFT,LIMIT,NATURAL,NOT,NOTNULL,NULL,ON,OR,ORDER,OUTER,PRIMARY,REFERENCES,RIGHT,ROLLBACK,SELECT,SET,TABLE,THEN,TO,TRANSACTION,UNION,UNIQUE,UPDATE,USING,VALUES,WHEN,WHERE. - /// - internal static string Keywords { - get { - return ResourceManager.GetString("Keywords", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to <?xml version="1.0" encoding="utf-8" ?> - ///<DocumentElement> - /// <MetaDataCollections> - /// <CollectionName>MetaDataCollections</CollectionName> - /// <NumberOfRestrictions>0</NumberOfRestrictions> - /// <NumberOfIdentifierParts>0</NumberOfIdentifierParts> - /// </MetaDataCollections> - /// <MetaDataCollections> - /// <CollectionName>DataSourceInformation</CollectionName> - /// <NumberOfRestrictions>0</NumberOfRestrictions> - /// <NumberOfIdentifierParts>0</NumberOfIdentifierParts> - /// </MetaDataCollections> - /// <MetaDataC [rest of string was truncated]";. - /// - internal static string MetaDataCollections { - get { - return ResourceManager.GetString("MetaDataCollections", resourceCulture); - } - } - } -} +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.1 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace System.Data.SQLite { + using System; + + + /// + /// A strongly-typed resource class, for looking up localized strings, etc. + /// + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class SR { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal SR() { + } + + /// + /// Returns the cached ResourceManager instance used by this class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager { + get { + if (object.ReferenceEquals(resourceMan, null)) { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("System.Data.SQLite.SR", typeof(SR).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + + /// + /// Looks up a localized string similar to <?xml version="1.0" standalone="yes"?> + ///<DocumentElement> + /// <DataTypes> + /// <TypeName>smallint</TypeName> + /// <ProviderDbType>10</ProviderDbType> + /// <ColumnSize>5</ColumnSize> + /// <DataType>System.Int16</DataType> + /// <CreateFormat>smallint</CreateFormat> + /// <IsAutoIncrementable>false</IsAutoIncrementable> + /// <IsCaseSensitive>false</IsCaseSensitive> + /// <IsFixedLength>true</IsFixedLength> + /// <IsFixedPrecisionScale>true</IsFixedPrecisionScale> + /// <IsLong>false</IsLong> + /// <IsNullable>true</ [rest of string was truncated]";. + /// + internal static string DataTypes { + get { + return ResourceManager.GetString("DataTypes", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to ALL,ALTER,AND,AS,AUTOINCREMENT,BETWEEN,BY,CASE,CHECK,COLLATE,COMMIT,CONSTRAINT,CREATE,CROSS,DEFAULT,DEFERRABLE,DELETE,DISTINCT,DROP,ELSE,ESCAPE,EXCEPT,FOREIGN,FROM,FULL,GROUP,HAVING,IN,INDEX,INNER,INSERT,INTERSECT,INTO,IS,ISNULL,JOIN,LEFT,LIMIT,NATURAL,NOT,NOTNULL,NULL,ON,OR,ORDER,OUTER,PRIMARY,REFERENCES,RIGHT,ROLLBACK,SELECT,SET,TABLE,THEN,TO,TRANSACTION,UNION,UNIQUE,UPDATE,USING,VALUES,WHEN,WHERE. + /// + internal static string Keywords { + get { + return ResourceManager.GetString("Keywords", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to <?xml version="1.0" encoding="utf-8" ?> + ///<DocumentElement> + /// <MetaDataCollections> + /// <CollectionName>MetaDataCollections</CollectionName> + /// <NumberOfRestrictions>0</NumberOfRestrictions> + /// <NumberOfIdentifierParts>0</NumberOfIdentifierParts> + /// </MetaDataCollections> + /// <MetaDataCollections> + /// <CollectionName>DataSourceInformation</CollectionName> + /// <NumberOfRestrictions>0</NumberOfRestrictions> + /// <NumberOfIdentifierParts>0</NumberOfIdentifierParts> + /// </MetaDataCollections> + /// <MetaDataC [rest of string was truncated]";. + /// + internal static string MetaDataCollections { + get { + return ResourceManager.GetString("MetaDataCollections", resourceCulture); + } + } + } +} Index: System.Data.SQLite/SR.resx ================================================================== --- System.Data.SQLite/SR.resx +++ System.Data.SQLite/SR.resx @@ -1,130 +1,130 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - - datatypes.xml;System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8 - - - ALL,ALTER,AND,AS,AUTOINCREMENT,BETWEEN,BY,CASE,CHECK,COLLATE,COMMIT,CONSTRAINT,CREATE,CROSS,DEFAULT,DEFERRABLE,DELETE,DISTINCT,DROP,ELSE,ESCAPE,EXCEPT,FOREIGN,FROM,FULL,GROUP,HAVING,IN,INDEX,INNER,INSERT,INTERSECT,INTO,IS,ISNULL,JOIN,LEFT,LIMIT,NATURAL,NOT,NOTNULL,NULL,ON,OR,ORDER,OUTER,PRIMARY,REFERENCES,RIGHT,ROLLBACK,SELECT,SET,TABLE,THEN,TO,TRANSACTION,UNION,UNIQUE,UPDATE,USING,VALUES,WHEN,WHERE - - - metadatacollections.xml;System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8 - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + + DataTypes.xml;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8 + + + ALL,ALTER,AND,AS,AUTOINCREMENT,BETWEEN,BY,CASE,CHECK,COLLATE,COMMIT,CONSTRAINT,CREATE,CROSS,DEFAULT,DEFERRABLE,DELETE,DISTINCT,DROP,ELSE,ESCAPE,EXCEPT,FOREIGN,FROM,FULL,GROUP,HAVING,IN,INDEX,INNER,INSERT,INTERSECT,INTO,IS,ISNULL,JOIN,LEFT,LIMIT,NATURAL,NOT,NOTNULL,NULL,ON,OR,ORDER,OUTER,PRIMARY,REFERENCES,RIGHT,ROLLBACK,SELECT,SET,TABLE,THEN,TO,TRANSACTION,UNION,UNIQUE,UPDATE,USING,VALUES,WHEN,WHERE + + + MetaDataCollections.xml;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8 + Index: System.Data.SQLite/UnsafeNativeMethods.cs ================================================================== --- System.Data.SQLite/UnsafeNativeMethods.cs +++ System.Data.SQLite/UnsafeNativeMethods.cs @@ -1,833 +1,840 @@ -/******************************************************** - * ADO.NET 2.0 Data Provider for SQLite Version 3.X - * Written by Robert Simpson (robert@blackcastlesoft.com) - * - * Released to the public domain, use at your own risk! - ********************************************************/ - -namespace System.Data.SQLite -{ - using System; - using System.Security; - using System.Runtime.InteropServices; - -#if !PLATFORM_COMPACTFRAMEWORK && !DEBUG - [SuppressUnmanagedCodeSecurity] -#endif - internal static class UnsafeNativeMethods - { -#if !SQLITE_STANDARD - -#if !USE_INTEROP_DLL - -#if !PLATFORM_COMPACTFRAMEWORK - private const string SQLITE_DLL = "System.Data.SQLite.DLL"; -#else - internal const string SQLITE_DLL = "SQLite.Interop.067.DLL"; -#endif // PLATFORM_COMPACTFRAMEWORK - -#else - private const string SQLITE_DLL = "SQLite.Interop.DLL"; -#endif // USE_INTEROP_DLL - -#else - private const string SQLITE_DLL = "sqlite3"; -#endif - - // This section uses interop calls that also fetch text length to optimize conversion. - // When using the standard dll, we can replace these calls with normal sqlite calls and do unoptimized conversions instead afterwards - #region interop added textlength calls - -#if !SQLITE_STANDARD - [DllImport(SQLITE_DLL)] - internal static extern IntPtr sqlite3_bind_parameter_name_interop(IntPtr stmt, int index, out int len); - - [DllImport(SQLITE_DLL)] - internal static extern IntPtr sqlite3_column_database_name_interop(IntPtr stmt, int index, out int len); - - [DllImport(SQLITE_DLL)] - internal static extern IntPtr sqlite3_column_database_name16_interop(IntPtr stmt, int index, out int len); - - [DllImport(SQLITE_DLL)] - internal static extern IntPtr sqlite3_column_decltype_interop(IntPtr stmt, int index, out int len); - - [DllImport(SQLITE_DLL)] - internal static extern IntPtr sqlite3_column_decltype16_interop(IntPtr stmt, int index, out int len); - - [DllImport(SQLITE_DLL)] - internal static extern IntPtr sqlite3_column_name_interop(IntPtr stmt, int index, out int len); - - [DllImport(SQLITE_DLL)] - internal static extern IntPtr sqlite3_column_name16_interop(IntPtr stmt, int index, out int len); - - [DllImport(SQLITE_DLL)] - internal static extern IntPtr sqlite3_column_origin_name_interop(IntPtr stmt, int index, out int len); - - [DllImport(SQLITE_DLL)] - internal static extern IntPtr sqlite3_column_origin_name16_interop(IntPtr stmt, int index, out int len); - - [DllImport(SQLITE_DLL)] - internal static extern IntPtr sqlite3_column_table_name_interop(IntPtr stmt, int index, out int len); - - [DllImport(SQLITE_DLL)] - internal static extern IntPtr sqlite3_column_table_name16_interop(IntPtr stmt, int index, out int len); - - [DllImport(SQLITE_DLL)] - internal static extern IntPtr sqlite3_column_text_interop(IntPtr stmt, int index, out int len); - - [DllImport(SQLITE_DLL)] - internal static extern IntPtr sqlite3_column_text16_interop(IntPtr stmt, int index, out int len); - - [DllImport(SQLITE_DLL)] - internal static extern IntPtr sqlite3_errmsg_interop(IntPtr db, out int len); - - [DllImport(SQLITE_DLL)] - internal static extern int sqlite3_prepare_interop(IntPtr db, IntPtr pSql, int nBytes, out IntPtr stmt, out IntPtr ptrRemain, out int nRemain); - - [DllImport(SQLITE_DLL)] - internal static extern int sqlite3_table_column_metadata_interop(IntPtr db, byte[] dbName, byte[] tblName, byte[] colName, out IntPtr ptrDataType, out IntPtr ptrCollSeq, out int notNull, out int primaryKey, out int autoInc, out int dtLen, out int csLen); - - [DllImport(SQLITE_DLL)] - internal static extern IntPtr sqlite3_value_text_interop(IntPtr p, out int len); - - [DllImport(SQLITE_DLL)] - internal static extern IntPtr sqlite3_value_text16_interop(IntPtr p, out int len); -#endif - - #endregion - - // These functions add existing functionality on top of SQLite and require a little effort to - // get working when using the standard SQLite library. - #region interop added functionality - -#if !SQLITE_STANDARD - [DllImport(SQLITE_DLL)] - internal static extern int sqlite3_close_interop(IntPtr db); - - [DllImport(SQLITE_DLL)] - internal static extern int sqlite3_create_function_interop(IntPtr db, byte[] strName, int nArgs, int nType, IntPtr pvUser, SQLiteCallback func, SQLiteCallback fstep, SQLiteFinalCallback ffinal, int needCollSeq); - - [DllImport(SQLITE_DLL)] - internal static extern int sqlite3_finalize_interop(IntPtr stmt); - - [DllImport(SQLITE_DLL)] - internal static extern int sqlite3_open_interop(byte[] utf8Filename, int flags, out IntPtr db); - - [DllImport(SQLITE_DLL)] - internal static extern int sqlite3_open16_interop(byte[] utf8Filename, int flags, out IntPtr db); - - [DllImport(SQLITE_DLL)] - internal static extern int sqlite3_reset_interop(IntPtr stmt); - -#endif - - #endregion - - // The standard api call equivalents of the above interop calls - #region standard versions of interop functions - -#if SQLITE_STANDARD -#if !PLATFORM_COMPACTFRAMEWORK - [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)] -#else - [DllImport(SQLITE_DLL)] -#endif - internal static extern int sqlite3_close(IntPtr db); - -#if !PLATFORM_COMPACTFRAMEWORK - [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)] -#else - [DllImport(SQLITE_DLL)] -#endif - internal static extern int sqlite3_create_function(IntPtr db, byte[] strName, int nArgs, int nType, IntPtr pvUser, SQLiteCallback func, SQLiteCallback fstep, SQLiteFinalCallback ffinal); - -#if !PLATFORM_COMPACTFRAMEWORK - [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)] -#else - [DllImport(SQLITE_DLL)] -#endif - internal static extern int sqlite3_finalize(IntPtr stmt); - -#if !PLATFORM_COMPACTFRAMEWORK - [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)] -#else - [DllImport(SQLITE_DLL)] -#endif - internal static extern int sqlite3_open_v2(byte[] utf8Filename, out IntPtr db, int flags, IntPtr vfs); - -#if !PLATFORM_COMPACTFRAMEWORK - [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Unicode)] -#else - [DllImport(SQLITE_DLL, CharSet = CharSet.Unicode)] -#endif - internal static extern int sqlite3_open16(string fileName, out IntPtr db); - -#if !PLATFORM_COMPACTFRAMEWORK - [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)] -#else - [DllImport(SQLITE_DLL)] -#endif - internal static extern int sqlite3_reset(IntPtr stmt); - -#if !PLATFORM_COMPACTFRAMEWORK - [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)] -#else - [DllImport(SQLITE_DLL)] -#endif - internal static extern IntPtr sqlite3_bind_parameter_name(IntPtr stmt, int index); - -#if !PLATFORM_COMPACTFRAMEWORK - [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)] -#else - [DllImport(SQLITE_DLL)] -#endif - internal static extern IntPtr sqlite3_column_database_name(IntPtr stmt, int index); - -#if !PLATFORM_COMPACTFRAMEWORK - [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)] -#else - [DllImport(SQLITE_DLL)] -#endif - internal static extern IntPtr sqlite3_column_database_name16(IntPtr stmt, int index); - -#if !PLATFORM_COMPACTFRAMEWORK - [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)] -#else - [DllImport(SQLITE_DLL)] -#endif - internal static extern IntPtr sqlite3_column_decltype(IntPtr stmt, int index); - -#if !PLATFORM_COMPACTFRAMEWORK - [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)] -#else - [DllImport(SQLITE_DLL)] -#endif - internal static extern IntPtr sqlite3_column_decltype16(IntPtr stmt, int index); - -#if !PLATFORM_COMPACTFRAMEWORK - [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)] -#else - [DllImport(SQLITE_DLL)] -#endif - internal static extern IntPtr sqlite3_column_name(IntPtr stmt, int index); - -#if !PLATFORM_COMPACTFRAMEWORK - [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)] -#else - [DllImport(SQLITE_DLL)] -#endif - internal static extern IntPtr sqlite3_column_name16(IntPtr stmt, int index); - -#if !PLATFORM_COMPACTFRAMEWORK - [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)] -#else - [DllImport(SQLITE_DLL)] -#endif - internal static extern IntPtr sqlite3_column_origin_name(IntPtr stmt, int index); - -#if !PLATFORM_COMPACTFRAMEWORK - [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)] -#else - [DllImport(SQLITE_DLL)] -#endif - internal static extern IntPtr sqlite3_column_origin_name16(IntPtr stmt, int index); - -#if !PLATFORM_COMPACTFRAMEWORK - [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)] -#else - [DllImport(SQLITE_DLL)] -#endif - internal static extern IntPtr sqlite3_column_table_name(IntPtr stmt, int index); - -#if !PLATFORM_COMPACTFRAMEWORK - [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)] -#else - [DllImport(SQLITE_DLL)] -#endif - internal static extern IntPtr sqlite3_column_table_name16(IntPtr stmt, int index); - -#if !PLATFORM_COMPACTFRAMEWORK - [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)] -#else - [DllImport(SQLITE_DLL)] -#endif - internal static extern IntPtr sqlite3_column_text(IntPtr stmt, int index); - -#if !PLATFORM_COMPACTFRAMEWORK - [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)] -#else - [DllImport(SQLITE_DLL)] -#endif - internal static extern IntPtr sqlite3_column_text16(IntPtr stmt, int index); - -#if !PLATFORM_COMPACTFRAMEWORK - [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)] -#else - [DllImport(SQLITE_DLL)] -#endif - internal static extern IntPtr sqlite3_errmsg(IntPtr db); - -#if !PLATFORM_COMPACTFRAMEWORK - [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)] -#else - [DllImport(SQLITE_DLL)] -#endif - internal static extern int sqlite3_prepare(IntPtr db, IntPtr pSql, int nBytes, out IntPtr stmt, out IntPtr ptrRemain); - -#if !PLATFORM_COMPACTFRAMEWORK - [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)] -#else - [DllImport(SQLITE_DLL)] -#endif - internal static extern int sqlite3_table_column_metadata(IntPtr db, byte[] dbName, byte[] tblName, byte[] colName, out IntPtr ptrDataType, out IntPtr ptrCollSeq, out int notNull, out int primaryKey, out int autoInc); - -#if !PLATFORM_COMPACTFRAMEWORK - [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)] -#else - [DllImport(SQLITE_DLL)] -#endif - internal static extern IntPtr sqlite3_value_text(IntPtr p); - -#if !PLATFORM_COMPACTFRAMEWORK - [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)] -#else - [DllImport(SQLITE_DLL)] -#endif - internal static extern IntPtr sqlite3_value_text16(IntPtr p); -#endif - - #endregion - - // These functions are custom and have no equivalent standard library method. - // All of them are "nice to haves" and not necessarily "need to haves". - #region no equivalent standard method - -#if !SQLITE_STANDARD - [DllImport(SQLITE_DLL)] - internal static extern IntPtr sqlite3_context_collseq(IntPtr context, out int type, out int enc, out int len); - - [DllImport(SQLITE_DLL)] - internal static extern int sqlite3_context_collcompare(IntPtr context, byte[] p1, int p1len, byte[] p2, int p2len); - - [DllImport(SQLITE_DLL)] - internal static extern int sqlite3_cursor_rowid(IntPtr stmt, int cursor, out long rowid); - - [DllImport(SQLITE_DLL)] - internal static extern int sqlite3_index_column_info_interop(IntPtr db, byte[] catalog, byte[] IndexName, byte[] ColumnName, out int sortOrder, out int onError, out IntPtr Collation, out int colllen); - - [DllImport(SQLITE_DLL)] - internal static extern void sqlite3_resetall_interop(IntPtr db); - - [DllImport(SQLITE_DLL)] - internal static extern int sqlite3_table_cursor(IntPtr stmt, int db, int tableRootPage); -#endif - - #endregion - - // Standard API calls global across versions. There are a few instances of interop calls - // scattered in here, but they are only active when PLATFORM_COMPACTFRAMEWORK is declared. - #region standard sqlite api calls - -#if !PLATFORM_COMPACTFRAMEWORK - [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)] -#else - [DllImport(SQLITE_DLL)] -#endif - internal static extern IntPtr sqlite3_libversion(); - -#if !PLATFORM_COMPACTFRAMEWORK - [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)] -#else - [DllImport(SQLITE_DLL)] -#endif - internal static extern void sqlite3_interrupt(IntPtr db); - -#if !PLATFORM_COMPACTFRAMEWORK - [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)] -#else - [DllImport(SQLITE_DLL)] -#endif - internal static extern int sqlite3_changes(IntPtr db); - -#if !PLATFORM_COMPACTFRAMEWORK - [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)] -#else - [DllImport(SQLITE_DLL)] -#endif - internal static extern int sqlite3_busy_timeout(IntPtr db, int ms); - -#if !PLATFORM_COMPACTFRAMEWORK - [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)] -#else - [DllImport(SQLITE_DLL)] -#endif - internal static extern int sqlite3_bind_blob(IntPtr stmt, int index, Byte[] value, int nSize, IntPtr nTransient); - -#if !PLATFORM_COMPACTFRAMEWORK - [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)] - internal static extern int sqlite3_bind_double(IntPtr stmt, int index, double value); -#else - [DllImport(SQLITE_DLL)] - internal static extern int sqlite3_bind_double_interop(IntPtr stmt, int index, ref double value); -#endif - -#if !PLATFORM_COMPACTFRAMEWORK - [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)] -#else - [DllImport(SQLITE_DLL)] -#endif - internal static extern int sqlite3_bind_int(IntPtr stmt, int index, int value); - -#if !PLATFORM_COMPACTFRAMEWORK - [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)] - internal static extern int sqlite3_bind_int64(IntPtr stmt, int index, long value); -#else - [DllImport(SQLITE_DLL)] - internal static extern int sqlite3_bind_int64_interop(IntPtr stmt, int index, ref long value); -#endif - -#if !PLATFORM_COMPACTFRAMEWORK - [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)] -#else - [DllImport(SQLITE_DLL)] -#endif - internal static extern int sqlite3_bind_null(IntPtr stmt, int index); - -#if !PLATFORM_COMPACTFRAMEWORK - [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)] -#else - [DllImport(SQLITE_DLL)] -#endif - internal static extern int sqlite3_bind_text(IntPtr stmt, int index, byte[] value, int nlen, IntPtr pvReserved); - -#if !PLATFORM_COMPACTFRAMEWORK - [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)] -#else - [DllImport(SQLITE_DLL)] -#endif - internal static extern int sqlite3_bind_parameter_count(IntPtr stmt); - -#if !PLATFORM_COMPACTFRAMEWORK - [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)] -#else - [DllImport(SQLITE_DLL)] -#endif - internal static extern int sqlite3_bind_parameter_index(IntPtr stmt, byte[] strName); - -#if !PLATFORM_COMPACTFRAMEWORK - [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)] -#else - [DllImport(SQLITE_DLL)] -#endif - internal static extern int sqlite3_column_count(IntPtr stmt); - -#if !PLATFORM_COMPACTFRAMEWORK - [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)] -#else - [DllImport(SQLITE_DLL)] -#endif - internal static extern int sqlite3_step(IntPtr stmt); - -#if !PLATFORM_COMPACTFRAMEWORK - [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)] - internal static extern double sqlite3_column_double(IntPtr stmt, int index); -#else - [DllImport(SQLITE_DLL)] - internal static extern void sqlite3_column_double_interop(IntPtr stmt, int index, out double value); -#endif - -#if !PLATFORM_COMPACTFRAMEWORK - [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)] -#else - [DllImport(SQLITE_DLL)] -#endif - internal static extern int sqlite3_column_int(IntPtr stmt, int index); - -#if !PLATFORM_COMPACTFRAMEWORK - [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)] - internal static extern long sqlite3_column_int64(IntPtr stmt, int index); -#else - [DllImport(SQLITE_DLL)] - internal static extern void sqlite3_column_int64_interop(IntPtr stmt, int index, out long value); -#endif - -#if !PLATFORM_COMPACTFRAMEWORK - [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)] -#else - [DllImport(SQLITE_DLL)] -#endif - internal static extern IntPtr sqlite3_column_blob(IntPtr stmt, int index); - -#if !PLATFORM_COMPACTFRAMEWORK - [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)] -#else - [DllImport(SQLITE_DLL)] -#endif - internal static extern int sqlite3_column_bytes(IntPtr stmt, int index); - -#if !PLATFORM_COMPACTFRAMEWORK - [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)] -#else - [DllImport(SQLITE_DLL)] -#endif - internal static extern TypeAffinity sqlite3_column_type(IntPtr stmt, int index); - -#if !PLATFORM_COMPACTFRAMEWORK - [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)] -#else - [DllImport(SQLITE_DLL)] -#endif - internal static extern int sqlite3_create_collation(IntPtr db, byte[] strName, int nType, IntPtr pvUser, SQLiteCollation func); - -#if !PLATFORM_COMPACTFRAMEWORK - [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)] -#else - [DllImport(SQLITE_DLL)] -#endif - internal static extern int sqlite3_aggregate_count(IntPtr context); - -#if !PLATFORM_COMPACTFRAMEWORK - [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)] -#else - [DllImport(SQLITE_DLL)] -#endif - internal static extern IntPtr sqlite3_value_blob(IntPtr p); - -#if !PLATFORM_COMPACTFRAMEWORK - [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)] -#else - [DllImport(SQLITE_DLL)] -#endif - internal static extern int sqlite3_value_bytes(IntPtr p); - -#if !PLATFORM_COMPACTFRAMEWORK - [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)] - internal static extern double sqlite3_value_double(IntPtr p); -#else - [DllImport(SQLITE_DLL)] - internal static extern void sqlite3_value_double_interop(IntPtr p, out double value); -#endif - -#if !PLATFORM_COMPACTFRAMEWORK - [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)] -#else - [DllImport(SQLITE_DLL)] -#endif - internal static extern int sqlite3_value_int(IntPtr p); - -#if !PLATFORM_COMPACTFRAMEWORK - [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)] - internal static extern long sqlite3_value_int64(IntPtr p); -#else - [DllImport(SQLITE_DLL)] - internal static extern void sqlite3_value_int64_interop(IntPtr p, out Int64 value); -#endif - -#if !PLATFORM_COMPACTFRAMEWORK - [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)] -#else - [DllImport(SQLITE_DLL)] -#endif - internal static extern TypeAffinity sqlite3_value_type(IntPtr p); - -#if !PLATFORM_COMPACTFRAMEWORK - [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)] -#else - [DllImport(SQLITE_DLL)] -#endif - internal static extern void sqlite3_result_blob(IntPtr context, byte[] value, int nSize, IntPtr pvReserved); - -#if !PLATFORM_COMPACTFRAMEWORK - [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)] - internal static extern void sqlite3_result_double(IntPtr context, double value); -#else - [DllImport(SQLITE_DLL)] - internal static extern void sqlite3_result_double_interop(IntPtr context, ref double value); -#endif - -#if !PLATFORM_COMPACTFRAMEWORK - [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)] -#else - [DllImport(SQLITE_DLL)] -#endif - internal static extern void sqlite3_result_error(IntPtr context, byte[] strErr, int nLen); - -#if !PLATFORM_COMPACTFRAMEWORK - [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)] -#else - [DllImport(SQLITE_DLL)] -#endif - internal static extern void sqlite3_result_int(IntPtr context, int value); - -#if !PLATFORM_COMPACTFRAMEWORK - [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)] - internal static extern void sqlite3_result_int64(IntPtr context, long value); -#else - [DllImport(SQLITE_DLL)] - internal static extern void sqlite3_result_int64_interop(IntPtr context, ref Int64 value); -#endif - -#if !PLATFORM_COMPACTFRAMEWORK - [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)] -#else - [DllImport(SQLITE_DLL)] -#endif - internal static extern void sqlite3_result_null(IntPtr context); - -#if !PLATFORM_COMPACTFRAMEWORK - [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)] -#else - [DllImport(SQLITE_DLL)] -#endif - internal static extern void sqlite3_result_text(IntPtr context, byte[] value, int nLen, IntPtr pvReserved); - -#if !PLATFORM_COMPACTFRAMEWORK - [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)] -#else - [DllImport(SQLITE_DLL)] -#endif - internal static extern IntPtr sqlite3_aggregate_context(IntPtr context, int nBytes); - -#if !PLATFORM_COMPACTFRAMEWORK - [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Unicode)] -#else - [DllImport(SQLITE_DLL, CharSet = CharSet.Unicode)] -#endif - internal static extern int sqlite3_bind_text16(IntPtr stmt, int index, string value, int nlen, IntPtr pvReserved); - -#if !PLATFORM_COMPACTFRAMEWORK - [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Unicode)] -#else - [DllImport(SQLITE_DLL, CharSet = CharSet.Unicode)] -#endif - internal static extern void sqlite3_result_error16(IntPtr context, string strName, int nLen); - -#if !PLATFORM_COMPACTFRAMEWORK - [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Unicode)] -#else - [DllImport(SQLITE_DLL, CharSet = CharSet.Unicode)] -#endif - internal static extern void sqlite3_result_text16(IntPtr context, string strName, int nLen, IntPtr pvReserved); - -#if !PLATFORM_COMPACTFRAMEWORK - [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)] -#else - [DllImport(SQLITE_DLL)] -#endif - internal static extern int sqlite3_key(IntPtr db, byte[] key, int keylen); - -#if !PLATFORM_COMPACTFRAMEWORK - [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)] -#else - [DllImport(SQLITE_DLL)] -#endif - internal static extern int sqlite3_rekey(IntPtr db, byte[] key, int keylen); - -#if !PLATFORM_COMPACTFRAMEWORK - [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)] -#else - [DllImport(SQLITE_DLL)] -#endif - internal static extern IntPtr sqlite3_update_hook(IntPtr db, SQLiteUpdateCallback func, IntPtr pvUser); - -#if !PLATFORM_COMPACTFRAMEWORK - [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)] -#else - [DllImport(SQLITE_DLL)] -#endif - internal static extern IntPtr sqlite3_commit_hook(IntPtr db, SQLiteCommitCallback func, IntPtr pvUser); - -#if !PLATFORM_COMPACTFRAMEWORK - [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)] -#else - [DllImport(SQLITE_DLL)] -#endif - internal static extern IntPtr sqlite3_rollback_hook(IntPtr db, SQLiteRollbackCallback func, IntPtr pvUser); - -#if !PLATFORM_COMPACTFRAMEWORK - [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)] -#else - [DllImport(SQLITE_DLL)] -#endif - internal static extern IntPtr sqlite3_db_handle(IntPtr stmt); - -#if !PLATFORM_COMPACTFRAMEWORK - [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)] -#else - [DllImport(SQLITE_DLL)] -#endif - internal static extern IntPtr sqlite3_next_stmt(IntPtr db, IntPtr stmt); - -#if !PLATFORM_COMPACTFRAMEWORK - [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)] -#else - [DllImport(SQLITE_DLL)] -#endif - internal static extern int sqlite3_exec(IntPtr db, byte[] strSql, IntPtr pvCallback, IntPtr pvParam, out IntPtr errMsg); - -#if !PLATFORM_COMPACTFRAMEWORK - [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)] -#else - [DllImport(SQLITE_DLL)] -#endif - internal static extern int sqlite3_get_autocommit(IntPtr db); - - #endregion - } - -#if PLATFORM_COMPACTFRAMEWORK - internal abstract class CriticalHandle : IDisposable - { - private bool _isClosed; - protected IntPtr handle; - - protected CriticalHandle(IntPtr invalidHandleValue) - { - handle = invalidHandleValue; - _isClosed = false; - } - - ~CriticalHandle() - { - Dispose(false); - } - - private void Cleanup() - { - if (!IsClosed) - { - this._isClosed = true; - if (!IsInvalid) - { - ReleaseHandle(); - GC.SuppressFinalize(this); - } - } - } - - public void Close() - { - Dispose(true); - } - - public void Dispose() - { - Dispose(true); - } - - protected virtual void Dispose(bool disposing) - { - Cleanup(); - } - - protected abstract bool ReleaseHandle(); - - protected void SetHandle(IntPtr value) - { - handle = value; - } - - public void SetHandleAsInvalid() - { - _isClosed = true; - GC.SuppressFinalize(this); - } - - public bool IsClosed - { - get { return _isClosed; } - } - - public abstract bool IsInvalid - { - get; - } - - } - -#endif - - // Handles the unmanaged database pointer, and provides finalization support for it. - internal class SQLiteConnectionHandle : CriticalHandle - { - public static implicit operator IntPtr(SQLiteConnectionHandle db) - { - return db.handle; - } - - public static implicit operator SQLiteConnectionHandle(IntPtr db) - { - return new SQLiteConnectionHandle(db); - } - - private SQLiteConnectionHandle(IntPtr db) - : this() - { - SetHandle(db); - } - - internal SQLiteConnectionHandle() - : base(IntPtr.Zero) - { - } - - protected override bool ReleaseHandle() - { - try - { - SQLiteBase.CloseConnection(this); - } - catch (SQLiteException) - { - } - return true; - } - - public override bool IsInvalid - { - get { return (handle == IntPtr.Zero); } - } - } - - // Provides finalization support for unmanaged SQLite statements. - internal class SQLiteStatementHandle : CriticalHandle - { - public static implicit operator IntPtr(SQLiteStatementHandle stmt) - { - return stmt.handle; - } - - public static implicit operator SQLiteStatementHandle(IntPtr stmt) - { - return new SQLiteStatementHandle(stmt); - } - - private SQLiteStatementHandle(IntPtr stmt) - : this() - { - SetHandle(stmt); - } - - internal SQLiteStatementHandle() - : base(IntPtr.Zero) - { - } - - protected override bool ReleaseHandle() - { - try - { - SQLiteBase.FinalizeStatement(this); - } - catch (SQLiteException) - { - } - return true; - } - - public override bool IsInvalid - { - get { return (handle == IntPtr.Zero); } - } - } -} +/******************************************************** + * ADO.NET 2.0 Data Provider for SQLite Version 3.X + * Written by Robert Simpson (robert@blackcastlesoft.com) + * + * Released to the public domain, use at your own risk! + ********************************************************/ + +namespace System.Data.SQLite +{ + using System; + using System.Security; + using System.Runtime.InteropServices; + +#if !PLATFORM_COMPACTFRAMEWORK && !DEBUG + [SuppressUnmanagedCodeSecurity] +#endif + internal static class UnsafeNativeMethods + { +#if !SQLITE_STANDARD + +#if !USE_INTEROP_DLL + +#if !PLATFORM_COMPACTFRAMEWORK + private const string SQLITE_DLL = "System.Data.SQLite.DLL"; +#else + internal const string SQLITE_DLL = "SQLite.Interop.066.DLL"; +#endif // PLATFORM_COMPACTFRAMEWORK + +#else + private const string SQLITE_DLL = "SQLite.Interop.DLL"; +#endif // USE_INTEROP_DLL + +#else + private const string SQLITE_DLL = "sqlite3"; +#endif + + // This section uses interop calls that also fetch text length to optimize conversion. + // When using the standard dll, we can replace these calls with normal sqlite calls and do unoptimized conversions instead afterwards + #region interop added textlength calls + +#if !SQLITE_STANDARD + [DllImport(SQLITE_DLL)] + internal static extern IntPtr sqlite3_bind_parameter_name_interop(IntPtr stmt, int index, out int len); + + [DllImport(SQLITE_DLL)] + internal static extern IntPtr sqlite3_column_database_name_interop(IntPtr stmt, int index, out int len); + + [DllImport(SQLITE_DLL)] + internal static extern IntPtr sqlite3_column_database_name16_interop(IntPtr stmt, int index, out int len); + + [DllImport(SQLITE_DLL)] + internal static extern IntPtr sqlite3_column_decltype_interop(IntPtr stmt, int index, out int len); + + [DllImport(SQLITE_DLL)] + internal static extern IntPtr sqlite3_column_decltype16_interop(IntPtr stmt, int index, out int len); + + [DllImport(SQLITE_DLL)] + internal static extern IntPtr sqlite3_column_name_interop(IntPtr stmt, int index, out int len); + + [DllImport(SQLITE_DLL)] + internal static extern IntPtr sqlite3_column_name16_interop(IntPtr stmt, int index, out int len); + + [DllImport(SQLITE_DLL)] + internal static extern IntPtr sqlite3_column_origin_name_interop(IntPtr stmt, int index, out int len); + + [DllImport(SQLITE_DLL)] + internal static extern IntPtr sqlite3_column_origin_name16_interop(IntPtr stmt, int index, out int len); + + [DllImport(SQLITE_DLL)] + internal static extern IntPtr sqlite3_column_table_name_interop(IntPtr stmt, int index, out int len); + + [DllImport(SQLITE_DLL)] + internal static extern IntPtr sqlite3_column_table_name16_interop(IntPtr stmt, int index, out int len); + + [DllImport(SQLITE_DLL)] + internal static extern IntPtr sqlite3_column_text_interop(IntPtr stmt, int index, out int len); + + [DllImport(SQLITE_DLL)] + internal static extern IntPtr sqlite3_column_text16_interop(IntPtr stmt, int index, out int len); + + [DllImport(SQLITE_DLL)] + internal static extern IntPtr sqlite3_errmsg_interop(IntPtr db, out int len); + + [DllImport(SQLITE_DLL)] + internal static extern int sqlite3_prepare_interop(IntPtr db, IntPtr pSql, int nBytes, out IntPtr stmt, out IntPtr ptrRemain, out int nRemain); + + [DllImport(SQLITE_DLL)] + internal static extern int sqlite3_table_column_metadata_interop(IntPtr db, byte[] dbName, byte[] tblName, byte[] colName, out IntPtr ptrDataType, out IntPtr ptrCollSeq, out int notNull, out int primaryKey, out int autoInc, out int dtLen, out int csLen); + + [DllImport(SQLITE_DLL)] + internal static extern IntPtr sqlite3_value_text_interop(IntPtr p, out int len); + + [DllImport(SQLITE_DLL)] + internal static extern IntPtr sqlite3_value_text16_interop(IntPtr p, out int len); +#endif + + #endregion + + // These functions add existing functionality on top of SQLite and require a little effort to + // get working when using the standard SQLite library. + #region interop added functionality + +#if !SQLITE_STANDARD + [DllImport(SQLITE_DLL)] + internal static extern int sqlite3_close_interop(IntPtr db); + + [DllImport(SQLITE_DLL)] + internal static extern int sqlite3_create_function_interop(IntPtr db, byte[] strName, int nArgs, int nType, IntPtr pvUser, SQLiteCallback func, SQLiteCallback fstep, SQLiteFinalCallback ffinal, int needCollSeq); + + [DllImport(SQLITE_DLL)] + internal static extern int sqlite3_finalize_interop(IntPtr stmt); + + [DllImport(SQLITE_DLL)] + internal static extern int sqlite3_open_interop(byte[] utf8Filename, int flags, out IntPtr db); + + [DllImport(SQLITE_DLL)] + internal static extern int sqlite3_open16_interop(byte[] utf8Filename, int flags, out IntPtr db); + + [DllImport(SQLITE_DLL)] + internal static extern int sqlite3_reset_interop(IntPtr stmt); + +#endif + + #endregion + + // The standard api call equivalents of the above interop calls + #region standard versions of interop functions + +#if SQLITE_STANDARD +#if !PLATFORM_COMPACTFRAMEWORK + [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)] +#else + [DllImport(SQLITE_DLL)] +#endif + internal static extern int sqlite3_close(IntPtr db); + +#if !PLATFORM_COMPACTFRAMEWORK + [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)] +#else + [DllImport(SQLITE_DLL)] +#endif + internal static extern int sqlite3_create_function(IntPtr db, byte[] strName, int nArgs, int nType, IntPtr pvUser, SQLiteCallback func, SQLiteCallback fstep, SQLiteFinalCallback ffinal); + +#if !PLATFORM_COMPACTFRAMEWORK + [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)] +#else + [DllImport(SQLITE_DLL)] +#endif + internal static extern int sqlite3_finalize(IntPtr stmt); + +#if !PLATFORM_COMPACTFRAMEWORK + [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)] +#else + [DllImport(SQLITE_DLL)] +#endif + internal static extern int sqlite3_open_v2(byte[] utf8Filename, out IntPtr db, int flags, IntPtr vfs); + +#if !PLATFORM_COMPACTFRAMEWORK + [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Unicode)] +#else + [DllImport(SQLITE_DLL, CharSet = CharSet.Unicode)] +#endif + internal static extern int sqlite3_open16(string fileName, out IntPtr db); + +#if !PLATFORM_COMPACTFRAMEWORK + [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)] +#else + [DllImport(SQLITE_DLL)] +#endif + internal static extern int sqlite3_reset(IntPtr stmt); + +#if !PLATFORM_COMPACTFRAMEWORK + [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)] +#else + [DllImport(SQLITE_DLL)] +#endif + internal static extern IntPtr sqlite3_bind_parameter_name(IntPtr stmt, int index); + +#if !PLATFORM_COMPACTFRAMEWORK + [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)] +#else + [DllImport(SQLITE_DLL)] +#endif + internal static extern IntPtr sqlite3_column_database_name(IntPtr stmt, int index); + +#if !PLATFORM_COMPACTFRAMEWORK + [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)] +#else + [DllImport(SQLITE_DLL)] +#endif + internal static extern IntPtr sqlite3_column_database_name16(IntPtr stmt, int index); + +#if !PLATFORM_COMPACTFRAMEWORK + [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)] +#else + [DllImport(SQLITE_DLL)] +#endif + internal static extern IntPtr sqlite3_column_decltype(IntPtr stmt, int index); + +#if !PLATFORM_COMPACTFRAMEWORK + [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)] +#else + [DllImport(SQLITE_DLL)] +#endif + internal static extern IntPtr sqlite3_column_decltype16(IntPtr stmt, int index); + +#if !PLATFORM_COMPACTFRAMEWORK + [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)] +#else + [DllImport(SQLITE_DLL)] +#endif + internal static extern IntPtr sqlite3_column_name(IntPtr stmt, int index); + +#if !PLATFORM_COMPACTFRAMEWORK + [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)] +#else + [DllImport(SQLITE_DLL)] +#endif + internal static extern IntPtr sqlite3_column_name16(IntPtr stmt, int index); + +#if !PLATFORM_COMPACTFRAMEWORK + [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)] +#else + [DllImport(SQLITE_DLL)] +#endif + internal static extern IntPtr sqlite3_column_origin_name(IntPtr stmt, int index); + +#if !PLATFORM_COMPACTFRAMEWORK + [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)] +#else + [DllImport(SQLITE_DLL)] +#endif + internal static extern IntPtr sqlite3_column_origin_name16(IntPtr stmt, int index); + +#if !PLATFORM_COMPACTFRAMEWORK + [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)] +#else + [DllImport(SQLITE_DLL)] +#endif + internal static extern IntPtr sqlite3_column_table_name(IntPtr stmt, int index); + +#if !PLATFORM_COMPACTFRAMEWORK + [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)] +#else + [DllImport(SQLITE_DLL)] +#endif + internal static extern IntPtr sqlite3_column_table_name16(IntPtr stmt, int index); + +#if !PLATFORM_COMPACTFRAMEWORK + [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)] +#else + [DllImport(SQLITE_DLL)] +#endif + internal static extern IntPtr sqlite3_column_text(IntPtr stmt, int index); + +#if !PLATFORM_COMPACTFRAMEWORK + [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)] +#else + [DllImport(SQLITE_DLL)] +#endif + internal static extern IntPtr sqlite3_column_text16(IntPtr stmt, int index); + +#if !PLATFORM_COMPACTFRAMEWORK + [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)] +#else + [DllImport(SQLITE_DLL)] +#endif + internal static extern IntPtr sqlite3_errmsg(IntPtr db); + +#if !PLATFORM_COMPACTFRAMEWORK + [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)] +#else + [DllImport(SQLITE_DLL)] +#endif + internal static extern int sqlite3_prepare(IntPtr db, IntPtr pSql, int nBytes, out IntPtr stmt, out IntPtr ptrRemain); + +#if !PLATFORM_COMPACTFRAMEWORK + [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)] +#else + [DllImport(SQLITE_DLL)] +#endif + internal static extern int sqlite3_table_column_metadata(IntPtr db, byte[] dbName, byte[] tblName, byte[] colName, out IntPtr ptrDataType, out IntPtr ptrCollSeq, out int notNull, out int primaryKey, out int autoInc); + +#if !PLATFORM_COMPACTFRAMEWORK + [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)] +#else + [DllImport(SQLITE_DLL)] +#endif + internal static extern IntPtr sqlite3_value_text(IntPtr p); + +#if !PLATFORM_COMPACTFRAMEWORK + [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)] +#else + [DllImport(SQLITE_DLL)] +#endif + internal static extern IntPtr sqlite3_value_text16(IntPtr p); +#endif + + #endregion + + // These functions are custom and have no equivalent standard library method. + // All of them are "nice to haves" and not necessarily "need to haves". + #region no equivalent standard method + +#if !SQLITE_STANDARD + [DllImport(SQLITE_DLL)] + internal static extern IntPtr sqlite3_context_collseq(IntPtr context, out int type, out int enc, out int len); + + [DllImport(SQLITE_DLL)] + internal static extern int sqlite3_context_collcompare(IntPtr context, byte[] p1, int p1len, byte[] p2, int p2len); + + [DllImport(SQLITE_DLL)] + internal static extern int sqlite3_cursor_rowid(IntPtr stmt, int cursor, out long rowid); + + [DllImport(SQLITE_DLL)] + internal static extern int sqlite3_index_column_info_interop(IntPtr db, byte[] catalog, byte[] IndexName, byte[] ColumnName, out int sortOrder, out int onError, out IntPtr Collation, out int colllen); + + [DllImport(SQLITE_DLL)] + internal static extern void sqlite3_resetall_interop(IntPtr db); + + [DllImport(SQLITE_DLL)] + internal static extern int sqlite3_table_cursor(IntPtr stmt, int db, int tableRootPage); +#endif + + #endregion + + // Standard API calls global across versions. There are a few instances of interop calls + // scattered in here, but they are only active when PLATFORM_COMPACTFRAMEWORK is declared. + #region standard sqlite api calls + +#if !PLATFORM_COMPACTFRAMEWORK + [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)] +#else + [DllImport(SQLITE_DLL)] +#endif + internal static extern IntPtr sqlite3_libversion(); + +#if !PLATFORM_COMPACTFRAMEWORK + [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)] +#else + [DllImport(SQLITE_DLL)] +#endif + internal static extern void sqlite3_interrupt(IntPtr db); + +#if !PLATFORM_COMPACTFRAMEWORK + [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)] +#else + [DllImport(SQLITE_DLL)] +#endif + internal static extern int sqlite3_changes(IntPtr db); + +#if !PLATFORM_COMPACTFRAMEWORK + [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)] +#else + [DllImport(SQLITE_DLL)] +#endif + internal static extern int sqlite3_busy_timeout(IntPtr db, int ms); + +#if !PLATFORM_COMPACTFRAMEWORK + [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)] +#else + [DllImport(SQLITE_DLL)] +#endif + internal static extern int sqlite3_bind_blob(IntPtr stmt, int index, Byte[] value, int nSize, IntPtr nTransient); + +#if !PLATFORM_COMPACTFRAMEWORK + [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)] + internal static extern int sqlite3_bind_double(IntPtr stmt, int index, double value); +#else + [DllImport(SQLITE_DLL)] + internal static extern int sqlite3_bind_double_interop(IntPtr stmt, int index, ref double value); +#endif + +#if !PLATFORM_COMPACTFRAMEWORK + [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)] +#else + [DllImport(SQLITE_DLL)] +#endif + internal static extern int sqlite3_bind_int(IntPtr stmt, int index, int value); + +#if !PLATFORM_COMPACTFRAMEWORK + [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)] + internal static extern int sqlite3_bind_int64(IntPtr stmt, int index, long value); +#else + [DllImport(SQLITE_DLL)] + internal static extern int sqlite3_bind_int64_interop(IntPtr stmt, int index, ref long value); +#endif + +#if !PLATFORM_COMPACTFRAMEWORK + [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)] +#else + [DllImport(SQLITE_DLL)] +#endif + internal static extern int sqlite3_bind_null(IntPtr stmt, int index); + +#if !PLATFORM_COMPACTFRAMEWORK + [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)] +#else + [DllImport(SQLITE_DLL)] +#endif + internal static extern int sqlite3_bind_text(IntPtr stmt, int index, byte[] value, int nlen, IntPtr pvReserved); + +#if !PLATFORM_COMPACTFRAMEWORK + [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)] +#else + [DllImport(SQLITE_DLL)] +#endif + internal static extern int sqlite3_bind_parameter_count(IntPtr stmt); + +#if !PLATFORM_COMPACTFRAMEWORK + [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)] +#else + [DllImport(SQLITE_DLL)] +#endif + internal static extern int sqlite3_bind_parameter_index(IntPtr stmt, byte[] strName); + +#if !PLATFORM_COMPACTFRAMEWORK + [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)] +#else + [DllImport(SQLITE_DLL)] +#endif + internal static extern int sqlite3_column_count(IntPtr stmt); + +#if !PLATFORM_COMPACTFRAMEWORK + [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)] +#else + [DllImport(SQLITE_DLL)] +#endif + internal static extern int sqlite3_step(IntPtr stmt); + +#if !PLATFORM_COMPACTFRAMEWORK + [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)] + internal static extern double sqlite3_column_double(IntPtr stmt, int index); +#else + [DllImport(SQLITE_DLL)] + internal static extern void sqlite3_column_double_interop(IntPtr stmt, int index, out double value); +#endif + +#if !PLATFORM_COMPACTFRAMEWORK + [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)] +#else + [DllImport(SQLITE_DLL)] +#endif + internal static extern int sqlite3_column_int(IntPtr stmt, int index); + +#if !PLATFORM_COMPACTFRAMEWORK + [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)] + internal static extern long sqlite3_column_int64(IntPtr stmt, int index); +#else + [DllImport(SQLITE_DLL)] + internal static extern void sqlite3_column_int64_interop(IntPtr stmt, int index, out long value); +#endif + +#if !PLATFORM_COMPACTFRAMEWORK + [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)] +#else + [DllImport(SQLITE_DLL)] +#endif + internal static extern IntPtr sqlite3_column_blob(IntPtr stmt, int index); + +#if !PLATFORM_COMPACTFRAMEWORK + [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)] +#else + [DllImport(SQLITE_DLL)] +#endif + internal static extern int sqlite3_column_bytes(IntPtr stmt, int index); + +#if !PLATFORM_COMPACTFRAMEWORK + [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)] +#else + [DllImport(SQLITE_DLL)] +#endif + internal static extern TypeAffinity sqlite3_column_type(IntPtr stmt, int index); + +#if !PLATFORM_COMPACTFRAMEWORK + [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)] +#else + [DllImport(SQLITE_DLL)] +#endif + internal static extern int sqlite3_create_collation(IntPtr db, byte[] strName, int nType, IntPtr pvUser, SQLiteCollation func); + +#if !PLATFORM_COMPACTFRAMEWORK + [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)] +#else + [DllImport(SQLITE_DLL)] +#endif + internal static extern int sqlite3_aggregate_count(IntPtr context); + +#if !PLATFORM_COMPACTFRAMEWORK + [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)] +#else + [DllImport(SQLITE_DLL)] +#endif + internal static extern IntPtr sqlite3_value_blob(IntPtr p); + +#if !PLATFORM_COMPACTFRAMEWORK + [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)] +#else + [DllImport(SQLITE_DLL)] +#endif + internal static extern int sqlite3_value_bytes(IntPtr p); + +#if !PLATFORM_COMPACTFRAMEWORK + [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)] + internal static extern double sqlite3_value_double(IntPtr p); +#else + [DllImport(SQLITE_DLL)] + internal static extern void sqlite3_value_double_interop(IntPtr p, out double value); +#endif + +#if !PLATFORM_COMPACTFRAMEWORK + [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)] +#else + [DllImport(SQLITE_DLL)] +#endif + internal static extern int sqlite3_value_int(IntPtr p); + +#if !PLATFORM_COMPACTFRAMEWORK + [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)] + internal static extern long sqlite3_value_int64(IntPtr p); +#else + [DllImport(SQLITE_DLL)] + internal static extern void sqlite3_value_int64_interop(IntPtr p, out Int64 value); +#endif + +#if !PLATFORM_COMPACTFRAMEWORK + [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)] +#else + [DllImport(SQLITE_DLL)] +#endif + internal static extern TypeAffinity sqlite3_value_type(IntPtr p); + +#if !PLATFORM_COMPACTFRAMEWORK + [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)] +#else + [DllImport(SQLITE_DLL)] +#endif + internal static extern void sqlite3_result_blob(IntPtr context, byte[] value, int nSize, IntPtr pvReserved); + +#if !PLATFORM_COMPACTFRAMEWORK + [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)] + internal static extern void sqlite3_result_double(IntPtr context, double value); +#else + [DllImport(SQLITE_DLL)] + internal static extern void sqlite3_result_double_interop(IntPtr context, ref double value); +#endif + +#if !PLATFORM_COMPACTFRAMEWORK + [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)] +#else + [DllImport(SQLITE_DLL)] +#endif + internal static extern void sqlite3_result_error(IntPtr context, byte[] strErr, int nLen); + +#if !PLATFORM_COMPACTFRAMEWORK + [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)] +#else + [DllImport(SQLITE_DLL)] +#endif + internal static extern void sqlite3_result_int(IntPtr context, int value); + +#if !PLATFORM_COMPACTFRAMEWORK + [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)] + internal static extern void sqlite3_result_int64(IntPtr context, long value); +#else + [DllImport(SQLITE_DLL)] + internal static extern void sqlite3_result_int64_interop(IntPtr context, ref Int64 value); +#endif + +#if !PLATFORM_COMPACTFRAMEWORK + [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)] +#else + [DllImport(SQLITE_DLL)] +#endif + internal static extern void sqlite3_result_null(IntPtr context); + +#if !PLATFORM_COMPACTFRAMEWORK + [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)] +#else + [DllImport(SQLITE_DLL)] +#endif + internal static extern void sqlite3_result_text(IntPtr context, byte[] value, int nLen, IntPtr pvReserved); + +#if !PLATFORM_COMPACTFRAMEWORK + [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)] +#else + [DllImport(SQLITE_DLL)] +#endif + internal static extern IntPtr sqlite3_aggregate_context(IntPtr context, int nBytes); + +#if !PLATFORM_COMPACTFRAMEWORK + [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Unicode)] +#else + [DllImport(SQLITE_DLL, CharSet = CharSet.Unicode)] +#endif + internal static extern int sqlite3_bind_text16(IntPtr stmt, int index, string value, int nlen, IntPtr pvReserved); + +#if !PLATFORM_COMPACTFRAMEWORK + [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Unicode)] +#else + [DllImport(SQLITE_DLL, CharSet = CharSet.Unicode)] +#endif + internal static extern void sqlite3_result_error16(IntPtr context, string strName, int nLen); + +#if !PLATFORM_COMPACTFRAMEWORK + [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Unicode)] +#else + [DllImport(SQLITE_DLL, CharSet = CharSet.Unicode)] +#endif + internal static extern void sqlite3_result_text16(IntPtr context, string strName, int nLen, IntPtr pvReserved); + +#if !PLATFORM_COMPACTFRAMEWORK + [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)] +#else + [DllImport(SQLITE_DLL)] +#endif + internal static extern int sqlite3_key(IntPtr db, byte[] key, int keylen); + +#if !PLATFORM_COMPACTFRAMEWORK + [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)] +#else + [DllImport(SQLITE_DLL)] +#endif + internal static extern int sqlite3_rekey(IntPtr db, byte[] key, int keylen); + +#if !PLATFORM_COMPACTFRAMEWORK + [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)] +#else + [DllImport(SQLITE_DLL)] +#endif + internal static extern IntPtr sqlite3_update_hook(IntPtr db, SQLiteUpdateCallback func, IntPtr pvUser); + +#if !PLATFORM_COMPACTFRAMEWORK + [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)] +#else + [DllImport(SQLITE_DLL)] +#endif + internal static extern IntPtr sqlite3_commit_hook(IntPtr db, SQLiteCommitCallback func, IntPtr pvUser); + +#if !PLATFORM_COMPACTFRAMEWORK + [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)] +#else + [DllImport(SQLITE_DLL)] +#endif + internal static extern IntPtr sqlite3_trace(IntPtr db, SQLiteTraceCallback func, IntPtr pvUser); + +#if !PLATFORM_COMPACTFRAMEWORK + [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)] +#else + [DllImport(SQLITE_DLL)] +#endif + internal static extern IntPtr sqlite3_rollback_hook(IntPtr db, SQLiteRollbackCallback func, IntPtr pvUser); + +#if !PLATFORM_COMPACTFRAMEWORK + [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)] +#else + [DllImport(SQLITE_DLL)] +#endif + internal static extern IntPtr sqlite3_db_handle(IntPtr stmt); + +#if !PLATFORM_COMPACTFRAMEWORK + [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)] +#else + [DllImport(SQLITE_DLL)] +#endif + internal static extern IntPtr sqlite3_next_stmt(IntPtr db, IntPtr stmt); + +#if !PLATFORM_COMPACTFRAMEWORK + [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)] +#else + [DllImport(SQLITE_DLL)] +#endif + internal static extern int sqlite3_exec(IntPtr db, byte[] strSql, IntPtr pvCallback, IntPtr pvParam, out IntPtr errMsg); + +#if !PLATFORM_COMPACTFRAMEWORK + [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)] +#else + [DllImport(SQLITE_DLL)] +#endif + internal static extern int sqlite3_get_autocommit(IntPtr db); + + #endregion + } + +#if PLATFORM_COMPACTFRAMEWORK + internal abstract class CriticalHandle : IDisposable + { + private bool _isClosed; + protected IntPtr handle; + + protected CriticalHandle(IntPtr invalidHandleValue) + { + handle = invalidHandleValue; + _isClosed = false; + } + + ~CriticalHandle() + { + Dispose(false); + } + + private void Cleanup() + { + if (!IsClosed) + { + this._isClosed = true; + if (!IsInvalid) + { + ReleaseHandle(); + GC.SuppressFinalize(this); + } + } + } + + public void Close() + { + Dispose(true); + } + + public void Dispose() + { + Dispose(true); + } + + protected virtual void Dispose(bool disposing) + { + Cleanup(); + } + + protected abstract bool ReleaseHandle(); + + protected void SetHandle(IntPtr value) + { + handle = value; + } + + public void SetHandleAsInvalid() + { + _isClosed = true; + GC.SuppressFinalize(this); + } + + public bool IsClosed + { + get { return _isClosed; } + } + + public abstract bool IsInvalid + { + get; + } + + } + +#endif + + // Handles the unmanaged database pointer, and provides finalization support for it. + internal class SQLiteConnectionHandle : CriticalHandle + { + public static implicit operator IntPtr(SQLiteConnectionHandle db) + { + return db.handle; + } + + public static implicit operator SQLiteConnectionHandle(IntPtr db) + { + return new SQLiteConnectionHandle(db); + } + + private SQLiteConnectionHandle(IntPtr db) + : this() + { + SetHandle(db); + } + + internal SQLiteConnectionHandle() + : base(IntPtr.Zero) + { + } + + protected override bool ReleaseHandle() + { + try + { + SQLiteBase.CloseConnection(this); + } + catch (SQLiteException) + { + } + return true; + } + + public override bool IsInvalid + { + get { return (handle == IntPtr.Zero); } + } + } + + // Provides finalization support for unmanaged SQLite statements. + internal class SQLiteStatementHandle : CriticalHandle + { + public static implicit operator IntPtr(SQLiteStatementHandle stmt) + { + return stmt.handle; + } + + public static implicit operator SQLiteStatementHandle(IntPtr stmt) + { + return new SQLiteStatementHandle(stmt); + } + + private SQLiteStatementHandle(IntPtr stmt) + : this() + { + SetHandle(stmt); + } + + internal SQLiteStatementHandle() + : base(IntPtr.Zero) + { + } + + protected override bool ReleaseHandle() + { + try + { + SQLiteBase.FinalizeStatement(this); + } + catch (SQLiteException) + { + } + return true; + } + + public override bool IsInvalid + { + get { return (handle == IntPtr.Zero); } + } + } +} Index: bin/System.Data.SQLite.dll ================================================================== --- bin/System.Data.SQLite.dll +++ bin/System.Data.SQLite.dll cannot compute difference between binary files Index: bin/test.exe ================================================================== --- bin/test.exe +++ bin/test.exe cannot compute difference between binary files Index: bin/test.exe.config ================================================================== --- bin/test.exe.config +++ bin/test.exe.config @@ -1,8 +1,8 @@ - - - - - - - - + + + + + + + + Index: readme.htm ================================================================== --- readme.htm +++ readme.htm @@ -1,1219 +1,1219 @@ - - - - - - - ADO.NET 2.0/3.5 SQLite Data Provider
- Version 1.0.67.0 August X, 2010
- Using SQLite 3.7.0.1
- Written by Robert Simpson (robert@blackcastlesoft.com)
- Released to the public domain, use at your own risk!
- Official provider website:  http://sqlite.phxsoftware.com
-
- The latest version can be downloaded - here -
-
- -

- Features:
-

-
    -
  • - Written from scratch on VS2008 specifically for ADO.NET 2.0, implementing all the - base classes and features recently introduced in the framework, including automatic - transaction enlistment.
  • Supports the Full - and Compact .NET Framework, and native C/C++ development.  100% binary - compatible with the original sqlite3.dll.
  • -
  • Full support for Mono via a "managed only" provider that runs against the - official SQLite 3.6.1 or higher library.
  • -
  • Full Entity Framework support (ADO.NET 3.5 SP1)
  • -
  • - On the Compact Framework, it is faster than Sql Server - Mobile. SQLite's installed size is a fraction of Sql Mobile's. It uses less memory at runtime, runs queries faster, and has a smaller database file size as well. -
  • Encrypted database support.  Encrypted databases are fully encrypted and - support both binary and cleartext password types.
  • -
  • - Visual Studio 2005/2008 Design-Time Support, works with all versions of VS2005/2008, - including - all Express Editions of VS2005.  You can add a SQLite - database to the Servers list, design queries with the Query Designer, - drag-and-drop tables onto a Typed DataSet, etc.
  • - Full SQLite schema editing inside Visual Studio.  - You can create/edit tables, views, triggers, indexes, check constraints and foreign keys.
  • - Single file redistributable (except on Compact Framework).  The core sqlite3 codebase and the ADO.NET wrapper - are combined into one multi-module assembly. -
  • - Binaries included for Itanium, x64, x86 and ARM processors.
  • - DbProviderFactory support. -
  • - Full support for ATTACH'ed databases.  Exposed as Catalogs - in the schema.  When cloning a connection, all attached databases are - automatically re-attached to the new connection. -
  • - DbConnection.GetSchema(...) support includes ReservedWords, MetaDataCollections, DataSourceInformation, - DataTypes, Columns, Tables, Views, ViewColumns, Catalogs, Indexes, - IndexColumns, ForeignKeys and Triggers. -
  • - Enhanced DbDataReader.GetSchemaTable() functionality returns catalog, namespace - and detailed schema information even for complex queries. -
  • - Named and unnamed parameters. -
  • - Full UTF-8 and UTF-16 support, each with optimized pipelines into the native - database core. -
  • - Multiple simultaneous DataReaders (one DataReader per Command however). -
  • - Full support for user-defined scalar and aggregate functions, encapsulated into - an easy-to-use base class in which only a couple of overrides are necessary to - implement new SQL functions. -
  • - Full support for user-defined collating sequences, every bit as simple to - implement as user-defined functions and uses the same base class. -
  • - Full source for the entire engine and wrapper.  No copyrights.  - Public Domain.  100% free for commercial and non-commercial use. 
- -

- Design-Time Support

-

- In Windows Explorer, navigate to the SQLite.NET\bin\Designer - folder and execute the INSTALL.EXE - file.  The program will - automatically detect what version(s) of Visual Studio 2005/2008 are installed and allow - you to selectively install and uninstall the designer for each edition.

-

DbFactory Support (Non-Compact Framework)

- In order to use the SQLiteFactory and have the SQLite data provider enumerated - in the DbProviderFactories methods, you must add the following segment into your application's app.config file:
-
-
<configuration>
-  <system.data>
-    <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" /> - </DbProviderFactories> - </system.data> -</configuration> -
-

See the help documentation for further details on implementing both version-specific (GAC enabled) and version independent DBProviderFactories support. -

-

- Compiling for the Compact Framework

-

- Just change the target platform from Win32 to Compact Framework and - recompile.  The Compact Framework has no support for enumerating - attributes in an assembly, therefore all user-defined collating sequences and - functions must be explicitly registered.  See the testce - sample application for an example of how to explicitly register user-defined - collating sequences and functions.

-

- Distributing The SQLite Engine and ADO.NET Assembly

-

- On the desktop, only the System.Data.SQLite.DLL file needs to be distributed with your - application(s).  This DLL contains both the managed wrapper and the native - SQLite3 codebase.  For the Compact Framework, you will have to distribute - both the CF version of System.Data.SQLite.DLL, as well as the - SQLite.Interop.XXX.DLL.  This is a breaking change as of 1.0.59.0.  - Recent Windows Mobile frameworks are not supporting the mixed CF assembly I was - building prior to this version.

-

Development Notes Regarding the SQLite 3 Source Code

-

- The core sqlite engine is compiled directly from the unmodified source code available - at the sqlite.org website.  Several additional pieces are compiled on top of - it to extend its functionality, but the core engine's source is not changed.

-

-

- Version History

-

1.0.67.0 - August X, 2010

-
    -
  • Code merge with SQLite 3.7.0.1
  • -
  • Re-enabled VS2005 designer support, broken in previous versions during the 2008 transition
  • -
  • Implemented new forms of Take/Skip in the EF framework courtesy jlsantiago
  • -
  • Added "Foreign Keys" to the connection string parameters
  • -
  • Added the Truncate option to the Journal Modes enumeration
  • -
-

1.0.66.0 - April 18, 2010

-
    -
  • Code merge with SQLite 3.6.23.1
  • -
  • Fixed a bug in the installer that accidentally modified the machine.config on .NET versions prior to 2.0, invaliding the config file.
  • -
  • Fixed INTERSECT and EXCEPT union query generation in EF
  • -
  • Fixed an out of memory error in the trigger designer in cases where a WHEN clause is used in the trigger
  • -
-

1.0.65.0 - July 26, 2009

-
    -
  • Fixed a bug in the encryption module to prevent a double free() when rekeying a database.
  • -
  • Fixed a bug in the encryption module when ATTACHing an encrypted database.
  • -
  • Incorporated the WinCE locking fix from ticket - #3991
  • -
  • Added "bigint" to the dropdown in the table designer, plus other minor table - designer bugfixes.
  • -
-

1.0.64.0 - July 9, 2009

-
    -
  • Fixed the missing resources problem from the 63 release.
  • -
  • Added preliminary support for the Visual Studio 2010 beta.
  • -
  • Fixed a bug in SQLiteCommand that threw a null reference exception when - setting the Transaction object to null.
  • -
  • If SQLiteConnection.EnlistTransaction is called multiple times for the same - transaction scope, just return without throwing an error.
  • -
-

1.0.63.0 - June 29, 2009

-
    -
  • Code merge with SQLite 3.6.16
  • -
  • Check the autocommit mode of the connection to which a transaction is bound - during the disposal of the transaction.  If autocommit is enabled, then the - database has already rolled back the transaction and we don't need to do it - during dispose, and can quietly ignore the step without throwing an error.
  • -
  • Eliminated the mergebin step altogether.  It was developed primarily to - merge the Compact Framework binaries together, but since we're not doing that - anymore, its use is limited.  Its non-standard method of merging a binary - on the desktop framework is redundant as well.  The desktop binary now - hard-links to MSCOREE, but as of Windows XP, this was redundant as well since XP - and beyond automatically attempt to load MSCOREE on startup when a DLL has a - .NET header.
  • -
  • More improvements to the test.exe program for running the tests against Sql - Server for comparison purposes.
  • -
-

1.0.62.0 - June 19, 2009

-
    -
  • Code merge with SQLite 3.6.15
  • -
  • Fixed the decimal reading bug in the SQLiteDataReader
  • -
  • Changed Join()'s to Sleep()'s in the statement retry code to prevent message - pumping
  • -
  • Fixed a bad pointer conversion when retrieving blobs using GetBytes() in - 64-bit land
  • -
  • Several changes to the Test program that comes with the provider.  Tests - can now be individually disabled, and the test program can run against several - provider back-ends
  • -
-

1.0.61.0 - April 28, 2009

-
    -
  • Code merge with SQLite 3.6.13. The new backup features are as yet unimplemented in the provider, but will be forthcoming in a subsequent release
  • -
  • Fixed the default-value lookups in SQLiteConnectionStringBuilder when accessing properties
  • -
  • Lock the SQLiteTransaction object during dispose to avoid potential race condition during cleanup
  • -
  • Fixed SQLiteDataReader.GetDecimal() processing and parsing of decimal values for cases when SQLite returns things like "1.0e-05" instead of "0.0001"
  • -
-

1.0.60.0 - October 3, 2008

-
    -
  • Throw a NotSupported exception in the EF Sql Gen code instead of parsing - illegal SQL during an update/insert/delete where no primary key is defined.
  • -
  • Fixed the Compact Framework interop library.  Since the linker flag - /subsystem had no version specified, it was causing a problem for many CE-based - platforms.
  • -
  • Incorporated SQLite patch for ticket - #3387 and reverted - out the vfs override code I added in build 59 to work around this problem.
  • -
  • Fixed a designer issue when creating a new table from the Server Explorer.  - After initially saving it, if you then continued to edit it and tried to save it - again, it would generate the change SQL using the old temporary table name - rather than the new name.
  • -
-

1.0.59.0 - September 22, 2008

-
    -
  • Code merge with SQLite 3.6.3.  Solves - a couple different EF issues that were either giving inconsistent results or - crashing the engine.
  • -
  • Fixed the parsing of literal binaries in the EF SqlGen code.  SQLite now - passes nearly all the testcases in - Microsoft's EF Query Samples application -- - the exception being the datetimeoffset and time constants tests, and tests - that use the APPLY keyword which are unsupported for now.
  • -
  • Revamped the Compact Framework mixed-mode assembly.  Tired of playing cat - and mouse with the Compact Framework's support for mixed-mode assemblies.  - The CF build now requires that you distribute both the System.Data.SQLite - library and the paired SQLite.Interop.XXX library.   The XXX denotes - the build number of the library.
  • -
  • Implemented a workaround for Vista's overzealous caching by turning off - FILE_FLAG_RANDOM_ACCESS for OS versions above XP.  This is implemented - as a custom (default override) VFS in the interop.c file, so no changes are made - to the SQLite source code.
  • -
  • Fixed some registry issues in the designer install.exe, which prevented some - design-time stuff from working on the Compact Framework when .NET 3.5 was - installed.
  • -
-

1.0.58.0 - August 30, 2008

-
    -
  • Code merge with SQLite 3.6.2.  If only I'd waited one more day to release - 57!  Several LINQ issues have been resolved with this engine release - relating to deeply-nested subqueries that the EF SqlGen creates.
  • -
  • The Rollback SQLiteConnection event no longer requires an open connection in - order to subscribe to it.  Missed this one in the 57 release.
  • -
-

1.0.57.0 - August 29, 2008

-
    -
  • Compiled against 3.6.1 with checkin - #3300 resolved, - which fixes an Entity Framework bug I was seeing.  I currently have 3 other - tickets out on the engine, which are not yet resolved and relate to EF.
  • -
  • Fixed decimal types to store and fetch using InvariantCulture.  If you're - using decimal datatypes in your database and were affected by the 56 release, - please issue an UPDATE <table> SET <column> = REPLACE(<column>, ',', '.');  - to fix the decimal separators.  Apologies for not testing that more - thoroughly before releasing 56.
  • -
  • Too many LINQ fixes to list.  Fixed views so they generate, - fixed the LIMIT clause, implemented additional functionality and removed unnecessary code.
  • -
  • Fixed foreign key names in the designer so viewing the SQL script on a new - unsaved table after renaming it in the properties toolwindow will reflect in the - script properly.
  • -
  • Fixed the Update and Commit events on SQLiteConnection so they don't require - the connection to be opened first.
  • -
  • Fixed userdef aggregate functions so they play nice with each other when - appearing multiple times in the same statement.
  • -
  • Fixed the editing and saving of default values in the table designer.
  • -
  • Fixed ForeignKeys schema to support multi-column foreign keys.  Also - hacked support for them in the table designer, provided two foreign keys in the - designer have the same name and reference the same foreign table and different - columns.  Will implement first-class support for this in the next release.
  • -
-

1.0.56.0 - August 11, 2008

-
    -
  • Fixed a bug in the table designer when designing new tables, wherein you had to - save the table first before being able to create indexes and foreign keys.
  • -
  • Tweaks to decimal type handling.  The 'decimal' type can't be represented - by Int64 or Double (without loss of precision) in SQLite, so we have to fudge it - by treating it like a string and converting it back and forth in the provider.  - Unfortunately backing it to the db as a string causes sorting problems.  - See this - post - for details on using a custom collation sequence to overcome the sorting issue arising from this patch.
  • -
  • Minor tweaks and bugfixes to the test program and the provider.
  • -
  • More adjustments to make the managed-only version of the provider run and pass - all tests on Mono.
  • -
  • LINQ to Entities bits heavily updated and compiled against VS2008 SP1 RTM.  SQLite - LINQ support is still considered beta.
  • -
-

1.0.55.0 - August 6, 2008

-
    -
  • Code merge with SQLite 3.6.1
  • -
  • Added support for the user-contributed extension-functions at - http://www.sqlite.org/contrib.  - Feel free to override any of them with your own implementation.  The new - functions are: acos, asin, atan, atn2, atan2, acosh, asinh, atanh, - difference, degrees, radians, cos, sin, tan, cot, cosh, sinh, tanh, coth, exp, - log, log10, power, sign, sqrt, square, ceil, floor, pi, replicate, charindex, - leftstr, rightstr, reverse, proper, padl, padr, padc, strfilter, and - aggregates stdev, variance, mode, median, lower_quartile, upper_quartile.
  • -
  • Moved the last_rows_affected() function to the C extension library.
  • -
  • Added a new class, SQLiteFunctionEx which extends SQLiteFunction and adds the - ability for a user-defined function to get the collating sequence during the - Invoke/Step methods.  User-defined functions can use the collating sequence - as a helper to compare values.
  • -
  • When registering user-defined collation sequences and functions, the provider - will now register both a UTF8 and a UTF16 version instead of just UTF8.
  • -
  • Revamped connection pooling and added static ClearPool() and ClearAllPools() - functions to SQLiteConnection.  Behavior of the pool and its clearing - mechanics match SqlClient.
  • -
  • Fixed connections going to the pool so that any unfinalized lingering commands - from un-collected datareaders are automatically reset and any lurking - transactions made on the connection are rolled back.
  • -
  • Transaction isolation levels are now partially supported.  Serializable - is the default, which obtains read/write locks immediately -- this is compatible - with previous releases of the provider.  Unspecified will default to - whatever the default isolation mode is set to, and ReadCommitted will cause a - deferred lock to be obtained.  No other values are legal.
  • -
  • Revamped the test.exe program.  It's now an interactive GUI application.  - Easier for me to add tests now.
  • -
  • Tweaks to the VS designer package and installer.
  • -
  • More adjustments to the internal SQLite3.Prepare() method to account for both - kinds of lock errors when retrying.
  • -
  • Stripped a lot of unnecessary interop() calls and replaced with base sqlite calls.  - Revamped most of UnsafeNativeMethods to make it easier to port the code.
  • -
  • Rerigged internal callbacks for userdef functions and other native to managed - callbacks.  More portable this way.
  • -
  • Source can now can be compiled with the SQLITE_STANDARD preprocessor symbol to - force the wrapper to use the stock sqlite3 library.  Some functionality is - missing, but its minimal.  None of the precompiled binaries are compiled - using this setting, but its useful for testing portability.
  • -
  • Added "boolean" and a couple other missing datatypes to the "DataTypes" schema - xml file.  Used by the VS designer when displaying tables and querying.
  • -
  • Added a new connection string option "Read Only".  When set to True, the - database will be opened in read-only mode.
  • -
  • Added a new connection string option "Max Pool Size" to set the maximum size - of the connection pool for a given db file connection.
  • -
  • Added a new connection string option "Default IsolationLevel" to set the - default isolation level of transactions.  Possible values are Serializable and - ReadCommitted.
  • -
  • Added a new connection string option "URI" as an optional parameter for - compatibility with other ports of the provider.
  • -
-

1.0.54.0 - July 25, 2008

-
    -
  • Fixed the setup project, which somehow "forgot" to include all the binaries in - the 53 release.
  • -
  • Fixed a crash in the table designer when creating a new table and tabbing past - the "Allow Nulls" cell in the grid while creating a new column.
  • -
  • Fixed a mostly-benign bug in SQLiteDataReader's GetEnumerator, which failed to - pass along a flag to the underyling DbEnumerator it creates.  This one's - been around since day 1 and nobody's noticed it in all these years.
  • -
  • Added a new connection string parameter "Journal Mode" that allows you to set - the SQLite journal mode to Delete, Persist or Off.
  • -
-

1.0.53.0 - July 24, 2008

-
    -
  • Enabled sqlite_load_extension
  • -
  • Added retry/timeout code to SQLite3.Prepare() when preparing statements for - execution and a SQLITE_BUSY error occurs.
  • -
  • Added a new schema to SQLiteConnection.GetSchema() called Triggers.  - Used to retrieve the trigger(s) associated with a database and/or table/view.
  • -
  • Extensive updates to table/view editing capabilities inside Visual Studio's - Server Explorer.  The program now parses and lets you edit CHECK constraints and - triggers on a table, as well as define triggers on views.  Experimental - still, so e-mail me if you have issues.
  • -
  • Minor bugfix to the ViewColumns schema to return the proper base column name - for a view that aliases a column.
  • -
  • Fixed the insert/update/delete DML support in the Linq module.
  • -
  • Changed the behavior of SQLiteCommand to allow a transaction to be set even if - the command hasn't been associated with a connection yet.
  • -
-

1.0.52.0 - July 16, 2008

-
    -
  • Code merge with SQLite 3.6.0
  • -
  • Added a lot of previously-missing exports to the DEF file for the - native library.
  • -
  • Fixed SQLiteDataReader to check for an invalid connection before operating on - an open cursor.
  • -
  • Implemented the Cancel() function of SQLiteCommand to cancel an active reader.
  • -
  • Added beta table and view designers to the Visual Studio Server Explorer.  You can now - edit/create tables and views, manage indexes and foreign keys from Visual Studio.  - This feature is still undergoing testing so use at your own risk!
  • -
  • Fixed the Server Explorer so VS2005 users can once again right-click tables - and views and open the table data.
  • -
  • Added some new interop code to assist in returning more metadata not normally - available through the SQLite API.  Specifically, index column sort modes - and collating sequences.  Also added code to detect (but not parse) CHECK - constraints, so the table designer can pop up a warning when editing a table - with these constraints.  Since I can't currently parse them.
  • -
  • Lots of LINQ SQL generation improvements and fixes.
  • -
  • Made some progress cleaning up and fixing up the schema definitions and - manifests for EdmGen.
  • -
  • Added a built-in SQLiteFunction called last_rows_affected() which can be - called from SQL to get the number of rows affected by the last update/insert - operation on the connection.  This is roughly equivalent to Sql Server's - @@ROWCOUNT variable.
  • -
-

1.0.51.0 - July 1, 2008

-
    -
  • VS2008 SP1 Beta1 LINQ Support
  • -
  • Added experimental Entity Framework support in a new library, - System.Data.SQLite.Linq.  Some things work, some don't.  I haven't - finished rigging everything up yet.  The core library remains stable.  - All LINQ-specific code is completely separate from the core.
  • -
  • Added some columns to several existing schemas to support some of the - EDM framework stuff.
  • -
  • Minor tweaks to the factory to better support dynamic loading of the Linq - extension library for SQLite.
  • -
  • SQLite's busy handler was interfering with the provider's busy handling - mechanism, so its been disabled.
  • -
-

1.0.50.0 - June 27, 2008

-
    -
  • Fixed some lingering dispose issues and race conditions when some objects were finalized.
  • -
  • Fixed the SQLiteConvert.Split() routine to be a little smarter when splitting - strings, which solves the quoted data source filename problem.
  • -
  • Enhanced the mergebin utility to work around the strong name validation bug on - the Compact Framework.  The old workaround kludged the DLL and caused WM6.1 - to fail to load it.  This new solution is permanent and no longer kludges - the DLL.
  • -
-

1.0.49.0 - May 28, 2008

-
    -
  • Code merge with SQLite 3.5.9
  • -
  • Fixed schema problems when querying the TEMP catalog.
  • -
  • Changed BLOB datatype schema to return IsLong = False instead of True.  This - was preventing DbCommandBuilder from using GUID's and BLOB's as primary keys.
  • -
  • Fix rollover issue with SQLite3.Reset() using TickCount.
  • -
  • Fixed SQLiteDataReader to dispose of its command (if called for) before - closing the connection (when flagged to do so) instead of the other way around.
  • -
  • Fixed a DbNull error when retrieving items not backed by a table schema.
  • -
  • Fixed foreign key constraint parsing bug.
  • -
  • Added FailIfMissing property to the SQLiteConnectionStringBuilder.
  • -
  • Converted the source projects to Visual Studio 2008.
  • -
-

1.0.48.0 - December 28, 2007

-
    -
  • Code merge with SQLite 3.5.4
  • -
  • Calling SQLiteDataReader.GetFieldType() on a column with no schema information - and whos first row is initially NULL now returns type Object instead of type DbNull.
  • -
  • Added support for a new DateTime type, JulianDay.  SQLite uses Julian dates - internally.
  • -
  • Added a new connection string parameter "Default Timeout" and a corresponding - method on the SQLiteConnection object to change the default command timeout.  - This is especially useful for changing the timeout on transactions, which use SQLiteCommand - objects internally and have no ADO.NET-friendly way to adjust the command timeout - on those commands.
  • -
  • FTS1 and FTS2 modules were removed from the codebase.  Please upgrade all - full-text indexes to use the FTS3 module. 
  • -
-

1.0.47.2 - December 10, 2007

-
    -
  • Fixed yet one more bug when closing a database with unfinalized command objects
  • -
  • Fixed the DataReader's GetFieldType function when dealing with untyped SQLite affinities
  • -
-

1.0.47.1 - December 5, 2007

-
    -
  • Fixed a leftover bug from the codemerge with SQLite 3.5.3 that failed to close a database.
  • -
  • Fixed the broken Compact Framework distribution binary.
  • -
  • SQLite 3.5.x changed some internal infrastructure pieces in the encryption interface - which I didn't catch initially.  Fixed. 
  • -
-

1.0.47.0 - December 4, 2007

-
    -
  • Code merge with SQLite 3.5.3
  • -
  • Added installer support for Visual Studio 2008.  Code is still using the - VS2005 SDK so one or two bells and whistles are missing, but nothing significant.
  • -
  • This is the last version that the FTS1 and FTS2 extensions will appear.  - Everyone should rebuild their fulltext indexes using the new FTS3 module.  - FTS1 and FTS2 suffer from a design flaw that could cause database corruption with - certain vacuum operations.
  • -
  • Fixed pooled connections so they rollback any outstanding transactions before - going to the pool. 
  • -
  • Fixed the unintended breaking of the TYPES keyword, and mis-typing of untyped - or indeterminate column types.
  • -
  • Assert a FileIOPermission() requirement in the static SQLiteFunction constructor. -
  • -
  • The CE-only SQLiteFunction.RegisterFunction() is now available on the desktop - platform for dynamic registration of functions.  You must still close and re-open - a connection in order for the new function to be seen by a connection.
  • -
  • Fixed the "database is locked" errors by implementing behavioral changes in the - interop.c file for SQLite.  Closing a database force-finalizes any prepared - statements on the database to ensure the connection is fully closed.  This - was rather tricky because the GC thread could still be finalizing statements itself. -  
  • -
  • Modifed the mergebin utility to help circumvent a long-standing strong name verification - bug in the Compact Framework.
  • -
-

1.0.46.0 - September 30, 2007

-
    -
  • Fixed faulty logic in type discovery code when using SQLiteDataReader.GetValue().
  • -
  • Fixed Connection.Open() bug when dealing with :memory: databases.
  • -
  • Fixed SQLiteCommand.ExecuteScalar() to return a properly-typed value.
  • -
  • Added support for SQLiteParameter.ResetDbType().
  • -
  • Added test cases for rigid and flexible type testing.
  • -
-

1.0.45.0 - September 25, 2007

-
    -
  • Breaking change in GetSchema("Indexes") -- MetaDataCollections - restrictions and identifier parts counts were wrong for this schema and I was using - the wrong final parameter as the final restriction.  Meaning, if you use the - Indexes schema and are querying for a specific index the array should now be {catalog, - null, table, index } instead of {catalog, null, table, null, index}
  • -
  • Code merge with SQLite 3.4.2
  • -
  • Fixed some errors in the encryption module, most notably when a non-default page - size is specified in the connection string.
  • -
  • Fixed SQLiteDataReader to better handle type-less usage scenarios, which also - fixes problems with null values and datetimes.
  • -
  • Fixed the leftover temp files problem on WinCE
  • -
  • Added connection pooling.  The default is disabled for now, but may change - in the future.  Set "Pooling=True" in the connection string to enable it.
  • -
  • Sped up SQLiteConnection.Open() considerably.
  • -
  • Added some more robust cleanup code regarding SQLiteFunctions.
  • -
  • Minor additions to the code to allow for future LINQ integration into the main - codebase.
  • -
  • Fixed a long-standing bug in the Open() command of SQLiteConnection which failed - to honor the documented default behavior of the SQLite.NET provider to open the - database in "Synchronous=Normal" mode.  The default was "Full".
  • -
  • If Open() fails, it no longer sets the connection state to Broken.  It instead - reverts back to Closed, and cleans up after itself.
  • -
  • Added several new parameters to the ConnectionString for setting max page count, - legacy file format, and another called FailIfMissing to raise an error rather than - create the database file automatically if it does not already exist.
  • -
  • Fixed some designer toolbox references to the wrong version of the SQLite.Designer
  • -
  • Fixed a bug in the mergebin utility with regards to COR20 metadata rowsize computations.  -
  • -
  • Minor documentation corrections   
  • -
-

1.0.44.0 - July 21, 2007

-
    -
  • Code merge with SQLite 3.4.1
  • -
  • Fixed a bug in SQLiteConnection.Open() which threw the wrong kind of error in - the wrong kind of way when a database file could not be opened or created. 
  • -
  • Small enhancements to the TYPES keyword, and added documentation for it in the - help file.
  • -
  • Hopefully fixed the occasional SQLITE_BUSY errors that cropped up when starting - a transaction.  Usually occurred in high-contention scenarios, and the underlying - SQLite engine bypasses the busy handler in this scenario to return immediately.
  • -
-

1.0.43.0 - June 21, 2007

-
    -
  • Code merge with SQLite 3.4.0
  • -
  • Fixed a reuse bug in the SQLiteDataAdapter in conjunction with the SQLiteCommandBuilder.  - It's been there unnoticed for more than a year, so it looks like most folks never - encountered it.
  • -
  • Fixed an event handler bug in SQLiteCommandBuilder in which it could fail to unlatch - from the DataAdapter when reused.  Relates to the previous bugfix.
  • -
  • Fixed a double-dispose bug in SQLiteStatement that triggered a SQLiteException. 
  • -
-

1.0.42.0 - June 1, 2007

-
    -
  • Code merge with SQLite 3.3.17
  • -
  • Changed the SQLiteFunction static constructor so it only enumerates loaded modules - that have referenced the SQLite assembly, which hopefully should cut down dramatically - the time it takes for that function to execute. 
  • -
  • Added the FTS2 full-text search extension to the project.  Look for FTS1 - to disappear within the next couple of revisions. 
  • -
  • Fixed a bug introduced with the finalizers that triggered an error when statements - ended with a semi-colon or had other non-parsable comments at the end of a statement 
  • -
  • Fixed an intermittent multi-threaded race condition between the garbage collector - thread and the main application thread which lead to an occasional SQLITE_MISUSE - error.
  • -
  • Fixed another issue relating to SQLite's inherent typelessness when dealing with - aggregate functions which could return Int64 or Double or even String for a given - row depending on what was aggregated.
  • -
  • Remembered to recompile the DDEX portion of the engine this time, so Compact Framework - users can once again use the design-time functionality
  • -
-

1.0.41.0 - April 23, 2007

-
    -
  • Code merge with SQLite 3.3.16
  • -
  • Second go at implementing proper finalizers to cleanup after folks who've forgotten to Dispose() of the SQLite objects
  • -
  • Enhanced GetSchema(IndexColumns) to provide numeric scale and precision values
  • -
  • Fixed the column ordinals in GetSchema(IndexColumns) to report the ordinal of the column in the index, not the table
  • -
  • Fixed a bug whereby parameters named with an empty string (such as String.Empty) were treated like a named parameter instead of an unnamed parameter
  • -
-

1.0.40.0 - January 31, 2007

-
    -
  • Code merge with SQLite 3.3.12
  • -
  • Lots of new code to handle misuse of the library.  Implemented finalizers - where it made sense, fixed numerous garbage collector issues when objects are not - disposed properly,  fixed some object lifetime issues, etc.
  • -
  • A failed Commit() on a transaction no longer leaves the transaction in an unusable - state.
  • -
-

1.0.39.1 - January 11, 2007

-
    -
  • Fixed a really dumb mistake that for some reason didn't trigger any errors in - the testcases, whereby commands when associated with a connection were not adding - or removing themselves from an internal list of commands for that connection -- - causing a "database is locked" error when trying to close the connection.
  • -
-

1.0.39.0 - January 10, 2007

-
    -
  • Code merge with SQLite 3.3.10
  • -
  • Fixed a multi-threaded race condition bug in the garbage collector when commands - and/or connections are not properly disposed by the user.
  • -
  • Switched the encryption's internal deallocation code to use sqlite's built-in - aux functions instead of modifying the pager.c source to free the crypt block.  - This eliminates the last of the code changes the provider makes to the original - sqlite engine sources.  Props to Ralf Junker for pointing that out.
  • -
-

1.0.38.0 - November 22, 2006

-
    -
  • Fixed a bug when using CommandBehavior.KeyInfo whereby integer primary key columns may be duplicated in the results.
  • -
  • Enhanced the CommandBuilder so that update/delete statements are optimized when the affected table contains unique constraints and - a primary key is present.
  • -
  • Fixed a bug in the DataReader when used in conjunction with CommandBehavior.CloseConnection.
-

1.0.37.0 - November 19, 2006

-
    -
  • Added support for CommandBehavior.KeyInfo.  - When specified in a query, additional column(s) will be returned describing the - key(s) defined for the table(s) selected in the query.  This is optimized when - INTEGER PRIMARY KEY is set for the given tables, but does additional work for other - kinds of primary keys.
  • -
  • Removed the default values from SQLiteDataReader.GetTableSchema(), to better follow - Sql Server's pattern and suppress schema errors when loading the records into a - dataset/datatable.
  • -
  • Allow integers to implicitly convert to double/decimal/single.
-

1.0.36.1 - October 25, 2006

-
    -
  • Added support for LONGVARCHAR, SMALLDATE and SMALLDATETIME. These were actually added in 1.0.36.0 but were undocumented.
  • -
  • Fixed the embedded helpfile which was accidentally built from old sources.
  • -
  • Fixed an unfortunate re-entry of a bug in the .36 codebase that caused the provider to "forget" about commands on a connection under certain circumstances.
  • -
-

1.0.36.0 - October 23, 2006

-
    -
  • Code merge with SQLite 3.3.8, including support for full-text search via the FTS1 - extension. 
  • Fixed a bug retrieving data types when UseUtf16Encoding is true. Side-effect of further merging the common code between the two base classes.
  • -
  • Fixed a bug with System.Transactions whereby a connection closed/disposed within - a transaction scope is rolled back and cannot be committed.
  • -
  • Added more error checking and reporting to transactions to help user's isolate - the source of transaction failures.
  • -
  • Implemented a workaround for a Compact Framework issue regarding strong-named - assemblies containing a PE section with a raw size less than the virtual size. 
  • -
-

1.0.35.1 - September 12, 2006

-
    -
  • Fixed the TYPES keyword to work when UseUTF16Encoding is true.
  • -
  • Fix another bug revealed in 1.0.35.0 regarding infinite loops when the 2nd or subsequent statements of a semi-colon separated command cannot be parsed.
  • -
  • Updated the help documentation. 
  • -
-

1.0.35.0 - September 10, 2006

-
    -
  • Fixed an infinite loop bug in SQLiteCommand caused when multiple semi-colon separated - statements in a single command are executed via datareader and one of the statements - contains a syntax error preventing it from being prepared. 
  • Added the TYPES preparser keyword to be placed before a SELECT statement to - aid the wrapper in converting expressions in a subsequent select clause into more - robust types.  Documentation yet to be integrated, but available on the forums.
  • -
  • Added a new connectionstring parameter "BinaryGUID=true/false" (default is "true").  - When true, guid types are stored in the database as binary blobs to save space.  - Binary has been the default format since 1.0.32.0 but this parameter eases backward - compatibility.
  • -
-

1.0.34.0 - September 4, 2006

-
    -
  • Fixed a bug in SQLiteParameterCollection.RemoveAt(namedparam)
  • -
  • Fixed a bug in SQLiteDataReader introduced in 1.0.30 that broke DateTimes using the Ticks option in the connection string.
  • -
  • Fixed a bug in the recent changes to guid behavior wherein using a datareader's - indexer to fetch a guid from a column containing both binary and text guids would - sometimes return a byte array instead of a guid.
  • -
  • Enacted a workaround involving typed datasets in Compact Framework projects in - which it took an excessive amount of time to open a form and generated a lot of - temporary files in the user's Local Settings\Application Data\Microsoft\VisualStudio\8.0\Assembly - References folder.
  • -
-

1.0.33.0 - August 21, 2006

-
    -
  • Code merge with SQLite 3.3.7
  • -
  • Fixed a bug in SQLiteConnection that caused it to "forget" about commands bound - to it and occasionally throw an error when a database is closed and opened repeatedly.  -
  • -
-

1.0.32.0 - August 6, 2006

-
    -
  • Added AllowPartiallyTrustedCallers attribute to the assembly
  • Added the missing "nchar" type
  • -
  • Added support for binary Guid's.  Guids are now stored as binary by default - when using parameterized queries.  Text guids are still fully supported.
  • -
  • Fixed a TransactionScope() error that caused the transaction not to be completed.
  • -
  • Enhanced parameter names so that if they are added to the Parameters collection - without their prefix character (@ : or $) they are still properly mapped. 
  • -
-

1.0.31.0 - July 16, 2006

-
    -
  • Re-applied the view parsing bugfix in 1.0.29.0 that was accidentally reverted - out of the 30 build.
  • Fixed SQLiteCommand.ExecuteScalar() to return null instead of DbNull.Value - when no rows were returned.
  • -
  • Design-time installer now installs the package-based designer on full Visual Studio - versions.  Express editions continue to use the packageless designer.
  • -
  • In Visual Studio (not Express), you can now right-click a SQLite connection in - the Server Explorer and vacuum the database and change the encryption password.
  • -
-

1.0.30.1 - July 2, 2006

-
    -
  • Code merge with SQLite 3.3.6
  • -
  • Added support for the |DataDirectory| keyword in the Data Source filename string.  -
  • -
  • Added hook notification support to SQLiteConnection.  Specifically, there - are three new events on the SQLiteConnection object which are raised when an update/insert/delete - occurs and when transactions are committed and rolled back.
  • Changed SQLiteTransaction to default to BEGIN IMMEDIATE instead of just BEGIN, - which solves a multithreaded race condition. 
  • -
  • Changed SQLiteDataReader to better support SQLite's typelessness.  The data - reader no longer caches column affinity, but re-evaluates it for each column/row.
  • -
  • Fixed a bug in Prepare() which caused an intermittant fault due to the code accessing - the memory of an unpinned variable. 
  • -
  • Fixed a multithreaded lock-retry bug in in SQLiteConnection.Open() and in - SQLiteTransaction, which failed to use a command timeout before giving up.
  • -
-

1.0.29.0 - May 16, 2006

-
    -
  • Fixed a bug in the Views schema information which caused multi-line view definition statements not to be parsed
  • -
  • Fixed a parsing bug in SQLiteDataReader.GetSchemaTable() to account for numeric(x,y) datatypes with specified precision and scale
  • -
  • Fixed a bug in SQLiteConnection.Open() which tried to automatically enlist in an ambient transaction but had not yet set the state of the database to Opened, thereby causing a transaction fault
  • -
  • Changed SQLiteException to inherit from DbException on the full framework
  • -
-

1.0.28.0 - April 14, 2006

-
    -
  • Code merge with SQLite 3.3.5
  • -
  • You can now specify a relative path in the Compact Framework's "Data Source" by - prefixing the file with ".\".  i.e. "Data Source=.\\mydb.db3"
  • -
  • Several more changes and enhancements to schemas for better compatibility.
  • -
  • Fixed several bugs with the 64-bit builds of the provider.  The x64 binary - is now optimized.
  • -
  • Design-time installer now tries to install the 64-bit builds into the GAC along - with the 32-bit build.
  • -
  • Fixed a bug in the SQLiteDataReader.GetSchemaTable() function when used with tables - containing apostrophes.
  • -
  • Fixed an XSD-related bug whereby the XSD utility was unable to locate the provider - and could not generate typed datasets.
  • -
  • Added NTEXT and STRING datatypes to the list of recognized keywords (used for - schema retrieval).
  • -
  • Due to the XSD bug and other potential problems related to external build utilities, - changes to the installation of the designer have had to be made.  The installer - used to write the DbProviderFactories XML into the devenv.exe.config file and its - express cousins, but now has to write instead to the machine.config.
  • -
  • Installer writes to both the 32-bit machine.config and the 64-bit machine.config - if it exists. 
  • -
-

1.0.27.1 - February 28, 2006

-
    -
  • Fixed a bug when doing data binding in Compact Framework projects that prevented - you from assigning a typed dataset to a bindingsource.  It turns out, the CF - version of the SQLite provider needs to be flagged as retargetable so it'll work - in the design-time desktop environment.  No changes were made to the desktop - build, but the revision was bumped on all libraries anyway in order to keep them - sync'd. 
-

1.0.27.0 - February 27, 2006

-
    -
  • Many optimizations and a few more minor adjustments to schemas and schema retrieval - performance.
  • -
  • Lots of design-time attributes added to the code.  The DbDataAdapter, DbCommand, - and DbConnection objects now have greatly enhanced design-time capabilities when - added to the toolbox and dropped on a form.
  • -
  • Lots of Server Explorer enhancements.
  • -
  • Binaries are now distributed in a setup program for easier administration and - configuration of the provider.
  • -
-

1.0.26.2 - February 15, 2006

-
    -
  • Yet another bugfix to index schemas, which was incorrectly marking most indexes - as primary key indexes.
  • Fixed GetSchema() to accept a null string array.
  • Fixed a misspelled export in the core C library that prevented databases opened - with UTF16Encoding from getting schema information and would likely cause an error - if attempted.
-

1.0.26.1 - February 14, 2006

-
    -
  • Fixed even more minor schema bugs having to do with indexes.
  • Added two missing pieces in the SQLite designer which were preventing it from - being used from within VS Express editions. 
  • Several bugfixes to the design-time installer program, including supporting - 64-bit environments.
-

1.0.26.0 - February 11, 2006

-
    -
  • Code merge with SQLite 3.3.4
  • Fixed an encryption bug when changing the password of databases over 1gb in - size. 
  • Fixed various designer issues related to construction of named parameters.
  • -
  • Retooled the GetSchema() method of SQLiteDataReader to use the new 3.3.4 API functions, - and made several enhancements and fixes to schemas. 
  • -
  • Implemented the SourceColumnNullMapping property of SQLiteParameter to fix - a DbCommandBuilder code generation bug. 
  • Removed the runtime dependency on MSVCR80.DLL.  File size is somewhat - larger for the varying desktop versions.
  • Created an install program to manage installation and uninstallation of the - SQLite design-time support.
  • -
  • Designer support now works for all Visual Studio editions, including all Express - Editions.
  • -
  • Design-time installer will now remove (if present) the machine.config SQLite entries - in favor of installing the xml code into the devenv.exe.config file (or any of the - variations for express editions).  The officially-accepted behavior of using - DbProviderFactories is to add the code to your app.config file, and the machine.config - file should not be touched.
  • -
-

1.0.25.0 - January 31, 2006

-
    -
  • Code merge with SQLite 3.3.3
  • Added automatic distributed transaction enlistment and implemented the DbConnection.EnlistTransaction - method for manual enlistment.
  • -
  • Nested transactions are now supported.
  • -
  • Rearranged the timing of SetPassword(), which now must be called before the database - is opened instead of afterwards.  Optionally, the password can be supplied - in the ConnectionString.
  • -
  • Fixed a bug in SQLiteFunction that caused a failure when an empty resultset was - returned and a custom user aggregate function was used in the query.
  • -
  • The designer has had another round of cleanup applied, in preparation for moving - to a VS package.
  • -
  • Added SQLiteMetaDataCollectionNames class.
  • -
-

1.0.24.6 beta - January 23, 2006

-
    -
  • This beta is built from sqlite.org's 3.3.2 beta.
  • Eliminated the static linking of mscoree from all binaries.  Native projects - can now use the library without any dependencies on the .NET framework, while managed - projects continue to be able to use the library normally.
-

1.0.24.5 beta - January 20, 2006

-
    -
  • This beta is built from sqlite.org's 3.3.1 alpha and contains development-in-progress code.  Therefore no guarantees - can be made regarding its suitability for production use.
  • -
  • You no longer need to distribute 2 files on the CompactFramework.  - You can delete SQLite.Interop.DLL entirely.  I wrote a custom tool - called "mergebin" (available in the source zip file) which combines the two libraries - and gets around a glaring defect in the VS2005 linker for ARM processors which doesn't - allow you to link netmodules.
  • -
  • x64 and ia64 builds now use the same strong name as the x86 build.  - This means breaking backward compatibility, but it was necessary in order to allow - you to drop any of those 3 builds onto a PC and have your .NET program run properly.  - Prior to this, you'd get an error if you built your program using the x86 build, - and then installed the x64 version on a target machine and tried to run your program - against it.
  • -
  • The entire source project has been gone over top to bottom.  A debug build - no longer combines the binaries into a single module, which was preventing proper - debugging.
-

1.0.24.4 beta - January 16, 2006

-
    -
  • This beta is built from sqlite.org's 3.3.1 alpha and contains development-in-progress code.  Therefore no guarantees - can be made regarding its suitability for production use.
  • -
  • Fixed a bug in the UTF-16 handling code for preparing statements due to a behavioral - change in SQLite 3.3.0.
  • -
  • Added pager.c code necessary to cleanup after an encrypted file is closed.
  • -
  • Fixed an encryption bug that caused a fault when an encrypted file was rolled - back.
  • -
  • Modified the testcase code to take advantage of optimizations regarding the use - of a DbCommandBuilder.  DataAdapter insert speed increased dramatically as - a result.
  • -
-

1.0.24.3 beta - January 10, 2006

-
    -
  • This beta is built from sqlite.org's 3.3.0 alpha and contains development-in-progress code.  Therefore no guarantees - can be made regarding its suitability for production use.
  • Added support for database encryption at the pager level.  Databases - are encrypted using a 128-bit RC4 stream algorithm.  To open an existing encrypted - database, you may now specify a "Password={password}" text in the ConnectionString, - or you may call the SQLiteConnection.SetPassword() function to set the password - on an open connection.  To encrypt existing non-encrypted databases or to change - the password on an encrypted database, you must use the SQLiteConnection.ChangePassword() - function.  If you use SetPassword() instead of specifying a password in the - connection string, or call ChangePassword() you may use a binary byte array or a - text string as the password.
  • -
  • Rewrote the locking implementation for the Compact Framework.  It is now - more robust and incorporates into the SQLite codebase more efficiently than the - previous CE adaptation.
  • -
  • Moved some of the embedded schema XML data into a resource file to ease code readability.
  • -
  • Automated the fixup of the original sqlite codebase's source prior to compiling, - to ease merging with sqlite.org's source.
  • -
  • Fixed a memory leak in SQLiteCommand due to it not removing an internal reference - to itself in SQLiteConnection. 
  • -
-

1.0.24.2 - December 30, 2005

-
    -
  • Fixed the SQLiteDataReader.HasRows property to return the proper value.
  • -
  • Implemented the inadvertently neglected RecordsAffected property on SQLiteDataReader. -
  • -
  • SQLiteFunction static constructor was changed to pre-filter classes with only the - SQLiteFunctionAttribute.  The code was throwing an exception when certain - assemblies were referenced in a project.
  • -
  • Fixed the SQLiteDataAdapter OnRowUpdated event, which was using the wrong variable - to find the attached event handler and subsequently not raising the event.
  • -
  • Small optimizations and fixes to SQLiteDataReader.NextResult(). 
  • -
-

1.0.24.1 - December 19, 2005

-
    -
  • Update core SQLite engine to 3.2.8 
-

1.0.24 - December 9, 2005

-
    -
  • Fixed the Catalogs schema bug that caused attached databases not to be re-attached to a cloned connection -
  • -
  • Enhanced transactions to allow for a deferred or immediate writelock.  SQLiteConnection.BeginTransaction() - now has an additional overload to support it 
  • Commands are now prepared as they are executed instead of beforehand.  This - fixes a bug whereby a multi-statement command that alters the database and subsequently - references the altered data would fail during Prepare().
  • Tightened up the SQLiteDataReader to prevent reading columns before calling - the first Read() and to prevent reading columns after the last Read().
  • -
  • A more descriptive error is thrown if there aren't enough parameters in the command - to satisfy the parameters required by the statement(s). 
  • -
-

1.0.23 - November 21, 2005

-
    -
  • Named parameters may now begin with @ to ease portability of - the provider. SQLite's named parameters are ordinarily prefixed with a : - or $.  The designer will still use the $ - prefix however, since its more compatible with the default SQLite engine.
  • Added several alternate ISO8601 date/time formats to SQLiteConvert.cs to increase - compatibility.
  • -
  • Relaxed coersion restrictions to work better with SQLite's inherent typelessness. 
  • -
-

1.0.22 - November 11, 2005

-
    -
  • Fixed some globalization issues which resulted in incorrect case-insensitive comparisons
  • -
  • Fixed a bug in the routine that finds all user-defined functions in a loaded assembly.  - It would throw an exception if any of the types in the assembly could not be loaded.  - The exception is now caught and handled appropriately.
  • -
-

1.0.21 - November 4, 2005

-
    -
  • Fixed a designer bug when creating typed datasets with parameterized queries.
  • -
  • The above fix then exposed another bug in the datareader's ability to query schema - information on parameterized commands, which was also fixed.
  • -
  • Compiled against the RTM version of VS2005.
  • -
  • Rewrote the design-time install script to use the XML DOM objects when writing - to the machine.config and to automatically register the DLL in the GAC.
  • Made changes to the app.config descriptions and help file to improve version-independent - factory support.
-

1.0.20 - October 19, 2005

-
    -
  • - Fixed a shortcut in SQLiteBase.GetValue which was insufficient for - international environments.  The shortcut was removed and the "proper" - procedure put in.
-

1.0.19 - October 5, 2005

-
    -
  • - Code merge with SQLite 3.2.7 -
  • - Fixed bugs in the CE port code (os_wince.c) which were brought to - light by recent changes in the SQLite engine. -
  • - Recompiled and modified to be compatible with the September VS2005 Release - Candidate.
    - Beta 2 users should continue to use 1.0.18.1
-

1.0.18.1 - September 19, 2005

-
    -
  • - Code merge with SQLite 3.2.6
-

1.0.18 - September 1, 2005

-
    -
  • - Added type-specific method calls when using the various SQLite classes that - would've normally returned a a generic Db base class, which aligns the code - better with the Microsoft-supplied data providers.
-

1.0.17 - August 26, 2005

-
    -
  • - Code merge with SQLite 3.2.5 -
  • - Added Itanium and x64 build settings to the project (needs testing) -
  • - Bugfixes and enhancements to several schema types -
  • - Additional design-time support to include index and foreign key - enumerations.  Requires re-registering the designer using - INSTALL.CMD.  The new designer code now allows the VS query designer and - typed datasets to automatically link up foreign keys, use indexes, and - automatically generate relationships from the schema.
  • - Additional static methods on SQLiteConnection to create a database file, - encrypt a file using the Encrypted File System (EFS) on NTFS (requires NT 2K or - above) and NTFS file compression
  • -
-

1.0.16 - August 24, 2005

-
    -
  • - Code merge with SQLite 3.2.4 with the large delete bugfix in CVS (which will - become 3.2.5 soon) -
  • - Added new GetSchema() types: IndexColumns, ViewColumns, ForeignKeys
  • -
-

1.0.15 - August 22, 2005
-

-
    -
  • - Code merge with SQLite 3.2.3 -
  • - Minor updates for better design-time experience. More design-time code to - follow in subsequent releases.
  • -
-

1.0.14 - August 16, 2005
-

-
    -
  • - Fixed a bug in the SQLiteDataAdapter due to insufficient implementation of the - class.  The RowUpdating and RowUpdated events are now properly - implemented, but unfortunately inserting and updating data in a DataTable or - DataSet is now much slower.  This is the proper design however, so the - changes are here to stay. -
  • - Lots of schema changes to support Visual Studio's Data Designer architecture.
  • Added - Designer support for the provider.  It's not 100%, but you can design - queries, add typed datasets and perform quite a number of tasks all within - Visual Studio now.
-

1.0.13 - August 8, 2005
-

-
-
    -
  • - Fixed a named parameter bug in the base SQLite_UTF16 class, which of course - only showed up when a database connection was opened using the - UseUTF16Encoding=True parameter. -
  • - Fixed a performance issue in SQLite_UTF16 involving string marshaling.
-
-

1.0.12 - August 5, 2005
-

-
-
    -
  • - Full support for the Compact Framework.  Each build (Debug/Release) now - has a platform, either Win32 or Compact Framework.  The correct - projects are built accordingly.  See the Distributing - SQLite - section for information on what files need to be distributed for each - platform.  -
  • - Modified SQLite3.Reset() and Step() functions to transparently handle timeouts - while waiting on the database to become available (typically when a writer is - waiting on a reader to finish, or a reader is waiting on a writer to finish). -
  • - Lots of code cleanup as suggested by the Code Analyzer (FxCop). -
  • - Lots of updates to the helpfile (as you can see). -
  • - Statements were already prepared lazily in a SQLiteCommand, but now - its even more lazy.  Statements are now only prepared if the statements - haven't been previously prepared and a Prepare() function is called (and the - command is associated with a connection) or just prior to the command being - executed. 
-
-

1.0.11 - August 1, 2005
-

-
    -
  • - For everything except the Compact Framework, System.Data.SQLite.DLL is - now the only DLL required to use this provider!  The - assembly is now a multi-module assembly, containing both the native SQLite3 - codebase and the C# classes built on top of it.  The Compact Framework - version (when completed) will not be able to support this feature, so backwards - compatibility with the Compact Framework has been preserved for the future. -
  • - Fixed a bug in SQLiteCommand.ExecuteScalar() that caused it to stop executing - commands once it obtained the first column of the first row-returning - resultset.  Any remaining statements after the row-returning statement was - ignored. -
  • -
-

1.0.10 - June 10, 2005
-

-
    -
  • - Fixed a bug in the SQLite3.cs Prepare() function that created a statement even - when the SQLite engine returned a NULL pointer. Typically this occurs when - multiple statements are processed and there are trailing comments at the end of - the statement. -
  • - Fixed a bug in SQLiteStatement.cs that retrieved parameter names for a - parameterized query.  SQLite's parameters are 1-based, and the function - was starting at 0.  This was fine when all parameters were unnamed, but - for named parameters it caused the parameters to be out of whack. -
  • -
-

1.0.09a - May 25, 2005
-

-
    -
  • - Fixed a broken helpfile and corrected some obsolete help remarks in - SQLiteFunction.cs -
  • - Added a version resource to the SQLite.Interop.DLL. 
-

1.0.09 - May 24, 2005
-

-
    -
  • - Code merge with the latest 3.21 version of SQLite. -
  • - Removed obsolete methods and properties for Whidbey Beta 2
-

1.0.08 Refresh - Mar 24, 2005
-
-

-
    -
  • - Code merge with the latest 3.20 version of SQLite. -
  • - Recompiled the help file to fix a build error in it. -
  • -
-

1.0.08 - Mar 11, 2005
-
-

-
    -
  • - Added additional #if statements to support the old beta 1 edition of VS2005. -
  • - Code merged the SQLite 3.14 source. -
  • -
-

1.0.07 - Mar 5, 2005
-

-
    -
  • - Made more optimizations to frequently-called functions, resulting in - significant performance gains in all tests. -
  • - Recompiled the binaries using the latest VS2005 February CTP, resulting in yet - more significant speed gains.  The 100k insert test used to take 3.5 - seconds and the insertwithidentity took almost 8 seconds.  With the above - two changes, those tests are now executing in 1.9 and 4.9 seconds respectively.
-

1.0.06 - Mar 1, 2005
-
-

-
    -
  • - Speed-ups to SQLiteDataReader.  It was interop'ing unnecessarily every - time it tried to fetch a field due to a logic error. -
  • - Changed/Added some code to SQLiteConvert's internal DbType, Type and - TypeAffinity functions. -
  • - Fixed the SQLiteDataReader to obey the flags set in the optional - CommandBehavior flag from SQLiteCommand.ExecuteReader(). -
  • - Changed the default page size to 1024 to reflect the defaults of SQLite.  - Ignores the "Page Size" connection string option for memory databases, as tests - revealed that changing it resulted in memory corruption errors. -
  • - Performance enhancements to the SQLiteCommand and SQLiteStatement classes which - reduced the 100,000 row insert execution time as well as the various Function - execution times significantly. -
  • -
-

1.0.05 - Feb 25, 2005 -

-
    -
  • - Fixed the SQLite3 C# class step/reset functions to accomodate schema changes - that invalidate a prepared statement.  Statements are recompiled - transparently. -
  • - Moved all native DLL declarations to an UnsafeNativeMethods class. -
  • - Split several classes into their own modules for readability. -
  • - Renamed many internal variables, reviewed access to variables marked as - internal and altered their protection levels accordingly. -
  • - Due to the presence of the altered sqlite3 codebase and so many added interop - functions, I decided to rename the sqlite3 C project and the DLL to - SQLite.Interop.DLL.  This is the same core sqlite3 codebase but designed - specifically for this ADO.NET provider.  This eliminates any possibility - of someone dropping another build of sqlite3.dll into the system and rendering - the provider inoperable.  In the future if the folks at sqlite.org finally - introduce a method of retrieving column usage for an arbitrary prepared - statement, I'll retool this library to be a lightweight function call wrapper - around the core binary distribution. -
  • - Added [SuppressUnmanagedCodeSecurity] attribute to the UnsafeNativeMethods - class which brings VS2005 November CTP execution speeds inline with the - December CTP. -
  • - Added a bin - directory to the project root where pre-compiled binaries can be found. -
  • - Added a doc - directory where preliminary documentation on the class library can be found. -
  • - Documented a lot more of the classes internally. -
  • -
-

1.0.04 - Feb 24, 2005 -

-
    -
  • - Removed the SQLiteContext class and revamped the way UserFunctions work to - simplify the imlementation. -
  • - Fixed a counting bug in the TestCases class, specifically in the function tests - where I wasn't resetting the counter and it was consequently reporting - intrinsic and raw select calls as being much much faster than they actually - were.  The numbers are now much closer to what I expected for performance, - with .NET user-functions still being the slowest, but only by a small margin. -
  • - Small performance tweaks to SQLiteDataReader. -
  • - Added PageSize to the SQLiteConnectionStringBuilder and subsequently to the - SQLiteConnection -
  • - Added a PRAGMA encoding=XXX execution statement to the SQLiteConnection after - opening a connection. -
  • -
-

1.0.03 - Feb 23, 2005 -

-
    -
  • - Fixed up SQLiteCommandBuilder to correct implementation errors, which resulted - in an enormous performance boost in the InsertMany test.   10,000 row - insert that executed in 1500ms now executes in 500ms. -
  • - Fixed several errors in the SQLite3_UTF16 class.  ToString() was working - incorrectly and the Open() method failed to register user defined functions and - collations. -
  • - Fixed a bug in SQLiteCommand.ClearCommands() whereby only the first statement - was being properly cleaned up. -
  • - Fixed a bug in SQLiteDataReader whereby calling NextResult() would not properly - reset the previously-executed command in the sequence. -
  • - Added an InsertManyWithIdentityFetch test, which appends a select clause to - populate the ID of the last inserted row into the InsertCommand, demonstrating - ADO.NET's ability to auto-fetch identity columns on insert. -
  • -
-

1.0.02 - Feb 21, 2005

-
    -
  • - Tweaks to the xxx_interop functions that return char *'s, so they also return - the length.  Saves an interop call to get the UTF-8 string length during - conversion to a .NET string. -
  • - Reworked the whole interop.c thing into interop.h and reduced the code required - to merge the main sqlite3 codebase. -
  • - Added support for user-defined collations. -
  • -
- - + + + + + + + ADO.NET 4.0 SQLite Data Provider
+ Version 1.0.66.1 April 18, 2010
+ Using SQLite 3.7.0.1
+ Written by Robert Simpson (robert@blackcastlesoft.com)
+ Released to the public domain, use at your own risk!
+ Official provider website:  http://sqlite.phxsoftware.com
+
+ The latest version can be downloaded + here +
+
+ +

+ Features:
+

+
    +
  • + Written from scratch on VS2008 specifically for ADO.NET 2.0, implementing all the + base classes and features recently introduced in the framework, including automatic + transaction enlistment.
  • Supports the Full + and Compact .NET Framework, and native C/C++ development.  100% binary + compatible with the original sqlite3.dll.
  • +
  • Full support for Mono via a "managed only" provider that runs against the + official SQLite 3.6.1 or higher library.
  • +
  • Full Entity Framework support (ADO.NET 3.5 SP1)
  • +
  • + On the Compact Framework, it is faster than Sql Server + Mobile. SQLite's installed size is a fraction of Sql Mobile's. It uses less memory at runtime, runs queries faster, and has a smaller database file size as well. +
  • Encrypted database support.  Encrypted databases are fully encrypted and + support both binary and cleartext password types.
  • +
  • + Visual Studio 2005/2008 Design-Time Support, works with all versions of VS2005/2008, + including + all Express Editions of VS2005.  You can add a SQLite + database to the Servers list, design queries with the Query Designer, + drag-and-drop tables onto a Typed DataSet, etc.
  • + Full SQLite schema editing inside Visual Studio.  + You can create/edit tables, views, triggers, indexes, check constraints and foreign keys.
  • + Single file redistributable (except on Compact Framework).  The core sqlite3 codebase and the ADO.NET wrapper + are combined into one multi-module assembly. +
  • + Binaries included for Itanium, x64, x86 and ARM processors.
  • + DbProviderFactory support. +
  • + Full support for ATTACH'ed databases.  Exposed as Catalogs + in the schema.  When cloning a connection, all attached databases are + automatically re-attached to the new connection. +
  • + DbConnection.GetSchema(...) support includes ReservedWords, MetaDataCollections, DataSourceInformation, + DataTypes, Columns, Tables, Views, ViewColumns, Catalogs, Indexes, + IndexColumns, ForeignKeys and Triggers. +
  • + Enhanced DbDataReader.GetSchemaTable() functionality returns catalog, namespace + and detailed schema information even for complex queries. +
  • + Named and unnamed parameters. +
  • + Full UTF-8 and UTF-16 support, each with optimized pipelines into the native + database core. +
  • + Multiple simultaneous DataReaders (one DataReader per Command however). +
  • + Full support for user-defined scalar and aggregate functions, encapsulated into + an easy-to-use base class in which only a couple of overrides are necessary to + implement new SQL functions. +
  • + Full support for user-defined collating sequences, every bit as simple to + implement as user-defined functions and uses the same base class. +
  • + Full source for the entire engine and wrapper.  No copyrights.  + Public Domain.  100% free for commercial and non-commercial use. 
+ +

+ Design-Time Support

+

+ In Windows Explorer, navigate to the SQLite.NET\bin\Designer + folder and execute the INSTALL.EXE + file.  The program will + automatically detect what version(s) of Visual Studio 2005/2008 are installed and allow + you to selectively install and uninstall the designer for each edition.

+

DbFactory Support (Non-Compact Framework)

+ In order to use the SQLiteFactory and have the SQLite data provider enumerated + in the DbProviderFactories methods, you must add the following segment into your application's app.config file:
+
+
<configuration>
+  <system.data>
+    <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" /> + </DbProviderFactories> + </system.data> +</configuration> +
+

See the help documentation for further details on implementing both version-specific (GAC enabled) and version independent DBProviderFactories support. +

+

+ Compiling for the Compact Framework

+

+ Just change the target platform from Win32 to Compact Framework and + recompile.  The Compact Framework has no support for enumerating + attributes in an assembly, therefore all user-defined collating sequences and + functions must be explicitly registered.  See the testce + sample application for an example of how to explicitly register user-defined + collating sequences and functions.

+

+ Distributing The SQLite Engine and ADO.NET Assembly

+

+ On the desktop, only the System.Data.SQLite.DLL file needs to be distributed with your + application(s).  This DLL contains both the managed wrapper and the native + SQLite3 codebase.  For the Compact Framework, you will have to distribute + both the CF version of System.Data.SQLite.DLL, as well as the + SQLite.Interop.XXX.DLL.  This is a breaking change as of 1.0.59.0.  + Recent Windows Mobile frameworks are not supporting the mixed CF assembly I was + building prior to this version.

+

Development Notes Regarding the SQLite 3 Source Code

+

+ The core sqlite engine is compiled directly from the unmodified source code available + at the sqlite.org website.  Several additional pieces are compiled on top of + it to extend its functionality, but the core engine's source is not changed.

+

+

+ Version History

+

1.0.67.0 - August X, 2010

+
    +
  • Code merge with SQLite 3.7.0.1
  • +
  • Re-enabled VS2005 designer support, broken in previous versions during the 2008 transition
  • +
  • Implemented new forms of Take/Skip in the EF framework courtesy jlsantiago
  • +
  • Added "Foreign Keys" to the connection string parameters
  • +
  • Added the Truncate option to the Journal Modes enumeration
  • +
+

1.0.66.0 - April 18, 2010

+
    +
  • Code merge with SQLite 3.6.23.1
  • +
  • Fixed a bug in the installer that accidentally modified the machine.config on .NET versions prior to 2.0, invaliding the config file.
  • +
  • Fixed INTERSECT and EXCEPT union query generation in EF
  • +
  • Fixed an out of memory error in the trigger designer in cases where a WHEN clause is used in the trigger
  • +
+

1.0.65.0 - July 26, 2009

+
    +
  • Fixed a bug in the encryption module to prevent a double free() when rekeying a database.
  • +
  • Fixed a bug in the encryption module when ATTACHing an encrypted database.
  • +
  • Incorporated the WinCE locking fix from ticket + #3991
  • +
  • Added "bigint" to the dropdown in the table designer, plus other minor table + designer bugfixes.
  • +
+

1.0.64.0 - July 9, 2009

+
    +
  • Fixed the missing resources problem from the 63 release.
  • +
  • Added preliminary support for the Visual Studio 2010 beta.
  • +
  • Fixed a bug in SQLiteCommand that threw a null reference exception when + setting the Transaction object to null.
  • +
  • If SQLiteConnection.EnlistTransaction is called multiple times for the same + transaction scope, just return without throwing an error.
  • +
+

1.0.63.0 - June 29, 2009

+
    +
  • Code merge with SQLite 3.6.16
  • +
  • Check the autocommit mode of the connection to which a transaction is bound + during the disposal of the transaction.  If autocommit is enabled, then the + database has already rolled back the transaction and we don't need to do it + during dispose, and can quietly ignore the step without throwing an error.
  • +
  • Eliminated the mergebin step altogether.  It was developed primarily to + merge the Compact Framework binaries together, but since we're not doing that + anymore, its use is limited.  Its non-standard method of merging a binary + on the desktop framework is redundant as well.  The desktop binary now + hard-links to MSCOREE, but as of Windows XP, this was redundant as well since XP + and beyond automatically attempt to load MSCOREE on startup when a DLL has a + .NET header.
  • +
  • More improvements to the test.exe program for running the tests against Sql + Server for comparison purposes.
  • +
+

1.0.62.0 - June 19, 2009

+
    +
  • Code merge with SQLite 3.6.15
  • +
  • Fixed the decimal reading bug in the SQLiteDataReader
  • +
  • Changed Join()'s to Sleep()'s in the statement retry code to prevent message + pumping
  • +
  • Fixed a bad pointer conversion when retrieving blobs using GetBytes() in + 64-bit land
  • +
  • Several changes to the Test program that comes with the provider.  Tests + can now be individually disabled, and the test program can run against several + provider back-ends
  • +
+

1.0.61.0 - April 28, 2009

+
    +
  • Code merge with SQLite 3.6.13. The new backup features are as yet unimplemented in the provider, but will be forthcoming in a subsequent release
  • +
  • Fixed the default-value lookups in SQLiteConnectionStringBuilder when accessing properties
  • +
  • Lock the SQLiteTransaction object during dispose to avoid potential race condition during cleanup
  • +
  • Fixed SQLiteDataReader.GetDecimal() processing and parsing of decimal values for cases when SQLite returns things like "1.0e-05" instead of "0.0001"
  • +
+

1.0.60.0 - October 3, 2008

+
    +
  • Throw a NotSupported exception in the EF Sql Gen code instead of parsing + illegal SQL during an update/insert/delete where no primary key is defined.
  • +
  • Fixed the Compact Framework interop library.  Since the linker flag + /subsystem had no version specified, it was causing a problem for many CE-based + platforms.
  • +
  • Incorporated SQLite patch for ticket + #3387 and reverted + out the vfs override code I added in build 59 to work around this problem.
  • +
  • Fixed a designer issue when creating a new table from the Server Explorer.  + After initially saving it, if you then continued to edit it and tried to save it + again, it would generate the change SQL using the old temporary table name + rather than the new name.
  • +
+

1.0.59.0 - September 22, 2008

+
    +
  • Code merge with SQLite 3.6.3.  Solves + a couple different EF issues that were either giving inconsistent results or + crashing the engine.
  • +
  • Fixed the parsing of literal binaries in the EF SqlGen code.  SQLite now + passes nearly all the testcases in + Microsoft's EF Query Samples application -- + the exception being the datetimeoffset and time constants tests, and tests + that use the APPLY keyword which are unsupported for now.
  • +
  • Revamped the Compact Framework mixed-mode assembly.  Tired of playing cat + and mouse with the Compact Framework's support for mixed-mode assemblies.  + The CF build now requires that you distribute both the System.Data.SQLite + library and the paired SQLite.Interop.XXX library.   The XXX denotes + the build number of the library.
  • +
  • Implemented a workaround for Vista's overzealous caching by turning off + FILE_FLAG_RANDOM_ACCESS for OS versions above XP.  This is implemented + as a custom (default override) VFS in the interop.c file, so no changes are made + to the SQLite source code.
  • +
  • Fixed some registry issues in the designer install.exe, which prevented some + design-time stuff from working on the Compact Framework when .NET 3.5 was + installed.
  • +
+

1.0.58.0 - August 30, 2008

+
    +
  • Code merge with SQLite 3.6.2.  If only I'd waited one more day to release + 57!  Several LINQ issues have been resolved with this engine release + relating to deeply-nested subqueries that the EF SqlGen creates.
  • +
  • The Rollback SQLiteConnection event no longer requires an open connection in + order to subscribe to it.  Missed this one in the 57 release.
  • +
+

1.0.57.0 - August 29, 2008

+
    +
  • Compiled against 3.6.1 with checkin + #3300 resolved, + which fixes an Entity Framework bug I was seeing.  I currently have 3 other + tickets out on the engine, which are not yet resolved and relate to EF.
  • +
  • Fixed decimal types to store and fetch using InvariantCulture.  If you're + using decimal datatypes in your database and were affected by the 56 release, + please issue an UPDATE <table> SET <column> = REPLACE(<column>, ',', '.');  + to fix the decimal separators.  Apologies for not testing that more + thoroughly before releasing 56.
  • +
  • Too many LINQ fixes to list.  Fixed views so they generate, + fixed the LIMIT clause, implemented additional functionality and removed unnecessary code.
  • +
  • Fixed foreign key names in the designer so viewing the SQL script on a new + unsaved table after renaming it in the properties toolwindow will reflect in the + script properly.
  • +
  • Fixed the Update and Commit events on SQLiteConnection so they don't require + the connection to be opened first.
  • +
  • Fixed userdef aggregate functions so they play nice with each other when + appearing multiple times in the same statement.
  • +
  • Fixed the editing and saving of default values in the table designer.
  • +
  • Fixed ForeignKeys schema to support multi-column foreign keys.  Also + hacked support for them in the table designer, provided two foreign keys in the + designer have the same name and reference the same foreign table and different + columns.  Will implement first-class support for this in the next release.
  • +
+

1.0.56.0 - August 11, 2008

+
    +
  • Fixed a bug in the table designer when designing new tables, wherein you had to + save the table first before being able to create indexes and foreign keys.
  • +
  • Tweaks to decimal type handling.  The 'decimal' type can't be represented + by Int64 or Double (without loss of precision) in SQLite, so we have to fudge it + by treating it like a string and converting it back and forth in the provider.  + Unfortunately backing it to the db as a string causes sorting problems.  + See this + post + for details on using a custom collation sequence to overcome the sorting issue arising from this patch.
  • +
  • Minor tweaks and bugfixes to the test program and the provider.
  • +
  • More adjustments to make the managed-only version of the provider run and pass + all tests on Mono.
  • +
  • LINQ to Entities bits heavily updated and compiled against VS2008 SP1 RTM.  SQLite + LINQ support is still considered beta.
  • +
+

1.0.55.0 - August 6, 2008

+
    +
  • Code merge with SQLite 3.6.1
  • +
  • Added support for the user-contributed extension-functions at + http://www.sqlite.org/contrib.  + Feel free to override any of them with your own implementation.  The new + functions are: acos, asin, atan, atn2, atan2, acosh, asinh, atanh, + difference, degrees, radians, cos, sin, tan, cot, cosh, sinh, tanh, coth, exp, + log, log10, power, sign, sqrt, square, ceil, floor, pi, replicate, charindex, + leftstr, rightstr, reverse, proper, padl, padr, padc, strfilter, and + aggregates stdev, variance, mode, median, lower_quartile, upper_quartile.
  • +
  • Moved the last_rows_affected() function to the C extension library.
  • +
  • Added a new class, SQLiteFunctionEx which extends SQLiteFunction and adds the + ability for a user-defined function to get the collating sequence during the + Invoke/Step methods.  User-defined functions can use the collating sequence + as a helper to compare values.
  • +
  • When registering user-defined collation sequences and functions, the provider + will now register both a UTF8 and a UTF16 version instead of just UTF8.
  • +
  • Revamped connection pooling and added static ClearPool() and ClearAllPools() + functions to SQLiteConnection.  Behavior of the pool and its clearing + mechanics match SqlClient.
  • +
  • Fixed connections going to the pool so that any unfinalized lingering commands + from un-collected datareaders are automatically reset and any lurking + transactions made on the connection are rolled back.
  • +
  • Transaction isolation levels are now partially supported.  Serializable + is the default, which obtains read/write locks immediately -- this is compatible + with previous releases of the provider.  Unspecified will default to + whatever the default isolation mode is set to, and ReadCommitted will cause a + deferred lock to be obtained.  No other values are legal.
  • +
  • Revamped the test.exe program.  It's now an interactive GUI application.  + Easier for me to add tests now.
  • +
  • Tweaks to the VS designer package and installer.
  • +
  • More adjustments to the internal SQLite3.Prepare() method to account for both + kinds of lock errors when retrying.
  • +
  • Stripped a lot of unnecessary interop() calls and replaced with base sqlite calls.  + Revamped most of UnsafeNativeMethods to make it easier to port the code.
  • +
  • Rerigged internal callbacks for userdef functions and other native to managed + callbacks.  More portable this way.
  • +
  • Source can now can be compiled with the SQLITE_STANDARD preprocessor symbol to + force the wrapper to use the stock sqlite3 library.  Some functionality is + missing, but its minimal.  None of the precompiled binaries are compiled + using this setting, but its useful for testing portability.
  • +
  • Added "boolean" and a couple other missing datatypes to the "DataTypes" schema + xml file.  Used by the VS designer when displaying tables and querying.
  • +
  • Added a new connection string option "Read Only".  When set to True, the + database will be opened in read-only mode.
  • +
  • Added a new connection string option "Max Pool Size" to set the maximum size + of the connection pool for a given db file connection.
  • +
  • Added a new connection string option "Default IsolationLevel" to set the + default isolation level of transactions.  Possible values are Serializable and + ReadCommitted.
  • +
  • Added a new connection string option "URI" as an optional parameter for + compatibility with other ports of the provider.
  • +
+

1.0.54.0 - July 25, 2008

+
    +
  • Fixed the setup project, which somehow "forgot" to include all the binaries in + the 53 release.
  • +
  • Fixed a crash in the table designer when creating a new table and tabbing past + the "Allow Nulls" cell in the grid while creating a new column.
  • +
  • Fixed a mostly-benign bug in SQLiteDataReader's GetEnumerator, which failed to + pass along a flag to the underyling DbEnumerator it creates.  This one's + been around since day 1 and nobody's noticed it in all these years.
  • +
  • Added a new connection string parameter "Journal Mode" that allows you to set + the SQLite journal mode to Delete, Persist or Off.
  • +
+

1.0.53.0 - July 24, 2008

+
    +
  • Enabled sqlite_load_extension
  • +
  • Added retry/timeout code to SQLite3.Prepare() when preparing statements for + execution and a SQLITE_BUSY error occurs.
  • +
  • Added a new schema to SQLiteConnection.GetSchema() called Triggers.  + Used to retrieve the trigger(s) associated with a database and/or table/view.
  • +
  • Extensive updates to table/view editing capabilities inside Visual Studio's + Server Explorer.  The program now parses and lets you edit CHECK constraints and + triggers on a table, as well as define triggers on views.  Experimental + still, so e-mail me if you have issues.
  • +
  • Minor bugfix to the ViewColumns schema to return the proper base column name + for a view that aliases a column.
  • +
  • Fixed the insert/update/delete DML support in the Linq module.
  • +
  • Changed the behavior of SQLiteCommand to allow a transaction to be set even if + the command hasn't been associated with a connection yet.
  • +
+

1.0.52.0 - July 16, 2008

+
    +
  • Code merge with SQLite 3.6.0
  • +
  • Added a lot of previously-missing exports to the DEF file for the + native library.
  • +
  • Fixed SQLiteDataReader to check for an invalid connection before operating on + an open cursor.
  • +
  • Implemented the Cancel() function of SQLiteCommand to cancel an active reader.
  • +
  • Added beta table and view designers to the Visual Studio Server Explorer.  You can now + edit/create tables and views, manage indexes and foreign keys from Visual Studio.  + This feature is still undergoing testing so use at your own risk!
  • +
  • Fixed the Server Explorer so VS2005 users can once again right-click tables + and views and open the table data.
  • +
  • Added some new interop code to assist in returning more metadata not normally + available through the SQLite API.  Specifically, index column sort modes + and collating sequences.  Also added code to detect (but not parse) CHECK + constraints, so the table designer can pop up a warning when editing a table + with these constraints.  Since I can't currently parse them.
  • +
  • Lots of LINQ SQL generation improvements and fixes.
  • +
  • Made some progress cleaning up and fixing up the schema definitions and + manifests for EdmGen.
  • +
  • Added a built-in SQLiteFunction called last_rows_affected() which can be + called from SQL to get the number of rows affected by the last update/insert + operation on the connection.  This is roughly equivalent to Sql Server's + @@ROWCOUNT variable.
  • +
+

1.0.51.0 - July 1, 2008

+
    +
  • VS2008 SP1 Beta1 LINQ Support
  • +
  • Added experimental Entity Framework support in a new library, + System.Data.SQLite.Linq.  Some things work, some don't.  I haven't + finished rigging everything up yet.  The core library remains stable.  + All LINQ-specific code is completely separate from the core.
  • +
  • Added some columns to several existing schemas to support some of the + EDM framework stuff.
  • +
  • Minor tweaks to the factory to better support dynamic loading of the Linq + extension library for SQLite.
  • +
  • SQLite's busy handler was interfering with the provider's busy handling + mechanism, so its been disabled.
  • +
+

1.0.50.0 - June 27, 2008

+
    +
  • Fixed some lingering dispose issues and race conditions when some objects were finalized.
  • +
  • Fixed the SQLiteConvert.Split() routine to be a little smarter when splitting + strings, which solves the quoted data source filename problem.
  • +
  • Enhanced the mergebin utility to work around the strong name validation bug on + the Compact Framework.  The old workaround kludged the DLL and caused WM6.1 + to fail to load it.  This new solution is permanent and no longer kludges + the DLL.
  • +
+

1.0.49.0 - May 28, 2008

+
    +
  • Code merge with SQLite 3.5.9
  • +
  • Fixed schema problems when querying the TEMP catalog.
  • +
  • Changed BLOB datatype schema to return IsLong = False instead of True.  This + was preventing DbCommandBuilder from using GUID's and BLOB's as primary keys.
  • +
  • Fix rollover issue with SQLite3.Reset() using TickCount.
  • +
  • Fixed SQLiteDataReader to dispose of its command (if called for) before + closing the connection (when flagged to do so) instead of the other way around.
  • +
  • Fixed a DbNull error when retrieving items not backed by a table schema.
  • +
  • Fixed foreign key constraint parsing bug.
  • +
  • Added FailIfMissing property to the SQLiteConnectionStringBuilder.
  • +
  • Converted the source projects to Visual Studio 2008.
  • +
+

1.0.48.0 - December 28, 2007

+
    +
  • Code merge with SQLite 3.5.4
  • +
  • Calling SQLiteDataReader.GetFieldType() on a column with no schema information + and whos first row is initially NULL now returns type Object instead of type DbNull.
  • +
  • Added support for a new DateTime type, JulianDay.  SQLite uses Julian dates + internally.
  • +
  • Added a new connection string parameter "Default Timeout" and a corresponding + method on the SQLiteConnection object to change the default command timeout.  + This is especially useful for changing the timeout on transactions, which use SQLiteCommand + objects internally and have no ADO.NET-friendly way to adjust the command timeout + on those commands.
  • +
  • FTS1 and FTS2 modules were removed from the codebase.  Please upgrade all + full-text indexes to use the FTS3 module. 
  • +
+

1.0.47.2 - December 10, 2007

+
    +
  • Fixed yet one more bug when closing a database with unfinalized command objects
  • +
  • Fixed the DataReader's GetFieldType function when dealing with untyped SQLite affinities
  • +
+

1.0.47.1 - December 5, 2007

+
    +
  • Fixed a leftover bug from the codemerge with SQLite 3.5.3 that failed to close a database.
  • +
  • Fixed the broken Compact Framework distribution binary.
  • +
  • SQLite 3.5.x changed some internal infrastructure pieces in the encryption interface + which I didn't catch initially.  Fixed. 
  • +
+

1.0.47.0 - December 4, 2007

+
    +
  • Code merge with SQLite 3.5.3
  • +
  • Added installer support for Visual Studio 2008.  Code is still using the + VS2005 SDK so one or two bells and whistles are missing, but nothing significant.
  • +
  • This is the last version that the FTS1 and FTS2 extensions will appear.  + Everyone should rebuild their fulltext indexes using the new FTS3 module.  + FTS1 and FTS2 suffer from a design flaw that could cause database corruption with + certain vacuum operations.
  • +
  • Fixed pooled connections so they rollback any outstanding transactions before + going to the pool. 
  • +
  • Fixed the unintended breaking of the TYPES keyword, and mis-typing of untyped + or indeterminate column types.
  • +
  • Assert a FileIOPermission() requirement in the static SQLiteFunction constructor. +
  • +
  • The CE-only SQLiteFunction.RegisterFunction() is now available on the desktop + platform for dynamic registration of functions.  You must still close and re-open + a connection in order for the new function to be seen by a connection.
  • +
  • Fixed the "database is locked" errors by implementing behavioral changes in the + interop.c file for SQLite.  Closing a database force-finalizes any prepared + statements on the database to ensure the connection is fully closed.  This + was rather tricky because the GC thread could still be finalizing statements itself. +  
  • +
  • Modifed the mergebin utility to help circumvent a long-standing strong name verification + bug in the Compact Framework.
  • +
+

1.0.46.0 - September 30, 2007

+
    +
  • Fixed faulty logic in type discovery code when using SQLiteDataReader.GetValue().
  • +
  • Fixed Connection.Open() bug when dealing with :memory: databases.
  • +
  • Fixed SQLiteCommand.ExecuteScalar() to return a properly-typed value.
  • +
  • Added support for SQLiteParameter.ResetDbType().
  • +
  • Added test cases for rigid and flexible type testing.
  • +
+

1.0.45.0 - September 25, 2007

+
    +
  • Breaking change in GetSchema("Indexes") -- MetaDataCollections + restrictions and identifier parts counts were wrong for this schema and I was using + the wrong final parameter as the final restriction.  Meaning, if you use the + Indexes schema and are querying for a specific index the array should now be {catalog, + null, table, index } instead of {catalog, null, table, null, index}
  • +
  • Code merge with SQLite 3.4.2
  • +
  • Fixed some errors in the encryption module, most notably when a non-default page + size is specified in the connection string.
  • +
  • Fixed SQLiteDataReader to better handle type-less usage scenarios, which also + fixes problems with null values and datetimes.
  • +
  • Fixed the leftover temp files problem on WinCE
  • +
  • Added connection pooling.  The default is disabled for now, but may change + in the future.  Set "Pooling=True" in the connection string to enable it.
  • +
  • Sped up SQLiteConnection.Open() considerably.
  • +
  • Added some more robust cleanup code regarding SQLiteFunctions.
  • +
  • Minor additions to the code to allow for future LINQ integration into the main + codebase.
  • +
  • Fixed a long-standing bug in the Open() command of SQLiteConnection which failed + to honor the documented default behavior of the SQLite.NET provider to open the + database in "Synchronous=Normal" mode.  The default was "Full".
  • +
  • If Open() fails, it no longer sets the connection state to Broken.  It instead + reverts back to Closed, and cleans up after itself.
  • +
  • Added several new parameters to the ConnectionString for setting max page count, + legacy file format, and another called FailIfMissing to raise an error rather than + create the database file automatically if it does not already exist.
  • +
  • Fixed some designer toolbox references to the wrong version of the SQLite.Designer
  • +
  • Fixed a bug in the mergebin utility with regards to COR20 metadata rowsize computations.  +
  • +
  • Minor documentation corrections   
  • +
+

1.0.44.0 - July 21, 2007

+
    +
  • Code merge with SQLite 3.4.1
  • +
  • Fixed a bug in SQLiteConnection.Open() which threw the wrong kind of error in + the wrong kind of way when a database file could not be opened or created. 
  • +
  • Small enhancements to the TYPES keyword, and added documentation for it in the + help file.
  • +
  • Hopefully fixed the occasional SQLITE_BUSY errors that cropped up when starting + a transaction.  Usually occurred in high-contention scenarios, and the underlying + SQLite engine bypasses the busy handler in this scenario to return immediately.
  • +
+

1.0.43.0 - June 21, 2007

+
    +
  • Code merge with SQLite 3.4.0
  • +
  • Fixed a reuse bug in the SQLiteDataAdapter in conjunction with the SQLiteCommandBuilder.  + It's been there unnoticed for more than a year, so it looks like most folks never + encountered it.
  • +
  • Fixed an event handler bug in SQLiteCommandBuilder in which it could fail to unlatch + from the DataAdapter when reused.  Relates to the previous bugfix.
  • +
  • Fixed a double-dispose bug in SQLiteStatement that triggered a SQLiteException. 
  • +
+

1.0.42.0 - June 1, 2007

+
    +
  • Code merge with SQLite 3.3.17
  • +
  • Changed the SQLiteFunction static constructor so it only enumerates loaded modules + that have referenced the SQLite assembly, which hopefully should cut down dramatically + the time it takes for that function to execute. 
  • +
  • Added the FTS2 full-text search extension to the project.  Look for FTS1 + to disappear within the next couple of revisions. 
  • +
  • Fixed a bug introduced with the finalizers that triggered an error when statements + ended with a semi-colon or had other non-parsable comments at the end of a statement 
  • +
  • Fixed an intermittent multi-threaded race condition between the garbage collector + thread and the main application thread which lead to an occasional SQLITE_MISUSE + error.
  • +
  • Fixed another issue relating to SQLite's inherent typelessness when dealing with + aggregate functions which could return Int64 or Double or even String for a given + row depending on what was aggregated.
  • +
  • Remembered to recompile the DDEX portion of the engine this time, so Compact Framework + users can once again use the design-time functionality
  • +
+

1.0.41.0 - April 23, 2007

+
    +
  • Code merge with SQLite 3.3.16
  • +
  • Second go at implementing proper finalizers to cleanup after folks who've forgotten to Dispose() of the SQLite objects
  • +
  • Enhanced GetSchema(IndexColumns) to provide numeric scale and precision values
  • +
  • Fixed the column ordinals in GetSchema(IndexColumns) to report the ordinal of the column in the index, not the table
  • +
  • Fixed a bug whereby parameters named with an empty string (such as String.Empty) were treated like a named parameter instead of an unnamed parameter
  • +
+

1.0.40.0 - January 31, 2007

+
    +
  • Code merge with SQLite 3.3.12
  • +
  • Lots of new code to handle misuse of the library.  Implemented finalizers + where it made sense, fixed numerous garbage collector issues when objects are not + disposed properly,  fixed some object lifetime issues, etc.
  • +
  • A failed Commit() on a transaction no longer leaves the transaction in an unusable + state.
  • +
+

1.0.39.1 - January 11, 2007

+
    +
  • Fixed a really dumb mistake that for some reason didn't trigger any errors in + the testcases, whereby commands when associated with a connection were not adding + or removing themselves from an internal list of commands for that connection -- + causing a "database is locked" error when trying to close the connection.
  • +
+

1.0.39.0 - January 10, 2007

+
    +
  • Code merge with SQLite 3.3.10
  • +
  • Fixed a multi-threaded race condition bug in the garbage collector when commands + and/or connections are not properly disposed by the user.
  • +
  • Switched the encryption's internal deallocation code to use sqlite's built-in + aux functions instead of modifying the pager.c source to free the crypt block.  + This eliminates the last of the code changes the provider makes to the original + sqlite engine sources.  Props to Ralf Junker for pointing that out.
  • +
+

1.0.38.0 - November 22, 2006

+
    +
  • Fixed a bug when using CommandBehavior.KeyInfo whereby integer primary key columns may be duplicated in the results.
  • +
  • Enhanced the CommandBuilder so that update/delete statements are optimized when the affected table contains unique constraints and + a primary key is present.
  • +
  • Fixed a bug in the DataReader when used in conjunction with CommandBehavior.CloseConnection.
+

1.0.37.0 - November 19, 2006

+
    +
  • Added support for CommandBehavior.KeyInfo.  + When specified in a query, additional column(s) will be returned describing the + key(s) defined for the table(s) selected in the query.  This is optimized when + INTEGER PRIMARY KEY is set for the given tables, but does additional work for other + kinds of primary keys.
  • +
  • Removed the default values from SQLiteDataReader.GetTableSchema(), to better follow + Sql Server's pattern and suppress schema errors when loading the records into a + dataset/datatable.
  • +
  • Allow integers to implicitly convert to double/decimal/single.
+

1.0.36.1 - October 25, 2006

+
    +
  • Added support for LONGVARCHAR, SMALLDATE and SMALLDATETIME. These were actually added in 1.0.36.0 but were undocumented.
  • +
  • Fixed the embedded helpfile which was accidentally built from old sources.
  • +
  • Fixed an unfortunate re-entry of a bug in the .36 codebase that caused the provider to "forget" about commands on a connection under certain circumstances.
  • +
+

1.0.36.0 - October 23, 2006

+
    +
  • Code merge with SQLite 3.3.8, including support for full-text search via the FTS1 + extension. 
  • Fixed a bug retrieving data types when UseUtf16Encoding is true. Side-effect of further merging the common code between the two base classes.
  • +
  • Fixed a bug with System.Transactions whereby a connection closed/disposed within + a transaction scope is rolled back and cannot be committed.
  • +
  • Added more error checking and reporting to transactions to help user's isolate + the source of transaction failures.
  • +
  • Implemented a workaround for a Compact Framework issue regarding strong-named + assemblies containing a PE section with a raw size less than the virtual size. 
  • +
+

1.0.35.1 - September 12, 2006

+
    +
  • Fixed the TYPES keyword to work when UseUTF16Encoding is true.
  • +
  • Fix another bug revealed in 1.0.35.0 regarding infinite loops when the 2nd or subsequent statements of a semi-colon separated command cannot be parsed.
  • +
  • Updated the help documentation. 
  • +
+

1.0.35.0 - September 10, 2006

+
    +
  • Fixed an infinite loop bug in SQLiteCommand caused when multiple semi-colon separated + statements in a single command are executed via datareader and one of the statements + contains a syntax error preventing it from being prepared. 
  • Added the TYPES preparser keyword to be placed before a SELECT statement to + aid the wrapper in converting expressions in a subsequent select clause into more + robust types.  Documentation yet to be integrated, but available on the forums.
  • +
  • Added a new connectionstring parameter "BinaryGUID=true/false" (default is "true").  + When true, guid types are stored in the database as binary blobs to save space.  + Binary has been the default format since 1.0.32.0 but this parameter eases backward + compatibility.
  • +
+

1.0.34.0 - September 4, 2006

+
    +
  • Fixed a bug in SQLiteParameterCollection.RemoveAt(namedparam)
  • +
  • Fixed a bug in SQLiteDataReader introduced in 1.0.30 that broke DateTimes using the Ticks option in the connection string.
  • +
  • Fixed a bug in the recent changes to guid behavior wherein using a datareader's + indexer to fetch a guid from a column containing both binary and text guids would + sometimes return a byte array instead of a guid.
  • +
  • Enacted a workaround involving typed datasets in Compact Framework projects in + which it took an excessive amount of time to open a form and generated a lot of + temporary files in the user's Local Settings\Application Data\Microsoft\VisualStudio\8.0\Assembly + References folder.
  • +
+

1.0.33.0 - August 21, 2006

+
    +
  • Code merge with SQLite 3.3.7
  • +
  • Fixed a bug in SQLiteConnection that caused it to "forget" about commands bound + to it and occasionally throw an error when a database is closed and opened repeatedly.  +
  • +
+

1.0.32.0 - August 6, 2006

+
    +
  • Added AllowPartiallyTrustedCallers attribute to the assembly
  • Added the missing "nchar" type
  • +
  • Added support for binary Guid's.  Guids are now stored as binary by default + when using parameterized queries.  Text guids are still fully supported.
  • +
  • Fixed a TransactionScope() error that caused the transaction not to be completed.
  • +
  • Enhanced parameter names so that if they are added to the Parameters collection + without their prefix character (@ : or $) they are still properly mapped. 
  • +
+

1.0.31.0 - July 16, 2006

+
    +
  • Re-applied the view parsing bugfix in 1.0.29.0 that was accidentally reverted + out of the 30 build.
  • Fixed SQLiteCommand.ExecuteScalar() to return null instead of DbNull.Value + when no rows were returned.
  • +
  • Design-time installer now installs the package-based designer on full Visual Studio + versions.  Express editions continue to use the packageless designer.
  • +
  • In Visual Studio (not Express), you can now right-click a SQLite connection in + the Server Explorer and vacuum the database and change the encryption password.
  • +
+

1.0.30.1 - July 2, 2006

+
    +
  • Code merge with SQLite 3.3.6
  • +
  • Added support for the |DataDirectory| keyword in the Data Source filename string.  +
  • +
  • Added hook notification support to SQLiteConnection.  Specifically, there + are three new events on the SQLiteConnection object which are raised when an update/insert/delete + occurs and when transactions are committed and rolled back.
  • Changed SQLiteTransaction to default to BEGIN IMMEDIATE instead of just BEGIN, + which solves a multithreaded race condition. 
  • +
  • Changed SQLiteDataReader to better support SQLite's typelessness.  The data + reader no longer caches column affinity, but re-evaluates it for each column/row.
  • +
  • Fixed a bug in Prepare() which caused an intermittant fault due to the code accessing + the memory of an unpinned variable. 
  • +
  • Fixed a multithreaded lock-retry bug in in SQLiteConnection.Open() and in + SQLiteTransaction, which failed to use a command timeout before giving up.
  • +
+

1.0.29.0 - May 16, 2006

+
    +
  • Fixed a bug in the Views schema information which caused multi-line view definition statements not to be parsed
  • +
  • Fixed a parsing bug in SQLiteDataReader.GetSchemaTable() to account for numeric(x,y) datatypes with specified precision and scale
  • +
  • Fixed a bug in SQLiteConnection.Open() which tried to automatically enlist in an ambient transaction but had not yet set the state of the database to Opened, thereby causing a transaction fault
  • +
  • Changed SQLiteException to inherit from DbException on the full framework
  • +
+

1.0.28.0 - April 14, 2006

+
    +
  • Code merge with SQLite 3.3.5
  • +
  • You can now specify a relative path in the Compact Framework's "Data Source" by + prefixing the file with ".\".  i.e. "Data Source=.\\mydb.db3"
  • +
  • Several more changes and enhancements to schemas for better compatibility.
  • +
  • Fixed several bugs with the 64-bit builds of the provider.  The x64 binary + is now optimized.
  • +
  • Design-time installer now tries to install the 64-bit builds into the GAC along + with the 32-bit build.
  • +
  • Fixed a bug in the SQLiteDataReader.GetSchemaTable() function when used with tables + containing apostrophes.
  • +
  • Fixed an XSD-related bug whereby the XSD utility was unable to locate the provider + and could not generate typed datasets.
  • +
  • Added NTEXT and STRING datatypes to the list of recognized keywords (used for + schema retrieval).
  • +
  • Due to the XSD bug and other potential problems related to external build utilities, + changes to the installation of the designer have had to be made.  The installer + used to write the DbProviderFactories XML into the devenv.exe.config file and its + express cousins, but now has to write instead to the machine.config.
  • +
  • Installer writes to both the 32-bit machine.config and the 64-bit machine.config + if it exists. 
  • +
+

1.0.27.1 - February 28, 2006

+
    +
  • Fixed a bug when doing data binding in Compact Framework projects that prevented + you from assigning a typed dataset to a bindingsource.  It turns out, the CF + version of the SQLite provider needs to be flagged as retargetable so it'll work + in the design-time desktop environment.  No changes were made to the desktop + build, but the revision was bumped on all libraries anyway in order to keep them + sync'd. 
+

1.0.27.0 - February 27, 2006

+
    +
  • Many optimizations and a few more minor adjustments to schemas and schema retrieval + performance.
  • +
  • Lots of design-time attributes added to the code.  The DbDataAdapter, DbCommand, + and DbConnection objects now have greatly enhanced design-time capabilities when + added to the toolbox and dropped on a form.
  • +
  • Lots of Server Explorer enhancements.
  • +
  • Binaries are now distributed in a setup program for easier administration and + configuration of the provider.
  • +
+

1.0.26.2 - February 15, 2006

+
    +
  • Yet another bugfix to index schemas, which was incorrectly marking most indexes + as primary key indexes.
  • Fixed GetSchema() to accept a null string array.
  • Fixed a misspelled export in the core C library that prevented databases opened + with UTF16Encoding from getting schema information and would likely cause an error + if attempted.
+

1.0.26.1 - February 14, 2006

+
    +
  • Fixed even more minor schema bugs having to do with indexes.
  • Added two missing pieces in the SQLite designer which were preventing it from + being used from within VS Express editions. 
  • Several bugfixes to the design-time installer program, including supporting + 64-bit environments.
+

1.0.26.0 - February 11, 2006

+
    +
  • Code merge with SQLite 3.3.4
  • Fixed an encryption bug when changing the password of databases over 1gb in + size. 
  • Fixed various designer issues related to construction of named parameters.
  • +
  • Retooled the GetSchema() method of SQLiteDataReader to use the new 3.3.4 API functions, + and made several enhancements and fixes to schemas. 
  • +
  • Implemented the SourceColumnNullMapping property of SQLiteParameter to fix + a DbCommandBuilder code generation bug. 
  • Removed the runtime dependency on MSVCR80.DLL.  File size is somewhat + larger for the varying desktop versions.
  • Created an install program to manage installation and uninstallation of the + SQLite design-time support.
  • +
  • Designer support now works for all Visual Studio editions, including all Express + Editions.
  • +
  • Design-time installer will now remove (if present) the machine.config SQLite entries + in favor of installing the xml code into the devenv.exe.config file (or any of the + variations for express editions).  The officially-accepted behavior of using + DbProviderFactories is to add the code to your app.config file, and the machine.config + file should not be touched.
  • +
+

1.0.25.0 - January 31, 2006

+
    +
  • Code merge with SQLite 3.3.3
  • Added automatic distributed transaction enlistment and implemented the DbConnection.EnlistTransaction + method for manual enlistment.
  • +
  • Nested transactions are now supported.
  • +
  • Rearranged the timing of SetPassword(), which now must be called before the database + is opened instead of afterwards.  Optionally, the password can be supplied + in the ConnectionString.
  • +
  • Fixed a bug in SQLiteFunction that caused a failure when an empty resultset was + returned and a custom user aggregate function was used in the query.
  • +
  • The designer has had another round of cleanup applied, in preparation for moving + to a VS package.
  • +
  • Added SQLiteMetaDataCollectionNames class.
  • +
+

1.0.24.6 beta - January 23, 2006

+
    +
  • This beta is built from sqlite.org's 3.3.2 beta.
  • Eliminated the static linking of mscoree from all binaries.  Native projects + can now use the library without any dependencies on the .NET framework, while managed + projects continue to be able to use the library normally.
+

1.0.24.5 beta - January 20, 2006

+
    +
  • This beta is built from sqlite.org's 3.3.1 alpha and contains development-in-progress code.  Therefore no guarantees + can be made regarding its suitability for production use.
  • +
  • You no longer need to distribute 2 files on the CompactFramework.  + You can delete SQLite.Interop.DLL entirely.  I wrote a custom tool + called "mergebin" (available in the source zip file) which combines the two libraries + and gets around a glaring defect in the VS2005 linker for ARM processors which doesn't + allow you to link netmodules.
  • +
  • x64 and ia64 builds now use the same strong name as the x86 build.  + This means breaking backward compatibility, but it was necessary in order to allow + you to drop any of those 3 builds onto a PC and have your .NET program run properly.  + Prior to this, you'd get an error if you built your program using the x86 build, + and then installed the x64 version on a target machine and tried to run your program + against it.
  • +
  • The entire source project has been gone over top to bottom.  A debug build + no longer combines the binaries into a single module, which was preventing proper + debugging.
+

1.0.24.4 beta - January 16, 2006

+
    +
  • This beta is built from sqlite.org's 3.3.1 alpha and contains development-in-progress code.  Therefore no guarantees + can be made regarding its suitability for production use.
  • +
  • Fixed a bug in the UTF-16 handling code for preparing statements due to a behavioral + change in SQLite 3.3.0.
  • +
  • Added pager.c code necessary to cleanup after an encrypted file is closed.
  • +
  • Fixed an encryption bug that caused a fault when an encrypted file was rolled + back.
  • +
  • Modified the testcase code to take advantage of optimizations regarding the use + of a DbCommandBuilder.  DataAdapter insert speed increased dramatically as + a result.
  • +
+

1.0.24.3 beta - January 10, 2006

+
    +
  • This beta is built from sqlite.org's 3.3.0 alpha and contains development-in-progress code.  Therefore no guarantees + can be made regarding its suitability for production use.
  • Added support for database encryption at the pager level.  Databases + are encrypted using a 128-bit RC4 stream algorithm.  To open an existing encrypted + database, you may now specify a "Password={password}" text in the ConnectionString, + or you may call the SQLiteConnection.SetPassword() function to set the password + on an open connection.  To encrypt existing non-encrypted databases or to change + the password on an encrypted database, you must use the SQLiteConnection.ChangePassword() + function.  If you use SetPassword() instead of specifying a password in the + connection string, or call ChangePassword() you may use a binary byte array or a + text string as the password.
  • +
  • Rewrote the locking implementation for the Compact Framework.  It is now + more robust and incorporates into the SQLite codebase more efficiently than the + previous CE adaptation.
  • +
  • Moved some of the embedded schema XML data into a resource file to ease code readability.
  • +
  • Automated the fixup of the original sqlite codebase's source prior to compiling, + to ease merging with sqlite.org's source.
  • +
  • Fixed a memory leak in SQLiteCommand due to it not removing an internal reference + to itself in SQLiteConnection. 
  • +
+

1.0.24.2 - December 30, 2005

+
    +
  • Fixed the SQLiteDataReader.HasRows property to return the proper value.
  • +
  • Implemented the inadvertently neglected RecordsAffected property on SQLiteDataReader. +
  • +
  • SQLiteFunction static constructor was changed to pre-filter classes with only the + SQLiteFunctionAttribute.  The code was throwing an exception when certain + assemblies were referenced in a project.
  • +
  • Fixed the SQLiteDataAdapter OnRowUpdated event, which was using the wrong variable + to find the attached event handler and subsequently not raising the event.
  • +
  • Small optimizations and fixes to SQLiteDataReader.NextResult(). 
  • +
+

1.0.24.1 - December 19, 2005

+
    +
  • Update core SQLite engine to 3.2.8 
+

1.0.24 - December 9, 2005

+
    +
  • Fixed the Catalogs schema bug that caused attached databases not to be re-attached to a cloned connection +
  • +
  • Enhanced transactions to allow for a deferred or immediate writelock.  SQLiteConnection.BeginTransaction() + now has an additional overload to support it 
  • Commands are now prepared as they are executed instead of beforehand.  This + fixes a bug whereby a multi-statement command that alters the database and subsequently + references the altered data would fail during Prepare().
  • Tightened up the SQLiteDataReader to prevent reading columns before calling + the first Read() and to prevent reading columns after the last Read().
  • +
  • A more descriptive error is thrown if there aren't enough parameters in the command + to satisfy the parameters required by the statement(s). 
  • +
+

1.0.23 - November 21, 2005

+
    +
  • Named parameters may now begin with @ to ease portability of + the provider. SQLite's named parameters are ordinarily prefixed with a : + or $.  The designer will still use the $ + prefix however, since its more compatible with the default SQLite engine.
  • Added several alternate ISO8601 date/time formats to SQLiteConvert.cs to increase + compatibility.
  • +
  • Relaxed coersion restrictions to work better with SQLite's inherent typelessness. 
  • +
+

1.0.22 - November 11, 2005

+
    +
  • Fixed some globalization issues which resulted in incorrect case-insensitive comparisons
  • +
  • Fixed a bug in the routine that finds all user-defined functions in a loaded assembly.  + It would throw an exception if any of the types in the assembly could not be loaded.  + The exception is now caught and handled appropriately.
  • +
+

1.0.21 - November 4, 2005

+
    +
  • Fixed a designer bug when creating typed datasets with parameterized queries.
  • +
  • The above fix then exposed another bug in the datareader's ability to query schema + information on parameterized commands, which was also fixed.
  • +
  • Compiled against the RTM version of VS2005.
  • +
  • Rewrote the design-time install script to use the XML DOM objects when writing + to the machine.config and to automatically register the DLL in the GAC.
  • Made changes to the app.config descriptions and help file to improve version-independent + factory support.
+

1.0.20 - October 19, 2005

+
    +
  • + Fixed a shortcut in SQLiteBase.GetValue which was insufficient for + international environments.  The shortcut was removed and the "proper" + procedure put in.
+

1.0.19 - October 5, 2005

+
    +
  • + Code merge with SQLite 3.2.7 +
  • + Fixed bugs in the CE port code (os_wince.c) which were brought to + light by recent changes in the SQLite engine. +
  • + Recompiled and modified to be compatible with the September VS2005 Release + Candidate.
    + Beta 2 users should continue to use 1.0.18.1
+

1.0.18.1 - September 19, 2005

+
    +
  • + Code merge with SQLite 3.2.6
+

1.0.18 - September 1, 2005

+
    +
  • + Added type-specific method calls when using the various SQLite classes that + would've normally returned a a generic Db base class, which aligns the code + better with the Microsoft-supplied data providers.
+

1.0.17 - August 26, 2005

+
    +
  • + Code merge with SQLite 3.2.5 +
  • + Added Itanium and x64 build settings to the project (needs testing) +
  • + Bugfixes and enhancements to several schema types +
  • + Additional design-time support to include index and foreign key + enumerations.  Requires re-registering the designer using + INSTALL.CMD.  The new designer code now allows the VS query designer and + typed datasets to automatically link up foreign keys, use indexes, and + automatically generate relationships from the schema.
  • + Additional static methods on SQLiteConnection to create a database file, + encrypt a file using the Encrypted File System (EFS) on NTFS (requires NT 2K or + above) and NTFS file compression
  • +
+

1.0.16 - August 24, 2005

+
    +
  • + Code merge with SQLite 3.2.4 with the large delete bugfix in CVS (which will + become 3.2.5 soon) +
  • + Added new GetSchema() types: IndexColumns, ViewColumns, ForeignKeys
  • +
+

1.0.15 - August 22, 2005
+

+
    +
  • + Code merge with SQLite 3.2.3 +
  • + Minor updates for better design-time experience. More design-time code to + follow in subsequent releases.
  • +
+

1.0.14 - August 16, 2005
+

+
    +
  • + Fixed a bug in the SQLiteDataAdapter due to insufficient implementation of the + class.  The RowUpdating and RowUpdated events are now properly + implemented, but unfortunately inserting and updating data in a DataTable or + DataSet is now much slower.  This is the proper design however, so the + changes are here to stay. +
  • + Lots of schema changes to support Visual Studio's Data Designer architecture.
  • Added + Designer support for the provider.  It's not 100%, but you can design + queries, add typed datasets and perform quite a number of tasks all within + Visual Studio now.
+

1.0.13 - August 8, 2005
+

+
+
    +
  • + Fixed a named parameter bug in the base SQLite_UTF16 class, which of course + only showed up when a database connection was opened using the + UseUTF16Encoding=True parameter. +
  • + Fixed a performance issue in SQLite_UTF16 involving string marshaling.
+
+

1.0.12 - August 5, 2005
+

+
+
    +
  • + Full support for the Compact Framework.  Each build (Debug/Release) now + has a platform, either Win32 or Compact Framework.  The correct + projects are built accordingly.  See the Distributing + SQLite + section for information on what files need to be distributed for each + platform.  +
  • + Modified SQLite3.Reset() and Step() functions to transparently handle timeouts + while waiting on the database to become available (typically when a writer is + waiting on a reader to finish, or a reader is waiting on a writer to finish). +
  • + Lots of code cleanup as suggested by the Code Analyzer (FxCop). +
  • + Lots of updates to the helpfile (as you can see). +
  • + Statements were already prepared lazily in a SQLiteCommand, but now + its even more lazy.  Statements are now only prepared if the statements + haven't been previously prepared and a Prepare() function is called (and the + command is associated with a connection) or just prior to the command being + executed. 
+
+

1.0.11 - August 1, 2005
+

+
    +
  • + For everything except the Compact Framework, System.Data.SQLite.DLL is + now the only DLL required to use this provider!  The + assembly is now a multi-module assembly, containing both the native SQLite3 + codebase and the C# classes built on top of it.  The Compact Framework + version (when completed) will not be able to support this feature, so backwards + compatibility with the Compact Framework has been preserved for the future. +
  • + Fixed a bug in SQLiteCommand.ExecuteScalar() that caused it to stop executing + commands once it obtained the first column of the first row-returning + resultset.  Any remaining statements after the row-returning statement was + ignored. +
  • +
+

1.0.10 - June 10, 2005
+

+
    +
  • + Fixed a bug in the SQLite3.cs Prepare() function that created a statement even + when the SQLite engine returned a NULL pointer. Typically this occurs when + multiple statements are processed and there are trailing comments at the end of + the statement. +
  • + Fixed a bug in SQLiteStatement.cs that retrieved parameter names for a + parameterized query.  SQLite's parameters are 1-based, and the function + was starting at 0.  This was fine when all parameters were unnamed, but + for named parameters it caused the parameters to be out of whack. +
  • +
+

1.0.09a - May 25, 2005
+

+
    +
  • + Fixed a broken helpfile and corrected some obsolete help remarks in + SQLiteFunction.cs +
  • + Added a version resource to the SQLite.Interop.DLL. 
+

1.0.09 - May 24, 2005
+

+
    +
  • + Code merge with the latest 3.21 version of SQLite. +
  • + Removed obsolete methods and properties for Whidbey Beta 2
+

1.0.08 Refresh - Mar 24, 2005
+
+

+
    +
  • + Code merge with the latest 3.20 version of SQLite. +
  • + Recompiled the help file to fix a build error in it. +
  • +
+

1.0.08 - Mar 11, 2005
+
+

+
    +
  • + Added additional #if statements to support the old beta 1 edition of VS2005. +
  • + Code merged the SQLite 3.14 source. +
  • +
+

1.0.07 - Mar 5, 2005
+

+
    +
  • + Made more optimizations to frequently-called functions, resulting in + significant performance gains in all tests. +
  • + Recompiled the binaries using the latest VS2005 February CTP, resulting in yet + more significant speed gains.  The 100k insert test used to take 3.5 + seconds and the insertwithidentity took almost 8 seconds.  With the above + two changes, those tests are now executing in 1.9 and 4.9 seconds respectively.
+

1.0.06 - Mar 1, 2005
+
+

+
    +
  • + Speed-ups to SQLiteDataReader.  It was interop'ing unnecessarily every + time it tried to fetch a field due to a logic error. +
  • + Changed/Added some code to SQLiteConvert's internal DbType, Type and + TypeAffinity functions. +
  • + Fixed the SQLiteDataReader to obey the flags set in the optional + CommandBehavior flag from SQLiteCommand.ExecuteReader(). +
  • + Changed the default page size to 1024 to reflect the defaults of SQLite.  + Ignores the "Page Size" connection string option for memory databases, as tests + revealed that changing it resulted in memory corruption errors. +
  • + Performance enhancements to the SQLiteCommand and SQLiteStatement classes which + reduced the 100,000 row insert execution time as well as the various Function + execution times significantly. +
  • +
+

1.0.05 - Feb 25, 2005 +

+
    +
  • + Fixed the SQLite3 C# class step/reset functions to accomodate schema changes + that invalidate a prepared statement.  Statements are recompiled + transparently. +
  • + Moved all native DLL declarations to an UnsafeNativeMethods class. +
  • + Split several classes into their own modules for readability. +
  • + Renamed many internal variables, reviewed access to variables marked as + internal and altered their protection levels accordingly. +
  • + Due to the presence of the altered sqlite3 codebase and so many added interop + functions, I decided to rename the sqlite3 C project and the DLL to + SQLite.Interop.DLL.  This is the same core sqlite3 codebase but designed + specifically for this ADO.NET provider.  This eliminates any possibility + of someone dropping another build of sqlite3.dll into the system and rendering + the provider inoperable.  In the future if the folks at sqlite.org finally + introduce a method of retrieving column usage for an arbitrary prepared + statement, I'll retool this library to be a lightweight function call wrapper + around the core binary distribution. +
  • + Added [SuppressUnmanagedCodeSecurity] attribute to the UnsafeNativeMethods + class which brings VS2005 November CTP execution speeds inline with the + December CTP. +
  • + Added a bin + directory to the project root where pre-compiled binaries can be found. +
  • + Added a doc + directory where preliminary documentation on the class library can be found. +
  • + Documented a lot more of the classes internally. +
  • +
+

1.0.04 - Feb 24, 2005 +

+
    +
  • + Removed the SQLiteContext class and revamped the way UserFunctions work to + simplify the imlementation. +
  • + Fixed a counting bug in the TestCases class, specifically in the function tests + where I wasn't resetting the counter and it was consequently reporting + intrinsic and raw select calls as being much much faster than they actually + were.  The numbers are now much closer to what I expected for performance, + with .NET user-functions still being the slowest, but only by a small margin. +
  • + Small performance tweaks to SQLiteDataReader. +
  • + Added PageSize to the SQLiteConnectionStringBuilder and subsequently to the + SQLiteConnection +
  • + Added a PRAGMA encoding=XXX execution statement to the SQLiteConnection after + opening a connection. +
  • +
+

1.0.03 - Feb 23, 2005 +

+
    +
  • + Fixed up SQLiteCommandBuilder to correct implementation errors, which resulted + in an enormous performance boost in the InsertMany test.   10,000 row + insert that executed in 1500ms now executes in 500ms. +
  • + Fixed several errors in the SQLite3_UTF16 class.  ToString() was working + incorrectly and the Open() method failed to register user defined functions and + collations. +
  • + Fixed a bug in SQLiteCommand.ClearCommands() whereby only the first statement + was being properly cleaned up. +
  • + Fixed a bug in SQLiteDataReader whereby calling NextResult() would not properly + reset the previously-executed command in the sequence. +
  • + Added an InsertManyWithIdentityFetch test, which appends a select clause to + populate the ID of the last inserted row into the InsertCommand, demonstrating + ADO.NET's ability to auto-fetch identity columns on insert. +
  • +
+

1.0.02 - Feb 21, 2005

+
    +
  • + Tweaks to the xxx_interop functions that return char *'s, so they also return + the length.  Saves an interop call to get the UTF-8 string length during + conversion to a .NET string. +
  • + Reworked the whole interop.c thing into interop.h and reduced the code required + to merge the main sqlite3 codebase. +
  • + Added support for user-defined collations. +
  • +
+ + Index: test/Properties/Resources.Designer.cs ================================================================== --- test/Properties/Resources.Designer.cs +++ test/Properties/Resources.Designer.cs @@ -1,63 +1,63 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// Runtime Version:2.0.50727.3031 -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -namespace test.Properties { - using System; - - - /// - /// A strongly-typed resource class, for looking up localized strings, etc. - /// - // This class was auto-generated by the StronglyTypedResourceBuilder - // class via a tool like ResGen or Visual Studio. - // To add or remove a member, edit your .ResX file then rerun ResGen - // with the /str option, or rebuild your VS project. - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "2.0.0.0")] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - internal class Resources { - - private static global::System.Resources.ResourceManager resourceMan; - - private static global::System.Globalization.CultureInfo resourceCulture; - - [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - internal Resources() { - } - - /// - /// Returns the cached ResourceManager instance used by this class. - /// - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Resources.ResourceManager ResourceManager { - get { - if (object.ReferenceEquals(resourceMan, null)) { - global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("test.Properties.Resources", typeof(Resources).Assembly); - resourceMan = temp; - } - return resourceMan; - } - } - - /// - /// Overrides the current thread's CurrentUICulture property for all - /// resource lookups using this strongly typed resource class. - /// - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Globalization.CultureInfo Culture { - get { - return resourceCulture; - } - set { - resourceCulture = value; - } - } - } -} +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.1 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace test.Properties { + using System; + + + /// + /// A strongly-typed resource class, for looking up localized strings, etc. + /// + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class Resources { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal Resources() { + } + + /// + /// Returns the cached ResourceManager instance used by this class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager { + get { + if (object.ReferenceEquals(resourceMan, null)) { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("test.Properties.Resources", typeof(Resources).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + } +} Index: test/TestCases.cs ================================================================== --- test/TestCases.cs +++ test/TestCases.cs @@ -1,2057 +1,2057 @@ -using System; -using System.Data.Common; -using System.Data; -using System.Data.SQLite; -using System.Transactions; -using System.Collections.Generic; -using System.Text; - -namespace test -{ - internal class TestCases : TestCaseBase - { - private List droptables = new List(); - private List maydroptable = new List(); - - internal TestCases() - { - } - - internal TestCases(DbProviderFactory factory, string connectionString) - : base(factory, connectionString) - { - } - - /// - /// Inserts binary data into the database using a named parameter - /// - internal void BinaryInsert() - { - using (DbCommand cmd = _cnn.CreateCommand()) - { - cmd.CommandText = "INSERT INTO TestCase(Field6) VALUES(@bin)"; - DbParameter Field6 = cmd.CreateParameter(); - - byte[] b = new byte[4000]; - b[0] = 1; - b[100] = 2; - b[1000] = 3; - b[2000] = 4; - b[3000] = 5; - - Field6.ParameterName = "@bin"; - Field6.Value = b; - - cmd.Parameters.Add(Field6); - - cmd.ExecuteNonQuery(); - } - } - - internal void CheckLocked() - { - // Lets make sure the database isn't locked. If it is, we've failed. - using (DbConnection newcnn = ((ICloneable)_cnn).Clone() as DbConnection) - using (DbCommand cmd = newcnn.CreateCommand()) - { - if (newcnn.State != ConnectionState.Open) newcnn.Open(); - - cmd.CommandText = "INSERT INTO TestCase (Field1) SELECT 1 WHERE 1 = 2"; - cmd.ExecuteNonQuery(); - } - } - - internal void CheckSQLite() - { - if (_fact.GetType().Name.IndexOf("SQLite", StringComparison.OrdinalIgnoreCase) == -1) - throw new InconclusiveException("Not a SQLite database"); - } - - [Test(Sequence=1)] - internal string VersionTest() - { - CheckSQLite(); - string[] version = _cnn.ServerVersion.Split('.'); - if (Convert.ToInt32(version[0]) < 3 - || (Convert.ToInt32(version[0]) == 3 && Convert.ToInt32(version[1]) < 6) - || (Convert.ToInt32(version[1]) == 6 && Convert.ToInt32(version[2]) < 1) - ) throw new Exception(String.Format("SQLite Engine is {0}. Minimum supported version is 3.6.1", _cnn.ServerVersion)); - - return String.Format("SQLite Engine is {0}", _cnn.ServerVersion); - } - - //[Test(Sequence = 1)] - internal void ParseTest() - { - DataTable tbl = _cnn.GetSchema("ViewColumns"); - DataTable tbl2 = _cnn.GetSchema("Views"); - - using (DbCommand cmd = _cnn.CreateCommand()) - { - cmd.Parameters.Add(cmd.CreateParameter()); - cmd.Parameters[0].Value = 1; - - cmd.Parameters.Add(cmd.CreateParameter()); - cmd.Parameters[1].Value = 1; - - cmd.CommandText = "select * from sqlite_master limit ? offset ?"; - object obj = cmd.ExecuteScalar(); - - cmd.CommandText = @" -CREATE TEMP TABLE A(ID INTEGER, BID INTEGER);CREATE TEMP TABLE B(ID INTEGER, MYVAL VARCHAR); -INSERT INTO A (ID, BID) VALUES(2, 1); -INSERT INTO B (ID, MYVAL) VALUES(1,'TEST'); -"; - cmd.ExecuteNonQuery(); - - cmd.CommandText = "select *, (select 1 as c from b where b.id = a.bid) from a;"; - using (DbDataReader reader = cmd.ExecuteReader()) - { - reader.Read(); - } - - cmd.CommandText = "select a.id as aa from a where (select 1 from (select 1 where 1 = aa));"; - using (DbDataReader reader = cmd.ExecuteReader()) - { - reader.Read(); - } - - cmd.CommandText = "select *, (select count(c) from (select 1 as c from b where b.id = a.bid)) from a;"; - using (DbDataReader reader = cmd.ExecuteReader()) - { - reader.Read(); - } - } - } - - [Test(Sequence = 39)] - internal void MultipleFunctions() - { - CheckSQLite(); - using (DbCommand cmd = _cnn.CreateCommand()) - { - cmd.CommandText = "SELECT MYCOUNT(Field1), MYCOUNT(Field2) FROM TestCase"; - using (DbDataReader reader = cmd.ExecuteReader()) - { - reader.Read(); - } - } - } - - [Test(Sequence = 8)] - internal void FunctionWithCollation() - { - CheckSQLite(); - using (DbCommand cmd = _cnn.CreateCommand()) - { - cmd.CommandText = "SELECT CHARINDEX('pat', 'thepat'), CHARINDEX('pat', 'THEPAT'), CHARINDEX('pat' COLLATE NOCASE, 'THEPAT' COLLATE NOCASE)"; - using (DbDataReader reader = cmd.ExecuteReader()) - { - reader.Read(); - if (reader.GetInt64(0) != reader.GetInt64(2) || reader.GetInt64(1) != 0 || reader.GetInt64(0) != 4) - throw new Exception("CharIndex returned wrong results!"); - } - } - } - - [Test(Sequence = 9)] - internal void FunctionWithCollation2() - { - CheckSQLite(); - using (DbCommand cmd = _cnn.CreateCommand()) - { - cmd.CommandText = "SELECT CASETEST('pat', 'pat'), CASETEST('pat', 'PAT'), CASETEST('pat' COLLATE NOCASE, 'PAT' COLLATE NOCASE), CASETEST('pat' COLLATE MYSEQUENCE, 'PAT' COLLATE MYSEQUENCE), CASETEST('tap', 'TAP' COLLATE NOCASE)"; - using (DbDataReader reader = cmd.ExecuteReader()) - { - reader.Read(); - if (reader.GetInt64(0) != reader.GetInt64(2) || reader.GetInt64(1) != 1 || reader.GetInt64(0) != 0) - throw new Exception("CharIndex returned wrong results!"); - } - } - } - - [Test] - internal void DataTypesSchema() - { - using (DataTable tbl = _cnn.GetSchema("DataTypes")) - { - } - } - - /// - /// Make sure our implementation of ClearPool() behaves exactly as the SqlClient version is documented to behave. - /// - [Test(Sequence=90)] - internal void ClearPoolTest() - { - string table = "clearpool"; - string temp = "TEMP"; - - if (_fact.GetType().Name.IndexOf("SQLite", StringComparison.OrdinalIgnoreCase) == -1) - { - temp = String.Empty; - table = "#clearpool"; - } - - object value; - if (_cnnstring.TryGetValue("Pooling", out value) == false) throw new Exception("Pooling not present in connection string"); - if ((bool)value == false) throw new InconclusiveException("Pooling not enabled in the connection string"); - - string sql = String.Format("CREATE {0} TABLE {1}(id int primary key);", temp, table); - using (DbCommand cmd = _cnn.CreateCommand()) - { - // Create a temp table in the main connection so we can confirm our new connections are using true new connections - cmd.CommandText = sql; - cmd.ExecuteNonQuery(); - } - - for (int n = 0; n < 10; n++) - { - using (DbConnection newcnn = ((ICloneable)_cnn).Clone() as DbConnection) - { - if (newcnn.State != ConnectionState.Open) newcnn.Open(); - using (DbCommand cmd = newcnn.CreateCommand()) - { - // If the pool is properly implemented and the pooled connection properly destroyed, this command will succeed. - // If the new connection was obtained from the pool even after we cleared it, then this table will already exist - // and the test fails. - cmd.CommandText = sql; - cmd.ExecuteNonQuery(); - } - // Try and clear the pool associated with this file - newcnn.GetType().InvokeMember("ClearPool", System.Reflection.BindingFlags.Static | System.Reflection.BindingFlags.InvokeMethod | System.Reflection.BindingFlags.Public, null, null, new object[] { newcnn }); - - // At this point when the connection is destroyed, it should not be returned to the pool, but instead disposed. - } - } - } - - /// - /// This tests ClearAllPools() functionality. Makes sure that the pool is working properly and clearing properly. - /// - [Test(Sequence = 100)] - internal void ClearAllPoolsTest() - { - string table = "clearpool"; - string temp = "TEMP"; - string exists = " IF NOT EXISTS "; - - if (_fact.GetType().Name.IndexOf("SQLite", StringComparison.OrdinalIgnoreCase) == -1) - { - temp = String.Empty; - exists = String.Empty; - table = "#clearpool"; - } - - object value; - if (_cnnstring.TryGetValue("Pooling", out value) == false) throw new Exception("Pooling not present in connection string"); - if ((bool)value == false) throw new InconclusiveException("Pooling not enabled in the connection string"); - - string sql = String.Format("CREATE {0} TABLE {2}{1}(id int primary key);", temp, table, exists); - - _cnn.GetType().InvokeMember("ClearAllPools", System.Reflection.BindingFlags.Static | System.Reflection.BindingFlags.InvokeMethod | System.Reflection.BindingFlags.Public, null, null, null); - - DbConnection[] arr = new DbConnection[10]; - - try - { - // Create 10 connections and create temporary tables on them - for (int n = 0; n < 10; n++) - { - arr[n] = ((ICloneable)_cnn).Clone() as DbConnection; - if (arr[n].State != ConnectionState.Open) arr[n].Open(); - - using (DbCommand cmd = arr[n].CreateCommand()) - { - cmd.CommandText = sql; - cmd.ExecuteNonQuery(); - cmd.CommandText = String.Format("INSERT INTO {1} (id) VALUES({0})", n, table); - cmd.ExecuteNonQuery(); - } - - switch (n) - { - case 2: // Put this one back into the pool - arr[n].Dispose(); - arr[n] = null; - break; - case 4: - // Clear all the pools - _cnn.GetType().InvokeMember("ClearAllPools", System.Reflection.BindingFlags.Static | System.Reflection.BindingFlags.InvokeMethod | System.Reflection.BindingFlags.Public, null, null, null); - break; - } - } - - // Now close all the connections. Only the last 5 should go into the pool - for (int n = 0; n < 10; n++) - { - if (arr[n] != null) - { - arr[n].Dispose(); - arr[n] = null; - } - } - - // Open 10 connections. They should either have a clearpool containing an id of 5 or greater, - // or should have no clearpool table at all. - for (int n = 0; n < 10; n++) - { - arr[n] = ((ICloneable)_cnn).Clone() as DbConnection; - if (arr[n].State != ConnectionState.Open) arr[n].Open(); - - using (DbCommand cmd = arr[n].CreateCommand()) - { - cmd.CommandText = sql; - cmd.ExecuteNonQuery(); - cmd.CommandText = String.Format("SELECT [id] FROM {0}", table); - object o = cmd.ExecuteScalar(); - - if (o == null || o == DBNull.Value) - continue; // No data in the table at all, which means we must've just created it -- connection wasn't part of the pool - - if (Convert.ToInt32(o) < 5) - throw new Exception("Unexpected data returned from table!"); - } - } - - // Clear all the pools - _cnn.GetType().InvokeMember("ClearAllPools", System.Reflection.BindingFlags.Static | System.Reflection.BindingFlags.InvokeMethod | System.Reflection.BindingFlags.Public, null, null, null); - - } - finally - { - // Close all the connections - for (int n = 0; n < 10; n++) - { - if (arr[n] != null) - { - arr[n].Dispose(); - arr[n] = null; - } - } - // Clear all the pools - _cnn.GetType().InvokeMember("ClearAllPools", System.Reflection.BindingFlags.Static | System.Reflection.BindingFlags.InvokeMethod | System.Reflection.BindingFlags.Public, null, null, null); - } - } - - [Test(Sequence = 50)] - internal void CoersionTest() - { - using (DbCommand cmd = _cnn.CreateCommand()) - { - cmd.CommandText = "SELECT Field1, Field2, [Fiëld3], [Fiæld4], Field5, 'A', 1, 1 + 1, 3.14159 FROM TestCase"; - using (DbDataReader rd = cmd.ExecuteReader()) - { - if (rd.Read()) - { - object Field1 = rd.GetInt32(0); - object Field2 = rd.GetDouble(1); - object Field3 = rd.GetString(2); - object Field4 = rd.GetString(3).TrimEnd(); - object Field5 = rd.GetDateTime(4); - - // The next statement should cause an exception - try - { - Field1 = rd.GetString(0); - throw new Exception("Should have failed type checking!"); - } - catch (InvalidCastException) - { - } - - try - { - Field2 = rd.GetString(1); - throw new Exception("Should have failed type checking!"); - } - catch (InvalidCastException) - { - } - Field3 = rd.GetString(2); - Field4 = rd.GetString(3); - - Field1 = rd.GetInt32(0); - - try - { - Field2 = rd.GetInt32(1); - throw new Exception("Should have failed type checking!"); - } - catch (InvalidCastException) - { - } - - try - { - Field3 = rd.GetInt32(2); - throw new Exception("Should have failed type checking!"); - } - catch (InvalidCastException) - { - } - - try - { - Field4 = rd.GetInt32(3); - throw new Exception("Should have failed type checking!"); - } - catch (InvalidCastException) - { - } - try - { - Field5 = rd.GetInt32(4); - throw new Exception("Should have failed type checking!"); - } - catch (InvalidCastException) - { - } - - try - { - Field3 = rd.GetDecimal(2); - throw new Exception("Should have failed type checking!"); - } - catch (InvalidCastException) - { - } - catch (FormatException) - { - } - try - { - Field4 = rd.GetDecimal(3); - throw new Exception("Should have failed type checking!"); - } - catch (InvalidCastException) - { - } - catch (FormatException) - { - } - try - { - Field5 = rd.GetDecimal(4); - throw new Exception("Should have failed type checking!"); - } - catch (InvalidCastException) - { - } - catch (FormatException) - { - } - } - else throw new Exception("No data in table"); - } - } - } - - [Test(Sequence = 10)] - internal void CreateTable() - { - droptables.Add("TestCase"); - - using (DbCommand cmd = _cnn.CreateCommand()) - { - if (_fact.GetType().Name.IndexOf("SQLite", StringComparison.OrdinalIgnoreCase) == -1) - cmd.CommandText = "CREATE TABLE TestCase (ID bigint primary key identity, Field1 integer, Field2 Float, [Fiëld3] VARCHAR(50), [Fiæld4] CHAR(10), Field5 DateTime, Field6 Image)"; - else - cmd.CommandText = "CREATE TABLE TestCase (ID integer primary key autoincrement, Field1 int, Field2 Float, [Fiëld3] VARCHAR(50), [Fiæld4] CHAR(10), Field5 DateTime, Field6 Image)"; - - cmd.ExecuteNonQuery(); - } - } - - [Test(Sequence = 1100)] - internal string DataAdapterTest() - { - return DataAdapter(false); - } - - [Test(Sequence = 1200)] - internal string DataAdapterWithIdentityFetch() - { - return DataAdapter(true); - } - - /// - /// Utilizes the SQLiteCommandBuilder, - /// which in turn utilizes SQLiteDataReader's GetSchemaTable() functionality - /// This insert is slow because it must raise callbacks before and after every update. - /// For a fast update, see the FastInsertMany function beneath this one - /// - internal string DataAdapter(bool bWithIdentity) - { - StringBuilder builder = new StringBuilder(); - - using (DbTransaction dbTrans = _cnn.BeginTransaction()) - { - using (DbDataAdapter adp = _fact.CreateDataAdapter()) - { - using (DbCommand cmd = _cnn.CreateCommand()) - { - cmd.Transaction = dbTrans; - cmd.CommandText = "SELECT * FROM TestCase WHERE 1 = 2"; - adp.SelectCommand = cmd; - - using (DbCommandBuilder bld = _fact.CreateCommandBuilder()) - { - bld.DataAdapter = adp; - using (adp.InsertCommand = (DbCommand)((ICloneable)bld.GetInsertCommand()).Clone()) - { - if (bWithIdentity) - { - if (_fact.GetType().Name.IndexOf("SQLite", StringComparison.OrdinalIgnoreCase) == -1) - adp.InsertCommand.CommandText += ";SELECT SCOPE_IDENTITY() AS [ID]"; - else - adp.InsertCommand.CommandText += ";SELECT last_insert_rowid() AS [ID]"; - adp.InsertCommand.UpdatedRowSource = UpdateRowSource.FirstReturnedRecord; - } - bld.DataAdapter = null; - - using (DataTable tbl = new DataTable()) - { - adp.Fill(tbl); - for (int n = 0; n < 10000; n++) - { - DataRow row = tbl.NewRow(); - row[1] = n + (50000 * ((bWithIdentity == true) ? 2 : 1)); - tbl.Rows.Add(row); - } - - //Console.WriteLine(String.Format(" Inserting using CommandBuilder and DataAdapter\r\n ->{0} (10,000 rows) ...", (bWithIdentity == true) ? "(with identity fetch)" : "")); - int dtStart = Environment.TickCount; - adp.Update(tbl); - int dtEnd = Environment.TickCount; - dtEnd -= dtStart; - builder.AppendFormat("Insert Ends in {0} ms ... ", (dtEnd)); - - dtStart = Environment.TickCount; - dbTrans.Commit(); - dtEnd = Environment.TickCount; - dtEnd -= dtStart; - builder.AppendFormat("Commits in {0} ms", (dtEnd)); - - if (bWithIdentity) - { - using (DataTable tbl2 = new DataTable()) - { - adp.SelectCommand.CommandText = "SELECT * FROM TestCase WHERE Field1 BETWEEN 100000 AND 199999 ORDER BY Field1"; - adp.Fill(tbl2); - - if (tbl2.Rows.Count != tbl.Rows.Count) throw new Exception("Selected data doesn't match updated data!"); - - for (int n = 0; n < tbl.Rows.Count; n++) - { - if (tbl.Rows[n][0].Equals(tbl2.Rows[n][0]) == false) - throw new Exception("Fetched identity doesn't match selected identity!"); - } - } - } - } - } - } - } - } - } - return builder.ToString(); - } - - /// - /// Make sure a datareader can run even if the parent command is disposed, and that the connection is closed - /// by the datareader when it is finished. - /// - [Test] - internal void DataReaderCleanup() - { - DbConnection newcnn = ((ICloneable)_cnn).Clone() as DbConnection; - DbCommand cmd = newcnn.CreateCommand(); - - try - { - if (newcnn.State != ConnectionState.Open) - newcnn.Open(); - - cmd.CommandText = "SELECT 1, 2, 3"; - using (DbDataReader reader = cmd.ExecuteReader(CommandBehavior.CloseConnection)) - { - cmd.Dispose(); // Dispose of the command while an open reader is active ... should still be able to read - try - { - reader.Read(); - } - catch - { - throw new Exception("Unable to read from a DataReader!"); - } - - if (reader.GetInt32(0) != 1 || reader.GetInt32(1) != 2 || reader.GetInt32(2) != 3) - throw new Exception("Unexpected return values from reader!"); - - reader.Close(); // Close the reader, and check if the connection is closed - - if (newcnn.State != ConnectionState.Closed) - throw new Exception("DataReader failed to cleanup!"); - } - } - finally - { - cmd.Dispose(); - newcnn.Dispose(); - } - } - - [Test] - internal void DataTypeTest() - { - DateTime now = DateTime.Now; - - using (DbCommand cmd = _cnn.CreateCommand()) - { - droptables.Add("datatypetest"); - - if (_fact.GetType().Name.IndexOf("SQLite", StringComparison.OrdinalIgnoreCase) == -1) - cmd.CommandText = "create table datatypetest(id bigint identity primary key, myvalue sql_variant, datetimevalue datetime, decimalvalue decimal(38,18))"; - else - cmd.CommandText = "create table datatypetest(id integer primary key, myvalue sql_variant, datetimevalue datetime, decimalvalue decimal(38,18))"; - - cmd.ExecuteNonQuery(); - - System.Globalization.CultureInfo oldculture = System.Threading.Thread.CurrentThread.CurrentCulture; - System.Globalization.CultureInfo olduiculture = System.Threading.Thread.CurrentThread.CurrentUICulture; - - // Insert using a different current culture - System.Threading.Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo("es-ES"); - System.Threading.Thread.CurrentThread.CurrentUICulture = System.Threading.Thread.CurrentThread.CurrentCulture; - - try - { - cmd.CommandText = "insert into datatypetest(myvalue, datetimevalue, decimalvalue) values(@p1,@p2,@p3)"; - DbParameter p1 = cmd.CreateParameter(); - DbParameter p2 = cmd.CreateParameter(); - DbParameter p3 = cmd.CreateParameter(); - - cmd.Parameters.Add(p1); - cmd.Parameters.Add(p2); - cmd.Parameters.Add(p3); - - p1.ParameterName = "@p1"; - p2.ParameterName = "@p2"; - p3.ParameterName = "@p3"; - - p1.Value = (long)1; - p2.Value = new DateTime(1753, 1, 1); - p3.Value = (Decimal)1.05; - cmd.ExecuteNonQuery(); - - p1.ResetDbType(); - p2.ResetDbType(); - p3.ResetDbType(); - - p1.Value = "One"; - p2.Value = "2001-01-01"; - p3.Value = (Decimal)1.0; - cmd.ExecuteNonQuery(); - - p1.ResetDbType(); - p2.ResetDbType(); - p3.ResetDbType(); - - p1.Value = 1.01; - p2.Value = now; - p3.Value = (Decimal)9.91; - cmd.ExecuteNonQuery(); - - // Read using a different current culture - System.Threading.Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo("en-US"); - System.Threading.Thread.CurrentThread.CurrentUICulture = System.Threading.Thread.CurrentThread.CurrentCulture; - - cmd.CommandText = "select myvalue, datetimevalue, decimalvalue from datatypetest"; - cmd.Parameters.Clear(); - using (DbDataReader reader = cmd.ExecuteReader()) - { - for (int n = 0; n < 3; n++) - { - reader.Read(); - if (reader.GetValue(1).GetType() != reader.GetDateTime(1).GetType()) throw new Exception("DateTime type non-match"); - if (reader.GetValue(2).GetType() != reader.GetDecimal(2).GetType()) throw new Exception("Decimal type non-match"); - - switch (n) - { - case 0: - if (reader.GetValue(0).GetType() != typeof(long)) throw new Exception("long type non-match"); - - if (reader.GetValue(0).Equals((long)1) == false) throw new Exception("long value non-match"); - if (reader.GetValue(1).Equals(new DateTime(1753, 1, 1)) == false) throw new Exception(String.Format("DateTime value non-match expected {0} got {1}", new DateTime(1753, 1, 1), reader.GetValue(1))); - if (reader.GetValue(2).Equals((Decimal)1.05) == false) throw new Exception("Decimal value non-match"); - - if (reader.GetValue(0).Equals(reader.GetInt64(0)) == false) throw new Exception(String.Format("long value failed to match itself, {0} and {1}", reader.GetValue(0), reader.GetInt64(0))); - if (reader.GetValue(1).Equals(reader.GetDateTime(1)) == false) throw new Exception(String.Format("DateTime failed to match itself {0} and {1}", reader.GetValue(1), reader.GetDateTime(1))); - if (reader.GetValue(2).Equals(reader.GetDecimal(2)) == false) throw new Exception(String.Format("Decimal failed to match itself {0} and {1}", reader.GetValue(2), reader.GetDecimal(2))); - break; - case 1: - if (reader.GetValue(0).GetType() != typeof(string)) throw new Exception("String type non-match"); - if (reader.GetValue(0).Equals("One") == false) throw new Exception("String value non-match"); - if (reader.GetValue(1).Equals(new DateTime(2001, 1, 1)) == false) throw new Exception(String.Format("DateTime value non-match expected {0} got {1}", new DateTime(2001, 1, 1), reader.GetValue(1))); - if (reader.GetValue(2).Equals((Decimal)1.0) == false) throw new Exception("Decimal value non-match"); - - if (reader.GetString(0) != "One") throw new Exception("String value non-match"); - if (reader.GetValue(1).Equals(reader.GetDateTime(1)) == false) throw new Exception(String.Format("DateTime failed to match itself {0} and {1}", reader.GetValue(1), reader.GetDateTime(1))); - if (reader.GetValue(2).Equals(reader.GetDecimal(2)) == false) throw new Exception(String.Format("Decimal failed to match itself {0} and {1}", reader.GetValue(2), reader.GetDecimal(2))); - break; - case 2: - if (reader.GetValue(0).GetType() != typeof(double)) throw new Exception("Double type non-match"); - if (reader.GetValue(0).Equals(1.01) == false) throw new Exception("Double value non-match"); - if (reader.GetValue(1).ToString() != now.ToString()) throw new Exception(String.Format("DateTime value non-match, expected {0} got {1}", now, reader.GetValue(1))); - if (reader.GetValue(2).Equals((Decimal)9.91) == false) throw new Exception("Decimal value non-match"); - - if (reader.GetDouble(0) != 1.01) throw new Exception("Double value non-match"); - if (reader.GetValue(1).Equals(reader.GetDateTime(1)) == false) throw new Exception(String.Format("DateTime failed to match itself {0} and {1}", reader.GetValue(1), reader.GetDateTime(1))); - if (reader.GetValue(2).Equals(reader.GetDecimal(2)) == false) throw new Exception(String.Format("Decimal failed to match itself {0} and {1}", reader.GetValue(2), reader.GetDecimal(2))); - break; - } - } - } - } - finally - { - System.Threading.Thread.CurrentThread.CurrentCulture = oldculture; - System.Threading.Thread.CurrentThread.CurrentUICulture = olduiculture; - } - } - } - - /// - /// This is an mean ugly test that leaves a lot of open datareaders out on many connections - /// to see if the database can survive being cloned a lot and disposed while active readers are up. - /// - [Test(Sequence = 40)] - internal void LeakyDataReaders() - { - try - { - { - DbConnection newcnn = null; - try - { - for (int x = 0; x < 10000; x++) - { - if (newcnn == null) - { - newcnn = ((ICloneable)_cnn).Clone() as DbConnection; - } - - if (newcnn.State != ConnectionState.Open) - newcnn.Open(); - - DbCommand cmd = newcnn.CreateCommand(); - cmd.CommandText = "SELECT * FROM TestCase"; - DbDataReader reader = cmd.ExecuteReader(); - reader.Read(); - object obj = reader[0]; - - if (x % 500 == 0) - { - newcnn.Close(); - newcnn = null; - } - } - } - finally - { - if (newcnn != null) - newcnn.Close(); - - newcnn = null; - } - } - CheckLocked(); - } - catch (Exception e) - { - System.Diagnostics.Debug.WriteLine(e.Message); - } - } - - [Test(Sequence = int.MaxValue)] - internal void DropTable() - { - DropTables(true); - } - - internal void DropTables(bool throwError) - { - //string[] arr = new string[] { "TestCase", "datatypetest", "MultiThreadedTest", "fulltext", "guidtest", "keyinfotest", "stepreader", "nonexistent" }; - string errors = String.Empty; - - using (DbCommand cmd = _cnn.CreateCommand()) - { - foreach(string table in droptables) - { - try - { - cmd.CommandText = String.Format("DROP TABLE{1} [{0}]", table, (throwError == false) ? " IF EXISTS" : ""); - cmd.ExecuteNonQuery(); - } - catch (Exception e) - { - if (throwError == true) - errors += String.Format("{0}\r\n", e.Message); - } - } - - foreach (string table in maydroptable) - { - try - { - cmd.CommandText = String.Format("DROP TABLE{1} [{0}]", table, (throwError == false) ? " IF EXISTS" : ""); - cmd.ExecuteNonQuery(); - } - catch (Exception) - { - } - } - } - - if (String.IsNullOrEmpty(errors) == false) - throw new Exception(errors); - - } - - [Test(Sequence = 1000)] - internal string FastInsertMany() - { - StringBuilder builder = new StringBuilder(); - using (DbTransaction dbTrans = _cnn.BeginTransaction()) - { - int dtStart; - int dtEnd; - - using (DbCommand cmd = _cnn.CreateCommand()) - { - cmd.Transaction = dbTrans; - cmd.CommandText = "INSERT INTO TestCase(Field1) VALUES(@p1)"; - DbParameter Field1 = cmd.CreateParameter(); - - Field1.ParameterName = "@p1"; - cmd.Parameters.Add(Field1); - - //Console.WriteLine(String.Format(" Fast insert using parameters and prepared statement\r\n -> (100,000 rows) Begins ... ")); - dtStart = Environment.TickCount; - for (int n = 0; n < 100000; n++) - { - Field1.Value = n + 200000; - cmd.ExecuteNonQuery(); - } - - dtEnd = Environment.TickCount; - dtEnd -= dtStart; - builder.AppendFormat("Ends in {0} ms ... ", (dtEnd)); - } - - dtStart = Environment.TickCount; - dbTrans.Commit(); - dtEnd = Environment.TickCount; - dtEnd -= dtStart; - builder.AppendFormat("Commits in {0} ms", (dtEnd)); - } - return builder.ToString(); - } - - [Test] - internal void FullTextTest() - { - CheckSQLite(); - - using (DbCommand cmd = _cnn.CreateCommand()) - { - droptables.Add("FullText"); - cmd.CommandText = "CREATE VIRTUAL TABLE FullText USING FTS3(name, ingredients);"; - cmd.ExecuteNonQuery(); - - string[] names = { "broccoli stew", "pumpkin stew", "broccoli pie", "pumpkin pie" }; - string[] ingredients = { "broccoli peppers cheese tomatoes", "pumpkin onions garlic celery", "broccoli cheese onions flour", "pumpkin sugar flour butter" }; - int n; - - cmd.CommandText = "insert into FullText (name, ingredients) values (@name, @ingredient);"; - DbParameter name = cmd.CreateParameter(); - DbParameter ingredient = cmd.CreateParameter(); - - name.ParameterName = "@name"; - ingredient.ParameterName = "@ingredient"; - - cmd.Parameters.Add(name); - cmd.Parameters.Add(ingredient); - - for (n = 0; n < names.Length; n++) - { - name.Value = names[n]; - ingredient.Value = ingredients[n]; - - cmd.ExecuteNonQuery(); - } - - cmd.CommandText = "select rowid, name, ingredients from FullText where name match 'pie';"; - cmd.Parameters.Clear(); - - int[] rowids = { 3, 4 }; - n = 0; - - using (DbDataReader reader = cmd.ExecuteReader()) - { - while (reader.Read()) - { - if (reader.GetInt64(0) != rowids[n++]) - throw new Exception("Unexpected rowid returned"); - - if (n > rowids.Length) throw new Exception("Too many rows returned"); - } - } - } - } - - [Test] - internal void GuidTest() - { - using (DbCommand cmd = _cnn.CreateCommand()) - { - Guid guid = Guid.NewGuid(); - - droptables.Add("GuidTest"); - - cmd.CommandText = "CREATE TABLE GuidTest(MyGuid uniqueidentifier)"; - cmd.ExecuteNonQuery(); - - // Insert a guid as a default binary representation - cmd.CommandText = "INSERT INTO GuidTest(MyGuid) VALUES(@b)"; - DbParameter parm = cmd.CreateParameter(); - parm.ParameterName = "@b"; - parm.Value = guid; - cmd.Parameters.Add(parm); - //((SQLiteParameterCollection)cmd.Parameters).AddWithValue("@b", guid); - - // Insert a guid as text - cmd.ExecuteNonQuery(); - cmd.Parameters[0].Value = guid.ToString(); - cmd.Parameters[0].DbType = DbType.String; - cmd.ExecuteNonQuery(); - - cmd.CommandText = "SELECT MyGuid FROM GuidTest"; - cmd.Parameters.Clear(); - - using (DbDataReader reader = cmd.ExecuteReader()) - { - reader.Read(); - if (reader.GetFieldType(0) != typeof(Guid)) throw new Exception("Column is not a Guid"); - if (reader.GetGuid(0) != guid) throw new Exception(String.Format("Got guid {0}, expected {1}", reader.GetGuid(0), guid)); - - reader.Read(); - if (reader.GetFieldType(0) != typeof(Guid)) throw new Exception("Column is not a Guid"); - if (reader.GetGuid(0) != guid) throw new Exception(String.Format("Got guid {0}, expected {1}", reader.GetGuid(0), guid)); - } - } - } - - [Test(Sequence = 20)] - internal void InsertTable() - { - using (DbCommand cmd = _cnn.CreateCommand()) - { - cmd.CommandText = "INSERT INTO TestCase(Field1, Field2, [Fiëld3], [Fiæld4], Field5) VALUES(1, 3.14159, 'Fiëld3', 'Fiæld4', '2005-01-01 13:49:00')"; - cmd.ExecuteNonQuery(); - } - } - - [Test] - internal string IterationTest1() - { - CheckSQLite(); - using (DbCommand cmd = _cnn.CreateCommand()) - { - int dtStart; - int dtEnd; - int nCount; - long n; - - cmd.CommandText = "SELECT Foo(ID, ID) FROM TestCase"; - cmd.Prepare(); - dtStart = Environment.TickCount; - nCount = 0; - using (DbDataReader rd = cmd.ExecuteReader()) - { - while (rd.Read()) - { - n = rd.GetInt64(0); - nCount++; - } - dtEnd = Environment.TickCount; - } - return String.Format("User Function iteration of {0} records in {1} ms", nCount, (dtEnd - dtStart)); - } - } - - [Test] - internal string IterationTest2() - { - StringBuilder builder = new StringBuilder(); - using (DbCommand cmd = _cnn.CreateCommand()) - { - int dtStart; - int dtEnd; - int nCount; - long n; - - cmd.CommandText = "SELECT ID FROM TestCase"; - cmd.Prepare(); - dtStart = Environment.TickCount; - nCount = 0; - using (DbDataReader rd = cmd.ExecuteReader()) - { - while (rd.Read()) - { - n = rd.GetInt64(0); - nCount++; - } - dtEnd = Environment.TickCount; - } - return String.Format("Raw iteration of {0} records in {1} ms", nCount, (dtEnd - dtStart)); - } - } - - [Test] - internal string IterationTest3() - { - StringBuilder builder = new StringBuilder(); - using (DbCommand cmd = _cnn.CreateCommand()) - { - int dtStart; - int dtEnd; - int nCount; - long n; - - cmd.CommandText = "SELECT ABS(ID) FROM TestCase"; - cmd.Prepare(); - dtStart = Environment.TickCount; - nCount = 0; - using (DbDataReader rd = cmd.ExecuteReader()) - { - while (rd.Read()) - { - n = rd.GetInt64(0); - nCount++; - } - dtEnd = Environment.TickCount; - } - return String.Format("Intrinsic Function iteration of {0} records in {1} ms", nCount, (dtEnd - dtStart)); - } - } - - [Test(Sequence=21)] - internal void KeyInfoTest() - { - using (DbCommand cmd = _cnn.CreateCommand()) - { - try - { - // First test against integer primary key (optimized) keyinfo fetch - droptables.Add("keyinfotest"); - cmd.CommandText = "Create table keyinfotest (id integer primary key, myuniquevalue integer unique not null, myvalue varchar(50))"; - cmd.ExecuteNonQuery(); - - cmd.CommandText = "Select * from keyinfotest"; - using (DbDataReader reader = cmd.ExecuteReader(CommandBehavior.KeyInfo | CommandBehavior.SchemaOnly)) - { - using (DataTable tbl = reader.GetSchemaTable()) - { - if (tbl.Rows.Count != 3) throw new Exception("Wrong number of columns returned"); - } - } - - cmd.CommandText = "SELECT MyValue FROM keyinfotest"; - using (DbDataReader reader = cmd.ExecuteReader(CommandBehavior.KeyInfo | CommandBehavior.SchemaOnly)) - { - using (DataTable tbl = reader.GetSchemaTable()) - { - if (tbl.Rows.Count != 2) throw new Exception("Wrong number of columns returned"); - } - } - } - finally - { - } - - cmd.CommandText = "DROP TABLE keyinfotest"; - cmd.ExecuteNonQuery(); - - droptables.Remove("keyinfotest"); - - try - { - // Now test against non-integer primary key (unoptimized) subquery keyinfo fetch - droptables.Add("keyinfotest"); - cmd.CommandText = "Create table keyinfotest (id char primary key, myuniquevalue integer unique not null, myvalue varchar(50))"; - cmd.ExecuteNonQuery(); - - cmd.CommandText = "SELECT MyValue FROM keyinfotest"; - using (DbDataReader reader = cmd.ExecuteReader(CommandBehavior.KeyInfo | CommandBehavior.SchemaOnly)) - { - using (DataTable tbl = reader.GetSchemaTable()) - { - if (tbl.Rows.Count != 2) throw new Exception("Wrong number of columns returned"); - } - } - - cmd.CommandText = "Select * from keyinfotest"; - using (DbDataReader reader = cmd.ExecuteReader(CommandBehavior.KeyInfo | CommandBehavior.SchemaOnly)) - { - using (DataTable tbl = reader.GetSchemaTable()) - { - if (tbl.Rows.Count != 3) throw new Exception("Wrong number of columns returned"); - } - } - - // Make sure commandbuilder can generate an update command with the correct parameter count - using (DbDataAdapter adp = _fact.CreateDataAdapter()) - using (DbCommandBuilder builder = _fact.CreateCommandBuilder()) - { - adp.SelectCommand = cmd; - builder.DataAdapter = adp; - builder.ConflictOption = ConflictOption.OverwriteChanges; - - using (DbCommand updatecmd = builder.GetUpdateCommand()) - { - if (updatecmd.Parameters.Count != 4) - throw new Exception("Wrong number of parameters in update command!"); - } - } - } - finally - { - } - } - } - - [Test] - internal void ConnectionStringBuilder() - { - DbConnectionStringBuilder builder = _fact.CreateConnectionStringBuilder(); - if (builder is SQLiteConnectionStringBuilder) - { - bool pool = ((SQLiteConnectionStringBuilder)builder).Pooling; - } - } - - [Test] - internal void LeakyCommands() - { - for (int n = 0; n < 100000; n++) - { - DbCommand cmd = _cnn.CreateCommand(); - cmd.CommandText = "SELECT * FROM sqlite_master"; - cmd.Prepare(); - } - CheckLocked(); - } - - [Test(Sequence = 60)] - internal void LockTest() - { - CheckSQLite(); - - using (DbCommand cmd = _cnn.CreateCommand()) - { - cmd.CommandText = "SELECT Field6 FROM TestCase WHERE Field6 IS NOT NULL"; - byte[] b = new byte[4000]; - - using (DbDataReader rd = cmd.ExecuteReader()) - { - if (rd.Read() == false) throw new Exception("No data to read!"); - - rd.GetBytes(0, 0, b, 0, 4000); - - if (b[0] != 1) throw new Exception("Binary value non-match byte 0"); - if (b[100] != 2) throw new Exception("Binary value non-match byte 100"); - if (b[1000] != 3) throw new Exception("Binary value non-match byte 1000"); - if (b[2000] != 4) throw new Exception("Binary value non-match byte 2000"); - if (b[3000] != 5) throw new Exception("Binary value non-match byte 3000"); - - using (DbConnection clone = (DbConnection)((ICloneable)_cnn).Clone()) - { - if (clone.State != ConnectionState.Open) clone.Open(); - using (DbCommand newcmd = clone.CreateCommand()) - { - newcmd.CommandText = "DELETE FROM TestCase WHERE Field6 IS NULL"; - newcmd.CommandTimeout = 2; - int cmdStart = Environment.TickCount; - int cmdEnd; - - try - { - newcmd.ExecuteNonQuery(); // should fail because there's a reader on the database - throw new ArgumentException("Should not have allowed an execute with an open reader"); // If we got here, the test failed - } - catch (Exception e) - { - if (e is ArgumentException) throw new Exception(e.Message); - - cmdEnd = Environment.TickCount; - if (cmdEnd - cmdStart < 2000 || cmdEnd - cmdStart > 3000) - throw new Exception("Did not give up the lock at the right time!"); // Didn't wait the right amount of time - - } - } - } - } - } - } - - /// - /// Execute multiple steps in a command and verify the results. Makes sure that commands after a select still - /// get executed even if MoveNext() isn't called explicitly to move things along. - /// - [Test] - internal void MultiStepReaderTest() - { - using (DbCommand cmd = _cnn.CreateCommand()) - { - droptables.Add("stepreader"); - cmd.CommandText = "CREATE TABLE stepreader (id int primary key);INSERT INTO stepreader values(1);SELECT * FROM stepreader;UPDATE stepreader set id = id + 1;"; - using (DbDataReader reader = cmd.ExecuteReader()) - { - if (reader.Read() == false) throw new Exception("Failed to read from the table"); - if (reader.GetInt32(0) != 1) throw new Exception(String.Format("Expected {0} got {1}", 1, reader.GetInt32(0))); - } - cmd.CommandText = "SELECT * FROM stepreader"; - using (DbDataReader reader = cmd.ExecuteReader()) - { - if (reader.Read() == false) throw new Exception("Failed to read from the table"); - if (reader.GetInt32(0) != 2) throw new Exception(String.Format("Expected {0} got {1}", 2, reader.GetInt32(0))); - } - } - } - - internal class MTTest - { - internal DbConnection cnn; - internal Exception e; - internal System.Threading.Thread t; - internal int value; - } - - [Test(Sequence=11)] - internal void MultithreadingTest() - { - using (DbCommand cmd = _cnn.CreateCommand()) - { - droptables.Add("MultiThreadedTest"); - if (_fact.GetType().Name.IndexOf("SQLite", StringComparison.OrdinalIgnoreCase) == -1) - cmd.CommandText = "CREATE TABLE MultiThreadedTest(ID integer identity primary key, ThreadId integer, MyValue integer)"; - else - cmd.CommandText = "CREATE TABLE MultiThreadedTest(ID integer primary key, ThreadId integer, MyValue integer)"; - - cmd.ExecuteNonQuery(); - } - - MTTest[] arr = new MTTest[8]; - - for (int n = 0; n < arr.Length; n++) - { - arr[n] = new MTTest(); - arr[n].t = new System.Threading.Thread(new System.Threading.ParameterizedThreadStart(MultithreadedTestThread)); - arr[n].t.IsBackground = true; - arr[n].cnn = ((ICloneable)_cnn).Clone() as DbConnection; - arr[n].t.Start(arr[n]); - } - - System.Threading.Thread.Sleep(8000); - bool failed = false; - Exception e = null; - for (int n = 0; n < arr.Length; n++) - { - if (arr[n].t.Join(0) == false) - { - failed = true; - arr[n].t.Abort(); - } - if (arr[n].e != null) e = arr[n].e; - arr[n].cnn.Dispose(); - } - if (failed) throw new Exception("One or more threads deadlocked"); - if (e != null) - throw e; - } - - internal void MultithreadedTestThread(object obj) - { - MTTest test = obj as MTTest; - - if (test.cnn.State != ConnectionState.Open) - test.cnn.Open(); - - int start = Environment.TickCount; - try - { - using (DbCommand cmd = test.cnn.CreateCommand()) - { - while (Environment.TickCount - start < 2000) - { - using (DbTransaction trans = test.cnn.BeginTransaction()) - { - cmd.CommandText = String.Format("SELECT * FROM MultiThreadedTest WHERE ThreadId = {0}", test.t.ManagedThreadId); - cmd.Transaction = trans; - using (DbDataReader reader = cmd.ExecuteReader()) - { - while (reader.Read()) - { - test.value += Convert.ToInt32(reader[2]); - } - } - cmd.CommandText = String.Format("INSERT INTO MultiThreadedTest(ThreadId, MyValue) VALUES({0}, {1})", test.t.ManagedThreadId, Environment.TickCount); - cmd.ExecuteNonQuery(); - - trans.Commit(); - } - } - } - } - catch (Exception e) - { - test.e = e; - } - } - - [Test] - internal void ParameterizedInsert() - { - using (DbCommand cmd = _cnn.CreateCommand()) - { - cmd.CommandText = "INSERT INTO TestCase(Field1, Field2, [Fiëld3], [Fiæld4], Field5) VALUES(@p1,@p2,@p3,@p4,@p5)"; - DbParameter Field1 = cmd.CreateParameter(); - DbParameter Field2 = cmd.CreateParameter(); - DbParameter Field3 = cmd.CreateParameter(); - DbParameter Field4 = cmd.CreateParameter(); - DbParameter Field5 = cmd.CreateParameter(); - - Field1.ParameterName = "@p1"; - Field2.ParameterName = "@p2"; - Field3.ParameterName = "@p3"; - Field4.ParameterName = "@p4"; - Field5.ParameterName = "@p5"; - - Field1.Value = 2; - Field2.Value = 3.14159; - Field3.Value = "Param Field3"; - Field4.Value = "Field4 Par"; - Field5.Value = DateTime.Now; - - cmd.Parameters.Add(Field1); - cmd.Parameters.Add(Field2); - cmd.Parameters.Add(Field3); - cmd.Parameters.Add(Field4); - cmd.Parameters.Add(Field5); - - cmd.ExecuteNonQuery(); - } - } - - [Test] - internal void ParameterizedInsertMissingParams() - { - using (DbCommand cmd = _cnn.CreateCommand()) - { - cmd.CommandText = "INSERT INTO TestCase(Field1, Field2, [Fiëld3], [Fiæld4], Field5) VALUES(@p1,@p2,@p3,@p4,@p5)"; - DbParameter Field1 = cmd.CreateParameter(); - DbParameter Field2 = cmd.CreateParameter(); - DbParameter Field3 = cmd.CreateParameter(); - DbParameter Field4 = cmd.CreateParameter(); - DbParameter Field5 = cmd.CreateParameter(); - - Field1.ParameterName = "@p1"; - Field2.ParameterName = "@p2"; - Field3.ParameterName = "@p3"; - Field4.ParameterName = "@p4"; - Field5.ParameterName = "@p5"; - - Field1.DbType = System.Data.DbType.Int32; - - Field1.Value = 2; - Field2.Value = 3.14159; - Field3.Value = "Field3 Param"; - Field4.Value = "Field4 Par"; - Field5.Value = DateTime.Now; - - cmd.Parameters.Add(Field1); - cmd.Parameters.Add(Field2); - cmd.Parameters.Add(Field3); - cmd.Parameters.Add(Field4); - - // Assertion here, not enough parameters - try - { - cmd.ExecuteNonQuery(); - throw new Exception("Executed with a missing parameter"); - } - catch (Exception) // Expected - { - } - } - } - - /// - /// Call Prepare() on a multi-statement command text where the second command depends on the existence of the first. - /// - [Test] - internal void PrepareTest() - { - using (DbCommand cmd = _cnn.CreateCommand()) - { - droptables.Add("nonexistent"); - cmd.CommandText = "CREATE TABLE nonexistent(id int primary key);SELECT id FROM nonexistent UNION SELECT 1"; - cmd.Prepare(); - object ob = cmd.ExecuteScalar(); - - if (ob == null || ob == DBNull.Value) throw new Exception("Multiple statements may not be supported"); - if (Convert.ToInt32(ob) != 1) throw new Exception(String.Format("Expected {0} got {1}", 1, ob)); - } - } - - /// - /// Checks to make sure transactions are rolled back before a connection goes back onto the pool - /// - [Test] - internal void PoolingWithStealthTransactionTest() - { - object value; - if (_cnnstring.TryGetValue("Pooling", out value) == false) throw new Exception("Pooling not present in connection string"); - if ((bool)value == false) throw new InconclusiveException("Pooling not enabled in the connection string"); - - maydroptable.Add("PoolTest"); - - for (int n = 0; n < 100; n++) - { - using (DbConnection newcnn = ((ICloneable)_cnn).Clone() as DbConnection) - { - if (newcnn.State != ConnectionState.Open) newcnn.Open(); - using (DbCommand cmd = newcnn.CreateCommand()) - { - cmd.CommandText = "BEGIN TRANSACTION"; - cmd.ExecuteNonQuery(); - - cmd.CommandText = "CREATE TABLE PoolTest(ID int primary key)"; - cmd.ExecuteNonQuery(); - } - } - } - } - - /// - /// Checks to make sure transactions are rolled back before a connection goes back onto the pool - /// - [Test] - internal void PoolingWithTransactionTest() - { - object value; - if (_cnnstring.TryGetValue("Pooling", out value) == false) throw new Exception("Pooling not present in connection string"); - if ((bool)value == false) throw new InconclusiveException("Pooling not enabled in the connection string"); - - maydroptable.Add("PoolTest"); - for (int n = 0; n < 100; n++) - { - using (DbConnection newcnn = ((ICloneable)_cnn).Clone() as DbConnection) - { - if (newcnn.State != ConnectionState.Open) newcnn.Open(); - DbTransaction trans = newcnn.BeginTransaction(); - using (DbCommand cmd = newcnn.CreateCommand()) - { - cmd.Transaction = trans; - cmd.CommandText = "CREATE TABLE PoolTest(ID int primary key)"; - cmd.ExecuteNonQuery(); - } - } - } - } - - /// - /// Open a reader and then attempt to write to test the writer's command timeout property - /// SQLite doesn't allow a write when a reader is active. - /// *** NOTE AS OF 3.3.8 this test no longer blocks because SQLite now allows you to update table(s) - /// while a reader is active on the same connection. Therefore the timeout test is invalid - /// - internal void TimeoutTest() - { - CheckSQLite(); - - using (DbCommand cmdRead = _cnn.CreateCommand()) - { - cmdRead.CommandText = "SELECT ID FROM TestCase"; - using (DbDataReader rd = cmdRead.ExecuteReader()) - { - using (DbCommand cmdwrite = _cnn.CreateCommand()) - { - cmdwrite.CommandText = "UPDATE [KeyInfoTest] SET [ID] = [ID]"; - cmdwrite.CommandTimeout = 5; - - int dwtick = Environment.TickCount; - try - { - cmdwrite.ExecuteNonQuery(); - } - catch (Exception) - { - dwtick = (Environment.TickCount - dwtick) / 1000; - if (dwtick < 5 || dwtick > 6) - throw new Exception("Timeout didn't wait long enough!"); - - return; - } - throw new Exception("Operation should have failed but completed successfully"); - } - } - } - } - - [Test(Sequence = 41)] - internal void TransactionScopeTest() - { - using (TransactionScope scope = new TransactionScope()) - { - using (DbConnection cnn2 = ((ICloneable)_cnn).Clone() as DbConnection) - { - if (cnn2.State != ConnectionState.Open) cnn2.Open(); - using (DbCommand cmd = cnn2.CreateCommand()) - { - // Created a table inside the transaction scope - cmd.CommandText = "CREATE TABLE VolatileTable (ID INTEGER PRIMARY KEY, MyValue VARCHAR(50))"; - cmd.ExecuteNonQuery(); - - maydroptable.Add("VolatileTable"); - - using (DbCommand cmd2 = cnn2.CreateCommand()) - { - using (cmd2.Transaction = cnn2.BeginTransaction()) - { - // Inserting a value inside the table, inside a transaction which is inside the transaction scope - cmd2.CommandText = "INSERT INTO VolatileTable (ID, MyValue) VALUES(1, 'Hello')"; - cmd2.ExecuteNonQuery(); - cmd2.Transaction.Commit(); - } - } - } - // Connection is disposed before the transactionscope leaves, thereby forcing the connection to stay open - } - // Exit the transactionscope without committing it, causing a rollback of both the create table and the insert - } - - // Verify that the table does not exist - using (DbCommand cmd = _cnn.CreateCommand()) - { - cmd.CommandText = "SELECT COUNT(*) FROM VolatileTable"; - try - { - object o = cmd.ExecuteScalar(); - cmd.CommandText = "DROP TABLE VolatileTable"; - cmd.ExecuteNonQuery(); - throw new InvalidOperationException("Transaction failed! The table exists!"); - } - catch(Exception e) - { - if (e is InvalidOperationException) throw new Exception(e.Message); - return; // Succeeded, the table should not have existed - } - } - } - - /// - /// Causes the user-defined aggregate to be iterated through - /// - /// - [Test] - internal string UserAggregate() - { - CheckSQLite(); - - StringBuilder builder = new StringBuilder(); - using (DbCommand cmd = _cnn.CreateCommand()) - { - int dtStart; - int n = 0; - int nCount; - - cmd.CommandText = "SELECT MyCount(*) FROM TestCase"; - - nCount = 0; - dtStart = Environment.TickCount; - while (Environment.TickCount - dtStart < 1000) - { - n = Convert.ToInt32(cmd.ExecuteScalar()); - nCount++; - } - if (n != 120003) throw new Exception("Unexpected count"); - builder.Append(String.Format("UserAggregate executed {0} times in 1 second.", nCount)); - } - return builder.ToString(); - } - - /// - /// Causes the user-defined collation sequence to be iterated through - /// - [Test] - internal void UserCollation() - { - CheckSQLite(); - - using (DbCommand cmd = _cnn.CreateCommand()) - { - // Using a default collating sequence in descending order, "Param Field3" will appear at the top - // and "Field3" will be next, followed by a NULL. Our user-defined collating sequence will - // deliberately place them out of order so Field3 is first. - cmd.CommandText = "SELECT [Fiëld3] FROM TestCase ORDER BY [Fiëld3] COLLATE MYSEQUENCE DESC"; - string s = (string)cmd.ExecuteScalar(); - if (s != "Fiëld3") throw new Exception("MySequence didn't sort properly"); - } - } - - /// - /// Causes the user-defined function to be called - /// - /// - [Test] - internal string UserFunction1() - { - CheckSQLite(); - using (DbCommand cmd = _cnn.CreateCommand()) - { - int nTimes; - int dtStart; - - nTimes = 0; - cmd.CommandText = "SELECT Foo('ee','foo')"; - dtStart = Environment.TickCount; - while (Environment.TickCount - dtStart < 1000) - { - cmd.ExecuteNonQuery(); - nTimes++; - } - return String.Format("User (text) command executed {0} times in 1 second.", nTimes); - } - } - - [Test] - internal string UserFunction2() - { - CheckSQLite(); - using (DbCommand cmd = _cnn.CreateCommand()) - { - int nTimes; - int dtStart; - - nTimes = 0; - cmd.CommandText = "SELECT Foo(10,11)"; - dtStart = Environment.TickCount; - while (Environment.TickCount - dtStart < 1000) - { - cmd.ExecuteNonQuery(); - nTimes++; - } - return String.Format("UserFunction command executed {0} times in 1 second.", nTimes); - } - } - - [Test] - internal string UserFunction3() - { - CheckSQLite(); - using (DbCommand cmd = _cnn.CreateCommand()) - { - int nTimes; - int dtStart; - - nTimes = 0; - cmd.CommandText = "SELECT ABS(1)"; - dtStart = Environment.TickCount; - while (Environment.TickCount - dtStart < 1000) - { - cmd.ExecuteNonQuery(); - nTimes++; - } - return String.Format("Intrinsic command executed {0} times in 1 second.", nTimes); - } - } - - [Test] - internal string UserFunction4() - { - CheckSQLite(); - using (DbCommand cmd = _cnn.CreateCommand()) - { - int nTimes; - int dtStart; - - nTimes = 0; - cmd.CommandText = "SELECT lower('FOO')"; - dtStart = Environment.TickCount; - while (Environment.TickCount - dtStart < 1000) - { - cmd.ExecuteNonQuery(); - nTimes++; - } - return String.Format("Intrin (txt) command executed {0} times in 1 second.", nTimes); - } - } - - [Test] - internal string UserFunction5() - { - CheckSQLite(); - using (DbCommand cmd = _cnn.CreateCommand()) - { - int nTimes; - int dtStart; - - nTimes = 0; - cmd.CommandText = "SELECT 1"; - dtStart = Environment.TickCount; - while (Environment.TickCount - dtStart < 1000) - { - cmd.ExecuteNonQuery(); - nTimes++; - } - return String.Format("Raw Value command executed {0} times in 1 second.", nTimes); - } - } - - [Test(Sequence = 42)] - internal void VerifyBinaryData() - { - BinaryInsert(); - using (DbCommand cmd = _cnn.CreateCommand()) - { - cmd.CommandText = "SELECT Field6 FROM TestCase WHERE Field6 IS NOT NULL"; - byte[] b = new byte[4000]; - - using (DbDataReader rd = cmd.ExecuteReader()) - { - if (rd.Read() == false) throw new Exception("No data to read!"); - - long n = rd.GetBytes(0, 0, null, 0, 0); - if (n != 4000) throw new Exception("Invalid byte length!"); - - rd.GetBytes(0, 0, b, 0, 4000); - - if (b[0] != 1) throw new Exception("Binary value non-match byte 0"); - if (b[100] != 2) throw new Exception("Binary value non-match byte 100"); - if (b[1000] != 3) throw new Exception("Binary value non-match byte 1000"); - if (b[2000] != 4) throw new Exception("Binary value non-match byte 2000"); - if (b[3000] != 5) throw new Exception("Binary value non-match byte 3000"); - } - } - } - - [Test] - internal void DecimalTest() - { - using (DbCommand cmd = _cnn.CreateCommand()) - { - droptables.Add("DECTEST"); - - cmd.CommandText = "CREATE TABLE DECTEST(x DECIMAL(38,18))"; - cmd.ExecuteNonQuery(); - - cmd.CommandText = "INSERT INTO DECTEST(x) VALUES(0.00001)"; - cmd.ExecuteNonQuery(); - - cmd.CommandText = "SELECT * FROM DECTEST"; - using (DbDataReader reader = cmd.ExecuteReader()) - { - reader.Read(); - decimal d = (decimal)reader.GetValue(0); - d = reader.GetDecimal(0); - } - } - } - - [Test(Sequence = 30)] - internal void VerifyInsert() - { - using (DbCommand cmd = _cnn.CreateCommand()) - { - cmd.CommandText = "SELECT Field1, Field2, [Fiëld3], [Fiæld4], Field5 FROM TestCase"; - cmd.Prepare(); - using (DbDataReader rd = cmd.ExecuteReader()) - { - if (rd.Read()) - { - int Field1 = rd.GetInt32(0); - double Field2 = rd.GetDouble(1); - string Field3 = rd.GetString(2); - string Field4 = rd.GetString(3).TrimEnd(); - DateTime Field5 = rd.GetDateTime(4); - - if (Field1 != 1) throw new Exception(String.Format("Field1 {0} did not match {1}", Field1, 1)); - if (Field2 != 3.14159) throw new Exception(String.Format("Field2 {0} did not match {1}", Field2, 3.14159)); - if (Field3 != "Fiëld3") throw new Exception(String.Format("Field3 {0} did not match {1}", Field3, "Fiëld3")); - if (Field4 != "Fiæld4") throw new Exception(String.Format("Field4 {0} did not match {1}", Field4, "Fiæld4")); - if (Field5.CompareTo(DateTime.Parse("2005-01-01 13:49:00")) != 0) throw new Exception(String.Format("Field5 {0} did not match {1}", Field4, DateTime.Parse("2005-01-01 13:49:00"))); - - if (rd.GetName(0) != "Field1") throw new Exception("Non-Match column name Field1"); - if (rd.GetName(1) != "Field2") throw new Exception("Non-Match column name Field2"); - if (rd.GetName(2) != "Fiëld3") throw new Exception("Non-Match column name Field3"); - if (rd.GetName(3) != "Fiæld4") throw new Exception("Non-Match column name Field4"); - if (rd.GetName(4) != "Field5") throw new Exception("Non-Match column name Field5"); - } - else throw new Exception("No data in table"); - } - } - } - } - - /// - /// Scalar user-defined function. In this example, the same class is declared twice with - /// different function names to demonstrate how to use alias names for user-defined functions. - /// - [SQLiteFunction(Name = "Foo", Arguments = 2, FuncType = FunctionType.Scalar)] - [SQLiteFunction(Name = "TestFunc", Arguments = 2, FuncType = FunctionType.Scalar)] - class TestFunc : SQLiteFunction - { - public override object Invoke(object[] args) - { - if (args[0].GetType() != typeof(int)) return args[0]; - - int Param1 = Convert.ToInt32(args[0]); // First parameter - int Param2 = Convert.ToInt32(args[1]); // Second parameter - - return Param1 + Param2; - } - } - - [SQLiteFunction(Name = "CASETEST", Arguments = 2, FuncType = FunctionType.Scalar)] - class CaseTestFunc : SQLiteFunctionEx - { - public override object Invoke(object[] args) - { - CollationSequence seq = GetCollationSequence(); - return seq.Compare(args[0].ToString(), args[1].ToString()); - } - } - - /// - /// Aggregate user-defined function. Arguments = -1 means any number of arguments is acceptable - /// - [SQLiteFunction(Name = "MyCount", Arguments = -1, FuncType = FunctionType.Aggregate)] - class MyCount : SQLiteFunction - { - public override void Step(object[] args, int nStep, ref object contextData) - { - if (contextData == null) - { - contextData = 1; - } - else - contextData = (int)contextData + 1; - } - - public override object Final(object contextData) - { - return contextData; - } - } - - /// - /// Sample regular expression function. Example Usage: - /// SELECT * FROM foo WHERE name REGEXP '$bar' - /// SELECT * FROM foo WHERE REGEXP('$bar', name) - /// - /// - [SQLiteFunction(Name = "REGEXP", Arguments = 2, FuncType = FunctionType.Scalar)] - class MyRegEx : SQLiteFunction - { - public override object Invoke(object[] args) - { - return System.Text.RegularExpressions.Regex.IsMatch(Convert.ToString(args[1]), Convert.ToString(args[0])); - } - } - - /// - /// User-defined collating sequence. - /// - [SQLiteFunction(Name = "MYSEQUENCE", FuncType = FunctionType.Collation)] - class MySequence : SQLiteFunction - { - public override int Compare(string param1, string param2) - { - // Make sure the string "Fiëld3" is sorted out of order - if (param1 == "Fiëld3") return 1; - if (param2 == "Fiëld3") return -1; - return String.Compare(param1, param2, true); - } - } - - [AttributeUsage(AttributeTargets.Method, Inherited = false, AllowMultiple = false)] - public sealed class TestAttribute : Attribute, IComparable - { - private static int _start = 65535; - private int _sequence; - - public TestAttribute() - { - _sequence = _start; - _start++; - } - - public int Sequence - { - get { return _sequence; } - set { _sequence = value; } - } - - #region IComparable Members - - public int CompareTo(TestAttribute other) - { - return _sequence.CompareTo(other._sequence); - } - #endregion - } - - internal enum TestResultEnum - { - Succeeded = 0, - Failed = 1, - Inconclusive = 2, - } - - internal class InconclusiveException : Exception - { - internal InconclusiveException() - : base() - { - } - - internal InconclusiveException(string message) - : base(message) - { - } - } - - internal class TestEventArgs : EventArgs - { - public readonly string TestName; - public readonly TestResultEnum Result; - public readonly Exception Exception; - public readonly string Message; - public readonly int Duration; - - internal TestEventArgs(string testName, TestResultEnum success, int duration, Exception e, string message) - { - TestName = testName; - Result = success; - Exception = e; - Message = message; - Duration = duration; - } - } - - delegate void TestCompletedEvent(object sender, TestEventArgs args); - delegate void TestStartingEvent(object sender, TestEventArgs args); - - internal abstract class TestCaseBase - { - protected DbProviderFactory _fact; - protected DbConnection _cnn = null; - protected DbConnectionStringBuilder _cnnstring; - protected Dictionary _tests = new Dictionary(); - - public event TestCompletedEvent OnTestFinished; - public event TestStartingEvent OnTestStarting; - public event EventHandler OnAllTestsDone; - - protected TestCaseBase() - { - SortedList items = new SortedList(); - foreach (System.Reflection.MethodInfo mi in GetType().GetMethods(System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.InvokeMethod)) - { - object[] att = mi.GetCustomAttributes(typeof(TestAttribute), false); - if (att.Length == 1) - { - items.Add((TestAttribute)att[0], mi); - } - } - - foreach (KeyValuePair pair in items) - { - _tests.Add(pair.Value.Name, true); - } - } - - protected TestCaseBase(DbProviderFactory factory, string connectionString) - { - _fact = factory; - _cnn = _fact.CreateConnection(); - _cnn.ConnectionString = connectionString; - _cnnstring = _fact.CreateConnectionStringBuilder(); - _cnnstring.ConnectionString = connectionString; - _cnn.Open(); - } - - internal Dictionary Tests - { - get - { - return _tests; - } - set - { - _tests = value; - } - } - - internal void Run() - { - SortedList items = new SortedList(); - foreach (System.Reflection.MethodInfo mi in GetType().GetMethods(System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.InvokeMethod)) - { - object[] att = mi.GetCustomAttributes(typeof(TestAttribute), false); - if (att.Length == 1 && _tests[mi.Name] == true) - { - items.Add((TestAttribute)att[0], mi); - } - } - - foreach (KeyValuePair pair in items) - { - if (OnTestStarting != null) - OnTestStarting(this, new TestEventArgs(pair.Value.Name, TestResultEnum.Inconclusive, 0, null, null)); - - int start = Environment.TickCount; - try - { - object obj = pair.Value.Invoke(this, null); - int duration = Environment.TickCount - start; - if (OnTestFinished != null) - OnTestFinished(this, new TestEventArgs(pair.Value.Name, TestResultEnum.Succeeded, duration, null, (obj is string) ? (string)obj : String.Empty)); - } - catch (Exception e) - { - int duration = Environment.TickCount - start; - Exception inner = e.InnerException; - - if (OnTestFinished != null) - { - if (inner is InconclusiveException) - { - OnTestFinished(this, new TestEventArgs(pair.Value.Name, TestResultEnum.Inconclusive, duration, null, inner.Message)); - } - else - { - OnTestFinished(this, new TestEventArgs(pair.Value.Name, TestResultEnum.Failed, duration, inner, null)); - } - } - } - } - - if (OnAllTestsDone != null) - OnAllTestsDone(this, EventArgs.Empty); - } - } -} +using System; +using System.Data.Common; +using System.Data; +using System.Data.SQLite; +using System.Transactions; +using System.Collections.Generic; +using System.Text; + +namespace test +{ + internal class TestCases : TestCaseBase + { + private List droptables = new List(); + private List maydroptable = new List(); + + internal TestCases() + { + } + + internal TestCases(DbProviderFactory factory, string connectionString) + : base(factory, connectionString) + { + } + + /// + /// Inserts binary data into the database using a named parameter + /// + internal void BinaryInsert() + { + using (DbCommand cmd = _cnn.CreateCommand()) + { + cmd.CommandText = "INSERT INTO TestCase(Field6) VALUES(@bin)"; + DbParameter Field6 = cmd.CreateParameter(); + + byte[] b = new byte[4000]; + b[0] = 1; + b[100] = 2; + b[1000] = 3; + b[2000] = 4; + b[3000] = 5; + + Field6.ParameterName = "@bin"; + Field6.Value = b; + + cmd.Parameters.Add(Field6); + + cmd.ExecuteNonQuery(); + } + } + + internal void CheckLocked() + { + // Lets make sure the database isn't locked. If it is, we've failed. + using (DbConnection newcnn = ((ICloneable)_cnn).Clone() as DbConnection) + using (DbCommand cmd = newcnn.CreateCommand()) + { + if (newcnn.State != ConnectionState.Open) newcnn.Open(); + + cmd.CommandText = "INSERT INTO TestCase (Field1) SELECT 1 WHERE 1 = 2"; + cmd.ExecuteNonQuery(); + } + } + + internal void CheckSQLite() + { + if (_fact.GetType().Name.IndexOf("SQLite", StringComparison.OrdinalIgnoreCase) == -1) + throw new InconclusiveException("Not a SQLite database"); + } + + [Test(Sequence=1)] + internal string VersionTest() + { + CheckSQLite(); + string[] version = _cnn.ServerVersion.Split('.'); + if (Convert.ToInt32(version[0]) < 3 + || (Convert.ToInt32(version[0]) == 3 && Convert.ToInt32(version[1]) < 6) + || (Convert.ToInt32(version[0]) == 3 && Convert.ToInt32(version[1]) == 6 && Convert.ToInt32(version[2]) < 1) + ) throw new Exception(String.Format("SQLite Engine is {0}. Minimum supported version is 3.6.1", _cnn.ServerVersion)); + + return String.Format("SQLite Engine is {0}", _cnn.ServerVersion); + } + + //[Test(Sequence = 1)] + internal void ParseTest() + { + DataTable tbl = _cnn.GetSchema("ViewColumns"); + DataTable tbl2 = _cnn.GetSchema("Views"); + + using (DbCommand cmd = _cnn.CreateCommand()) + { + cmd.Parameters.Add(cmd.CreateParameter()); + cmd.Parameters[0].Value = 1; + + cmd.Parameters.Add(cmd.CreateParameter()); + cmd.Parameters[1].Value = 1; + + cmd.CommandText = "select * from sqlite_master limit ? offset ?"; + object obj = cmd.ExecuteScalar(); + + cmd.CommandText = @" +CREATE TEMP TABLE A(ID INTEGER, BID INTEGER);CREATE TEMP TABLE B(ID INTEGER, MYVAL VARCHAR); +INSERT INTO A (ID, BID) VALUES(2, 1); +INSERT INTO B (ID, MYVAL) VALUES(1,'TEST'); +"; + cmd.ExecuteNonQuery(); + + cmd.CommandText = "select *, (select 1 as c from b where b.id = a.bid) from a;"; + using (DbDataReader reader = cmd.ExecuteReader()) + { + reader.Read(); + } + + cmd.CommandText = "select a.id as aa from a where (select 1 from (select 1 where 1 = aa));"; + using (DbDataReader reader = cmd.ExecuteReader()) + { + reader.Read(); + } + + cmd.CommandText = "select *, (select count(c) from (select 1 as c from b where b.id = a.bid)) from a;"; + using (DbDataReader reader = cmd.ExecuteReader()) + { + reader.Read(); + } + } + } + + [Test(Sequence = 39)] + internal void MultipleFunctions() + { + CheckSQLite(); + using (DbCommand cmd = _cnn.CreateCommand()) + { + cmd.CommandText = "SELECT MYCOUNT(Field1), MYCOUNT(Field2) FROM TestCase"; + using (DbDataReader reader = cmd.ExecuteReader()) + { + reader.Read(); + } + } + } + + [Test(Sequence = 8)] + internal void FunctionWithCollation() + { + CheckSQLite(); + using (DbCommand cmd = _cnn.CreateCommand()) + { + cmd.CommandText = "SELECT CHARINDEX('pat', 'thepat'), CHARINDEX('pat', 'THEPAT'), CHARINDEX('pat' COLLATE NOCASE, 'THEPAT' COLLATE NOCASE)"; + using (DbDataReader reader = cmd.ExecuteReader()) + { + reader.Read(); + if (reader.GetInt64(0) != reader.GetInt64(2) || reader.GetInt64(1) != 0 || reader.GetInt64(0) != 4) + throw new Exception("CharIndex returned wrong results!"); + } + } + } + + [Test(Sequence = 9)] + internal void FunctionWithCollation2() + { + CheckSQLite(); + using (DbCommand cmd = _cnn.CreateCommand()) + { + cmd.CommandText = "SELECT CASETEST('pat', 'pat'), CASETEST('pat', 'PAT'), CASETEST('pat' COLLATE NOCASE, 'PAT' COLLATE NOCASE), CASETEST('pat' COLLATE MYSEQUENCE, 'PAT' COLLATE MYSEQUENCE), CASETEST('tap', 'TAP' COLLATE NOCASE)"; + using (DbDataReader reader = cmd.ExecuteReader()) + { + reader.Read(); + if (reader.GetInt64(0) != reader.GetInt64(2) || reader.GetInt64(1) != 1 || reader.GetInt64(0) != 0) + throw new Exception("CharIndex returned wrong results!"); + } + } + } + + [Test] + internal void DataTypesSchema() + { + using (DataTable tbl = _cnn.GetSchema("DataTypes")) + { + } + } + + /// + /// Make sure our implementation of ClearPool() behaves exactly as the SqlClient version is documented to behave. + /// + [Test(Sequence=90)] + internal void ClearPoolTest() + { + string table = "clearpool"; + string temp = "TEMP"; + + if (_fact.GetType().Name.IndexOf("SQLite", StringComparison.OrdinalIgnoreCase) == -1) + { + temp = String.Empty; + table = "#clearpool"; + } + + object value; + if (_cnnstring.TryGetValue("Pooling", out value) == false) throw new Exception("Pooling not present in connection string"); + if ((bool)value == false) throw new InconclusiveException("Pooling not enabled in the connection string"); + + string sql = String.Format("CREATE {0} TABLE {1}(id int primary key);", temp, table); + using (DbCommand cmd = _cnn.CreateCommand()) + { + // Create a temp table in the main connection so we can confirm our new connections are using true new connections + cmd.CommandText = sql; + cmd.ExecuteNonQuery(); + } + + for (int n = 0; n < 10; n++) + { + using (DbConnection newcnn = ((ICloneable)_cnn).Clone() as DbConnection) + { + if (newcnn.State != ConnectionState.Open) newcnn.Open(); + using (DbCommand cmd = newcnn.CreateCommand()) + { + // If the pool is properly implemented and the pooled connection properly destroyed, this command will succeed. + // If the new connection was obtained from the pool even after we cleared it, then this table will already exist + // and the test fails. + cmd.CommandText = sql; + cmd.ExecuteNonQuery(); + } + // Try and clear the pool associated with this file + newcnn.GetType().InvokeMember("ClearPool", System.Reflection.BindingFlags.Static | System.Reflection.BindingFlags.InvokeMethod | System.Reflection.BindingFlags.Public, null, null, new object[] { newcnn }); + + // At this point when the connection is destroyed, it should not be returned to the pool, but instead disposed. + } + } + } + + /// + /// This tests ClearAllPools() functionality. Makes sure that the pool is working properly and clearing properly. + /// + [Test(Sequence = 100)] + internal void ClearAllPoolsTest() + { + string table = "clearpool"; + string temp = "TEMP"; + string exists = " IF NOT EXISTS "; + + if (_fact.GetType().Name.IndexOf("SQLite", StringComparison.OrdinalIgnoreCase) == -1) + { + temp = String.Empty; + exists = String.Empty; + table = "#clearpool"; + } + + object value; + if (_cnnstring.TryGetValue("Pooling", out value) == false) throw new Exception("Pooling not present in connection string"); + if ((bool)value == false) throw new InconclusiveException("Pooling not enabled in the connection string"); + + string sql = String.Format("CREATE {0} TABLE {2}{1}(id int primary key);", temp, table, exists); + + _cnn.GetType().InvokeMember("ClearAllPools", System.Reflection.BindingFlags.Static | System.Reflection.BindingFlags.InvokeMethod | System.Reflection.BindingFlags.Public, null, null, null); + + DbConnection[] arr = new DbConnection[10]; + + try + { + // Create 10 connections and create temporary tables on them + for (int n = 0; n < 10; n++) + { + arr[n] = ((ICloneable)_cnn).Clone() as DbConnection; + if (arr[n].State != ConnectionState.Open) arr[n].Open(); + + using (DbCommand cmd = arr[n].CreateCommand()) + { + cmd.CommandText = sql; + cmd.ExecuteNonQuery(); + cmd.CommandText = String.Format("INSERT INTO {1} (id) VALUES({0})", n, table); + cmd.ExecuteNonQuery(); + } + + switch (n) + { + case 2: // Put this one back into the pool + arr[n].Dispose(); + arr[n] = null; + break; + case 4: + // Clear all the pools + _cnn.GetType().InvokeMember("ClearAllPools", System.Reflection.BindingFlags.Static | System.Reflection.BindingFlags.InvokeMethod | System.Reflection.BindingFlags.Public, null, null, null); + break; + } + } + + // Now close all the connections. Only the last 5 should go into the pool + for (int n = 0; n < 10; n++) + { + if (arr[n] != null) + { + arr[n].Dispose(); + arr[n] = null; + } + } + + // Open 10 connections. They should either have a clearpool containing an id of 5 or greater, + // or should have no clearpool table at all. + for (int n = 0; n < 10; n++) + { + arr[n] = ((ICloneable)_cnn).Clone() as DbConnection; + if (arr[n].State != ConnectionState.Open) arr[n].Open(); + + using (DbCommand cmd = arr[n].CreateCommand()) + { + cmd.CommandText = sql; + cmd.ExecuteNonQuery(); + cmd.CommandText = String.Format("SELECT [id] FROM {0}", table); + object o = cmd.ExecuteScalar(); + + if (o == null || o == DBNull.Value) + continue; // No data in the table at all, which means we must've just created it -- connection wasn't part of the pool + + if (Convert.ToInt32(o) < 5) + throw new Exception("Unexpected data returned from table!"); + } + } + + // Clear all the pools + _cnn.GetType().InvokeMember("ClearAllPools", System.Reflection.BindingFlags.Static | System.Reflection.BindingFlags.InvokeMethod | System.Reflection.BindingFlags.Public, null, null, null); + + } + finally + { + // Close all the connections + for (int n = 0; n < 10; n++) + { + if (arr[n] != null) + { + arr[n].Dispose(); + arr[n] = null; + } + } + // Clear all the pools + _cnn.GetType().InvokeMember("ClearAllPools", System.Reflection.BindingFlags.Static | System.Reflection.BindingFlags.InvokeMethod | System.Reflection.BindingFlags.Public, null, null, null); + } + } + + [Test(Sequence = 50)] + internal void CoersionTest() + { + using (DbCommand cmd = _cnn.CreateCommand()) + { + cmd.CommandText = "SELECT Field1, Field2, [Fiëld3], [Fiæld4], Field5, 'A', 1, 1 + 1, 3.14159 FROM TestCase"; + using (DbDataReader rd = cmd.ExecuteReader()) + { + if (rd.Read()) + { + object Field1 = rd.GetInt32(0); + object Field2 = rd.GetDouble(1); + object Field3 = rd.GetString(2); + object Field4 = rd.GetString(3).TrimEnd(); + object Field5 = rd.GetDateTime(4); + + // The next statement should cause an exception + try + { + Field1 = rd.GetString(0); + throw new Exception("Should have failed type checking!"); + } + catch (InvalidCastException) + { + } + + try + { + Field2 = rd.GetString(1); + throw new Exception("Should have failed type checking!"); + } + catch (InvalidCastException) + { + } + Field3 = rd.GetString(2); + Field4 = rd.GetString(3); + + Field1 = rd.GetInt32(0); + + try + { + Field2 = rd.GetInt32(1); + throw new Exception("Should have failed type checking!"); + } + catch (InvalidCastException) + { + } + + try + { + Field3 = rd.GetInt32(2); + throw new Exception("Should have failed type checking!"); + } + catch (InvalidCastException) + { + } + + try + { + Field4 = rd.GetInt32(3); + throw new Exception("Should have failed type checking!"); + } + catch (InvalidCastException) + { + } + try + { + Field5 = rd.GetInt32(4); + throw new Exception("Should have failed type checking!"); + } + catch (InvalidCastException) + { + } + + try + { + Field3 = rd.GetDecimal(2); + throw new Exception("Should have failed type checking!"); + } + catch (InvalidCastException) + { + } + catch (FormatException) + { + } + try + { + Field4 = rd.GetDecimal(3); + throw new Exception("Should have failed type checking!"); + } + catch (InvalidCastException) + { + } + catch (FormatException) + { + } + try + { + Field5 = rd.GetDecimal(4); + throw new Exception("Should have failed type checking!"); + } + catch (InvalidCastException) + { + } + catch (FormatException) + { + } + } + else throw new Exception("No data in table"); + } + } + } + + [Test(Sequence = 10)] + internal void CreateTable() + { + droptables.Add("TestCase"); + + using (DbCommand cmd = _cnn.CreateCommand()) + { + if (_fact.GetType().Name.IndexOf("SQLite", StringComparison.OrdinalIgnoreCase) == -1) + cmd.CommandText = "CREATE TABLE TestCase (ID bigint primary key identity, Field1 integer, Field2 Float, [Fiëld3] VARCHAR(50), [Fiæld4] CHAR(10), Field5 DateTime, Field6 Image)"; + else + cmd.CommandText = "CREATE TABLE TestCase (ID integer primary key autoincrement, Field1 int, Field2 Float, [Fiëld3] VARCHAR(50), [Fiæld4] CHAR(10), Field5 DateTime, Field6 Image)"; + + cmd.ExecuteNonQuery(); + } + } + + [Test(Sequence = 1100)] + internal string DataAdapterTest() + { + return DataAdapter(false); + } + + [Test(Sequence = 1200)] + internal string DataAdapterWithIdentityFetch() + { + return DataAdapter(true); + } + + /// + /// Utilizes the SQLiteCommandBuilder, + /// which in turn utilizes SQLiteDataReader's GetSchemaTable() functionality + /// This insert is slow because it must raise callbacks before and after every update. + /// For a fast update, see the FastInsertMany function beneath this one + /// + internal string DataAdapter(bool bWithIdentity) + { + StringBuilder builder = new StringBuilder(); + + using (DbTransaction dbTrans = _cnn.BeginTransaction()) + { + using (DbDataAdapter adp = _fact.CreateDataAdapter()) + { + using (DbCommand cmd = _cnn.CreateCommand()) + { + cmd.Transaction = dbTrans; + cmd.CommandText = "SELECT * FROM TestCase WHERE 1 = 2"; + adp.SelectCommand = cmd; + + using (DbCommandBuilder bld = _fact.CreateCommandBuilder()) + { + bld.DataAdapter = adp; + using (adp.InsertCommand = (DbCommand)((ICloneable)bld.GetInsertCommand()).Clone()) + { + if (bWithIdentity) + { + if (_fact.GetType().Name.IndexOf("SQLite", StringComparison.OrdinalIgnoreCase) == -1) + adp.InsertCommand.CommandText += ";SELECT SCOPE_IDENTITY() AS [ID]"; + else + adp.InsertCommand.CommandText += ";SELECT last_insert_rowid() AS [ID]"; + adp.InsertCommand.UpdatedRowSource = UpdateRowSource.FirstReturnedRecord; + } + bld.DataAdapter = null; + + using (DataTable tbl = new DataTable()) + { + adp.Fill(tbl); + for (int n = 0; n < 10000; n++) + { + DataRow row = tbl.NewRow(); + row[1] = n + (50000 * ((bWithIdentity == true) ? 2 : 1)); + tbl.Rows.Add(row); + } + + //Console.WriteLine(String.Format(" Inserting using CommandBuilder and DataAdapter\r\n ->{0} (10,000 rows) ...", (bWithIdentity == true) ? "(with identity fetch)" : "")); + int dtStart = Environment.TickCount; + adp.Update(tbl); + int dtEnd = Environment.TickCount; + dtEnd -= dtStart; + builder.AppendFormat("Insert Ends in {0} ms ... ", (dtEnd)); + + dtStart = Environment.TickCount; + dbTrans.Commit(); + dtEnd = Environment.TickCount; + dtEnd -= dtStart; + builder.AppendFormat("Commits in {0} ms", (dtEnd)); + + if (bWithIdentity) + { + using (DataTable tbl2 = new DataTable()) + { + adp.SelectCommand.CommandText = "SELECT * FROM TestCase WHERE Field1 BETWEEN 100000 AND 199999 ORDER BY Field1"; + adp.Fill(tbl2); + + if (tbl2.Rows.Count != tbl.Rows.Count) throw new Exception("Selected data doesn't match updated data!"); + + for (int n = 0; n < tbl.Rows.Count; n++) + { + if (tbl.Rows[n][0].Equals(tbl2.Rows[n][0]) == false) + throw new Exception("Fetched identity doesn't match selected identity!"); + } + } + } + } + } + } + } + } + } + return builder.ToString(); + } + + /// + /// Make sure a datareader can run even if the parent command is disposed, and that the connection is closed + /// by the datareader when it is finished. + /// + [Test] + internal void DataReaderCleanup() + { + DbConnection newcnn = ((ICloneable)_cnn).Clone() as DbConnection; + DbCommand cmd = newcnn.CreateCommand(); + + try + { + if (newcnn.State != ConnectionState.Open) + newcnn.Open(); + + cmd.CommandText = "SELECT 1, 2, 3"; + using (DbDataReader reader = cmd.ExecuteReader(CommandBehavior.CloseConnection)) + { + cmd.Dispose(); // Dispose of the command while an open reader is active ... should still be able to read + try + { + reader.Read(); + } + catch + { + throw new Exception("Unable to read from a DataReader!"); + } + + if (reader.GetInt32(0) != 1 || reader.GetInt32(1) != 2 || reader.GetInt32(2) != 3) + throw new Exception("Unexpected return values from reader!"); + + reader.Close(); // Close the reader, and check if the connection is closed + + if (newcnn.State != ConnectionState.Closed) + throw new Exception("DataReader failed to cleanup!"); + } + } + finally + { + cmd.Dispose(); + newcnn.Dispose(); + } + } + + [Test] + internal void DataTypeTest() + { + DateTime now = DateTime.Now; + + using (DbCommand cmd = _cnn.CreateCommand()) + { + droptables.Add("datatypetest"); + + if (_fact.GetType().Name.IndexOf("SQLite", StringComparison.OrdinalIgnoreCase) == -1) + cmd.CommandText = "create table datatypetest(id bigint identity primary key, myvalue sql_variant, datetimevalue datetime, decimalvalue decimal(38,18))"; + else + cmd.CommandText = "create table datatypetest(id integer primary key, myvalue sql_variant, datetimevalue datetime, decimalvalue decimal(38,18))"; + + cmd.ExecuteNonQuery(); + + System.Globalization.CultureInfo oldculture = System.Threading.Thread.CurrentThread.CurrentCulture; + System.Globalization.CultureInfo olduiculture = System.Threading.Thread.CurrentThread.CurrentUICulture; + + // Insert using a different current culture + System.Threading.Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo("es-ES"); + System.Threading.Thread.CurrentThread.CurrentUICulture = System.Threading.Thread.CurrentThread.CurrentCulture; + + try + { + cmd.CommandText = "insert into datatypetest(myvalue, datetimevalue, decimalvalue) values(@p1,@p2,@p3)"; + DbParameter p1 = cmd.CreateParameter(); + DbParameter p2 = cmd.CreateParameter(); + DbParameter p3 = cmd.CreateParameter(); + + cmd.Parameters.Add(p1); + cmd.Parameters.Add(p2); + cmd.Parameters.Add(p3); + + p1.ParameterName = "@p1"; + p2.ParameterName = "@p2"; + p3.ParameterName = "@p3"; + + p1.Value = (long)1; + p2.Value = new DateTime(1753, 1, 1); + p3.Value = (Decimal)1.05; + cmd.ExecuteNonQuery(); + + p1.ResetDbType(); + p2.ResetDbType(); + p3.ResetDbType(); + + p1.Value = "One"; + p2.Value = "2001-01-01"; + p3.Value = (Decimal)1.0; + cmd.ExecuteNonQuery(); + + p1.ResetDbType(); + p2.ResetDbType(); + p3.ResetDbType(); + + p1.Value = 1.01; + p2.Value = now; + p3.Value = (Decimal)9.91; + cmd.ExecuteNonQuery(); + + // Read using a different current culture + System.Threading.Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo("en-US"); + System.Threading.Thread.CurrentThread.CurrentUICulture = System.Threading.Thread.CurrentThread.CurrentCulture; + + cmd.CommandText = "select myvalue, datetimevalue, decimalvalue from datatypetest"; + cmd.Parameters.Clear(); + using (DbDataReader reader = cmd.ExecuteReader()) + { + for (int n = 0; n < 3; n++) + { + reader.Read(); + if (reader.GetValue(1).GetType() != reader.GetDateTime(1).GetType()) throw new Exception("DateTime type non-match"); + if (reader.GetValue(2).GetType() != reader.GetDecimal(2).GetType()) throw new Exception("Decimal type non-match"); + + switch (n) + { + case 0: + if (reader.GetValue(0).GetType() != typeof(long)) throw new Exception("long type non-match"); + + if (reader.GetValue(0).Equals((long)1) == false) throw new Exception("long value non-match"); + if (reader.GetValue(1).Equals(new DateTime(1753, 1, 1)) == false) throw new Exception(String.Format("DateTime value non-match expected {0} got {1}", new DateTime(1753, 1, 1), reader.GetValue(1))); + if (reader.GetValue(2).Equals((Decimal)1.05) == false) throw new Exception("Decimal value non-match"); + + if (reader.GetValue(0).Equals(reader.GetInt64(0)) == false) throw new Exception(String.Format("long value failed to match itself, {0} and {1}", reader.GetValue(0), reader.GetInt64(0))); + if (reader.GetValue(1).Equals(reader.GetDateTime(1)) == false) throw new Exception(String.Format("DateTime failed to match itself {0} and {1}", reader.GetValue(1), reader.GetDateTime(1))); + if (reader.GetValue(2).Equals(reader.GetDecimal(2)) == false) throw new Exception(String.Format("Decimal failed to match itself {0} and {1}", reader.GetValue(2), reader.GetDecimal(2))); + break; + case 1: + if (reader.GetValue(0).GetType() != typeof(string)) throw new Exception("String type non-match"); + if (reader.GetValue(0).Equals("One") == false) throw new Exception("String value non-match"); + if (reader.GetValue(1).Equals(new DateTime(2001, 1, 1)) == false) throw new Exception(String.Format("DateTime value non-match expected {0} got {1}", new DateTime(2001, 1, 1), reader.GetValue(1))); + if (reader.GetValue(2).Equals((Decimal)1.0) == false) throw new Exception("Decimal value non-match"); + + if (reader.GetString(0) != "One") throw new Exception("String value non-match"); + if (reader.GetValue(1).Equals(reader.GetDateTime(1)) == false) throw new Exception(String.Format("DateTime failed to match itself {0} and {1}", reader.GetValue(1), reader.GetDateTime(1))); + if (reader.GetValue(2).Equals(reader.GetDecimal(2)) == false) throw new Exception(String.Format("Decimal failed to match itself {0} and {1}", reader.GetValue(2), reader.GetDecimal(2))); + break; + case 2: + if (reader.GetValue(0).GetType() != typeof(double)) throw new Exception("Double type non-match"); + if (reader.GetValue(0).Equals(1.01) == false) throw new Exception("Double value non-match"); + if (reader.GetValue(1).ToString() != now.ToString()) throw new Exception(String.Format("DateTime value non-match, expected {0} got {1}", now, reader.GetValue(1))); + if (reader.GetValue(2).Equals((Decimal)9.91) == false) throw new Exception("Decimal value non-match"); + + if (reader.GetDouble(0) != 1.01) throw new Exception("Double value non-match"); + if (reader.GetValue(1).Equals(reader.GetDateTime(1)) == false) throw new Exception(String.Format("DateTime failed to match itself {0} and {1}", reader.GetValue(1), reader.GetDateTime(1))); + if (reader.GetValue(2).Equals(reader.GetDecimal(2)) == false) throw new Exception(String.Format("Decimal failed to match itself {0} and {1}", reader.GetValue(2), reader.GetDecimal(2))); + break; + } + } + } + } + finally + { + System.Threading.Thread.CurrentThread.CurrentCulture = oldculture; + System.Threading.Thread.CurrentThread.CurrentUICulture = olduiculture; + } + } + } + + /// + /// This is an mean ugly test that leaves a lot of open datareaders out on many connections + /// to see if the database can survive being cloned a lot and disposed while active readers are up. + /// + [Test(Sequence = 40)] + internal void LeakyDataReaders() + { + try + { + { + DbConnection newcnn = null; + try + { + for (int x = 0; x < 10000; x++) + { + if (newcnn == null) + { + newcnn = ((ICloneable)_cnn).Clone() as DbConnection; + } + + if (newcnn.State != ConnectionState.Open) + newcnn.Open(); + + DbCommand cmd = newcnn.CreateCommand(); + cmd.CommandText = "SELECT * FROM TestCase"; + DbDataReader reader = cmd.ExecuteReader(); + reader.Read(); + object obj = reader[0]; + + if (x % 500 == 0) + { + newcnn.Close(); + newcnn = null; + } + } + } + finally + { + if (newcnn != null) + newcnn.Close(); + + newcnn = null; + } + } + CheckLocked(); + } + catch (Exception e) + { + System.Diagnostics.Debug.WriteLine(e.Message); + } + } + + [Test(Sequence = int.MaxValue)] + internal void DropTable() + { + DropTables(true); + } + + internal void DropTables(bool throwError) + { + //string[] arr = new string[] { "TestCase", "datatypetest", "MultiThreadedTest", "fulltext", "guidtest", "keyinfotest", "stepreader", "nonexistent" }; + string errors = String.Empty; + + using (DbCommand cmd = _cnn.CreateCommand()) + { + foreach(string table in droptables) + { + try + { + cmd.CommandText = String.Format("DROP TABLE{1} [{0}]", table, (throwError == false) ? " IF EXISTS" : ""); + cmd.ExecuteNonQuery(); + } + catch (Exception e) + { + if (throwError == true) + errors += String.Format("{0}\r\n", e.Message); + } + } + + foreach (string table in maydroptable) + { + try + { + cmd.CommandText = String.Format("DROP TABLE{1} [{0}]", table, (throwError == false) ? " IF EXISTS" : ""); + cmd.ExecuteNonQuery(); + } + catch (Exception) + { + } + } + } + + if (String.IsNullOrEmpty(errors) == false) + throw new Exception(errors); + + } + + [Test(Sequence = 1000)] + internal string FastInsertMany() + { + StringBuilder builder = new StringBuilder(); + using (DbTransaction dbTrans = _cnn.BeginTransaction()) + { + int dtStart; + int dtEnd; + + using (DbCommand cmd = _cnn.CreateCommand()) + { + cmd.Transaction = dbTrans; + cmd.CommandText = "INSERT INTO TestCase(Field1) VALUES(@p1)"; + DbParameter Field1 = cmd.CreateParameter(); + + Field1.ParameterName = "@p1"; + cmd.Parameters.Add(Field1); + + //Console.WriteLine(String.Format(" Fast insert using parameters and prepared statement\r\n -> (100,000 rows) Begins ... ")); + dtStart = Environment.TickCount; + for (int n = 0; n < 100000; n++) + { + Field1.Value = n + 200000; + cmd.ExecuteNonQuery(); + } + + dtEnd = Environment.TickCount; + dtEnd -= dtStart; + builder.AppendFormat("Ends in {0} ms ... ", (dtEnd)); + } + + dtStart = Environment.TickCount; + dbTrans.Commit(); + dtEnd = Environment.TickCount; + dtEnd -= dtStart; + builder.AppendFormat("Commits in {0} ms", (dtEnd)); + } + return builder.ToString(); + } + + [Test] + internal void FullTextTest() + { + CheckSQLite(); + + using (DbCommand cmd = _cnn.CreateCommand()) + { + droptables.Add("FullText"); + cmd.CommandText = "CREATE VIRTUAL TABLE FullText USING FTS3(name, ingredients);"; + cmd.ExecuteNonQuery(); + + string[] names = { "broccoli stew", "pumpkin stew", "broccoli pie", "pumpkin pie" }; + string[] ingredients = { "broccoli peppers cheese tomatoes", "pumpkin onions garlic celery", "broccoli cheese onions flour", "pumpkin sugar flour butter" }; + int n; + + cmd.CommandText = "insert into FullText (name, ingredients) values (@name, @ingredient);"; + DbParameter name = cmd.CreateParameter(); + DbParameter ingredient = cmd.CreateParameter(); + + name.ParameterName = "@name"; + ingredient.ParameterName = "@ingredient"; + + cmd.Parameters.Add(name); + cmd.Parameters.Add(ingredient); + + for (n = 0; n < names.Length; n++) + { + name.Value = names[n]; + ingredient.Value = ingredients[n]; + + cmd.ExecuteNonQuery(); + } + + cmd.CommandText = "select rowid, name, ingredients from FullText where name match 'pie';"; + cmd.Parameters.Clear(); + + int[] rowids = { 3, 4 }; + n = 0; + + using (DbDataReader reader = cmd.ExecuteReader()) + { + while (reader.Read()) + { + if (reader.GetInt64(0) != rowids[n++]) + throw new Exception("Unexpected rowid returned"); + + if (n > rowids.Length) throw new Exception("Too many rows returned"); + } + } + } + } + + [Test] + internal void GuidTest() + { + using (DbCommand cmd = _cnn.CreateCommand()) + { + Guid guid = Guid.NewGuid(); + + droptables.Add("GuidTest"); + + cmd.CommandText = "CREATE TABLE GuidTest(MyGuid uniqueidentifier)"; + cmd.ExecuteNonQuery(); + + // Insert a guid as a default binary representation + cmd.CommandText = "INSERT INTO GuidTest(MyGuid) VALUES(@b)"; + DbParameter parm = cmd.CreateParameter(); + parm.ParameterName = "@b"; + parm.Value = guid; + cmd.Parameters.Add(parm); + //((SQLiteParameterCollection)cmd.Parameters).AddWithValue("@b", guid); + + // Insert a guid as text + cmd.ExecuteNonQuery(); + cmd.Parameters[0].Value = guid.ToString(); + cmd.Parameters[0].DbType = DbType.String; + cmd.ExecuteNonQuery(); + + cmd.CommandText = "SELECT MyGuid FROM GuidTest"; + cmd.Parameters.Clear(); + + using (DbDataReader reader = cmd.ExecuteReader()) + { + reader.Read(); + if (reader.GetFieldType(0) != typeof(Guid)) throw new Exception("Column is not a Guid"); + if (reader.GetGuid(0) != guid) throw new Exception(String.Format("Got guid {0}, expected {1}", reader.GetGuid(0), guid)); + + reader.Read(); + if (reader.GetFieldType(0) != typeof(Guid)) throw new Exception("Column is not a Guid"); + if (reader.GetGuid(0) != guid) throw new Exception(String.Format("Got guid {0}, expected {1}", reader.GetGuid(0), guid)); + } + } + } + + [Test(Sequence = 20)] + internal void InsertTable() + { + using (DbCommand cmd = _cnn.CreateCommand()) + { + cmd.CommandText = "INSERT INTO TestCase(Field1, Field2, [Fiëld3], [Fiæld4], Field5) VALUES(1, 3.14159, 'Fiëld3', 'Fiæld4', '2005-01-01 13:49:00')"; + cmd.ExecuteNonQuery(); + } + } + + [Test] + internal string IterationTest1() + { + CheckSQLite(); + using (DbCommand cmd = _cnn.CreateCommand()) + { + int dtStart; + int dtEnd; + int nCount; + long n; + + cmd.CommandText = "SELECT Foo(ID, ID) FROM TestCase"; + cmd.Prepare(); + dtStart = Environment.TickCount; + nCount = 0; + using (DbDataReader rd = cmd.ExecuteReader()) + { + while (rd.Read()) + { + n = rd.GetInt64(0); + nCount++; + } + dtEnd = Environment.TickCount; + } + return String.Format("User Function iteration of {0} records in {1} ms", nCount, (dtEnd - dtStart)); + } + } + + [Test] + internal string IterationTest2() + { + StringBuilder builder = new StringBuilder(); + using (DbCommand cmd = _cnn.CreateCommand()) + { + int dtStart; + int dtEnd; + int nCount; + long n; + + cmd.CommandText = "SELECT ID FROM TestCase"; + cmd.Prepare(); + dtStart = Environment.TickCount; + nCount = 0; + using (DbDataReader rd = cmd.ExecuteReader()) + { + while (rd.Read()) + { + n = rd.GetInt64(0); + nCount++; + } + dtEnd = Environment.TickCount; + } + return String.Format("Raw iteration of {0} records in {1} ms", nCount, (dtEnd - dtStart)); + } + } + + [Test] + internal string IterationTest3() + { + StringBuilder builder = new StringBuilder(); + using (DbCommand cmd = _cnn.CreateCommand()) + { + int dtStart; + int dtEnd; + int nCount; + long n; + + cmd.CommandText = "SELECT ABS(ID) FROM TestCase"; + cmd.Prepare(); + dtStart = Environment.TickCount; + nCount = 0; + using (DbDataReader rd = cmd.ExecuteReader()) + { + while (rd.Read()) + { + n = rd.GetInt64(0); + nCount++; + } + dtEnd = Environment.TickCount; + } + return String.Format("Intrinsic Function iteration of {0} records in {1} ms", nCount, (dtEnd - dtStart)); + } + } + + [Test(Sequence=21)] + internal void KeyInfoTest() + { + using (DbCommand cmd = _cnn.CreateCommand()) + { + try + { + // First test against integer primary key (optimized) keyinfo fetch + droptables.Add("keyinfotest"); + cmd.CommandText = "Create table keyinfotest (id integer primary key, myuniquevalue integer unique not null, myvalue varchar(50))"; + cmd.ExecuteNonQuery(); + + cmd.CommandText = "Select * from keyinfotest"; + using (DbDataReader reader = cmd.ExecuteReader(CommandBehavior.KeyInfo | CommandBehavior.SchemaOnly)) + { + using (DataTable tbl = reader.GetSchemaTable()) + { + if (tbl.Rows.Count != 3) throw new Exception("Wrong number of columns returned"); + } + } + + cmd.CommandText = "SELECT MyValue FROM keyinfotest"; + using (DbDataReader reader = cmd.ExecuteReader(CommandBehavior.KeyInfo | CommandBehavior.SchemaOnly)) + { + using (DataTable tbl = reader.GetSchemaTable()) + { + if (tbl.Rows.Count != 2) throw new Exception("Wrong number of columns returned"); + } + } + } + finally + { + } + + cmd.CommandText = "DROP TABLE keyinfotest"; + cmd.ExecuteNonQuery(); + + droptables.Remove("keyinfotest"); + + try + { + // Now test against non-integer primary key (unoptimized) subquery keyinfo fetch + droptables.Add("keyinfotest"); + cmd.CommandText = "Create table keyinfotest (id char primary key, myuniquevalue integer unique not null, myvalue varchar(50))"; + cmd.ExecuteNonQuery(); + + cmd.CommandText = "SELECT MyValue FROM keyinfotest"; + using (DbDataReader reader = cmd.ExecuteReader(CommandBehavior.KeyInfo | CommandBehavior.SchemaOnly)) + { + using (DataTable tbl = reader.GetSchemaTable()) + { + if (tbl.Rows.Count != 2) throw new Exception("Wrong number of columns returned"); + } + } + + cmd.CommandText = "Select * from keyinfotest"; + using (DbDataReader reader = cmd.ExecuteReader(CommandBehavior.KeyInfo | CommandBehavior.SchemaOnly)) + { + using (DataTable tbl = reader.GetSchemaTable()) + { + if (tbl.Rows.Count != 3) throw new Exception("Wrong number of columns returned"); + } + } + + // Make sure commandbuilder can generate an update command with the correct parameter count + using (DbDataAdapter adp = _fact.CreateDataAdapter()) + using (DbCommandBuilder builder = _fact.CreateCommandBuilder()) + { + adp.SelectCommand = cmd; + builder.DataAdapter = adp; + builder.ConflictOption = ConflictOption.OverwriteChanges; + + using (DbCommand updatecmd = builder.GetUpdateCommand()) + { + if (updatecmd.Parameters.Count != 4) + throw new Exception("Wrong number of parameters in update command!"); + } + } + } + finally + { + } + } + } + + [Test] + internal void ConnectionStringBuilder() + { + DbConnectionStringBuilder builder = _fact.CreateConnectionStringBuilder(); + if (builder is SQLiteConnectionStringBuilder) + { + bool pool = ((SQLiteConnectionStringBuilder)builder).Pooling; + } + } + + [Test] + internal void LeakyCommands() + { + for (int n = 0; n < 100000; n++) + { + DbCommand cmd = _cnn.CreateCommand(); + cmd.CommandText = "SELECT * FROM sqlite_master"; + cmd.Prepare(); + } + CheckLocked(); + } + + [Test(Sequence = 60)] + internal void LockTest() + { + CheckSQLite(); + + using (DbCommand cmd = _cnn.CreateCommand()) + { + cmd.CommandText = "SELECT Field6 FROM TestCase WHERE Field6 IS NOT NULL"; + byte[] b = new byte[4000]; + + using (DbDataReader rd = cmd.ExecuteReader()) + { + if (rd.Read() == false) throw new Exception("No data to read!"); + + rd.GetBytes(0, 0, b, 0, 4000); + + if (b[0] != 1) throw new Exception("Binary value non-match byte 0"); + if (b[100] != 2) throw new Exception("Binary value non-match byte 100"); + if (b[1000] != 3) throw new Exception("Binary value non-match byte 1000"); + if (b[2000] != 4) throw new Exception("Binary value non-match byte 2000"); + if (b[3000] != 5) throw new Exception("Binary value non-match byte 3000"); + + using (DbConnection clone = (DbConnection)((ICloneable)_cnn).Clone()) + { + if (clone.State != ConnectionState.Open) clone.Open(); + using (DbCommand newcmd = clone.CreateCommand()) + { + newcmd.CommandText = "DELETE FROM TestCase WHERE Field6 IS NULL"; + newcmd.CommandTimeout = 2; + int cmdStart = Environment.TickCount; + int cmdEnd; + + try + { + newcmd.ExecuteNonQuery(); // should fail because there's a reader on the database + throw new ArgumentException("Should not have allowed an execute with an open reader"); // If we got here, the test failed + } + catch (Exception e) + { + if (e is ArgumentException) throw new Exception(e.Message); + + cmdEnd = Environment.TickCount; + if (cmdEnd - cmdStart < 2000 || cmdEnd - cmdStart > 3000) + throw new Exception("Did not give up the lock at the right time!"); // Didn't wait the right amount of time + + } + } + } + } + } + } + + /// + /// Execute multiple steps in a command and verify the results. Makes sure that commands after a select still + /// get executed even if MoveNext() isn't called explicitly to move things along. + /// + [Test] + internal void MultiStepReaderTest() + { + using (DbCommand cmd = _cnn.CreateCommand()) + { + droptables.Add("stepreader"); + cmd.CommandText = "CREATE TABLE stepreader (id int primary key);INSERT INTO stepreader values(1);SELECT * FROM stepreader;UPDATE stepreader set id = id + 1;"; + using (DbDataReader reader = cmd.ExecuteReader()) + { + if (reader.Read() == false) throw new Exception("Failed to read from the table"); + if (reader.GetInt32(0) != 1) throw new Exception(String.Format("Expected {0} got {1}", 1, reader.GetInt32(0))); + } + cmd.CommandText = "SELECT * FROM stepreader"; + using (DbDataReader reader = cmd.ExecuteReader()) + { + if (reader.Read() == false) throw new Exception("Failed to read from the table"); + if (reader.GetInt32(0) != 2) throw new Exception(String.Format("Expected {0} got {1}", 2, reader.GetInt32(0))); + } + } + } + + internal class MTTest + { + internal DbConnection cnn; + internal Exception e; + internal System.Threading.Thread t; + internal int value; + } + + [Test(Sequence=11)] + internal void MultithreadingTest() + { + using (DbCommand cmd = _cnn.CreateCommand()) + { + droptables.Add("MultiThreadedTest"); + if (_fact.GetType().Name.IndexOf("SQLite", StringComparison.OrdinalIgnoreCase) == -1) + cmd.CommandText = "CREATE TABLE MultiThreadedTest(ID integer identity primary key, ThreadId integer, MyValue integer)"; + else + cmd.CommandText = "CREATE TABLE MultiThreadedTest(ID integer primary key, ThreadId integer, MyValue integer)"; + + cmd.ExecuteNonQuery(); + } + + MTTest[] arr = new MTTest[8]; + + for (int n = 0; n < arr.Length; n++) + { + arr[n] = new MTTest(); + arr[n].t = new System.Threading.Thread(new System.Threading.ParameterizedThreadStart(MultithreadedTestThread)); + arr[n].t.IsBackground = true; + arr[n].cnn = ((ICloneable)_cnn).Clone() as DbConnection; + arr[n].t.Start(arr[n]); + } + + System.Threading.Thread.Sleep(8000); + bool failed = false; + Exception e = null; + for (int n = 0; n < arr.Length; n++) + { + if (arr[n].t.Join(0) == false) + { + failed = true; + arr[n].t.Abort(); + } + if (arr[n].e != null) e = arr[n].e; + arr[n].cnn.Dispose(); + } + if (failed) throw new Exception("One or more threads deadlocked"); + if (e != null) + throw e; + } + + internal void MultithreadedTestThread(object obj) + { + MTTest test = obj as MTTest; + + if (test.cnn.State != ConnectionState.Open) + test.cnn.Open(); + + int start = Environment.TickCount; + try + { + using (DbCommand cmd = test.cnn.CreateCommand()) + { + while (Environment.TickCount - start < 2000) + { + using (DbTransaction trans = test.cnn.BeginTransaction()) + { + cmd.CommandText = String.Format("SELECT * FROM MultiThreadedTest WHERE ThreadId = {0}", test.t.ManagedThreadId); + cmd.Transaction = trans; + using (DbDataReader reader = cmd.ExecuteReader()) + { + while (reader.Read()) + { + test.value += Convert.ToInt32(reader[2]); + } + } + cmd.CommandText = String.Format("INSERT INTO MultiThreadedTest(ThreadId, MyValue) VALUES({0}, {1})", test.t.ManagedThreadId, Environment.TickCount); + cmd.ExecuteNonQuery(); + + trans.Commit(); + } + } + } + } + catch (Exception e) + { + test.e = e; + } + } + + [Test] + internal void ParameterizedInsert() + { + using (DbCommand cmd = _cnn.CreateCommand()) + { + cmd.CommandText = "INSERT INTO TestCase(Field1, Field2, [Fiëld3], [Fiæld4], Field5) VALUES(@p1,@p2,@p3,@p4,@p5)"; + DbParameter Field1 = cmd.CreateParameter(); + DbParameter Field2 = cmd.CreateParameter(); + DbParameter Field3 = cmd.CreateParameter(); + DbParameter Field4 = cmd.CreateParameter(); + DbParameter Field5 = cmd.CreateParameter(); + + Field1.ParameterName = "@p1"; + Field2.ParameterName = "@p2"; + Field3.ParameterName = "@p3"; + Field4.ParameterName = "@p4"; + Field5.ParameterName = "@p5"; + + Field1.Value = 2; + Field2.Value = 3.14159; + Field3.Value = "Param Field3"; + Field4.Value = "Field4 Par"; + Field5.Value = DateTime.Now; + + cmd.Parameters.Add(Field1); + cmd.Parameters.Add(Field2); + cmd.Parameters.Add(Field3); + cmd.Parameters.Add(Field4); + cmd.Parameters.Add(Field5); + + cmd.ExecuteNonQuery(); + } + } + + [Test] + internal void ParameterizedInsertMissingParams() + { + using (DbCommand cmd = _cnn.CreateCommand()) + { + cmd.CommandText = "INSERT INTO TestCase(Field1, Field2, [Fiëld3], [Fiæld4], Field5) VALUES(@p1,@p2,@p3,@p4,@p5)"; + DbParameter Field1 = cmd.CreateParameter(); + DbParameter Field2 = cmd.CreateParameter(); + DbParameter Field3 = cmd.CreateParameter(); + DbParameter Field4 = cmd.CreateParameter(); + DbParameter Field5 = cmd.CreateParameter(); + + Field1.ParameterName = "@p1"; + Field2.ParameterName = "@p2"; + Field3.ParameterName = "@p3"; + Field4.ParameterName = "@p4"; + Field5.ParameterName = "@p5"; + + Field1.DbType = System.Data.DbType.Int32; + + Field1.Value = 2; + Field2.Value = 3.14159; + Field3.Value = "Field3 Param"; + Field4.Value = "Field4 Par"; + Field5.Value = DateTime.Now; + + cmd.Parameters.Add(Field1); + cmd.Parameters.Add(Field2); + cmd.Parameters.Add(Field3); + cmd.Parameters.Add(Field4); + + // Assertion here, not enough parameters + try + { + cmd.ExecuteNonQuery(); + throw new Exception("Executed with a missing parameter"); + } + catch (Exception) // Expected + { + } + } + } + + /// + /// Call Prepare() on a multi-statement command text where the second command depends on the existence of the first. + /// + [Test] + internal void PrepareTest() + { + using (DbCommand cmd = _cnn.CreateCommand()) + { + droptables.Add("nonexistent"); + cmd.CommandText = "CREATE TABLE nonexistent(id int primary key);SELECT id FROM nonexistent UNION SELECT 1"; + cmd.Prepare(); + object ob = cmd.ExecuteScalar(); + + if (ob == null || ob == DBNull.Value) throw new Exception("Multiple statements may not be supported"); + if (Convert.ToInt32(ob) != 1) throw new Exception(String.Format("Expected {0} got {1}", 1, ob)); + } + } + + /// + /// Checks to make sure transactions are rolled back before a connection goes back onto the pool + /// + [Test] + internal void PoolingWithStealthTransactionTest() + { + object value; + if (_cnnstring.TryGetValue("Pooling", out value) == false) throw new Exception("Pooling not present in connection string"); + if ((bool)value == false) throw new InconclusiveException("Pooling not enabled in the connection string"); + + maydroptable.Add("PoolTest"); + + for (int n = 0; n < 100; n++) + { + using (DbConnection newcnn = ((ICloneable)_cnn).Clone() as DbConnection) + { + if (newcnn.State != ConnectionState.Open) newcnn.Open(); + using (DbCommand cmd = newcnn.CreateCommand()) + { + cmd.CommandText = "BEGIN TRANSACTION"; + cmd.ExecuteNonQuery(); + + cmd.CommandText = "CREATE TABLE PoolTest(ID int primary key)"; + cmd.ExecuteNonQuery(); + } + } + } + } + + /// + /// Checks to make sure transactions are rolled back before a connection goes back onto the pool + /// + [Test] + internal void PoolingWithTransactionTest() + { + object value; + if (_cnnstring.TryGetValue("Pooling", out value) == false) throw new Exception("Pooling not present in connection string"); + if ((bool)value == false) throw new InconclusiveException("Pooling not enabled in the connection string"); + + maydroptable.Add("PoolTest"); + for (int n = 0; n < 100; n++) + { + using (DbConnection newcnn = ((ICloneable)_cnn).Clone() as DbConnection) + { + if (newcnn.State != ConnectionState.Open) newcnn.Open(); + DbTransaction trans = newcnn.BeginTransaction(); + using (DbCommand cmd = newcnn.CreateCommand()) + { + cmd.Transaction = trans; + cmd.CommandText = "CREATE TABLE PoolTest(ID int primary key)"; + cmd.ExecuteNonQuery(); + } + } + } + } + + /// + /// Open a reader and then attempt to write to test the writer's command timeout property + /// SQLite doesn't allow a write when a reader is active. + /// *** NOTE AS OF 3.3.8 this test no longer blocks because SQLite now allows you to update table(s) + /// while a reader is active on the same connection. Therefore the timeout test is invalid + /// + internal void TimeoutTest() + { + CheckSQLite(); + + using (DbCommand cmdRead = _cnn.CreateCommand()) + { + cmdRead.CommandText = "SELECT ID FROM TestCase"; + using (DbDataReader rd = cmdRead.ExecuteReader()) + { + using (DbCommand cmdwrite = _cnn.CreateCommand()) + { + cmdwrite.CommandText = "UPDATE [KeyInfoTest] SET [ID] = [ID]"; + cmdwrite.CommandTimeout = 5; + + int dwtick = Environment.TickCount; + try + { + cmdwrite.ExecuteNonQuery(); + } + catch (Exception) + { + dwtick = (Environment.TickCount - dwtick) / 1000; + if (dwtick < 5 || dwtick > 6) + throw new Exception("Timeout didn't wait long enough!"); + + return; + } + throw new Exception("Operation should have failed but completed successfully"); + } + } + } + } + + [Test(Sequence = 41)] + internal void TransactionScopeTest() + { + using (TransactionScope scope = new TransactionScope()) + { + using (DbConnection cnn2 = ((ICloneable)_cnn).Clone() as DbConnection) + { + if (cnn2.State != ConnectionState.Open) cnn2.Open(); + using (DbCommand cmd = cnn2.CreateCommand()) + { + // Created a table inside the transaction scope + cmd.CommandText = "CREATE TABLE VolatileTable (ID INTEGER PRIMARY KEY, MyValue VARCHAR(50))"; + cmd.ExecuteNonQuery(); + + maydroptable.Add("VolatileTable"); + + using (DbCommand cmd2 = cnn2.CreateCommand()) + { + using (cmd2.Transaction = cnn2.BeginTransaction()) + { + // Inserting a value inside the table, inside a transaction which is inside the transaction scope + cmd2.CommandText = "INSERT INTO VolatileTable (ID, MyValue) VALUES(1, 'Hello')"; + cmd2.ExecuteNonQuery(); + cmd2.Transaction.Commit(); + } + } + } + // Connection is disposed before the transactionscope leaves, thereby forcing the connection to stay open + } + // Exit the transactionscope without committing it, causing a rollback of both the create table and the insert + } + + // Verify that the table does not exist + using (DbCommand cmd = _cnn.CreateCommand()) + { + cmd.CommandText = "SELECT COUNT(*) FROM VolatileTable"; + try + { + object o = cmd.ExecuteScalar(); + cmd.CommandText = "DROP TABLE VolatileTable"; + cmd.ExecuteNonQuery(); + throw new InvalidOperationException("Transaction failed! The table exists!"); + } + catch(Exception e) + { + if (e is InvalidOperationException) throw new Exception(e.Message); + return; // Succeeded, the table should not have existed + } + } + } + + /// + /// Causes the user-defined aggregate to be iterated through + /// + /// + [Test] + internal string UserAggregate() + { + CheckSQLite(); + + StringBuilder builder = new StringBuilder(); + using (DbCommand cmd = _cnn.CreateCommand()) + { + int dtStart; + int n = 0; + int nCount; + + cmd.CommandText = "SELECT MyCount(*) FROM TestCase"; + + nCount = 0; + dtStart = Environment.TickCount; + while (Environment.TickCount - dtStart < 1000) + { + n = Convert.ToInt32(cmd.ExecuteScalar()); + nCount++; + } + if (n != 120003) throw new Exception("Unexpected count"); + builder.Append(String.Format("UserAggregate executed {0} times in 1 second.", nCount)); + } + return builder.ToString(); + } + + /// + /// Causes the user-defined collation sequence to be iterated through + /// + [Test] + internal void UserCollation() + { + CheckSQLite(); + + using (DbCommand cmd = _cnn.CreateCommand()) + { + // Using a default collating sequence in descending order, "Param Field3" will appear at the top + // and "Field3" will be next, followed by a NULL. Our user-defined collating sequence will + // deliberately place them out of order so Field3 is first. + cmd.CommandText = "SELECT [Fiëld3] FROM TestCase ORDER BY [Fiëld3] COLLATE MYSEQUENCE DESC"; + string s = (string)cmd.ExecuteScalar(); + if (s != "Fiëld3") throw new Exception("MySequence didn't sort properly"); + } + } + + /// + /// Causes the user-defined function to be called + /// + /// + [Test] + internal string UserFunction1() + { + CheckSQLite(); + using (DbCommand cmd = _cnn.CreateCommand()) + { + int nTimes; + int dtStart; + + nTimes = 0; + cmd.CommandText = "SELECT Foo('ee','foo')"; + dtStart = Environment.TickCount; + while (Environment.TickCount - dtStart < 1000) + { + cmd.ExecuteNonQuery(); + nTimes++; + } + return String.Format("User (text) command executed {0} times in 1 second.", nTimes); + } + } + + [Test] + internal string UserFunction2() + { + CheckSQLite(); + using (DbCommand cmd = _cnn.CreateCommand()) + { + int nTimes; + int dtStart; + + nTimes = 0; + cmd.CommandText = "SELECT Foo(10,11)"; + dtStart = Environment.TickCount; + while (Environment.TickCount - dtStart < 1000) + { + cmd.ExecuteNonQuery(); + nTimes++; + } + return String.Format("UserFunction command executed {0} times in 1 second.", nTimes); + } + } + + [Test] + internal string UserFunction3() + { + CheckSQLite(); + using (DbCommand cmd = _cnn.CreateCommand()) + { + int nTimes; + int dtStart; + + nTimes = 0; + cmd.CommandText = "SELECT ABS(1)"; + dtStart = Environment.TickCount; + while (Environment.TickCount - dtStart < 1000) + { + cmd.ExecuteNonQuery(); + nTimes++; + } + return String.Format("Intrinsic command executed {0} times in 1 second.", nTimes); + } + } + + [Test] + internal string UserFunction4() + { + CheckSQLite(); + using (DbCommand cmd = _cnn.CreateCommand()) + { + int nTimes; + int dtStart; + + nTimes = 0; + cmd.CommandText = "SELECT lower('FOO')"; + dtStart = Environment.TickCount; + while (Environment.TickCount - dtStart < 1000) + { + cmd.ExecuteNonQuery(); + nTimes++; + } + return String.Format("Intrin (txt) command executed {0} times in 1 second.", nTimes); + } + } + + [Test] + internal string UserFunction5() + { + CheckSQLite(); + using (DbCommand cmd = _cnn.CreateCommand()) + { + int nTimes; + int dtStart; + + nTimes = 0; + cmd.CommandText = "SELECT 1"; + dtStart = Environment.TickCount; + while (Environment.TickCount - dtStart < 1000) + { + cmd.ExecuteNonQuery(); + nTimes++; + } + return String.Format("Raw Value command executed {0} times in 1 second.", nTimes); + } + } + + [Test(Sequence = 42)] + internal void VerifyBinaryData() + { + BinaryInsert(); + using (DbCommand cmd = _cnn.CreateCommand()) + { + cmd.CommandText = "SELECT Field6 FROM TestCase WHERE Field6 IS NOT NULL"; + byte[] b = new byte[4000]; + + using (DbDataReader rd = cmd.ExecuteReader()) + { + if (rd.Read() == false) throw new Exception("No data to read!"); + + long n = rd.GetBytes(0, 0, null, 0, 0); + if (n != 4000) throw new Exception("Invalid byte length!"); + + rd.GetBytes(0, 0, b, 0, 4000); + + if (b[0] != 1) throw new Exception("Binary value non-match byte 0"); + if (b[100] != 2) throw new Exception("Binary value non-match byte 100"); + if (b[1000] != 3) throw new Exception("Binary value non-match byte 1000"); + if (b[2000] != 4) throw new Exception("Binary value non-match byte 2000"); + if (b[3000] != 5) throw new Exception("Binary value non-match byte 3000"); + } + } + } + + [Test] + internal void DecimalTest() + { + using (DbCommand cmd = _cnn.CreateCommand()) + { + droptables.Add("DECTEST"); + + cmd.CommandText = "CREATE TABLE DECTEST(x DECIMAL(38,18))"; + cmd.ExecuteNonQuery(); + + cmd.CommandText = "INSERT INTO DECTEST(x) VALUES(0.00001)"; + cmd.ExecuteNonQuery(); + + cmd.CommandText = "SELECT * FROM DECTEST"; + using (DbDataReader reader = cmd.ExecuteReader()) + { + reader.Read(); + decimal d = (decimal)reader.GetValue(0); + d = reader.GetDecimal(0); + } + } + } + + [Test(Sequence = 30)] + internal void VerifyInsert() + { + using (DbCommand cmd = _cnn.CreateCommand()) + { + cmd.CommandText = "SELECT Field1, Field2, [Fiëld3], [Fiæld4], Field5 FROM TestCase"; + cmd.Prepare(); + using (DbDataReader rd = cmd.ExecuteReader()) + { + if (rd.Read()) + { + int Field1 = rd.GetInt32(0); + double Field2 = rd.GetDouble(1); + string Field3 = rd.GetString(2); + string Field4 = rd.GetString(3).TrimEnd(); + DateTime Field5 = rd.GetDateTime(4); + + if (Field1 != 1) throw new Exception(String.Format("Field1 {0} did not match {1}", Field1, 1)); + if (Field2 != 3.14159) throw new Exception(String.Format("Field2 {0} did not match {1}", Field2, 3.14159)); + if (Field3 != "Fiëld3") throw new Exception(String.Format("Field3 {0} did not match {1}", Field3, "Fiëld3")); + if (Field4 != "Fiæld4") throw new Exception(String.Format("Field4 {0} did not match {1}", Field4, "Fiæld4")); + if (Field5.CompareTo(DateTime.Parse("2005-01-01 13:49:00")) != 0) throw new Exception(String.Format("Field5 {0} did not match {1}", Field4, DateTime.Parse("2005-01-01 13:49:00"))); + + if (rd.GetName(0) != "Field1") throw new Exception("Non-Match column name Field1"); + if (rd.GetName(1) != "Field2") throw new Exception("Non-Match column name Field2"); + if (rd.GetName(2) != "Fiëld3") throw new Exception("Non-Match column name Field3"); + if (rd.GetName(3) != "Fiæld4") throw new Exception("Non-Match column name Field4"); + if (rd.GetName(4) != "Field5") throw new Exception("Non-Match column name Field5"); + } + else throw new Exception("No data in table"); + } + } + } + } + + /// + /// Scalar user-defined function. In this example, the same class is declared twice with + /// different function names to demonstrate how to use alias names for user-defined functions. + /// + [SQLiteFunction(Name = "Foo", Arguments = 2, FuncType = FunctionType.Scalar)] + [SQLiteFunction(Name = "TestFunc", Arguments = 2, FuncType = FunctionType.Scalar)] + class TestFunc : SQLiteFunction + { + public override object Invoke(object[] args) + { + if (args[0].GetType() != typeof(int)) return args[0]; + + int Param1 = Convert.ToInt32(args[0]); // First parameter + int Param2 = Convert.ToInt32(args[1]); // Second parameter + + return Param1 + Param2; + } + } + + [SQLiteFunction(Name = "CASETEST", Arguments = 2, FuncType = FunctionType.Scalar)] + class CaseTestFunc : SQLiteFunctionEx + { + public override object Invoke(object[] args) + { + CollationSequence seq = GetCollationSequence(); + return seq.Compare(args[0].ToString(), args[1].ToString()); + } + } + + /// + /// Aggregate user-defined function. Arguments = -1 means any number of arguments is acceptable + /// + [SQLiteFunction(Name = "MyCount", Arguments = -1, FuncType = FunctionType.Aggregate)] + class MyCount : SQLiteFunction + { + public override void Step(object[] args, int nStep, ref object contextData) + { + if (contextData == null) + { + contextData = 1; + } + else + contextData = (int)contextData + 1; + } + + public override object Final(object contextData) + { + return contextData; + } + } + + /// + /// Sample regular expression function. Example Usage: + /// SELECT * FROM foo WHERE name REGEXP '$bar' + /// SELECT * FROM foo WHERE REGEXP('$bar', name) + /// + /// + [SQLiteFunction(Name = "REGEXP", Arguments = 2, FuncType = FunctionType.Scalar)] + class MyRegEx : SQLiteFunction + { + public override object Invoke(object[] args) + { + return System.Text.RegularExpressions.Regex.IsMatch(Convert.ToString(args[1]), Convert.ToString(args[0])); + } + } + + /// + /// User-defined collating sequence. + /// + [SQLiteFunction(Name = "MYSEQUENCE", FuncType = FunctionType.Collation)] + class MySequence : SQLiteFunction + { + public override int Compare(string param1, string param2) + { + // Make sure the string "Fiëld3" is sorted out of order + if (param1 == "Fiëld3") return 1; + if (param2 == "Fiëld3") return -1; + return String.Compare(param1, param2, true); + } + } + + [AttributeUsage(AttributeTargets.Method, Inherited = false, AllowMultiple = false)] + public sealed class TestAttribute : Attribute, IComparable + { + private static int _start = 65535; + private int _sequence; + + public TestAttribute() + { + _sequence = _start; + _start++; + } + + public int Sequence + { + get { return _sequence; } + set { _sequence = value; } + } + + #region IComparable Members + + public int CompareTo(TestAttribute other) + { + return _sequence.CompareTo(other._sequence); + } + #endregion + } + + internal enum TestResultEnum + { + Succeeded = 0, + Failed = 1, + Inconclusive = 2, + } + + internal class InconclusiveException : Exception + { + internal InconclusiveException() + : base() + { + } + + internal InconclusiveException(string message) + : base(message) + { + } + } + + internal class TestEventArgs : EventArgs + { + public readonly string TestName; + public readonly TestResultEnum Result; + public readonly Exception Exception; + public readonly string Message; + public readonly int Duration; + + internal TestEventArgs(string testName, TestResultEnum success, int duration, Exception e, string message) + { + TestName = testName; + Result = success; + Exception = e; + Message = message; + Duration = duration; + } + } + + delegate void TestCompletedEvent(object sender, TestEventArgs args); + delegate void TestStartingEvent(object sender, TestEventArgs args); + + internal abstract class TestCaseBase + { + protected DbProviderFactory _fact; + protected DbConnection _cnn = null; + protected DbConnectionStringBuilder _cnnstring; + protected Dictionary _tests = new Dictionary(); + + public event TestCompletedEvent OnTestFinished; + public event TestStartingEvent OnTestStarting; + public event EventHandler OnAllTestsDone; + + protected TestCaseBase() + { + SortedList items = new SortedList(); + foreach (System.Reflection.MethodInfo mi in GetType().GetMethods(System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.InvokeMethod)) + { + object[] att = mi.GetCustomAttributes(typeof(TestAttribute), false); + if (att.Length == 1) + { + items.Add((TestAttribute)att[0], mi); + } + } + + foreach (KeyValuePair pair in items) + { + _tests.Add(pair.Value.Name, true); + } + } + + protected TestCaseBase(DbProviderFactory factory, string connectionString) + { + _fact = factory; + _cnn = _fact.CreateConnection(); + _cnn.ConnectionString = connectionString; + _cnnstring = _fact.CreateConnectionStringBuilder(); + _cnnstring.ConnectionString = connectionString; + _cnn.Open(); + } + + internal Dictionary Tests + { + get + { + return _tests; + } + set + { + _tests = value; + } + } + + internal void Run() + { + SortedList items = new SortedList(); + foreach (System.Reflection.MethodInfo mi in GetType().GetMethods(System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.InvokeMethod)) + { + object[] att = mi.GetCustomAttributes(typeof(TestAttribute), false); + if (att.Length == 1 && _tests[mi.Name] == true) + { + items.Add((TestAttribute)att[0], mi); + } + } + + foreach (KeyValuePair pair in items) + { + if (OnTestStarting != null) + OnTestStarting(this, new TestEventArgs(pair.Value.Name, TestResultEnum.Inconclusive, 0, null, null)); + + int start = Environment.TickCount; + try + { + object obj = pair.Value.Invoke(this, null); + int duration = Environment.TickCount - start; + if (OnTestFinished != null) + OnTestFinished(this, new TestEventArgs(pair.Value.Name, TestResultEnum.Succeeded, duration, null, (obj is string) ? (string)obj : String.Empty)); + } + catch (Exception e) + { + int duration = Environment.TickCount - start; + Exception inner = e.InnerException; + + if (OnTestFinished != null) + { + if (inner is InconclusiveException) + { + OnTestFinished(this, new TestEventArgs(pair.Value.Name, TestResultEnum.Inconclusive, duration, null, inner.Message)); + } + else + { + OnTestFinished(this, new TestEventArgs(pair.Value.Name, TestResultEnum.Failed, duration, inner, null)); + } + } + } + } + + if (OnAllTestsDone != null) + OnAllTestsDone(this, EventArgs.Empty); + } + } +} Index: test/app.config ================================================================== --- test/app.config +++ test/app.config @@ -1,8 +1,8 @@ - - - - - - - - + + + + + + + + Index: test/test.csproj ================================================================== --- test/test.csproj +++ test/test.csproj @@ -1,169 +1,191 @@ - - - ..\bin\x64\ - true - 512 - - - x64 - true - GlobalSuppressions.cs - false - Off - - - true - ..\bin\x64\ - DEBUG;TRACE - full - x64 - true - GlobalSuppressions.cs - - - ..\bin\ - true - 512 - - - x86 - true - GlobalSuppressions.cs - false - Off - - - ..\bin\Itanium\ - true - 512 - - - Itanium - true - GlobalSuppressions.cs - false - Off - - - true - ..\bin\Itanium\ - DEBUG;TRACE - full - Itanium - true - GlobalSuppressions.cs - - - Debug - AnyCPU - 9.0.30729 - 2.0 - {E27B1B1E-19C0-45E8-AA74-B6E1C041A130} - WinExe - test - test - 4 - true - http://localhost/test - true - Web - true - Foreground - 7 - Days - false - false - false - 1.0.0.* - true - - - 2.0 - - - - - - - true - full - false - ..\bin\ - DEBUG;TRACE - x86 - - - none - true - ..\bin\ManagedOnly\ - - - x86 - 512 - Off - false - - - true - ..\bin\ - DEBUG;TRACE - full - x86 - true - GlobalSuppressions.cs - false - - - - - - False - False - - - - - - - - - - - - True - True - Resources.resx - - - - Form - - - TestCasesDialog.cs - - - - - False - .NET Framework 2.0 - true - - - - - False - .NET Framework 2.0 Beta - true - - - - - ResXFileCodeGenerator - Resources.Designer.cs - - - TestCasesDialog.cs - - - + + + + ..\bin\x64\ + true + 512 + + + x64 + true + GlobalSuppressions.cs + false + Off + AllRules.ruleset + + + true + ..\bin\x64\ + DEBUG;TRACE + full + x64 + true + GlobalSuppressions.cs + AllRules.ruleset + + + ..\bin\ + true + 512 + + + x86 + true + GlobalSuppressions.cs + false + Off + AllRules.ruleset + + + ..\bin\Itanium\ + true + 512 + + + Itanium + true + GlobalSuppressions.cs + false + Off + AllRules.ruleset + + + true + ..\bin\Itanium\ + DEBUG;TRACE + full + Itanium + true + GlobalSuppressions.cs + AllRules.ruleset + + + Debug + AnyCPU + 9.0.30729 + 2.0 + {E27B1B1E-19C0-45E8-AA74-B6E1C041A130} + WinExe + test + test + 4 + true + + + 3.5 + + + + + v4.0 + http://localhost/test + true + Web + true + Foreground + 7 + Days + false + false + false + 0 + 1.0.0.%2a + false + true + Client + + + true + full + false + ..\bin\ + DEBUG;TRACE + x86 + AllRules.ruleset + + + none + true + ..\bin\ManagedOnly\ + + + x86 + 512 + Off + false + AllRules.ruleset + + + true + ..\bin\ + DEBUG;TRACE + full + x86 + true + GlobalSuppressions.cs + false + AllRules.ruleset + + + + + + False + + + + + + + + + + + + True + True + Resources.resx + + + + Form + + + TestCasesDialog.cs + + + + + False + .NET Framework 2.0 + true + + + + + False + .NET Framework 3.5 SP1 Client Profile + false + + + False + .NET Framework 2.0 Beta + true + + + False + .NET Framework 3.5 SP1 + false + + + + + ResXFileCodeGenerator + Resources.Designer.cs + + + TestCasesDialog.cs + + + Index: testce/testce.csproj ================================================================== --- testce/testce.csproj +++ testce/testce.csproj @@ -1,109 +1,109 @@ - - - Debug - AnyCPU - 9.0.30729 - 2.0 - {B86CE504-C4E4-496F-A0F0-E613BCFD3DF7} - WinExe - Properties - test - testce - {4D628B5B-2FBC-4AA6-8C16-197242AEB884};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - PocketPC - 3C41C503-53EF-4c2a-8DD4-A8217CAD115E - 4.20 - testce - v2.0 - - - - - %25CSIDL_PROGRAM_FILES%25 - - - 2.0 - Pocket PC 2003 - - - - - true - full - false - ..\bin\CompactFramework\ - TRACE;DEBUG;PocketPC - true - true - prompt - 512 - 4 - off - true - - - none - true - ..\bin\CompactFramework\ - PocketPC - true - true - prompt - 512 - 4 - off - - - - - False - - - False - - - False - True - - - False - - - False - - - False - - - - - - Form - - - Form1.cs - - - - - - - - Form1.cs - Designer - - - - - - - - - - - - - - - + + + + Debug + AnyCPU + 9.0.30729 + 2.0 + {B86CE504-C4E4-496F-A0F0-E613BCFD3DF7} + WinExe + Properties + test + testce + {4D628B5B-2FBC-4AA6-8C16-197242AEB884};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + PocketPC + 3C41C503-53EF-4c2a-8DD4-A8217CAD115E + 4.20 + testce + v2.0 + + + + + %25CSIDL_PROGRAM_FILES%25 + 0 + 4.0 + Pocket PC 2003 + + + + + true + full + false + ..\bin\CompactFramework\ + TRACE;DEBUG;PocketPC + true + true + prompt + 512 + 4 + off + true + + + none + true + ..\bin\CompactFramework\ + PocketPC + true + true + prompt + 512 + 4 + off + + + + + False + + + False + + + False + True + + + False + + + False + + + False + + + + + + Form + + + Form1.cs + + + + + + + + Form1.cs + Designer + + + + + + + + + + + + + + + Index: testlinq/App.Config ================================================================== --- testlinq/App.Config +++ testlinq/App.Config @@ -1,8 +1,8 @@ - - - - - - - - + + + + + + + + Index: testlinq/NorthwindModel.Designer.cs ================================================================== --- testlinq/NorthwindModel.Designer.cs +++ testlinq/NorthwindModel.Designer.cs @@ -1,3202 +1,3498 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// Runtime Version:2.0.50727.3053 -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -[assembly: global::System.Data.Objects.DataClasses.EdmSchemaAttribute()] -[assembly: global::System.Data.Objects.DataClasses.EdmRelationshipAttribute("northwindEFModel", "FK_Products_CategoryID_CategoryID", "Categories", global::System.Data.Metadata.Edm.RelationshipMultiplicity.ZeroOrOne, typeof(testlinq.Categories), "Products", global::System.Data.Metadata.Edm.RelationshipMultiplicity.Many, typeof(testlinq.Products))] -[assembly: global::System.Data.Objects.DataClasses.EdmRelationshipAttribute("northwindEFModel", "FK_Orders_CustomerID_CustomerID", "Customers", global::System.Data.Metadata.Edm.RelationshipMultiplicity.ZeroOrOne, typeof(testlinq.Customers), "Orders", global::System.Data.Metadata.Edm.RelationshipMultiplicity.Many, typeof(testlinq.Orders))] -[assembly: global::System.Data.Objects.DataClasses.EdmRelationshipAttribute("northwindEFModel", "FK_InternationalOrders_OrderID_OrderID", "Orders", global::System.Data.Metadata.Edm.RelationshipMultiplicity.One, typeof(testlinq.Orders), "InternationalOrders", global::System.Data.Metadata.Edm.RelationshipMultiplicity.ZeroOrOne, typeof(testlinq.InternationalOrders))] -[assembly: global::System.Data.Objects.DataClasses.EdmRelationshipAttribute("northwindEFModel", "FK_OrderDetails_OrderID_OrderID", "Orders", global::System.Data.Metadata.Edm.RelationshipMultiplicity.One, typeof(testlinq.Orders), "OrderDetails", global::System.Data.Metadata.Edm.RelationshipMultiplicity.Many, typeof(testlinq.OrderDetails))] -[assembly: global::System.Data.Objects.DataClasses.EdmRelationshipAttribute("northwindEFModel", "FK_OrderDetails_ProductID_ProductID", "Products", global::System.Data.Metadata.Edm.RelationshipMultiplicity.One, typeof(testlinq.Products), "OrderDetails", global::System.Data.Metadata.Edm.RelationshipMultiplicity.Many, typeof(testlinq.OrderDetails))] -[assembly: global::System.Data.Objects.DataClasses.EdmRelationshipAttribute("northwindEFModel", "FK_Products_SupplierID_SupplierID", "Suppliers", global::System.Data.Metadata.Edm.RelationshipMultiplicity.ZeroOrOne, typeof(testlinq.Suppliers), "Products", global::System.Data.Metadata.Edm.RelationshipMultiplicity.Many, typeof(testlinq.Products))] -[assembly: global::System.Data.Objects.DataClasses.EdmRelationshipAttribute("northwindEFModel", "FK_Territories_RegionID_RegionID", "Regions", global::System.Data.Metadata.Edm.RelationshipMultiplicity.One, typeof(testlinq.Regions), "Territories", global::System.Data.Metadata.Edm.RelationshipMultiplicity.Many, typeof(testlinq.Territories))] -[assembly: global::System.Data.Objects.DataClasses.EdmRelationshipAttribute("northwindEFModel", "EmployeesTerritories", "Employees", global::System.Data.Metadata.Edm.RelationshipMultiplicity.Many, typeof(testlinq.Employees), "Territories", global::System.Data.Metadata.Edm.RelationshipMultiplicity.Many, typeof(testlinq.Territories))] - -// Original file name: -// Generation date: 8/25/2008 8:54:05 AM -namespace testlinq -{ - - /// - /// There are no comments for northwindEFEntities in the schema. - /// - public partial class northwindEFEntities : global::System.Data.Objects.ObjectContext - { - /// - /// Initializes a new northwindEFEntities object using the connection string found in the 'northwindEFEntities' section of the application configuration file. - /// - public northwindEFEntities() : - base("name=northwindEFEntities", "northwindEFEntities") - { - this.OnContextCreated(); - } - /// - /// Initialize a new northwindEFEntities object. - /// - public northwindEFEntities(string connectionString) : - base(connectionString, "northwindEFEntities") - { - this.OnContextCreated(); - } - /// - /// Initialize a new northwindEFEntities object. - /// - public northwindEFEntities(global::System.Data.EntityClient.EntityConnection connection) : - base(connection, "northwindEFEntities") - { - this.OnContextCreated(); - } - partial void OnContextCreated(); - /// - /// There are no comments for Categories in the schema. - /// - public global::System.Data.Objects.ObjectQuery Categories - { - get - { - if ((this._Categories == null)) - { - this._Categories = base.CreateQuery("[Categories]"); - } - return this._Categories; - } - } - private global::System.Data.Objects.ObjectQuery _Categories; - /// - /// There are no comments for Customers in the schema. - /// - public global::System.Data.Objects.ObjectQuery Customers - { - get - { - if ((this._Customers == null)) - { - this._Customers = base.CreateQuery("[Customers]"); - } - return this._Customers; - } - } - private global::System.Data.Objects.ObjectQuery _Customers; - /// - /// There are no comments for Employees in the schema. - /// - public global::System.Data.Objects.ObjectQuery Employees - { - get - { - if ((this._Employees == null)) - { - this._Employees = base.CreateQuery("[Employees]"); - } - return this._Employees; - } - } - private global::System.Data.Objects.ObjectQuery _Employees; - /// - /// There are no comments for InternationalOrders in the schema. - /// - public global::System.Data.Objects.ObjectQuery InternationalOrders - { - get - { - if ((this._InternationalOrders == null)) - { - this._InternationalOrders = base.CreateQuery("[InternationalOrders]"); - } - return this._InternationalOrders; - } - } - private global::System.Data.Objects.ObjectQuery _InternationalOrders; - /// - /// There are no comments for OrderDetails in the schema. - /// - public global::System.Data.Objects.ObjectQuery OrderDetails - { - get - { - if ((this._OrderDetails == null)) - { - this._OrderDetails = base.CreateQuery("[OrderDetails]"); - } - return this._OrderDetails; - } - } - private global::System.Data.Objects.ObjectQuery _OrderDetails; - /// - /// There are no comments for Orders in the schema. - /// - public global::System.Data.Objects.ObjectQuery Orders - { - get - { - if ((this._Orders == null)) - { - this._Orders = base.CreateQuery("[Orders]"); - } - return this._Orders; - } - } - private global::System.Data.Objects.ObjectQuery _Orders; - /// - /// There are no comments for PreviousEmployees in the schema. - /// - public global::System.Data.Objects.ObjectQuery PreviousEmployees - { - get - { - if ((this._PreviousEmployees == null)) - { - this._PreviousEmployees = base.CreateQuery("[PreviousEmployees]"); - } - return this._PreviousEmployees; - } - } - private global::System.Data.Objects.ObjectQuery _PreviousEmployees; - /// - /// There are no comments for Products in the schema. - /// - public global::System.Data.Objects.ObjectQuery Products - { - get - { - if ((this._Products == null)) - { - this._Products = base.CreateQuery("[Products]"); - } - return this._Products; - } - } - private global::System.Data.Objects.ObjectQuery _Products; - /// - /// There are no comments for Regions in the schema. - /// - public global::System.Data.Objects.ObjectQuery Regions - { - get - { - if ((this._Regions == null)) - { - this._Regions = base.CreateQuery("[Regions]"); - } - return this._Regions; - } - } - private global::System.Data.Objects.ObjectQuery _Regions; - /// - /// There are no comments for Suppliers in the schema. - /// - public global::System.Data.Objects.ObjectQuery Suppliers - { - get - { - if ((this._Suppliers == null)) - { - this._Suppliers = base.CreateQuery("[Suppliers]"); - } - return this._Suppliers; - } - } - private global::System.Data.Objects.ObjectQuery _Suppliers; - /// - /// There are no comments for Territories in the schema. - /// - public global::System.Data.Objects.ObjectQuery Territories - { - get - { - if ((this._Territories == null)) - { - this._Territories = base.CreateQuery("[Territories]"); - } - return this._Territories; - } - } - private global::System.Data.Objects.ObjectQuery _Territories; - /// - /// There are no comments for Categories in the schema. - /// - public void AddToCategories(Categories categories) - { - base.AddObject("Categories", categories); - } - /// - /// There are no comments for Customers in the schema. - /// - public void AddToCustomers(Customers customers) - { - base.AddObject("Customers", customers); - } - /// - /// There are no comments for Employees in the schema. - /// - public void AddToEmployees(Employees employees) - { - base.AddObject("Employees", employees); - } - /// - /// There are no comments for InternationalOrders in the schema. - /// - public void AddToInternationalOrders(InternationalOrders internationalOrders) - { - base.AddObject("InternationalOrders", internationalOrders); - } - /// - /// There are no comments for OrderDetails in the schema. - /// - public void AddToOrderDetails(OrderDetails orderDetails) - { - base.AddObject("OrderDetails", orderDetails); - } - /// - /// There are no comments for Orders in the schema. - /// - public void AddToOrders(Orders orders) - { - base.AddObject("Orders", orders); - } - /// - /// There are no comments for PreviousEmployees in the schema. - /// - public void AddToPreviousEmployees(PreviousEmployees previousEmployees) - { - base.AddObject("PreviousEmployees", previousEmployees); - } - /// - /// There are no comments for Products in the schema. - /// - public void AddToProducts(Products products) - { - base.AddObject("Products", products); - } - /// - /// There are no comments for Regions in the schema. - /// - public void AddToRegions(Regions regions) - { - base.AddObject("Regions", regions); - } - /// - /// There are no comments for Suppliers in the schema. - /// - public void AddToSuppliers(Suppliers suppliers) - { - base.AddObject("Suppliers", suppliers); - } - /// - /// There are no comments for Territories in the schema. - /// - public void AddToTerritories(Territories territories) - { - base.AddObject("Territories", territories); - } - } - /// - /// There are no comments for northwindEFModel.Categories in the schema. - /// - /// - /// CategoryID - /// - [global::System.Data.Objects.DataClasses.EdmEntityTypeAttribute(NamespaceName="northwindEFModel", Name="Categories")] - [global::System.Runtime.Serialization.DataContractAttribute(IsReference=true)] - [global::System.Serializable()] - public partial class Categories : global::System.Data.Objects.DataClasses.EntityObject - { - /// - /// Create a new Categories object. - /// - /// Initial value of CategoryID. - /// Initial value of CategoryName. - public static Categories CreateCategories(long categoryID, string categoryName) - { - Categories categories = new Categories(); - categories.CategoryID = categoryID; - categories.CategoryName = categoryName; - return categories; - } - /// - /// There are no comments for Property CategoryID in the schema. - /// - [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute(EntityKeyProperty=true, IsNullable=false)] - [global::System.Runtime.Serialization.DataMemberAttribute()] - public long CategoryID - { - get - { - return this._CategoryID; - } - set - { - this.OnCategoryIDChanging(value); - this.ReportPropertyChanging("CategoryID"); - this._CategoryID = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value); - this.ReportPropertyChanged("CategoryID"); - this.OnCategoryIDChanged(); - } - } - private long _CategoryID; - partial void OnCategoryIDChanging(long value); - partial void OnCategoryIDChanged(); - /// - /// There are no comments for Property CategoryName in the schema. - /// - [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute(IsNullable=false)] - [global::System.Runtime.Serialization.DataMemberAttribute()] - public string CategoryName - { - get - { - return this._CategoryName; - } - set - { - this.OnCategoryNameChanging(value); - this.ReportPropertyChanging("CategoryName"); - this._CategoryName = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value, false); - this.ReportPropertyChanged("CategoryName"); - this.OnCategoryNameChanged(); - } - } - private string _CategoryName; - partial void OnCategoryNameChanging(string value); - partial void OnCategoryNameChanged(); - /// - /// There are no comments for Property Description in the schema. - /// - [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute()] - [global::System.Runtime.Serialization.DataMemberAttribute()] - public string Description - { - get - { - return this._Description; - } - set - { - this.OnDescriptionChanging(value); - this.ReportPropertyChanging("Description"); - this._Description = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value, true); - this.ReportPropertyChanged("Description"); - this.OnDescriptionChanged(); - } - } - private string _Description; - partial void OnDescriptionChanging(string value); - partial void OnDescriptionChanged(); - /// - /// There are no comments for Property Picture in the schema. - /// - [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute()] - [global::System.Runtime.Serialization.DataMemberAttribute()] - public byte[] Picture - { - get - { - return global::System.Data.Objects.DataClasses.StructuralObject.GetValidValue(this._Picture); - } - set - { - this.OnPictureChanging(value); - this.ReportPropertyChanging("Picture"); - this._Picture = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value, true); - this.ReportPropertyChanged("Picture"); - this.OnPictureChanged(); - } - } - private byte[] _Picture; - partial void OnPictureChanging(byte[] value); - partial void OnPictureChanged(); - /// - /// There are no comments for Products in the schema. - /// - [global::System.Data.Objects.DataClasses.EdmRelationshipNavigationPropertyAttribute("northwindEFModel", "FK_Products_CategoryID_CategoryID", "Products")] - [global::System.Xml.Serialization.XmlIgnoreAttribute()] - [global::System.Xml.Serialization.SoapIgnoreAttribute()] - [global::System.Runtime.Serialization.DataMemberAttribute()] - public global::System.Data.Objects.DataClasses.EntityCollection Products - { - get - { - return ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.GetRelatedCollection("northwindEFModel.FK_Products_CategoryID_CategoryID", "Products"); - } - set - { - if ((value != null)) - { - ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.InitializeRelatedCollection("northwindEFModel.FK_Products_CategoryID_CategoryID", "Products", value); - } - } - } - } - /// - /// There are no comments for northwindEFModel.Customers in the schema. - /// - /// - /// CustomerID - /// - [global::System.Data.Objects.DataClasses.EdmEntityTypeAttribute(NamespaceName="northwindEFModel", Name="Customers")] - [global::System.Runtime.Serialization.DataContractAttribute(IsReference=true)] - [global::System.Serializable()] - public partial class Customers : global::System.Data.Objects.DataClasses.EntityObject - { - /// - /// Create a new Customers object. - /// - /// Initial value of CustomerID. - /// Initial value of CompanyName. - public static Customers CreateCustomers(string customerID, string companyName) - { - Customers customers = new Customers(); - customers.CustomerID = customerID; - customers.CompanyName = companyName; - return customers; - } - /// - /// There are no comments for Property CustomerID in the schema. - /// - [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute(EntityKeyProperty=true, IsNullable=false)] - [global::System.Runtime.Serialization.DataMemberAttribute()] - public string CustomerID - { - get - { - return this._CustomerID; - } - set - { - this.OnCustomerIDChanging(value); - this.ReportPropertyChanging("CustomerID"); - this._CustomerID = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value, false); - this.ReportPropertyChanged("CustomerID"); - this.OnCustomerIDChanged(); - } - } - private string _CustomerID; - partial void OnCustomerIDChanging(string value); - partial void OnCustomerIDChanged(); - /// - /// There are no comments for Property CompanyName in the schema. - /// - [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute(IsNullable=false)] - [global::System.Runtime.Serialization.DataMemberAttribute()] - public string CompanyName - { - get - { - return this._CompanyName; - } - set - { - this.OnCompanyNameChanging(value); - this.ReportPropertyChanging("CompanyName"); - this._CompanyName = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value, false); - this.ReportPropertyChanged("CompanyName"); - this.OnCompanyNameChanged(); - } - } - private string _CompanyName; - partial void OnCompanyNameChanging(string value); - partial void OnCompanyNameChanged(); - /// - /// There are no comments for Property ContactName in the schema. - /// - [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute()] - [global::System.Runtime.Serialization.DataMemberAttribute()] - public string ContactName - { - get - { - return this._ContactName; - } - set - { - this.OnContactNameChanging(value); - this.ReportPropertyChanging("ContactName"); - this._ContactName = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value, true); - this.ReportPropertyChanged("ContactName"); - this.OnContactNameChanged(); - } - } - private string _ContactName; - partial void OnContactNameChanging(string value); - partial void OnContactNameChanged(); - /// - /// There are no comments for Property ContactTitle in the schema. - /// - [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute()] - [global::System.Runtime.Serialization.DataMemberAttribute()] - public string ContactTitle - { - get - { - return this._ContactTitle; - } - set - { - this.OnContactTitleChanging(value); - this.ReportPropertyChanging("ContactTitle"); - this._ContactTitle = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value, true); - this.ReportPropertyChanged("ContactTitle"); - this.OnContactTitleChanged(); - } - } - private string _ContactTitle; - partial void OnContactTitleChanging(string value); - partial void OnContactTitleChanged(); - /// - /// There are no comments for Property Address in the schema. - /// - [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute()] - [global::System.Runtime.Serialization.DataMemberAttribute()] - public string Address - { - get - { - return this._Address; - } - set - { - this.OnAddressChanging(value); - this.ReportPropertyChanging("Address"); - this._Address = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value, true); - this.ReportPropertyChanged("Address"); - this.OnAddressChanged(); - } - } - private string _Address; - partial void OnAddressChanging(string value); - partial void OnAddressChanged(); - /// - /// There are no comments for Property City in the schema. - /// - [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute()] - [global::System.Runtime.Serialization.DataMemberAttribute()] - public string City - { - get - { - return this._City; - } - set - { - this.OnCityChanging(value); - this.ReportPropertyChanging("City"); - this._City = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value, true); - this.ReportPropertyChanged("City"); - this.OnCityChanged(); - } - } - private string _City; - partial void OnCityChanging(string value); - partial void OnCityChanged(); - /// - /// There are no comments for Property Region in the schema. - /// - [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute()] - [global::System.Runtime.Serialization.DataMemberAttribute()] - public string Region - { - get - { - return this._Region; - } - set - { - this.OnRegionChanging(value); - this.ReportPropertyChanging("Region"); - this._Region = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value, true); - this.ReportPropertyChanged("Region"); - this.OnRegionChanged(); - } - } - private string _Region; - partial void OnRegionChanging(string value); - partial void OnRegionChanged(); - /// - /// There are no comments for Property PostalCode in the schema. - /// - [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute()] - [global::System.Runtime.Serialization.DataMemberAttribute()] - public string PostalCode - { - get - { - return this._PostalCode; - } - set - { - this.OnPostalCodeChanging(value); - this.ReportPropertyChanging("PostalCode"); - this._PostalCode = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value, true); - this.ReportPropertyChanged("PostalCode"); - this.OnPostalCodeChanged(); - } - } - private string _PostalCode; - partial void OnPostalCodeChanging(string value); - partial void OnPostalCodeChanged(); - /// - /// There are no comments for Property Country in the schema. - /// - [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute()] - [global::System.Runtime.Serialization.DataMemberAttribute()] - public string Country - { - get - { - return this._Country; - } - set - { - this.OnCountryChanging(value); - this.ReportPropertyChanging("Country"); - this._Country = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value, true); - this.ReportPropertyChanged("Country"); - this.OnCountryChanged(); - } - } - private string _Country; - partial void OnCountryChanging(string value); - partial void OnCountryChanged(); - /// - /// There are no comments for Property Phone in the schema. - /// - [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute()] - [global::System.Runtime.Serialization.DataMemberAttribute()] - public string Phone - { - get - { - return this._Phone; - } - set - { - this.OnPhoneChanging(value); - this.ReportPropertyChanging("Phone"); - this._Phone = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value, true); - this.ReportPropertyChanged("Phone"); - this.OnPhoneChanged(); - } - } - private string _Phone; - partial void OnPhoneChanging(string value); - partial void OnPhoneChanged(); - /// - /// There are no comments for Property Fax in the schema. - /// - [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute()] - [global::System.Runtime.Serialization.DataMemberAttribute()] - public string Fax - { - get - { - return this._Fax; - } - set - { - this.OnFaxChanging(value); - this.ReportPropertyChanging("Fax"); - this._Fax = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value, true); - this.ReportPropertyChanged("Fax"); - this.OnFaxChanged(); - } - } - private string _Fax; - partial void OnFaxChanging(string value); - partial void OnFaxChanged(); - /// - /// There are no comments for Orders in the schema. - /// - [global::System.Data.Objects.DataClasses.EdmRelationshipNavigationPropertyAttribute("northwindEFModel", "FK_Orders_CustomerID_CustomerID", "Orders")] - [global::System.Xml.Serialization.XmlIgnoreAttribute()] - [global::System.Xml.Serialization.SoapIgnoreAttribute()] - [global::System.Runtime.Serialization.DataMemberAttribute()] - public global::System.Data.Objects.DataClasses.EntityCollection Orders - { - get - { - return ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.GetRelatedCollection("northwindEFModel.FK_Orders_CustomerID_CustomerID", "Orders"); - } - set - { - if ((value != null)) - { - ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.InitializeRelatedCollection("northwindEFModel.FK_Orders_CustomerID_CustomerID", "Orders", value); - } - } - } - } - /// - /// There are no comments for northwindEFModel.Employees in the schema. - /// - /// - /// EmployeeID - /// - [global::System.Data.Objects.DataClasses.EdmEntityTypeAttribute(NamespaceName="northwindEFModel", Name="Employees")] - [global::System.Runtime.Serialization.DataContractAttribute(IsReference=true)] - [global::System.Serializable()] - public partial class Employees : global::System.Data.Objects.DataClasses.EntityObject - { - /// - /// Create a new Employees object. - /// - /// Initial value of EmployeeID. - /// Initial value of LastName. - /// Initial value of FirstName. - public static Employees CreateEmployees(long employeeID, string lastName, string firstName) - { - Employees employees = new Employees(); - employees.EmployeeID = employeeID; - employees.LastName = lastName; - employees.FirstName = firstName; - return employees; - } - /// - /// There are no comments for Property EmployeeID in the schema. - /// - [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute(EntityKeyProperty=true, IsNullable=false)] - [global::System.Runtime.Serialization.DataMemberAttribute()] - public long EmployeeID - { - get - { - return this._EmployeeID; - } - set - { - this.OnEmployeeIDChanging(value); - this.ReportPropertyChanging("EmployeeID"); - this._EmployeeID = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value); - this.ReportPropertyChanged("EmployeeID"); - this.OnEmployeeIDChanged(); - } - } - private long _EmployeeID; - partial void OnEmployeeIDChanging(long value); - partial void OnEmployeeIDChanged(); - /// - /// There are no comments for Property LastName in the schema. - /// - [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute(IsNullable=false)] - [global::System.Runtime.Serialization.DataMemberAttribute()] - public string LastName - { - get - { - return this._LastName; - } - set - { - this.OnLastNameChanging(value); - this.ReportPropertyChanging("LastName"); - this._LastName = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value, false); - this.ReportPropertyChanged("LastName"); - this.OnLastNameChanged(); - } - } - private string _LastName; - partial void OnLastNameChanging(string value); - partial void OnLastNameChanged(); - /// - /// There are no comments for Property FirstName in the schema. - /// - [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute(IsNullable=false)] - [global::System.Runtime.Serialization.DataMemberAttribute()] - public string FirstName - { - get - { - return this._FirstName; - } - set - { - this.OnFirstNameChanging(value); - this.ReportPropertyChanging("FirstName"); - this._FirstName = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value, false); - this.ReportPropertyChanged("FirstName"); - this.OnFirstNameChanged(); - } - } - private string _FirstName; - partial void OnFirstNameChanging(string value); - partial void OnFirstNameChanged(); - /// - /// There are no comments for Property Title in the schema. - /// - [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute()] - [global::System.Runtime.Serialization.DataMemberAttribute()] - public string Title - { - get - { - return this._Title; - } - set - { - this.OnTitleChanging(value); - this.ReportPropertyChanging("Title"); - this._Title = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value, true); - this.ReportPropertyChanged("Title"); - this.OnTitleChanged(); - } - } - private string _Title; - partial void OnTitleChanging(string value); - partial void OnTitleChanged(); - /// - /// There are no comments for Property TitleOfCourtesy in the schema. - /// - [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute()] - [global::System.Runtime.Serialization.DataMemberAttribute()] - public string TitleOfCourtesy - { - get - { - return this._TitleOfCourtesy; - } - set - { - this.OnTitleOfCourtesyChanging(value); - this.ReportPropertyChanging("TitleOfCourtesy"); - this._TitleOfCourtesy = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value, true); - this.ReportPropertyChanged("TitleOfCourtesy"); - this.OnTitleOfCourtesyChanged(); - } - } - private string _TitleOfCourtesy; - partial void OnTitleOfCourtesyChanging(string value); - partial void OnTitleOfCourtesyChanged(); - /// - /// There are no comments for Property BirthDate in the schema. - /// - [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute()] - [global::System.Runtime.Serialization.DataMemberAttribute()] - public global::System.Nullable BirthDate - { - get - { - return this._BirthDate; - } - set - { - this.OnBirthDateChanging(value); - this.ReportPropertyChanging("BirthDate"); - this._BirthDate = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value); - this.ReportPropertyChanged("BirthDate"); - this.OnBirthDateChanged(); - } - } - private global::System.Nullable _BirthDate; - partial void OnBirthDateChanging(global::System.Nullable value); - partial void OnBirthDateChanged(); - /// - /// There are no comments for Property HireDate in the schema. - /// - [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute()] - [global::System.Runtime.Serialization.DataMemberAttribute()] - public global::System.Nullable HireDate - { - get - { - return this._HireDate; - } - set - { - this.OnHireDateChanging(value); - this.ReportPropertyChanging("HireDate"); - this._HireDate = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value); - this.ReportPropertyChanged("HireDate"); - this.OnHireDateChanged(); - } - } - private global::System.Nullable _HireDate; - partial void OnHireDateChanging(global::System.Nullable value); - partial void OnHireDateChanged(); - /// - /// There are no comments for Property Address in the schema. - /// - [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute()] - [global::System.Runtime.Serialization.DataMemberAttribute()] - public string Address - { - get - { - return this._Address; - } - set - { - this.OnAddressChanging(value); - this.ReportPropertyChanging("Address"); - this._Address = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value, true); - this.ReportPropertyChanged("Address"); - this.OnAddressChanged(); - } - } - private string _Address; - partial void OnAddressChanging(string value); - partial void OnAddressChanged(); - /// - /// There are no comments for Property City in the schema. - /// - [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute()] - [global::System.Runtime.Serialization.DataMemberAttribute()] - public string City - { - get - { - return this._City; - } - set - { - this.OnCityChanging(value); - this.ReportPropertyChanging("City"); - this._City = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value, true); - this.ReportPropertyChanged("City"); - this.OnCityChanged(); - } - } - private string _City; - partial void OnCityChanging(string value); - partial void OnCityChanged(); - /// - /// There are no comments for Property Region in the schema. - /// - [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute()] - [global::System.Runtime.Serialization.DataMemberAttribute()] - public string Region - { - get - { - return this._Region; - } - set - { - this.OnRegionChanging(value); - this.ReportPropertyChanging("Region"); - this._Region = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value, true); - this.ReportPropertyChanged("Region"); - this.OnRegionChanged(); - } - } - private string _Region; - partial void OnRegionChanging(string value); - partial void OnRegionChanged(); - /// - /// There are no comments for Property PostalCode in the schema. - /// - [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute()] - [global::System.Runtime.Serialization.DataMemberAttribute()] - public string PostalCode - { - get - { - return this._PostalCode; - } - set - { - this.OnPostalCodeChanging(value); - this.ReportPropertyChanging("PostalCode"); - this._PostalCode = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value, true); - this.ReportPropertyChanged("PostalCode"); - this.OnPostalCodeChanged(); - } - } - private string _PostalCode; - partial void OnPostalCodeChanging(string value); - partial void OnPostalCodeChanged(); - /// - /// There are no comments for Property Country in the schema. - /// - [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute()] - [global::System.Runtime.Serialization.DataMemberAttribute()] - public string Country - { - get - { - return this._Country; - } - set - { - this.OnCountryChanging(value); - this.ReportPropertyChanging("Country"); - this._Country = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value, true); - this.ReportPropertyChanged("Country"); - this.OnCountryChanged(); - } - } - private string _Country; - partial void OnCountryChanging(string value); - partial void OnCountryChanged(); - /// - /// There are no comments for Property HomePhone in the schema. - /// - [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute()] - [global::System.Runtime.Serialization.DataMemberAttribute()] - public string HomePhone - { - get - { - return this._HomePhone; - } - set - { - this.OnHomePhoneChanging(value); - this.ReportPropertyChanging("HomePhone"); - this._HomePhone = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value, true); - this.ReportPropertyChanged("HomePhone"); - this.OnHomePhoneChanged(); - } - } - private string _HomePhone; - partial void OnHomePhoneChanging(string value); - partial void OnHomePhoneChanged(); - /// - /// There are no comments for Property Extension in the schema. - /// - [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute()] - [global::System.Runtime.Serialization.DataMemberAttribute()] - public string Extension - { - get - { - return this._Extension; - } - set - { - this.OnExtensionChanging(value); - this.ReportPropertyChanging("Extension"); - this._Extension = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value, true); - this.ReportPropertyChanged("Extension"); - this.OnExtensionChanged(); - } - } - private string _Extension; - partial void OnExtensionChanging(string value); - partial void OnExtensionChanged(); - /// - /// There are no comments for Property Photo in the schema. - /// - [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute()] - [global::System.Runtime.Serialization.DataMemberAttribute()] - public byte[] Photo - { - get - { - return global::System.Data.Objects.DataClasses.StructuralObject.GetValidValue(this._Photo); - } - set - { - this.OnPhotoChanging(value); - this.ReportPropertyChanging("Photo"); - this._Photo = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value, true); - this.ReportPropertyChanged("Photo"); - this.OnPhotoChanged(); - } - } - private byte[] _Photo; - partial void OnPhotoChanging(byte[] value); - partial void OnPhotoChanged(); - /// - /// There are no comments for Property Notes in the schema. - /// - [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute()] - [global::System.Runtime.Serialization.DataMemberAttribute()] - public string Notes - { - get - { - return this._Notes; - } - set - { - this.OnNotesChanging(value); - this.ReportPropertyChanging("Notes"); - this._Notes = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value, true); - this.ReportPropertyChanged("Notes"); - this.OnNotesChanged(); - } - } - private string _Notes; - partial void OnNotesChanging(string value); - partial void OnNotesChanged(); - /// - /// There are no comments for Property PhotoPath in the schema. - /// - [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute()] - [global::System.Runtime.Serialization.DataMemberAttribute()] - public string PhotoPath - { - get - { - return this._PhotoPath; - } - set - { - this.OnPhotoPathChanging(value); - this.ReportPropertyChanging("PhotoPath"); - this._PhotoPath = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value, true); - this.ReportPropertyChanged("PhotoPath"); - this.OnPhotoPathChanged(); - } - } - private string _PhotoPath; - partial void OnPhotoPathChanging(string value); - partial void OnPhotoPathChanged(); - /// - /// There are no comments for Territories in the schema. - /// - [global::System.Data.Objects.DataClasses.EdmRelationshipNavigationPropertyAttribute("northwindEFModel", "EmployeesTerritories", "Territories")] - [global::System.Xml.Serialization.XmlIgnoreAttribute()] - [global::System.Xml.Serialization.SoapIgnoreAttribute()] - [global::System.Runtime.Serialization.DataMemberAttribute()] - public global::System.Data.Objects.DataClasses.EntityCollection Territories - { - get - { - return ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.GetRelatedCollection("northwindEFModel.EmployeesTerritories", "Territories"); - } - set - { - if ((value != null)) - { - ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.InitializeRelatedCollection("northwindEFModel.EmployeesTerritories", "Territories", value); - } - } - } - } - /// - /// There are no comments for northwindEFModel.InternationalOrders in the schema. - /// - /// - /// OrderID - /// - [global::System.Data.Objects.DataClasses.EdmEntityTypeAttribute(NamespaceName="northwindEFModel", Name="InternationalOrders")] - [global::System.Runtime.Serialization.DataContractAttribute(IsReference=true)] - [global::System.Serializable()] - public partial class InternationalOrders : global::System.Data.Objects.DataClasses.EntityObject - { - /// - /// Create a new InternationalOrders object. - /// - /// Initial value of OrderID. - /// Initial value of CustomsDescription. - /// Initial value of ExciseTax. - public static InternationalOrders CreateInternationalOrders(long orderID, string customsDescription, decimal exciseTax) - { - InternationalOrders internationalOrders = new InternationalOrders(); - internationalOrders.OrderID = orderID; - internationalOrders.CustomsDescription = customsDescription; - internationalOrders.ExciseTax = exciseTax; - return internationalOrders; - } - /// - /// There are no comments for Property OrderID in the schema. - /// - [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute(EntityKeyProperty=true, IsNullable=false)] - [global::System.Runtime.Serialization.DataMemberAttribute()] - public long OrderID - { - get - { - return this._OrderID; - } - set - { - this.OnOrderIDChanging(value); - this.ReportPropertyChanging("OrderID"); - this._OrderID = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value); - this.ReportPropertyChanged("OrderID"); - this.OnOrderIDChanged(); - } - } - private long _OrderID; - partial void OnOrderIDChanging(long value); - partial void OnOrderIDChanged(); - /// - /// There are no comments for Property CustomsDescription in the schema. - /// - [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute(IsNullable=false)] - [global::System.Runtime.Serialization.DataMemberAttribute()] - public string CustomsDescription - { - get - { - return this._CustomsDescription; - } - set - { - this.OnCustomsDescriptionChanging(value); - this.ReportPropertyChanging("CustomsDescription"); - this._CustomsDescription = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value, false); - this.ReportPropertyChanged("CustomsDescription"); - this.OnCustomsDescriptionChanged(); - } - } - private string _CustomsDescription; - partial void OnCustomsDescriptionChanging(string value); - partial void OnCustomsDescriptionChanged(); - /// - /// There are no comments for Property ExciseTax in the schema. - /// - [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute(IsNullable=false)] - [global::System.Runtime.Serialization.DataMemberAttribute()] - public decimal ExciseTax - { - get - { - return this._ExciseTax; - } - set - { - this.OnExciseTaxChanging(value); - this.ReportPropertyChanging("ExciseTax"); - this._ExciseTax = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value); - this.ReportPropertyChanged("ExciseTax"); - this.OnExciseTaxChanged(); - } - } - private decimal _ExciseTax; - partial void OnExciseTaxChanging(decimal value); - partial void OnExciseTaxChanged(); - /// - /// There are no comments for Orders in the schema. - /// - [global::System.Data.Objects.DataClasses.EdmRelationshipNavigationPropertyAttribute("northwindEFModel", "FK_InternationalOrders_OrderID_OrderID", "Orders")] - [global::System.Xml.Serialization.XmlIgnoreAttribute()] - [global::System.Xml.Serialization.SoapIgnoreAttribute()] - [global::System.Runtime.Serialization.DataMemberAttribute()] - public Orders Orders - { - get - { - return ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.GetRelatedReference("northwindEFModel.FK_InternationalOrders_OrderID_OrderID", "Orders").Value; - } - set - { - ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.GetRelatedReference("northwindEFModel.FK_InternationalOrders_OrderID_OrderID", "Orders").Value = value; - } - } - /// - /// There are no comments for Orders in the schema. - /// - [global::System.ComponentModel.BrowsableAttribute(false)] - [global::System.Runtime.Serialization.DataMemberAttribute()] - public global::System.Data.Objects.DataClasses.EntityReference OrdersReference - { - get - { - return ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.GetRelatedReference("northwindEFModel.FK_InternationalOrders_OrderID_OrderID", "Orders"); - } - set - { - if ((value != null)) - { - ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.InitializeRelatedReference("northwindEFModel.FK_InternationalOrders_OrderID_OrderID", "Orders", value); - } - } - } - } - /// - /// There are no comments for northwindEFModel.OrderDetails in the schema. - /// - /// - /// OrderID - /// ProductID - /// - [global::System.Data.Objects.DataClasses.EdmEntityTypeAttribute(NamespaceName="northwindEFModel", Name="OrderDetails")] - [global::System.Runtime.Serialization.DataContractAttribute(IsReference=true)] - [global::System.Serializable()] - public partial class OrderDetails : global::System.Data.Objects.DataClasses.EntityObject - { - /// - /// Create a new OrderDetails object. - /// - /// Initial value of OrderID. - /// Initial value of ProductID. - /// Initial value of UnitPrice. - /// Initial value of Quantity. - /// Initial value of Discount. - public static OrderDetails CreateOrderDetails(long orderID, long productID, decimal unitPrice, short quantity, float discount) - { - OrderDetails orderDetails = new OrderDetails(); - orderDetails.OrderID = orderID; - orderDetails.ProductID = productID; - orderDetails.UnitPrice = unitPrice; - orderDetails.Quantity = quantity; - orderDetails.Discount = discount; - return orderDetails; - } - /// - /// There are no comments for Property OrderID in the schema. - /// - [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute(EntityKeyProperty=true, IsNullable=false)] - [global::System.Runtime.Serialization.DataMemberAttribute()] - public long OrderID - { - get - { - return this._OrderID; - } - set - { - this.OnOrderIDChanging(value); - this.ReportPropertyChanging("OrderID"); - this._OrderID = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value); - this.ReportPropertyChanged("OrderID"); - this.OnOrderIDChanged(); - } - } - private long _OrderID; - partial void OnOrderIDChanging(long value); - partial void OnOrderIDChanged(); - /// - /// There are no comments for Property ProductID in the schema. - /// - [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute(EntityKeyProperty=true, IsNullable=false)] - [global::System.Runtime.Serialization.DataMemberAttribute()] - public long ProductID - { - get - { - return this._ProductID; - } - set - { - this.OnProductIDChanging(value); - this.ReportPropertyChanging("ProductID"); - this._ProductID = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value); - this.ReportPropertyChanged("ProductID"); - this.OnProductIDChanged(); - } - } - private long _ProductID; - partial void OnProductIDChanging(long value); - partial void OnProductIDChanged(); - /// - /// There are no comments for Property UnitPrice in the schema. - /// - [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute(IsNullable=false)] - [global::System.Runtime.Serialization.DataMemberAttribute()] - public decimal UnitPrice - { - get - { - return this._UnitPrice; - } - set - { - this.OnUnitPriceChanging(value); - this.ReportPropertyChanging("UnitPrice"); - this._UnitPrice = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value); - this.ReportPropertyChanged("UnitPrice"); - this.OnUnitPriceChanged(); - } - } - private decimal _UnitPrice; - partial void OnUnitPriceChanging(decimal value); - partial void OnUnitPriceChanged(); - /// - /// There are no comments for Property Quantity in the schema. - /// - [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute(IsNullable=false)] - [global::System.Runtime.Serialization.DataMemberAttribute()] - public short Quantity - { - get - { - return this._Quantity; - } - set - { - this.OnQuantityChanging(value); - this.ReportPropertyChanging("Quantity"); - this._Quantity = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value); - this.ReportPropertyChanged("Quantity"); - this.OnQuantityChanged(); - } - } - private short _Quantity; - partial void OnQuantityChanging(short value); - partial void OnQuantityChanged(); - /// - /// There are no comments for Property Discount in the schema. - /// - [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute(IsNullable=false)] - [global::System.Runtime.Serialization.DataMemberAttribute()] - public float Discount - { - get - { - return this._Discount; - } - set - { - this.OnDiscountChanging(value); - this.ReportPropertyChanging("Discount"); - this._Discount = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value); - this.ReportPropertyChanged("Discount"); - this.OnDiscountChanged(); - } - } - private float _Discount; - partial void OnDiscountChanging(float value); - partial void OnDiscountChanged(); - /// - /// There are no comments for Orders in the schema. - /// - [global::System.Data.Objects.DataClasses.EdmRelationshipNavigationPropertyAttribute("northwindEFModel", "FK_OrderDetails_OrderID_OrderID", "Orders")] - [global::System.Xml.Serialization.XmlIgnoreAttribute()] - [global::System.Xml.Serialization.SoapIgnoreAttribute()] - [global::System.Runtime.Serialization.DataMemberAttribute()] - public Orders Orders - { - get - { - return ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.GetRelatedReference("northwindEFModel.FK_OrderDetails_OrderID_OrderID", "Orders").Value; - } - set - { - ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.GetRelatedReference("northwindEFModel.FK_OrderDetails_OrderID_OrderID", "Orders").Value = value; - } - } - /// - /// There are no comments for Orders in the schema. - /// - [global::System.ComponentModel.BrowsableAttribute(false)] - [global::System.Runtime.Serialization.DataMemberAttribute()] - public global::System.Data.Objects.DataClasses.EntityReference OrdersReference - { - get - { - return ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.GetRelatedReference("northwindEFModel.FK_OrderDetails_OrderID_OrderID", "Orders"); - } - set - { - if ((value != null)) - { - ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.InitializeRelatedReference("northwindEFModel.FK_OrderDetails_OrderID_OrderID", "Orders", value); - } - } - } - /// - /// There are no comments for Products in the schema. - /// - [global::System.Data.Objects.DataClasses.EdmRelationshipNavigationPropertyAttribute("northwindEFModel", "FK_OrderDetails_ProductID_ProductID", "Products")] - [global::System.Xml.Serialization.XmlIgnoreAttribute()] - [global::System.Xml.Serialization.SoapIgnoreAttribute()] - [global::System.Runtime.Serialization.DataMemberAttribute()] - public Products Products - { - get - { - return ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.GetRelatedReference("northwindEFModel.FK_OrderDetails_ProductID_ProductID", "Products").Value; - } - set - { - ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.GetRelatedReference("northwindEFModel.FK_OrderDetails_ProductID_ProductID", "Products").Value = value; - } - } - /// - /// There are no comments for Products in the schema. - /// - [global::System.ComponentModel.BrowsableAttribute(false)] - [global::System.Runtime.Serialization.DataMemberAttribute()] - public global::System.Data.Objects.DataClasses.EntityReference ProductsReference - { - get - { - return ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.GetRelatedReference("northwindEFModel.FK_OrderDetails_ProductID_ProductID", "Products"); - } - set - { - if ((value != null)) - { - ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.InitializeRelatedReference("northwindEFModel.FK_OrderDetails_ProductID_ProductID", "Products", value); - } - } - } - } - /// - /// There are no comments for northwindEFModel.Orders in the schema. - /// - /// - /// OrderID - /// - [global::System.Data.Objects.DataClasses.EdmEntityTypeAttribute(NamespaceName="northwindEFModel", Name="Orders")] - [global::System.Runtime.Serialization.DataContractAttribute(IsReference=true)] - [global::System.Serializable()] - public partial class Orders : global::System.Data.Objects.DataClasses.EntityObject - { - /// - /// Create a new Orders object. - /// - /// Initial value of OrderID. - public static Orders CreateOrders(long orderID) - { - Orders orders = new Orders(); - orders.OrderID = orderID; - return orders; - } - /// - /// There are no comments for Property OrderID in the schema. - /// - [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute(EntityKeyProperty=true, IsNullable=false)] - [global::System.Runtime.Serialization.DataMemberAttribute()] - public long OrderID - { - get - { - return this._OrderID; - } - set - { - this.OnOrderIDChanging(value); - this.ReportPropertyChanging("OrderID"); - this._OrderID = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value); - this.ReportPropertyChanged("OrderID"); - this.OnOrderIDChanged(); - } - } - private long _OrderID; - partial void OnOrderIDChanging(long value); - partial void OnOrderIDChanged(); - /// - /// There are no comments for Property EmployeeID in the schema. - /// - [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute()] - [global::System.Runtime.Serialization.DataMemberAttribute()] - public global::System.Nullable EmployeeID - { - get - { - return this._EmployeeID; - } - set - { - this.OnEmployeeIDChanging(value); - this.ReportPropertyChanging("EmployeeID"); - this._EmployeeID = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value); - this.ReportPropertyChanged("EmployeeID"); - this.OnEmployeeIDChanged(); - } - } - private global::System.Nullable _EmployeeID; - partial void OnEmployeeIDChanging(global::System.Nullable value); - partial void OnEmployeeIDChanged(); - /// - /// There are no comments for Property OrderDate in the schema. - /// - [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute()] - [global::System.Runtime.Serialization.DataMemberAttribute()] - public global::System.Nullable OrderDate - { - get - { - return this._OrderDate; - } - set - { - this.OnOrderDateChanging(value); - this.ReportPropertyChanging("OrderDate"); - this._OrderDate = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value); - this.ReportPropertyChanged("OrderDate"); - this.OnOrderDateChanged(); - } - } - private global::System.Nullable _OrderDate; - partial void OnOrderDateChanging(global::System.Nullable value); - partial void OnOrderDateChanged(); - /// - /// There are no comments for Property RequiredDate in the schema. - /// - [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute()] - [global::System.Runtime.Serialization.DataMemberAttribute()] - public global::System.Nullable RequiredDate - { - get - { - return this._RequiredDate; - } - set - { - this.OnRequiredDateChanging(value); - this.ReportPropertyChanging("RequiredDate"); - this._RequiredDate = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value); - this.ReportPropertyChanged("RequiredDate"); - this.OnRequiredDateChanged(); - } - } - private global::System.Nullable _RequiredDate; - partial void OnRequiredDateChanging(global::System.Nullable value); - partial void OnRequiredDateChanged(); - /// - /// There are no comments for Property ShippedDate in the schema. - /// - [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute()] - [global::System.Runtime.Serialization.DataMemberAttribute()] - public global::System.Nullable ShippedDate - { - get - { - return this._ShippedDate; - } - set - { - this.OnShippedDateChanging(value); - this.ReportPropertyChanging("ShippedDate"); - this._ShippedDate = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value); - this.ReportPropertyChanged("ShippedDate"); - this.OnShippedDateChanged(); - } - } - private global::System.Nullable _ShippedDate; - partial void OnShippedDateChanging(global::System.Nullable value); - partial void OnShippedDateChanged(); - /// - /// There are no comments for Property Freight in the schema. - /// - [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute()] - [global::System.Runtime.Serialization.DataMemberAttribute()] - public global::System.Nullable Freight - { - get - { - return this._Freight; - } - set - { - this.OnFreightChanging(value); - this.ReportPropertyChanging("Freight"); - this._Freight = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value); - this.ReportPropertyChanged("Freight"); - this.OnFreightChanged(); - } - } - private global::System.Nullable _Freight; - partial void OnFreightChanging(global::System.Nullable value); - partial void OnFreightChanged(); - /// - /// There are no comments for Property ShipName in the schema. - /// - [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute()] - [global::System.Runtime.Serialization.DataMemberAttribute()] - public string ShipName - { - get - { - return this._ShipName; - } - set - { - this.OnShipNameChanging(value); - this.ReportPropertyChanging("ShipName"); - this._ShipName = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value, true); - this.ReportPropertyChanged("ShipName"); - this.OnShipNameChanged(); - } - } - private string _ShipName; - partial void OnShipNameChanging(string value); - partial void OnShipNameChanged(); - /// - /// There are no comments for Property ShipAddress in the schema. - /// - [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute()] - [global::System.Runtime.Serialization.DataMemberAttribute()] - public string ShipAddress - { - get - { - return this._ShipAddress; - } - set - { - this.OnShipAddressChanging(value); - this.ReportPropertyChanging("ShipAddress"); - this._ShipAddress = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value, true); - this.ReportPropertyChanged("ShipAddress"); - this.OnShipAddressChanged(); - } - } - private string _ShipAddress; - partial void OnShipAddressChanging(string value); - partial void OnShipAddressChanged(); - /// - /// There are no comments for Property ShipCity in the schema. - /// - [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute()] - [global::System.Runtime.Serialization.DataMemberAttribute()] - public string ShipCity - { - get - { - return this._ShipCity; - } - set - { - this.OnShipCityChanging(value); - this.ReportPropertyChanging("ShipCity"); - this._ShipCity = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value, true); - this.ReportPropertyChanged("ShipCity"); - this.OnShipCityChanged(); - } - } - private string _ShipCity; - partial void OnShipCityChanging(string value); - partial void OnShipCityChanged(); - /// - /// There are no comments for Property ShipRegion in the schema. - /// - [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute()] - [global::System.Runtime.Serialization.DataMemberAttribute()] - public string ShipRegion - { - get - { - return this._ShipRegion; - } - set - { - this.OnShipRegionChanging(value); - this.ReportPropertyChanging("ShipRegion"); - this._ShipRegion = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value, true); - this.ReportPropertyChanged("ShipRegion"); - this.OnShipRegionChanged(); - } - } - private string _ShipRegion; - partial void OnShipRegionChanging(string value); - partial void OnShipRegionChanged(); - /// - /// There are no comments for Property ShipPostalCode in the schema. - /// - [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute()] - [global::System.Runtime.Serialization.DataMemberAttribute()] - public string ShipPostalCode - { - get - { - return this._ShipPostalCode; - } - set - { - this.OnShipPostalCodeChanging(value); - this.ReportPropertyChanging("ShipPostalCode"); - this._ShipPostalCode = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value, true); - this.ReportPropertyChanged("ShipPostalCode"); - this.OnShipPostalCodeChanged(); - } - } - private string _ShipPostalCode; - partial void OnShipPostalCodeChanging(string value); - partial void OnShipPostalCodeChanged(); - /// - /// There are no comments for Property ShipCountry in the schema. - /// - [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute()] - [global::System.Runtime.Serialization.DataMemberAttribute()] - public string ShipCountry - { - get - { - return this._ShipCountry; - } - set - { - this.OnShipCountryChanging(value); - this.ReportPropertyChanging("ShipCountry"); - this._ShipCountry = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value, true); - this.ReportPropertyChanged("ShipCountry"); - this.OnShipCountryChanged(); - } - } - private string _ShipCountry; - partial void OnShipCountryChanging(string value); - partial void OnShipCountryChanged(); - /// - /// There are no comments for Customers in the schema. - /// - [global::System.Data.Objects.DataClasses.EdmRelationshipNavigationPropertyAttribute("northwindEFModel", "FK_Orders_CustomerID_CustomerID", "Customers")] - [global::System.Xml.Serialization.XmlIgnoreAttribute()] - [global::System.Xml.Serialization.SoapIgnoreAttribute()] - [global::System.Runtime.Serialization.DataMemberAttribute()] - public Customers Customers - { - get - { - return ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.GetRelatedReference("northwindEFModel.FK_Orders_CustomerID_CustomerID", "Customers").Value; - } - set - { - ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.GetRelatedReference("northwindEFModel.FK_Orders_CustomerID_CustomerID", "Customers").Value = value; - } - } - /// - /// There are no comments for Customers in the schema. - /// - [global::System.ComponentModel.BrowsableAttribute(false)] - [global::System.Runtime.Serialization.DataMemberAttribute()] - public global::System.Data.Objects.DataClasses.EntityReference CustomersReference - { - get - { - return ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.GetRelatedReference("northwindEFModel.FK_Orders_CustomerID_CustomerID", "Customers"); - } - set - { - if ((value != null)) - { - ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.InitializeRelatedReference("northwindEFModel.FK_Orders_CustomerID_CustomerID", "Customers", value); - } - } - } - /// - /// There are no comments for InternationalOrders in the schema. - /// - [global::System.Data.Objects.DataClasses.EdmRelationshipNavigationPropertyAttribute("northwindEFModel", "FK_InternationalOrders_OrderID_OrderID", "InternationalOrders")] - [global::System.Xml.Serialization.XmlIgnoreAttribute()] - [global::System.Xml.Serialization.SoapIgnoreAttribute()] - [global::System.Runtime.Serialization.DataMemberAttribute()] - public InternationalOrders InternationalOrders - { - get - { - return ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.GetRelatedReference("northwindEFModel.FK_InternationalOrders_OrderID_OrderID", "InternationalOrders").Value; - } - set - { - ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.GetRelatedReference("northwindEFModel.FK_InternationalOrders_OrderID_OrderID", "InternationalOrders").Value = value; - } - } - /// - /// There are no comments for InternationalOrders in the schema. - /// - [global::System.ComponentModel.BrowsableAttribute(false)] - [global::System.Runtime.Serialization.DataMemberAttribute()] - public global::System.Data.Objects.DataClasses.EntityReference InternationalOrdersReference - { - get - { - return ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.GetRelatedReference("northwindEFModel.FK_InternationalOrders_OrderID_OrderID", "InternationalOrders"); - } - set - { - if ((value != null)) - { - ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.InitializeRelatedReference("northwindEFModel.FK_InternationalOrders_OrderID_OrderID", "InternationalOrders", value); - } - } - } - /// - /// There are no comments for OrderDetails in the schema. - /// - [global::System.Data.Objects.DataClasses.EdmRelationshipNavigationPropertyAttribute("northwindEFModel", "FK_OrderDetails_OrderID_OrderID", "OrderDetails")] - [global::System.Xml.Serialization.XmlIgnoreAttribute()] - [global::System.Xml.Serialization.SoapIgnoreAttribute()] - [global::System.Runtime.Serialization.DataMemberAttribute()] - public global::System.Data.Objects.DataClasses.EntityCollection OrderDetails - { - get - { - return ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.GetRelatedCollection("northwindEFModel.FK_OrderDetails_OrderID_OrderID", "OrderDetails"); - } - set - { - if ((value != null)) - { - ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.InitializeRelatedCollection("northwindEFModel.FK_OrderDetails_OrderID_OrderID", "OrderDetails", value); - } - } - } - } - /// - /// There are no comments for northwindEFModel.PreviousEmployees in the schema. - /// - /// - /// EmployeeID - /// - [global::System.Data.Objects.DataClasses.EdmEntityTypeAttribute(NamespaceName="northwindEFModel", Name="PreviousEmployees")] - [global::System.Runtime.Serialization.DataContractAttribute(IsReference=true)] - [global::System.Serializable()] - public partial class PreviousEmployees : global::System.Data.Objects.DataClasses.EntityObject - { - /// - /// Create a new PreviousEmployees object. - /// - /// Initial value of EmployeeID. - /// Initial value of LastName. - /// Initial value of FirstName. - public static PreviousEmployees CreatePreviousEmployees(long employeeID, string lastName, string firstName) - { - PreviousEmployees previousEmployees = new PreviousEmployees(); - previousEmployees.EmployeeID = employeeID; - previousEmployees.LastName = lastName; - previousEmployees.FirstName = firstName; - return previousEmployees; - } - /// - /// There are no comments for Property EmployeeID in the schema. - /// - [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute(EntityKeyProperty=true, IsNullable=false)] - [global::System.Runtime.Serialization.DataMemberAttribute()] - public long EmployeeID - { - get - { - return this._EmployeeID; - } - set - { - this.OnEmployeeIDChanging(value); - this.ReportPropertyChanging("EmployeeID"); - this._EmployeeID = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value); - this.ReportPropertyChanged("EmployeeID"); - this.OnEmployeeIDChanged(); - } - } - private long _EmployeeID; - partial void OnEmployeeIDChanging(long value); - partial void OnEmployeeIDChanged(); - /// - /// There are no comments for Property LastName in the schema. - /// - [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute(IsNullable=false)] - [global::System.Runtime.Serialization.DataMemberAttribute()] - public string LastName - { - get - { - return this._LastName; - } - set - { - this.OnLastNameChanging(value); - this.ReportPropertyChanging("LastName"); - this._LastName = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value, false); - this.ReportPropertyChanged("LastName"); - this.OnLastNameChanged(); - } - } - private string _LastName; - partial void OnLastNameChanging(string value); - partial void OnLastNameChanged(); - /// - /// There are no comments for Property FirstName in the schema. - /// - [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute(IsNullable=false)] - [global::System.Runtime.Serialization.DataMemberAttribute()] - public string FirstName - { - get - { - return this._FirstName; - } - set - { - this.OnFirstNameChanging(value); - this.ReportPropertyChanging("FirstName"); - this._FirstName = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value, false); - this.ReportPropertyChanged("FirstName"); - this.OnFirstNameChanged(); - } - } - private string _FirstName; - partial void OnFirstNameChanging(string value); - partial void OnFirstNameChanged(); - /// - /// There are no comments for Property Title in the schema. - /// - [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute()] - [global::System.Runtime.Serialization.DataMemberAttribute()] - public string Title - { - get - { - return this._Title; - } - set - { - this.OnTitleChanging(value); - this.ReportPropertyChanging("Title"); - this._Title = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value, true); - this.ReportPropertyChanged("Title"); - this.OnTitleChanged(); - } - } - private string _Title; - partial void OnTitleChanging(string value); - partial void OnTitleChanged(); - /// - /// There are no comments for Property TitleOfCourtesy in the schema. - /// - [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute()] - [global::System.Runtime.Serialization.DataMemberAttribute()] - public string TitleOfCourtesy - { - get - { - return this._TitleOfCourtesy; - } - set - { - this.OnTitleOfCourtesyChanging(value); - this.ReportPropertyChanging("TitleOfCourtesy"); - this._TitleOfCourtesy = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value, true); - this.ReportPropertyChanged("TitleOfCourtesy"); - this.OnTitleOfCourtesyChanged(); - } - } - private string _TitleOfCourtesy; - partial void OnTitleOfCourtesyChanging(string value); - partial void OnTitleOfCourtesyChanged(); - /// - /// There are no comments for Property BirthDate in the schema. - /// - [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute()] - [global::System.Runtime.Serialization.DataMemberAttribute()] - public global::System.Nullable BirthDate - { - get - { - return this._BirthDate; - } - set - { - this.OnBirthDateChanging(value); - this.ReportPropertyChanging("BirthDate"); - this._BirthDate = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value); - this.ReportPropertyChanged("BirthDate"); - this.OnBirthDateChanged(); - } - } - private global::System.Nullable _BirthDate; - partial void OnBirthDateChanging(global::System.Nullable value); - partial void OnBirthDateChanged(); - /// - /// There are no comments for Property HireDate in the schema. - /// - [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute()] - [global::System.Runtime.Serialization.DataMemberAttribute()] - public global::System.Nullable HireDate - { - get - { - return this._HireDate; - } - set - { - this.OnHireDateChanging(value); - this.ReportPropertyChanging("HireDate"); - this._HireDate = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value); - this.ReportPropertyChanged("HireDate"); - this.OnHireDateChanged(); - } - } - private global::System.Nullable _HireDate; - partial void OnHireDateChanging(global::System.Nullable value); - partial void OnHireDateChanged(); - /// - /// There are no comments for Property Address in the schema. - /// - [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute()] - [global::System.Runtime.Serialization.DataMemberAttribute()] - public string Address - { - get - { - return this._Address; - } - set - { - this.OnAddressChanging(value); - this.ReportPropertyChanging("Address"); - this._Address = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value, true); - this.ReportPropertyChanged("Address"); - this.OnAddressChanged(); - } - } - private string _Address; - partial void OnAddressChanging(string value); - partial void OnAddressChanged(); - /// - /// There are no comments for Property City in the schema. - /// - [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute()] - [global::System.Runtime.Serialization.DataMemberAttribute()] - public string City - { - get - { - return this._City; - } - set - { - this.OnCityChanging(value); - this.ReportPropertyChanging("City"); - this._City = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value, true); - this.ReportPropertyChanged("City"); - this.OnCityChanged(); - } - } - private string _City; - partial void OnCityChanging(string value); - partial void OnCityChanged(); - /// - /// There are no comments for Property Region in the schema. - /// - [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute()] - [global::System.Runtime.Serialization.DataMemberAttribute()] - public string Region - { - get - { - return this._Region; - } - set - { - this.OnRegionChanging(value); - this.ReportPropertyChanging("Region"); - this._Region = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value, true); - this.ReportPropertyChanged("Region"); - this.OnRegionChanged(); - } - } - private string _Region; - partial void OnRegionChanging(string value); - partial void OnRegionChanged(); - /// - /// There are no comments for Property PostalCode in the schema. - /// - [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute()] - [global::System.Runtime.Serialization.DataMemberAttribute()] - public string PostalCode - { - get - { - return this._PostalCode; - } - set - { - this.OnPostalCodeChanging(value); - this.ReportPropertyChanging("PostalCode"); - this._PostalCode = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value, true); - this.ReportPropertyChanged("PostalCode"); - this.OnPostalCodeChanged(); - } - } - private string _PostalCode; - partial void OnPostalCodeChanging(string value); - partial void OnPostalCodeChanged(); - /// - /// There are no comments for Property Country in the schema. - /// - [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute()] - [global::System.Runtime.Serialization.DataMemberAttribute()] - public string Country - { - get - { - return this._Country; - } - set - { - this.OnCountryChanging(value); - this.ReportPropertyChanging("Country"); - this._Country = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value, true); - this.ReportPropertyChanged("Country"); - this.OnCountryChanged(); - } - } - private string _Country; - partial void OnCountryChanging(string value); - partial void OnCountryChanged(); - /// - /// There are no comments for Property HomePhone in the schema. - /// - [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute()] - [global::System.Runtime.Serialization.DataMemberAttribute()] - public string HomePhone - { - get - { - return this._HomePhone; - } - set - { - this.OnHomePhoneChanging(value); - this.ReportPropertyChanging("HomePhone"); - this._HomePhone = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value, true); - this.ReportPropertyChanged("HomePhone"); - this.OnHomePhoneChanged(); - } - } - private string _HomePhone; - partial void OnHomePhoneChanging(string value); - partial void OnHomePhoneChanged(); - /// - /// There are no comments for Property Extension in the schema. - /// - [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute()] - [global::System.Runtime.Serialization.DataMemberAttribute()] - public string Extension - { - get - { - return this._Extension; - } - set - { - this.OnExtensionChanging(value); - this.ReportPropertyChanging("Extension"); - this._Extension = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value, true); - this.ReportPropertyChanged("Extension"); - this.OnExtensionChanged(); - } - } - private string _Extension; - partial void OnExtensionChanging(string value); - partial void OnExtensionChanged(); - /// - /// There are no comments for Property Photo in the schema. - /// - [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute()] - [global::System.Runtime.Serialization.DataMemberAttribute()] - public byte[] Photo - { - get - { - return global::System.Data.Objects.DataClasses.StructuralObject.GetValidValue(this._Photo); - } - set - { - this.OnPhotoChanging(value); - this.ReportPropertyChanging("Photo"); - this._Photo = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value, true); - this.ReportPropertyChanged("Photo"); - this.OnPhotoChanged(); - } - } - private byte[] _Photo; - partial void OnPhotoChanging(byte[] value); - partial void OnPhotoChanged(); - /// - /// There are no comments for Property Notes in the schema. - /// - [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute()] - [global::System.Runtime.Serialization.DataMemberAttribute()] - public string Notes - { - get - { - return this._Notes; - } - set - { - this.OnNotesChanging(value); - this.ReportPropertyChanging("Notes"); - this._Notes = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value, true); - this.ReportPropertyChanged("Notes"); - this.OnNotesChanged(); - } - } - private string _Notes; - partial void OnNotesChanging(string value); - partial void OnNotesChanged(); - /// - /// There are no comments for Property PhotoPath in the schema. - /// - [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute()] - [global::System.Runtime.Serialization.DataMemberAttribute()] - public string PhotoPath - { - get - { - return this._PhotoPath; - } - set - { - this.OnPhotoPathChanging(value); - this.ReportPropertyChanging("PhotoPath"); - this._PhotoPath = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value, true); - this.ReportPropertyChanged("PhotoPath"); - this.OnPhotoPathChanged(); - } - } - private string _PhotoPath; - partial void OnPhotoPathChanging(string value); - partial void OnPhotoPathChanged(); - } - /// - /// There are no comments for northwindEFModel.Products in the schema. - /// - /// - /// ProductID - /// - [global::System.Data.Objects.DataClasses.EdmEntityTypeAttribute(NamespaceName="northwindEFModel", Name="Products")] - [global::System.Runtime.Serialization.DataContractAttribute(IsReference=true)] - [global::System.Serializable()] - public partial class Products : global::System.Data.Objects.DataClasses.EntityObject - { - /// - /// Create a new Products object. - /// - /// Initial value of ProductID. - /// Initial value of ProductName. - /// Initial value of Discontinued. - public static Products CreateProducts(long productID, string productName, bool discontinued) - { - Products products = new Products(); - products.ProductID = productID; - products.ProductName = productName; - products.Discontinued = discontinued; - return products; - } - /// - /// There are no comments for Property ProductID in the schema. - /// - [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute(EntityKeyProperty=true, IsNullable=false)] - [global::System.Runtime.Serialization.DataMemberAttribute()] - public long ProductID - { - get - { - return this._ProductID; - } - set - { - this.OnProductIDChanging(value); - this.ReportPropertyChanging("ProductID"); - this._ProductID = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value); - this.ReportPropertyChanged("ProductID"); - this.OnProductIDChanged(); - } - } - private long _ProductID; - partial void OnProductIDChanging(long value); - partial void OnProductIDChanged(); - /// - /// There are no comments for Property ProductName in the schema. - /// - [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute(IsNullable=false)] - [global::System.Runtime.Serialization.DataMemberAttribute()] - public string ProductName - { - get - { - return this._ProductName; - } - set - { - this.OnProductNameChanging(value); - this.ReportPropertyChanging("ProductName"); - this._ProductName = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value, false); - this.ReportPropertyChanged("ProductName"); - this.OnProductNameChanged(); - } - } - private string _ProductName; - partial void OnProductNameChanging(string value); - partial void OnProductNameChanged(); - /// - /// There are no comments for Property QuantityPerUnit in the schema. - /// - [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute()] - [global::System.Runtime.Serialization.DataMemberAttribute()] - public string QuantityPerUnit - { - get - { - return this._QuantityPerUnit; - } - set - { - this.OnQuantityPerUnitChanging(value); - this.ReportPropertyChanging("QuantityPerUnit"); - this._QuantityPerUnit = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value, true); - this.ReportPropertyChanged("QuantityPerUnit"); - this.OnQuantityPerUnitChanged(); - } - } - private string _QuantityPerUnit; - partial void OnQuantityPerUnitChanging(string value); - partial void OnQuantityPerUnitChanged(); - /// - /// There are no comments for Property UnitPrice in the schema. - /// - [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute()] - [global::System.Runtime.Serialization.DataMemberAttribute()] - public global::System.Nullable UnitPrice - { - get - { - return this._UnitPrice; - } - set - { - this.OnUnitPriceChanging(value); - this.ReportPropertyChanging("UnitPrice"); - this._UnitPrice = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value); - this.ReportPropertyChanged("UnitPrice"); - this.OnUnitPriceChanged(); - } - } - private global::System.Nullable _UnitPrice; - partial void OnUnitPriceChanging(global::System.Nullable value); - partial void OnUnitPriceChanged(); - /// - /// There are no comments for Property UnitsInStock in the schema. - /// - [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute()] - [global::System.Runtime.Serialization.DataMemberAttribute()] - public global::System.Nullable UnitsInStock - { - get - { - return this._UnitsInStock; - } - set - { - this.OnUnitsInStockChanging(value); - this.ReportPropertyChanging("UnitsInStock"); - this._UnitsInStock = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value); - this.ReportPropertyChanged("UnitsInStock"); - this.OnUnitsInStockChanged(); - } - } - private global::System.Nullable _UnitsInStock; - partial void OnUnitsInStockChanging(global::System.Nullable value); - partial void OnUnitsInStockChanged(); - /// - /// There are no comments for Property UnitsOnOrder in the schema. - /// - [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute()] - [global::System.Runtime.Serialization.DataMemberAttribute()] - public global::System.Nullable UnitsOnOrder - { - get - { - return this._UnitsOnOrder; - } - set - { - this.OnUnitsOnOrderChanging(value); - this.ReportPropertyChanging("UnitsOnOrder"); - this._UnitsOnOrder = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value); - this.ReportPropertyChanged("UnitsOnOrder"); - this.OnUnitsOnOrderChanged(); - } - } - private global::System.Nullable _UnitsOnOrder; - partial void OnUnitsOnOrderChanging(global::System.Nullable value); - partial void OnUnitsOnOrderChanged(); - /// - /// There are no comments for Property ReorderLevel in the schema. - /// - [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute()] - [global::System.Runtime.Serialization.DataMemberAttribute()] - public global::System.Nullable ReorderLevel - { - get - { - return this._ReorderLevel; - } - set - { - this.OnReorderLevelChanging(value); - this.ReportPropertyChanging("ReorderLevel"); - this._ReorderLevel = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value); - this.ReportPropertyChanged("ReorderLevel"); - this.OnReorderLevelChanged(); - } - } - private global::System.Nullable _ReorderLevel; - partial void OnReorderLevelChanging(global::System.Nullable value); - partial void OnReorderLevelChanged(); - /// - /// There are no comments for Property Discontinued in the schema. - /// - [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute(IsNullable=false)] - [global::System.Runtime.Serialization.DataMemberAttribute()] - public bool Discontinued - { - get - { - return this._Discontinued; - } - set - { - this.OnDiscontinuedChanging(value); - this.ReportPropertyChanging("Discontinued"); - this._Discontinued = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value); - this.ReportPropertyChanged("Discontinued"); - this.OnDiscontinuedChanged(); - } - } - private bool _Discontinued; - partial void OnDiscontinuedChanging(bool value); - partial void OnDiscontinuedChanged(); - /// - /// There are no comments for Property DiscontinuedDate in the schema. - /// - [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute()] - [global::System.Runtime.Serialization.DataMemberAttribute()] - public global::System.Nullable DiscontinuedDate - { - get - { - return this._DiscontinuedDate; - } - set - { - this.OnDiscontinuedDateChanging(value); - this.ReportPropertyChanging("DiscontinuedDate"); - this._DiscontinuedDate = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value); - this.ReportPropertyChanged("DiscontinuedDate"); - this.OnDiscontinuedDateChanged(); - } - } - private global::System.Nullable _DiscontinuedDate; - partial void OnDiscontinuedDateChanging(global::System.Nullable value); - partial void OnDiscontinuedDateChanged(); - /// - /// There are no comments for Categories in the schema. - /// - [global::System.Data.Objects.DataClasses.EdmRelationshipNavigationPropertyAttribute("northwindEFModel", "FK_Products_CategoryID_CategoryID", "Categories")] - [global::System.Xml.Serialization.XmlIgnoreAttribute()] - [global::System.Xml.Serialization.SoapIgnoreAttribute()] - [global::System.Runtime.Serialization.DataMemberAttribute()] - public Categories Categories - { - get - { - return ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.GetRelatedReference("northwindEFModel.FK_Products_CategoryID_CategoryID", "Categories").Value; - } - set - { - ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.GetRelatedReference("northwindEFModel.FK_Products_CategoryID_CategoryID", "Categories").Value = value; - } - } - /// - /// There are no comments for Categories in the schema. - /// - [global::System.ComponentModel.BrowsableAttribute(false)] - [global::System.Runtime.Serialization.DataMemberAttribute()] - public global::System.Data.Objects.DataClasses.EntityReference CategoriesReference - { - get - { - return ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.GetRelatedReference("northwindEFModel.FK_Products_CategoryID_CategoryID", "Categories"); - } - set - { - if ((value != null)) - { - ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.InitializeRelatedReference("northwindEFModel.FK_Products_CategoryID_CategoryID", "Categories", value); - } - } - } - /// - /// There are no comments for OrderDetails in the schema. - /// - [global::System.Data.Objects.DataClasses.EdmRelationshipNavigationPropertyAttribute("northwindEFModel", "FK_OrderDetails_ProductID_ProductID", "OrderDetails")] - [global::System.Xml.Serialization.XmlIgnoreAttribute()] - [global::System.Xml.Serialization.SoapIgnoreAttribute()] - [global::System.Runtime.Serialization.DataMemberAttribute()] - public global::System.Data.Objects.DataClasses.EntityCollection OrderDetails - { - get - { - return ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.GetRelatedCollection("northwindEFModel.FK_OrderDetails_ProductID_ProductID", "OrderDetails"); - } - set - { - if ((value != null)) - { - ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.InitializeRelatedCollection("northwindEFModel.FK_OrderDetails_ProductID_ProductID", "OrderDetails", value); - } - } - } - /// - /// There are no comments for Suppliers in the schema. - /// - [global::System.Data.Objects.DataClasses.EdmRelationshipNavigationPropertyAttribute("northwindEFModel", "FK_Products_SupplierID_SupplierID", "Suppliers")] - [global::System.Xml.Serialization.XmlIgnoreAttribute()] - [global::System.Xml.Serialization.SoapIgnoreAttribute()] - [global::System.Runtime.Serialization.DataMemberAttribute()] - public Suppliers Suppliers - { - get - { - return ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.GetRelatedReference("northwindEFModel.FK_Products_SupplierID_SupplierID", "Suppliers").Value; - } - set - { - ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.GetRelatedReference("northwindEFModel.FK_Products_SupplierID_SupplierID", "Suppliers").Value = value; - } - } - /// - /// There are no comments for Suppliers in the schema. - /// - [global::System.ComponentModel.BrowsableAttribute(false)] - [global::System.Runtime.Serialization.DataMemberAttribute()] - public global::System.Data.Objects.DataClasses.EntityReference SuppliersReference - { - get - { - return ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.GetRelatedReference("northwindEFModel.FK_Products_SupplierID_SupplierID", "Suppliers"); - } - set - { - if ((value != null)) - { - ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.InitializeRelatedReference("northwindEFModel.FK_Products_SupplierID_SupplierID", "Suppliers", value); - } - } - } - } - /// - /// There are no comments for northwindEFModel.Regions in the schema. - /// - /// - /// RegionID - /// - [global::System.Data.Objects.DataClasses.EdmEntityTypeAttribute(NamespaceName="northwindEFModel", Name="Regions")] - [global::System.Runtime.Serialization.DataContractAttribute(IsReference=true)] - [global::System.Serializable()] - public partial class Regions : global::System.Data.Objects.DataClasses.EntityObject - { - /// - /// Create a new Regions object. - /// - /// Initial value of RegionID. - /// Initial value of RegionDescription. - public static Regions CreateRegions(long regionID, string regionDescription) - { - Regions regions = new Regions(); - regions.RegionID = regionID; - regions.RegionDescription = regionDescription; - return regions; - } - /// - /// There are no comments for Property RegionID in the schema. - /// - [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute(EntityKeyProperty=true, IsNullable=false)] - [global::System.Runtime.Serialization.DataMemberAttribute()] - public long RegionID - { - get - { - return this._RegionID; - } - set - { - this.OnRegionIDChanging(value); - this.ReportPropertyChanging("RegionID"); - this._RegionID = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value); - this.ReportPropertyChanged("RegionID"); - this.OnRegionIDChanged(); - } - } - private long _RegionID; - partial void OnRegionIDChanging(long value); - partial void OnRegionIDChanged(); - /// - /// There are no comments for Property RegionDescription in the schema. - /// - [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute(IsNullable=false)] - [global::System.Runtime.Serialization.DataMemberAttribute()] - public string RegionDescription - { - get - { - return this._RegionDescription; - } - set - { - this.OnRegionDescriptionChanging(value); - this.ReportPropertyChanging("RegionDescription"); - this._RegionDescription = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value, false); - this.ReportPropertyChanged("RegionDescription"); - this.OnRegionDescriptionChanged(); - } - } - private string _RegionDescription; - partial void OnRegionDescriptionChanging(string value); - partial void OnRegionDescriptionChanged(); - /// - /// There are no comments for Territories in the schema. - /// - [global::System.Data.Objects.DataClasses.EdmRelationshipNavigationPropertyAttribute("northwindEFModel", "FK_Territories_RegionID_RegionID", "Territories")] - [global::System.Xml.Serialization.XmlIgnoreAttribute()] - [global::System.Xml.Serialization.SoapIgnoreAttribute()] - [global::System.Runtime.Serialization.DataMemberAttribute()] - public global::System.Data.Objects.DataClasses.EntityCollection Territories - { - get - { - return ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.GetRelatedCollection("northwindEFModel.FK_Territories_RegionID_RegionID", "Territories"); - } - set - { - if ((value != null)) - { - ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.InitializeRelatedCollection("northwindEFModel.FK_Territories_RegionID_RegionID", "Territories", value); - } - } - } - } - /// - /// There are no comments for northwindEFModel.Suppliers in the schema. - /// - /// - /// SupplierID - /// - [global::System.Data.Objects.DataClasses.EdmEntityTypeAttribute(NamespaceName="northwindEFModel", Name="Suppliers")] - [global::System.Runtime.Serialization.DataContractAttribute(IsReference=true)] - [global::System.Serializable()] - public partial class Suppliers : global::System.Data.Objects.DataClasses.EntityObject - { - /// - /// Create a new Suppliers object. - /// - /// Initial value of SupplierID. - /// Initial value of CompanyName. - public static Suppliers CreateSuppliers(long supplierID, string companyName) - { - Suppliers suppliers = new Suppliers(); - suppliers.SupplierID = supplierID; - suppliers.CompanyName = companyName; - return suppliers; - } - /// - /// There are no comments for Property SupplierID in the schema. - /// - [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute(EntityKeyProperty=true, IsNullable=false)] - [global::System.Runtime.Serialization.DataMemberAttribute()] - public long SupplierID - { - get - { - return this._SupplierID; - } - set - { - this.OnSupplierIDChanging(value); - this.ReportPropertyChanging("SupplierID"); - this._SupplierID = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value); - this.ReportPropertyChanged("SupplierID"); - this.OnSupplierIDChanged(); - } - } - private long _SupplierID; - partial void OnSupplierIDChanging(long value); - partial void OnSupplierIDChanged(); - /// - /// There are no comments for Property CompanyName in the schema. - /// - [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute(IsNullable=false)] - [global::System.Runtime.Serialization.DataMemberAttribute()] - public string CompanyName - { - get - { - return this._CompanyName; - } - set - { - this.OnCompanyNameChanging(value); - this.ReportPropertyChanging("CompanyName"); - this._CompanyName = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value, false); - this.ReportPropertyChanged("CompanyName"); - this.OnCompanyNameChanged(); - } - } - private string _CompanyName; - partial void OnCompanyNameChanging(string value); - partial void OnCompanyNameChanged(); - /// - /// There are no comments for Property ContactName in the schema. - /// - [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute()] - [global::System.Runtime.Serialization.DataMemberAttribute()] - public string ContactName - { - get - { - return this._ContactName; - } - set - { - this.OnContactNameChanging(value); - this.ReportPropertyChanging("ContactName"); - this._ContactName = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value, true); - this.ReportPropertyChanged("ContactName"); - this.OnContactNameChanged(); - } - } - private string _ContactName; - partial void OnContactNameChanging(string value); - partial void OnContactNameChanged(); - /// - /// There are no comments for Property ContactTitle in the schema. - /// - [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute()] - [global::System.Runtime.Serialization.DataMemberAttribute()] - public string ContactTitle - { - get - { - return this._ContactTitle; - } - set - { - this.OnContactTitleChanging(value); - this.ReportPropertyChanging("ContactTitle"); - this._ContactTitle = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value, true); - this.ReportPropertyChanged("ContactTitle"); - this.OnContactTitleChanged(); - } - } - private string _ContactTitle; - partial void OnContactTitleChanging(string value); - partial void OnContactTitleChanged(); - /// - /// There are no comments for Property Address in the schema. - /// - [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute()] - [global::System.Runtime.Serialization.DataMemberAttribute()] - public string Address - { - get - { - return this._Address; - } - set - { - this.OnAddressChanging(value); - this.ReportPropertyChanging("Address"); - this._Address = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value, true); - this.ReportPropertyChanged("Address"); - this.OnAddressChanged(); - } - } - private string _Address; - partial void OnAddressChanging(string value); - partial void OnAddressChanged(); - /// - /// There are no comments for Property City in the schema. - /// - [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute()] - [global::System.Runtime.Serialization.DataMemberAttribute()] - public string City - { - get - { - return this._City; - } - set - { - this.OnCityChanging(value); - this.ReportPropertyChanging("City"); - this._City = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value, true); - this.ReportPropertyChanged("City"); - this.OnCityChanged(); - } - } - private string _City; - partial void OnCityChanging(string value); - partial void OnCityChanged(); - /// - /// There are no comments for Property Region in the schema. - /// - [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute()] - [global::System.Runtime.Serialization.DataMemberAttribute()] - public string Region - { - get - { - return this._Region; - } - set - { - this.OnRegionChanging(value); - this.ReportPropertyChanging("Region"); - this._Region = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value, true); - this.ReportPropertyChanged("Region"); - this.OnRegionChanged(); - } - } - private string _Region; - partial void OnRegionChanging(string value); - partial void OnRegionChanged(); - /// - /// There are no comments for Property PostalCode in the schema. - /// - [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute()] - [global::System.Runtime.Serialization.DataMemberAttribute()] - public string PostalCode - { - get - { - return this._PostalCode; - } - set - { - this.OnPostalCodeChanging(value); - this.ReportPropertyChanging("PostalCode"); - this._PostalCode = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value, true); - this.ReportPropertyChanged("PostalCode"); - this.OnPostalCodeChanged(); - } - } - private string _PostalCode; - partial void OnPostalCodeChanging(string value); - partial void OnPostalCodeChanged(); - /// - /// There are no comments for Property Country in the schema. - /// - [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute()] - [global::System.Runtime.Serialization.DataMemberAttribute()] - public string Country - { - get - { - return this._Country; - } - set - { - this.OnCountryChanging(value); - this.ReportPropertyChanging("Country"); - this._Country = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value, true); - this.ReportPropertyChanged("Country"); - this.OnCountryChanged(); - } - } - private string _Country; - partial void OnCountryChanging(string value); - partial void OnCountryChanged(); - /// - /// There are no comments for Property Phone in the schema. - /// - [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute()] - [global::System.Runtime.Serialization.DataMemberAttribute()] - public string Phone - { - get - { - return this._Phone; - } - set - { - this.OnPhoneChanging(value); - this.ReportPropertyChanging("Phone"); - this._Phone = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value, true); - this.ReportPropertyChanged("Phone"); - this.OnPhoneChanged(); - } - } - private string _Phone; - partial void OnPhoneChanging(string value); - partial void OnPhoneChanged(); - /// - /// There are no comments for Property Fax in the schema. - /// - [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute()] - [global::System.Runtime.Serialization.DataMemberAttribute()] - public string Fax - { - get - { - return this._Fax; - } - set - { - this.OnFaxChanging(value); - this.ReportPropertyChanging("Fax"); - this._Fax = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value, true); - this.ReportPropertyChanged("Fax"); - this.OnFaxChanged(); - } - } - private string _Fax; - partial void OnFaxChanging(string value); - partial void OnFaxChanged(); - /// - /// There are no comments for Property HomePage in the schema. - /// - [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute()] - [global::System.Runtime.Serialization.DataMemberAttribute()] - public string HomePage - { - get - { - return this._HomePage; - } - set - { - this.OnHomePageChanging(value); - this.ReportPropertyChanging("HomePage"); - this._HomePage = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value, true); - this.ReportPropertyChanged("HomePage"); - this.OnHomePageChanged(); - } - } - private string _HomePage; - partial void OnHomePageChanging(string value); - partial void OnHomePageChanged(); - /// - /// There are no comments for Products in the schema. - /// - [global::System.Data.Objects.DataClasses.EdmRelationshipNavigationPropertyAttribute("northwindEFModel", "FK_Products_SupplierID_SupplierID", "Products")] - [global::System.Xml.Serialization.XmlIgnoreAttribute()] - [global::System.Xml.Serialization.SoapIgnoreAttribute()] - [global::System.Runtime.Serialization.DataMemberAttribute()] - public global::System.Data.Objects.DataClasses.EntityCollection Products - { - get - { - return ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.GetRelatedCollection("northwindEFModel.FK_Products_SupplierID_SupplierID", "Products"); - } - set - { - if ((value != null)) - { - ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.InitializeRelatedCollection("northwindEFModel.FK_Products_SupplierID_SupplierID", "Products", value); - } - } - } - } - /// - /// There are no comments for northwindEFModel.Territories in the schema. - /// - /// - /// TerritoryID - /// - [global::System.Data.Objects.DataClasses.EdmEntityTypeAttribute(NamespaceName="northwindEFModel", Name="Territories")] - [global::System.Runtime.Serialization.DataContractAttribute(IsReference=true)] - [global::System.Serializable()] - public partial class Territories : global::System.Data.Objects.DataClasses.EntityObject - { - /// - /// Create a new Territories object. - /// - /// Initial value of TerritoryID. - /// Initial value of TerritoryDescription. - public static Territories CreateTerritories(long territoryID, string territoryDescription) - { - Territories territories = new Territories(); - territories.TerritoryID = territoryID; - territories.TerritoryDescription = territoryDescription; - return territories; - } - /// - /// There are no comments for Property TerritoryID in the schema. - /// - [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute(EntityKeyProperty=true, IsNullable=false)] - [global::System.Runtime.Serialization.DataMemberAttribute()] - public long TerritoryID - { - get - { - return this._TerritoryID; - } - set - { - this.OnTerritoryIDChanging(value); - this.ReportPropertyChanging("TerritoryID"); - this._TerritoryID = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value); - this.ReportPropertyChanged("TerritoryID"); - this.OnTerritoryIDChanged(); - } - } - private long _TerritoryID; - partial void OnTerritoryIDChanging(long value); - partial void OnTerritoryIDChanged(); - /// - /// There are no comments for Property TerritoryDescription in the schema. - /// - [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute(IsNullable=false)] - [global::System.Runtime.Serialization.DataMemberAttribute()] - public string TerritoryDescription - { - get - { - return this._TerritoryDescription; - } - set - { - this.OnTerritoryDescriptionChanging(value); - this.ReportPropertyChanging("TerritoryDescription"); - this._TerritoryDescription = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value, false); - this.ReportPropertyChanged("TerritoryDescription"); - this.OnTerritoryDescriptionChanged(); - } - } - private string _TerritoryDescription; - partial void OnTerritoryDescriptionChanging(string value); - partial void OnTerritoryDescriptionChanged(); - /// - /// There are no comments for Regions in the schema. - /// - [global::System.Data.Objects.DataClasses.EdmRelationshipNavigationPropertyAttribute("northwindEFModel", "FK_Territories_RegionID_RegionID", "Regions")] - [global::System.Xml.Serialization.XmlIgnoreAttribute()] - [global::System.Xml.Serialization.SoapIgnoreAttribute()] - [global::System.Runtime.Serialization.DataMemberAttribute()] - public Regions Regions - { - get - { - return ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.GetRelatedReference("northwindEFModel.FK_Territories_RegionID_RegionID", "Regions").Value; - } - set - { - ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.GetRelatedReference("northwindEFModel.FK_Territories_RegionID_RegionID", "Regions").Value = value; - } - } - /// - /// There are no comments for Regions in the schema. - /// - [global::System.ComponentModel.BrowsableAttribute(false)] - [global::System.Runtime.Serialization.DataMemberAttribute()] - public global::System.Data.Objects.DataClasses.EntityReference RegionsReference - { - get - { - return ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.GetRelatedReference("northwindEFModel.FK_Territories_RegionID_RegionID", "Regions"); - } - set - { - if ((value != null)) - { - ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.InitializeRelatedReference("northwindEFModel.FK_Territories_RegionID_RegionID", "Regions", value); - } - } - } - /// - /// There are no comments for Employees in the schema. - /// - [global::System.Data.Objects.DataClasses.EdmRelationshipNavigationPropertyAttribute("northwindEFModel", "EmployeesTerritories", "Employees")] - [global::System.Xml.Serialization.XmlIgnoreAttribute()] - [global::System.Xml.Serialization.SoapIgnoreAttribute()] - [global::System.Runtime.Serialization.DataMemberAttribute()] - public global::System.Data.Objects.DataClasses.EntityCollection Employees - { - get - { - return ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.GetRelatedCollection("northwindEFModel.EmployeesTerritories", "Employees"); - } - set - { - if ((value != null)) - { - ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.InitializeRelatedCollection("northwindEFModel.EmployeesTerritories", "Employees", value); - } - } - } - } -} +//------------------------------------------------------------------------------ +// +// This code was generated from a template. +// +// Manual changes to this file may cause unexpected behavior in your application. +// Manual changes to this file will be overwritten if the code is regenerated. +// +//------------------------------------------------------------------------------ + +using System; +using System.Data.Objects; +using System.Data.Objects.DataClasses; +using System.Data.EntityClient; +using System.ComponentModel; +using System.Xml.Serialization; +using System.Runtime.Serialization; + +[assembly: EdmSchemaAttribute()] +#region EDM Relationship Metadata + +[assembly: EdmRelationshipAttribute("northwindEFModel", "FK_Products_CategoryID_CategoryID", "Categories", System.Data.Metadata.Edm.RelationshipMultiplicity.ZeroOrOne, typeof(testlinq.Categories), "Products", System.Data.Metadata.Edm.RelationshipMultiplicity.Many, typeof(testlinq.Products))] +[assembly: EdmRelationshipAttribute("northwindEFModel", "FK_Orders_CustomerID_CustomerID", "Customers", System.Data.Metadata.Edm.RelationshipMultiplicity.ZeroOrOne, typeof(testlinq.Customers), "Orders", System.Data.Metadata.Edm.RelationshipMultiplicity.Many, typeof(testlinq.Orders))] +[assembly: EdmRelationshipAttribute("northwindEFModel", "FK_InternationalOrders_OrderID_OrderID", "Orders", System.Data.Metadata.Edm.RelationshipMultiplicity.One, typeof(testlinq.Orders), "InternationalOrders", System.Data.Metadata.Edm.RelationshipMultiplicity.ZeroOrOne, typeof(testlinq.InternationalOrders), true)] +[assembly: EdmRelationshipAttribute("northwindEFModel", "FK_OrderDetails_OrderID_OrderID", "Orders", System.Data.Metadata.Edm.RelationshipMultiplicity.One, typeof(testlinq.Orders), "OrderDetails", System.Data.Metadata.Edm.RelationshipMultiplicity.Many, typeof(testlinq.OrderDetails), true)] +[assembly: EdmRelationshipAttribute("northwindEFModel", "FK_OrderDetails_ProductID_ProductID", "Products", System.Data.Metadata.Edm.RelationshipMultiplicity.One, typeof(testlinq.Products), "OrderDetails", System.Data.Metadata.Edm.RelationshipMultiplicity.Many, typeof(testlinq.OrderDetails), true)] +[assembly: EdmRelationshipAttribute("northwindEFModel", "FK_Products_SupplierID_SupplierID", "Suppliers", System.Data.Metadata.Edm.RelationshipMultiplicity.ZeroOrOne, typeof(testlinq.Suppliers), "Products", System.Data.Metadata.Edm.RelationshipMultiplicity.Many, typeof(testlinq.Products))] +[assembly: EdmRelationshipAttribute("northwindEFModel", "FK_Territories_RegionID_RegionID", "Regions", System.Data.Metadata.Edm.RelationshipMultiplicity.One, typeof(testlinq.Regions), "Territories", System.Data.Metadata.Edm.RelationshipMultiplicity.Many, typeof(testlinq.Territories))] +[assembly: EdmRelationshipAttribute("northwindEFModel", "EmployeesTerritories", "Employees", System.Data.Metadata.Edm.RelationshipMultiplicity.Many, typeof(testlinq.Employees), "Territories", System.Data.Metadata.Edm.RelationshipMultiplicity.Many, typeof(testlinq.Territories))] + +#endregion + +namespace testlinq +{ + #region Contexts + + /// + /// No Metadata Documentation available. + /// + public partial class northwindEFEntities : ObjectContext + { + #region Constructors + + /// + /// Initializes a new northwindEFEntities object using the connection string found in the 'northwindEFEntities' section of the application configuration file. + /// + public northwindEFEntities() : base("name=northwindEFEntities", "northwindEFEntities") + { + OnContextCreated(); + } + + /// + /// Initialize a new northwindEFEntities object. + /// + public northwindEFEntities(string connectionString) : base(connectionString, "northwindEFEntities") + { + OnContextCreated(); + } + + /// + /// Initialize a new northwindEFEntities object. + /// + public northwindEFEntities(EntityConnection connection) : base(connection, "northwindEFEntities") + { + OnContextCreated(); + } + + #endregion + + #region Partial Methods + + partial void OnContextCreated(); + + #endregion + + #region ObjectSet Properties + + /// + /// No Metadata Documentation available. + /// + public ObjectSet Categories + { + get + { + if ((_Categories == null)) + { + _Categories = base.CreateObjectSet("Categories"); + } + return _Categories; + } + } + private ObjectSet _Categories; + + /// + /// No Metadata Documentation available. + /// + public ObjectSet Customers + { + get + { + if ((_Customers == null)) + { + _Customers = base.CreateObjectSet("Customers"); + } + return _Customers; + } + } + private ObjectSet _Customers; + + /// + /// No Metadata Documentation available. + /// + public ObjectSet Employees + { + get + { + if ((_Employees == null)) + { + _Employees = base.CreateObjectSet("Employees"); + } + return _Employees; + } + } + private ObjectSet _Employees; + + /// + /// No Metadata Documentation available. + /// + public ObjectSet InternationalOrders + { + get + { + if ((_InternationalOrders == null)) + { + _InternationalOrders = base.CreateObjectSet("InternationalOrders"); + } + return _InternationalOrders; + } + } + private ObjectSet _InternationalOrders; + + /// + /// No Metadata Documentation available. + /// + public ObjectSet OrderDetails + { + get + { + if ((_OrderDetails == null)) + { + _OrderDetails = base.CreateObjectSet("OrderDetails"); + } + return _OrderDetails; + } + } + private ObjectSet _OrderDetails; + + /// + /// No Metadata Documentation available. + /// + public ObjectSet Orders + { + get + { + if ((_Orders == null)) + { + _Orders = base.CreateObjectSet("Orders"); + } + return _Orders; + } + } + private ObjectSet _Orders; + + /// + /// No Metadata Documentation available. + /// + public ObjectSet PreviousEmployees + { + get + { + if ((_PreviousEmployees == null)) + { + _PreviousEmployees = base.CreateObjectSet("PreviousEmployees"); + } + return _PreviousEmployees; + } + } + private ObjectSet _PreviousEmployees; + + /// + /// No Metadata Documentation available. + /// + public ObjectSet Products + { + get + { + if ((_Products == null)) + { + _Products = base.CreateObjectSet("Products"); + } + return _Products; + } + } + private ObjectSet _Products; + + /// + /// No Metadata Documentation available. + /// + public ObjectSet Regions + { + get + { + if ((_Regions == null)) + { + _Regions = base.CreateObjectSet("Regions"); + } + return _Regions; + } + } + private ObjectSet _Regions; + + /// + /// No Metadata Documentation available. + /// + public ObjectSet Suppliers + { + get + { + if ((_Suppliers == null)) + { + _Suppliers = base.CreateObjectSet("Suppliers"); + } + return _Suppliers; + } + } + private ObjectSet _Suppliers; + + /// + /// No Metadata Documentation available. + /// + public ObjectSet Territories + { + get + { + if ((_Territories == null)) + { + _Territories = base.CreateObjectSet("Territories"); + } + return _Territories; + } + } + private ObjectSet _Territories; + + #endregion + #region AddTo Methods + + /// + /// Deprecated Method for adding a new object to the Categories EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. + /// + public void AddToCategories(Categories categories) + { + base.AddObject("Categories", categories); + } + + /// + /// Deprecated Method for adding a new object to the Customers EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. + /// + public void AddToCustomers(Customers customers) + { + base.AddObject("Customers", customers); + } + + /// + /// Deprecated Method for adding a new object to the Employees EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. + /// + public void AddToEmployees(Employees employees) + { + base.AddObject("Employees", employees); + } + + /// + /// Deprecated Method for adding a new object to the InternationalOrders EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. + /// + public void AddToInternationalOrders(InternationalOrders internationalOrders) + { + base.AddObject("InternationalOrders", internationalOrders); + } + + /// + /// Deprecated Method for adding a new object to the OrderDetails EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. + /// + public void AddToOrderDetails(OrderDetails orderDetails) + { + base.AddObject("OrderDetails", orderDetails); + } + + /// + /// Deprecated Method for adding a new object to the Orders EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. + /// + public void AddToOrders(Orders orders) + { + base.AddObject("Orders", orders); + } + + /// + /// Deprecated Method for adding a new object to the PreviousEmployees EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. + /// + public void AddToPreviousEmployees(PreviousEmployees previousEmployees) + { + base.AddObject("PreviousEmployees", previousEmployees); + } + + /// + /// Deprecated Method for adding a new object to the Products EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. + /// + public void AddToProducts(Products products) + { + base.AddObject("Products", products); + } + + /// + /// Deprecated Method for adding a new object to the Regions EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. + /// + public void AddToRegions(Regions regions) + { + base.AddObject("Regions", regions); + } + + /// + /// Deprecated Method for adding a new object to the Suppliers EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. + /// + public void AddToSuppliers(Suppliers suppliers) + { + base.AddObject("Suppliers", suppliers); + } + + /// + /// Deprecated Method for adding a new object to the Territories EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. + /// + public void AddToTerritories(Territories territories) + { + base.AddObject("Territories", territories); + } + + #endregion + } + + + #endregion + + #region Entities + + /// + /// No Metadata Documentation available. + /// + [EdmEntityTypeAttribute(NamespaceName="northwindEFModel", Name="Categories")] + [Serializable()] + [DataContractAttribute(IsReference=true)] + public partial class Categories : EntityObject + { + #region Factory Method + + /// + /// Create a new Categories object. + /// + /// Initial value of the CategoryID property. + /// Initial value of the CategoryName property. + public static Categories CreateCategories(global::System.Int64 categoryID, global::System.String categoryName) + { + Categories categories = new Categories(); + categories.CategoryID = categoryID; + categories.CategoryName = categoryName; + return categories; + } + + #endregion + #region Primitive Properties + + /// + /// No Metadata Documentation available. + /// + [EdmScalarPropertyAttribute(EntityKeyProperty=true, IsNullable=false)] + [DataMemberAttribute()] + public global::System.Int64 CategoryID + { + get + { + return _CategoryID; + } + set + { + if (_CategoryID != value) + { + OnCategoryIDChanging(value); + ReportPropertyChanging("CategoryID"); + _CategoryID = StructuralObject.SetValidValue(value); + ReportPropertyChanged("CategoryID"); + OnCategoryIDChanged(); + } + } + } + private global::System.Int64 _CategoryID; + partial void OnCategoryIDChanging(global::System.Int64 value); + partial void OnCategoryIDChanged(); + + /// + /// No Metadata Documentation available. + /// + [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)] + [DataMemberAttribute()] + public global::System.String CategoryName + { + get + { + return _CategoryName; + } + set + { + OnCategoryNameChanging(value); + ReportPropertyChanging("CategoryName"); + _CategoryName = StructuralObject.SetValidValue(value, false); + ReportPropertyChanged("CategoryName"); + OnCategoryNameChanged(); + } + } + private global::System.String _CategoryName; + partial void OnCategoryNameChanging(global::System.String value); + partial void OnCategoryNameChanged(); + + /// + /// No Metadata Documentation available. + /// + [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)] + [DataMemberAttribute()] + public global::System.String Description + { + get + { + return _Description; + } + set + { + OnDescriptionChanging(value); + ReportPropertyChanging("Description"); + _Description = StructuralObject.SetValidValue(value, true); + ReportPropertyChanged("Description"); + OnDescriptionChanged(); + } + } + private global::System.String _Description; + partial void OnDescriptionChanging(global::System.String value); + partial void OnDescriptionChanged(); + + /// + /// No Metadata Documentation available. + /// + [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)] + [DataMemberAttribute()] + public global::System.Byte[] Picture + { + get + { + return StructuralObject.GetValidValue(_Picture); + } + set + { + OnPictureChanging(value); + ReportPropertyChanging("Picture"); + _Picture = StructuralObject.SetValidValue(value, true); + ReportPropertyChanged("Picture"); + OnPictureChanged(); + } + } + private global::System.Byte[] _Picture; + partial void OnPictureChanging(global::System.Byte[] value); + partial void OnPictureChanged(); + + #endregion + + #region Navigation Properties + + /// + /// No Metadata Documentation available. + /// + [XmlIgnoreAttribute()] + [SoapIgnoreAttribute()] + [DataMemberAttribute()] + [EdmRelationshipNavigationPropertyAttribute("northwindEFModel", "FK_Products_CategoryID_CategoryID", "Products")] + public EntityCollection Products + { + get + { + return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedCollection("northwindEFModel.FK_Products_CategoryID_CategoryID", "Products"); + } + set + { + if ((value != null)) + { + ((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedCollection("northwindEFModel.FK_Products_CategoryID_CategoryID", "Products", value); + } + } + } + + #endregion + } + + /// + /// No Metadata Documentation available. + /// + [EdmEntityTypeAttribute(NamespaceName="northwindEFModel", Name="Customers")] + [Serializable()] + [DataContractAttribute(IsReference=true)] + public partial class Customers : EntityObject + { + #region Factory Method + + /// + /// Create a new Customers object. + /// + /// Initial value of the CustomerID property. + /// Initial value of the CompanyName property. + public static Customers CreateCustomers(global::System.String customerID, global::System.String companyName) + { + Customers customers = new Customers(); + customers.CustomerID = customerID; + customers.CompanyName = companyName; + return customers; + } + + #endregion + #region Primitive Properties + + /// + /// No Metadata Documentation available. + /// + [EdmScalarPropertyAttribute(EntityKeyProperty=true, IsNullable=false)] + [DataMemberAttribute()] + public global::System.String CustomerID + { + get + { + return _CustomerID; + } + set + { + if (_CustomerID != value) + { + OnCustomerIDChanging(value); + ReportPropertyChanging("CustomerID"); + _CustomerID = StructuralObject.SetValidValue(value, false); + ReportPropertyChanged("CustomerID"); + OnCustomerIDChanged(); + } + } + } + private global::System.String _CustomerID; + partial void OnCustomerIDChanging(global::System.String value); + partial void OnCustomerIDChanged(); + + /// + /// No Metadata Documentation available. + /// + [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)] + [DataMemberAttribute()] + public global::System.String CompanyName + { + get + { + return _CompanyName; + } + set + { + OnCompanyNameChanging(value); + ReportPropertyChanging("CompanyName"); + _CompanyName = StructuralObject.SetValidValue(value, false); + ReportPropertyChanged("CompanyName"); + OnCompanyNameChanged(); + } + } + private global::System.String _CompanyName; + partial void OnCompanyNameChanging(global::System.String value); + partial void OnCompanyNameChanged(); + + /// + /// No Metadata Documentation available. + /// + [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)] + [DataMemberAttribute()] + public global::System.String ContactName + { + get + { + return _ContactName; + } + set + { + OnContactNameChanging(value); + ReportPropertyChanging("ContactName"); + _ContactName = StructuralObject.SetValidValue(value, true); + ReportPropertyChanged("ContactName"); + OnContactNameChanged(); + } + } + private global::System.String _ContactName; + partial void OnContactNameChanging(global::System.String value); + partial void OnContactNameChanged(); + + /// + /// No Metadata Documentation available. + /// + [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)] + [DataMemberAttribute()] + public global::System.String ContactTitle + { + get + { + return _ContactTitle; + } + set + { + OnContactTitleChanging(value); + ReportPropertyChanging("ContactTitle"); + _ContactTitle = StructuralObject.SetValidValue(value, true); + ReportPropertyChanged("ContactTitle"); + OnContactTitleChanged(); + } + } + private global::System.String _ContactTitle; + partial void OnContactTitleChanging(global::System.String value); + partial void OnContactTitleChanged(); + + /// + /// No Metadata Documentation available. + /// + [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)] + [DataMemberAttribute()] + public global::System.String Address + { + get + { + return _Address; + } + set + { + OnAddressChanging(value); + ReportPropertyChanging("Address"); + _Address = StructuralObject.SetValidValue(value, true); + ReportPropertyChanged("Address"); + OnAddressChanged(); + } + } + private global::System.String _Address; + partial void OnAddressChanging(global::System.String value); + partial void OnAddressChanged(); + + /// + /// No Metadata Documentation available. + /// + [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)] + [DataMemberAttribute()] + public global::System.String City + { + get + { + return _City; + } + set + { + OnCityChanging(value); + ReportPropertyChanging("City"); + _City = StructuralObject.SetValidValue(value, true); + ReportPropertyChanged("City"); + OnCityChanged(); + } + } + private global::System.String _City; + partial void OnCityChanging(global::System.String value); + partial void OnCityChanged(); + + /// + /// No Metadata Documentation available. + /// + [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)] + [DataMemberAttribute()] + public global::System.String Region + { + get + { + return _Region; + } + set + { + OnRegionChanging(value); + ReportPropertyChanging("Region"); + _Region = StructuralObject.SetValidValue(value, true); + ReportPropertyChanged("Region"); + OnRegionChanged(); + } + } + private global::System.String _Region; + partial void OnRegionChanging(global::System.String value); + partial void OnRegionChanged(); + + /// + /// No Metadata Documentation available. + /// + [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)] + [DataMemberAttribute()] + public global::System.String PostalCode + { + get + { + return _PostalCode; + } + set + { + OnPostalCodeChanging(value); + ReportPropertyChanging("PostalCode"); + _PostalCode = StructuralObject.SetValidValue(value, true); + ReportPropertyChanged("PostalCode"); + OnPostalCodeChanged(); + } + } + private global::System.String _PostalCode; + partial void OnPostalCodeChanging(global::System.String value); + partial void OnPostalCodeChanged(); + + /// + /// No Metadata Documentation available. + /// + [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)] + [DataMemberAttribute()] + public global::System.String Country + { + get + { + return _Country; + } + set + { + OnCountryChanging(value); + ReportPropertyChanging("Country"); + _Country = StructuralObject.SetValidValue(value, true); + ReportPropertyChanged("Country"); + OnCountryChanged(); + } + } + private global::System.String _Country; + partial void OnCountryChanging(global::System.String value); + partial void OnCountryChanged(); + + /// + /// No Metadata Documentation available. + /// + [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)] + [DataMemberAttribute()] + public global::System.String Phone + { + get + { + return _Phone; + } + set + { + OnPhoneChanging(value); + ReportPropertyChanging("Phone"); + _Phone = StructuralObject.SetValidValue(value, true); + ReportPropertyChanged("Phone"); + OnPhoneChanged(); + } + } + private global::System.String _Phone; + partial void OnPhoneChanging(global::System.String value); + partial void OnPhoneChanged(); + + /// + /// No Metadata Documentation available. + /// + [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)] + [DataMemberAttribute()] + public global::System.String Fax + { + get + { + return _Fax; + } + set + { + OnFaxChanging(value); + ReportPropertyChanging("Fax"); + _Fax = StructuralObject.SetValidValue(value, true); + ReportPropertyChanged("Fax"); + OnFaxChanged(); + } + } + private global::System.String _Fax; + partial void OnFaxChanging(global::System.String value); + partial void OnFaxChanged(); + + #endregion + + #region Navigation Properties + + /// + /// No Metadata Documentation available. + /// + [XmlIgnoreAttribute()] + [SoapIgnoreAttribute()] + [DataMemberAttribute()] + [EdmRelationshipNavigationPropertyAttribute("northwindEFModel", "FK_Orders_CustomerID_CustomerID", "Orders")] + public EntityCollection Orders + { + get + { + return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedCollection("northwindEFModel.FK_Orders_CustomerID_CustomerID", "Orders"); + } + set + { + if ((value != null)) + { + ((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedCollection("northwindEFModel.FK_Orders_CustomerID_CustomerID", "Orders", value); + } + } + } + + #endregion + } + + /// + /// No Metadata Documentation available. + /// + [EdmEntityTypeAttribute(NamespaceName="northwindEFModel", Name="Employees")] + [Serializable()] + [DataContractAttribute(IsReference=true)] + public partial class Employees : EntityObject + { + #region Factory Method + + /// + /// Create a new Employees object. + /// + /// Initial value of the EmployeeID property. + /// Initial value of the LastName property. + /// Initial value of the FirstName property. + public static Employees CreateEmployees(global::System.Int64 employeeID, global::System.String lastName, global::System.String firstName) + { + Employees employees = new Employees(); + employees.EmployeeID = employeeID; + employees.LastName = lastName; + employees.FirstName = firstName; + return employees; + } + + #endregion + #region Primitive Properties + + /// + /// No Metadata Documentation available. + /// + [EdmScalarPropertyAttribute(EntityKeyProperty=true, IsNullable=false)] + [DataMemberAttribute()] + public global::System.Int64 EmployeeID + { + get + { + return _EmployeeID; + } + set + { + if (_EmployeeID != value) + { + OnEmployeeIDChanging(value); + ReportPropertyChanging("EmployeeID"); + _EmployeeID = StructuralObject.SetValidValue(value); + ReportPropertyChanged("EmployeeID"); + OnEmployeeIDChanged(); + } + } + } + private global::System.Int64 _EmployeeID; + partial void OnEmployeeIDChanging(global::System.Int64 value); + partial void OnEmployeeIDChanged(); + + /// + /// No Metadata Documentation available. + /// + [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)] + [DataMemberAttribute()] + public global::System.String LastName + { + get + { + return _LastName; + } + set + { + OnLastNameChanging(value); + ReportPropertyChanging("LastName"); + _LastName = StructuralObject.SetValidValue(value, false); + ReportPropertyChanged("LastName"); + OnLastNameChanged(); + } + } + private global::System.String _LastName; + partial void OnLastNameChanging(global::System.String value); + partial void OnLastNameChanged(); + + /// + /// No Metadata Documentation available. + /// + [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)] + [DataMemberAttribute()] + public global::System.String FirstName + { + get + { + return _FirstName; + } + set + { + OnFirstNameChanging(value); + ReportPropertyChanging("FirstName"); + _FirstName = StructuralObject.SetValidValue(value, false); + ReportPropertyChanged("FirstName"); + OnFirstNameChanged(); + } + } + private global::System.String _FirstName; + partial void OnFirstNameChanging(global::System.String value); + partial void OnFirstNameChanged(); + + /// + /// No Metadata Documentation available. + /// + [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)] + [DataMemberAttribute()] + public global::System.String Title + { + get + { + return _Title; + } + set + { + OnTitleChanging(value); + ReportPropertyChanging("Title"); + _Title = StructuralObject.SetValidValue(value, true); + ReportPropertyChanged("Title"); + OnTitleChanged(); + } + } + private global::System.String _Title; + partial void OnTitleChanging(global::System.String value); + partial void OnTitleChanged(); + + /// + /// No Metadata Documentation available. + /// + [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)] + [DataMemberAttribute()] + public global::System.String TitleOfCourtesy + { + get + { + return _TitleOfCourtesy; + } + set + { + OnTitleOfCourtesyChanging(value); + ReportPropertyChanging("TitleOfCourtesy"); + _TitleOfCourtesy = StructuralObject.SetValidValue(value, true); + ReportPropertyChanged("TitleOfCourtesy"); + OnTitleOfCourtesyChanged(); + } + } + private global::System.String _TitleOfCourtesy; + partial void OnTitleOfCourtesyChanging(global::System.String value); + partial void OnTitleOfCourtesyChanged(); + + /// + /// No Metadata Documentation available. + /// + [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)] + [DataMemberAttribute()] + public Nullable BirthDate + { + get + { + return _BirthDate; + } + set + { + OnBirthDateChanging(value); + ReportPropertyChanging("BirthDate"); + _BirthDate = StructuralObject.SetValidValue(value); + ReportPropertyChanged("BirthDate"); + OnBirthDateChanged(); + } + } + private Nullable _BirthDate; + partial void OnBirthDateChanging(Nullable value); + partial void OnBirthDateChanged(); + + /// + /// No Metadata Documentation available. + /// + [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)] + [DataMemberAttribute()] + public Nullable HireDate + { + get + { + return _HireDate; + } + set + { + OnHireDateChanging(value); + ReportPropertyChanging("HireDate"); + _HireDate = StructuralObject.SetValidValue(value); + ReportPropertyChanged("HireDate"); + OnHireDateChanged(); + } + } + private Nullable _HireDate; + partial void OnHireDateChanging(Nullable value); + partial void OnHireDateChanged(); + + /// + /// No Metadata Documentation available. + /// + [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)] + [DataMemberAttribute()] + public global::System.String Address + { + get + { + return _Address; + } + set + { + OnAddressChanging(value); + ReportPropertyChanging("Address"); + _Address = StructuralObject.SetValidValue(value, true); + ReportPropertyChanged("Address"); + OnAddressChanged(); + } + } + private global::System.String _Address; + partial void OnAddressChanging(global::System.String value); + partial void OnAddressChanged(); + + /// + /// No Metadata Documentation available. + /// + [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)] + [DataMemberAttribute()] + public global::System.String City + { + get + { + return _City; + } + set + { + OnCityChanging(value); + ReportPropertyChanging("City"); + _City = StructuralObject.SetValidValue(value, true); + ReportPropertyChanged("City"); + OnCityChanged(); + } + } + private global::System.String _City; + partial void OnCityChanging(global::System.String value); + partial void OnCityChanged(); + + /// + /// No Metadata Documentation available. + /// + [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)] + [DataMemberAttribute()] + public global::System.String Region + { + get + { + return _Region; + } + set + { + OnRegionChanging(value); + ReportPropertyChanging("Region"); + _Region = StructuralObject.SetValidValue(value, true); + ReportPropertyChanged("Region"); + OnRegionChanged(); + } + } + private global::System.String _Region; + partial void OnRegionChanging(global::System.String value); + partial void OnRegionChanged(); + + /// + /// No Metadata Documentation available. + /// + [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)] + [DataMemberAttribute()] + public global::System.String PostalCode + { + get + { + return _PostalCode; + } + set + { + OnPostalCodeChanging(value); + ReportPropertyChanging("PostalCode"); + _PostalCode = StructuralObject.SetValidValue(value, true); + ReportPropertyChanged("PostalCode"); + OnPostalCodeChanged(); + } + } + private global::System.String _PostalCode; + partial void OnPostalCodeChanging(global::System.String value); + partial void OnPostalCodeChanged(); + + /// + /// No Metadata Documentation available. + /// + [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)] + [DataMemberAttribute()] + public global::System.String Country + { + get + { + return _Country; + } + set + { + OnCountryChanging(value); + ReportPropertyChanging("Country"); + _Country = StructuralObject.SetValidValue(value, true); + ReportPropertyChanged("Country"); + OnCountryChanged(); + } + } + private global::System.String _Country; + partial void OnCountryChanging(global::System.String value); + partial void OnCountryChanged(); + + /// + /// No Metadata Documentation available. + /// + [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)] + [DataMemberAttribute()] + public global::System.String HomePhone + { + get + { + return _HomePhone; + } + set + { + OnHomePhoneChanging(value); + ReportPropertyChanging("HomePhone"); + _HomePhone = StructuralObject.SetValidValue(value, true); + ReportPropertyChanged("HomePhone"); + OnHomePhoneChanged(); + } + } + private global::System.String _HomePhone; + partial void OnHomePhoneChanging(global::System.String value); + partial void OnHomePhoneChanged(); + + /// + /// No Metadata Documentation available. + /// + [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)] + [DataMemberAttribute()] + public global::System.String Extension + { + get + { + return _Extension; + } + set + { + OnExtensionChanging(value); + ReportPropertyChanging("Extension"); + _Extension = StructuralObject.SetValidValue(value, true); + ReportPropertyChanged("Extension"); + OnExtensionChanged(); + } + } + private global::System.String _Extension; + partial void OnExtensionChanging(global::System.String value); + partial void OnExtensionChanged(); + + /// + /// No Metadata Documentation available. + /// + [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)] + [DataMemberAttribute()] + public global::System.Byte[] Photo + { + get + { + return StructuralObject.GetValidValue(_Photo); + } + set + { + OnPhotoChanging(value); + ReportPropertyChanging("Photo"); + _Photo = StructuralObject.SetValidValue(value, true); + ReportPropertyChanged("Photo"); + OnPhotoChanged(); + } + } + private global::System.Byte[] _Photo; + partial void OnPhotoChanging(global::System.Byte[] value); + partial void OnPhotoChanged(); + + /// + /// No Metadata Documentation available. + /// + [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)] + [DataMemberAttribute()] + public global::System.String Notes + { + get + { + return _Notes; + } + set + { + OnNotesChanging(value); + ReportPropertyChanging("Notes"); + _Notes = StructuralObject.SetValidValue(value, true); + ReportPropertyChanged("Notes"); + OnNotesChanged(); + } + } + private global::System.String _Notes; + partial void OnNotesChanging(global::System.String value); + partial void OnNotesChanged(); + + /// + /// No Metadata Documentation available. + /// + [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)] + [DataMemberAttribute()] + public global::System.String PhotoPath + { + get + { + return _PhotoPath; + } + set + { + OnPhotoPathChanging(value); + ReportPropertyChanging("PhotoPath"); + _PhotoPath = StructuralObject.SetValidValue(value, true); + ReportPropertyChanged("PhotoPath"); + OnPhotoPathChanged(); + } + } + private global::System.String _PhotoPath; + partial void OnPhotoPathChanging(global::System.String value); + partial void OnPhotoPathChanged(); + + #endregion + + #region Navigation Properties + + /// + /// No Metadata Documentation available. + /// + [XmlIgnoreAttribute()] + [SoapIgnoreAttribute()] + [DataMemberAttribute()] + [EdmRelationshipNavigationPropertyAttribute("northwindEFModel", "EmployeesTerritories", "Territories")] + public EntityCollection Territories + { + get + { + return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedCollection("northwindEFModel.EmployeesTerritories", "Territories"); + } + set + { + if ((value != null)) + { + ((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedCollection("northwindEFModel.EmployeesTerritories", "Territories", value); + } + } + } + + #endregion + } + + /// + /// No Metadata Documentation available. + /// + [EdmEntityTypeAttribute(NamespaceName="northwindEFModel", Name="InternationalOrders")] + [Serializable()] + [DataContractAttribute(IsReference=true)] + public partial class InternationalOrders : EntityObject + { + #region Factory Method + + /// + /// Create a new InternationalOrders object. + /// + /// Initial value of the OrderID property. + /// Initial value of the CustomsDescription property. + /// Initial value of the ExciseTax property. + public static InternationalOrders CreateInternationalOrders(global::System.Int64 orderID, global::System.String customsDescription, global::System.Decimal exciseTax) + { + InternationalOrders internationalOrders = new InternationalOrders(); + internationalOrders.OrderID = orderID; + internationalOrders.CustomsDescription = customsDescription; + internationalOrders.ExciseTax = exciseTax; + return internationalOrders; + } + + #endregion + #region Primitive Properties + + /// + /// No Metadata Documentation available. + /// + [EdmScalarPropertyAttribute(EntityKeyProperty=true, IsNullable=false)] + [DataMemberAttribute()] + public global::System.Int64 OrderID + { + get + { + return _OrderID; + } + set + { + if (_OrderID != value) + { + OnOrderIDChanging(value); + ReportPropertyChanging("OrderID"); + _OrderID = StructuralObject.SetValidValue(value); + ReportPropertyChanged("OrderID"); + OnOrderIDChanged(); + } + } + } + private global::System.Int64 _OrderID; + partial void OnOrderIDChanging(global::System.Int64 value); + partial void OnOrderIDChanged(); + + /// + /// No Metadata Documentation available. + /// + [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)] + [DataMemberAttribute()] + public global::System.String CustomsDescription + { + get + { + return _CustomsDescription; + } + set + { + OnCustomsDescriptionChanging(value); + ReportPropertyChanging("CustomsDescription"); + _CustomsDescription = StructuralObject.SetValidValue(value, false); + ReportPropertyChanged("CustomsDescription"); + OnCustomsDescriptionChanged(); + } + } + private global::System.String _CustomsDescription; + partial void OnCustomsDescriptionChanging(global::System.String value); + partial void OnCustomsDescriptionChanged(); + + /// + /// No Metadata Documentation available. + /// + [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)] + [DataMemberAttribute()] + public global::System.Decimal ExciseTax + { + get + { + return _ExciseTax; + } + set + { + OnExciseTaxChanging(value); + ReportPropertyChanging("ExciseTax"); + _ExciseTax = StructuralObject.SetValidValue(value); + ReportPropertyChanged("ExciseTax"); + OnExciseTaxChanged(); + } + } + private global::System.Decimal _ExciseTax; + partial void OnExciseTaxChanging(global::System.Decimal value); + partial void OnExciseTaxChanged(); + + #endregion + + #region Navigation Properties + + /// + /// No Metadata Documentation available. + /// + [XmlIgnoreAttribute()] + [SoapIgnoreAttribute()] + [DataMemberAttribute()] + [EdmRelationshipNavigationPropertyAttribute("northwindEFModel", "FK_InternationalOrders_OrderID_OrderID", "Orders")] + public Orders Orders + { + get + { + return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference("northwindEFModel.FK_InternationalOrders_OrderID_OrderID", "Orders").Value; + } + set + { + ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference("northwindEFModel.FK_InternationalOrders_OrderID_OrderID", "Orders").Value = value; + } + } + /// + /// No Metadata Documentation available. + /// + [BrowsableAttribute(false)] + [DataMemberAttribute()] + public EntityReference OrdersReference + { + get + { + return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference("northwindEFModel.FK_InternationalOrders_OrderID_OrderID", "Orders"); + } + set + { + if ((value != null)) + { + ((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedReference("northwindEFModel.FK_InternationalOrders_OrderID_OrderID", "Orders", value); + } + } + } + + #endregion + } + + /// + /// No Metadata Documentation available. + /// + [EdmEntityTypeAttribute(NamespaceName="northwindEFModel", Name="OrderDetails")] + [Serializable()] + [DataContractAttribute(IsReference=true)] + public partial class OrderDetails : EntityObject + { + #region Factory Method + + /// + /// Create a new OrderDetails object. + /// + /// Initial value of the OrderID property. + /// Initial value of the ProductID property. + /// Initial value of the UnitPrice property. + /// Initial value of the Quantity property. + /// Initial value of the Discount property. + public static OrderDetails CreateOrderDetails(global::System.Int64 orderID, global::System.Int64 productID, global::System.Decimal unitPrice, global::System.Int16 quantity, global::System.Single discount) + { + OrderDetails orderDetails = new OrderDetails(); + orderDetails.OrderID = orderID; + orderDetails.ProductID = productID; + orderDetails.UnitPrice = unitPrice; + orderDetails.Quantity = quantity; + orderDetails.Discount = discount; + return orderDetails; + } + + #endregion + #region Primitive Properties + + /// + /// No Metadata Documentation available. + /// + [EdmScalarPropertyAttribute(EntityKeyProperty=true, IsNullable=false)] + [DataMemberAttribute()] + public global::System.Int64 OrderID + { + get + { + return _OrderID; + } + set + { + if (_OrderID != value) + { + OnOrderIDChanging(value); + ReportPropertyChanging("OrderID"); + _OrderID = StructuralObject.SetValidValue(value); + ReportPropertyChanged("OrderID"); + OnOrderIDChanged(); + } + } + } + private global::System.Int64 _OrderID; + partial void OnOrderIDChanging(global::System.Int64 value); + partial void OnOrderIDChanged(); + + /// + /// No Metadata Documentation available. + /// + [EdmScalarPropertyAttribute(EntityKeyProperty=true, IsNullable=false)] + [DataMemberAttribute()] + public global::System.Int64 ProductID + { + get + { + return _ProductID; + } + set + { + if (_ProductID != value) + { + OnProductIDChanging(value); + ReportPropertyChanging("ProductID"); + _ProductID = StructuralObject.SetValidValue(value); + ReportPropertyChanged("ProductID"); + OnProductIDChanged(); + } + } + } + private global::System.Int64 _ProductID; + partial void OnProductIDChanging(global::System.Int64 value); + partial void OnProductIDChanged(); + + /// + /// No Metadata Documentation available. + /// + [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)] + [DataMemberAttribute()] + public global::System.Decimal UnitPrice + { + get + { + return _UnitPrice; + } + set + { + OnUnitPriceChanging(value); + ReportPropertyChanging("UnitPrice"); + _UnitPrice = StructuralObject.SetValidValue(value); + ReportPropertyChanged("UnitPrice"); + OnUnitPriceChanged(); + } + } + private global::System.Decimal _UnitPrice; + partial void OnUnitPriceChanging(global::System.Decimal value); + partial void OnUnitPriceChanged(); + + /// + /// No Metadata Documentation available. + /// + [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)] + [DataMemberAttribute()] + public global::System.Int16 Quantity + { + get + { + return _Quantity; + } + set + { + OnQuantityChanging(value); + ReportPropertyChanging("Quantity"); + _Quantity = StructuralObject.SetValidValue(value); + ReportPropertyChanged("Quantity"); + OnQuantityChanged(); + } + } + private global::System.Int16 _Quantity; + partial void OnQuantityChanging(global::System.Int16 value); + partial void OnQuantityChanged(); + + /// + /// No Metadata Documentation available. + /// + [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)] + [DataMemberAttribute()] + public global::System.Single Discount + { + get + { + return _Discount; + } + set + { + OnDiscountChanging(value); + ReportPropertyChanging("Discount"); + _Discount = StructuralObject.SetValidValue(value); + ReportPropertyChanged("Discount"); + OnDiscountChanged(); + } + } + private global::System.Single _Discount; + partial void OnDiscountChanging(global::System.Single value); + partial void OnDiscountChanged(); + + #endregion + + #region Navigation Properties + + /// + /// No Metadata Documentation available. + /// + [XmlIgnoreAttribute()] + [SoapIgnoreAttribute()] + [DataMemberAttribute()] + [EdmRelationshipNavigationPropertyAttribute("northwindEFModel", "FK_OrderDetails_OrderID_OrderID", "Orders")] + public Orders Orders + { + get + { + return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference("northwindEFModel.FK_OrderDetails_OrderID_OrderID", "Orders").Value; + } + set + { + ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference("northwindEFModel.FK_OrderDetails_OrderID_OrderID", "Orders").Value = value; + } + } + /// + /// No Metadata Documentation available. + /// + [BrowsableAttribute(false)] + [DataMemberAttribute()] + public EntityReference OrdersReference + { + get + { + return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference("northwindEFModel.FK_OrderDetails_OrderID_OrderID", "Orders"); + } + set + { + if ((value != null)) + { + ((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedReference("northwindEFModel.FK_OrderDetails_OrderID_OrderID", "Orders", value); + } + } + } + + /// + /// No Metadata Documentation available. + /// + [XmlIgnoreAttribute()] + [SoapIgnoreAttribute()] + [DataMemberAttribute()] + [EdmRelationshipNavigationPropertyAttribute("northwindEFModel", "FK_OrderDetails_ProductID_ProductID", "Products")] + public Products Products + { + get + { + return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference("northwindEFModel.FK_OrderDetails_ProductID_ProductID", "Products").Value; + } + set + { + ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference("northwindEFModel.FK_OrderDetails_ProductID_ProductID", "Products").Value = value; + } + } + /// + /// No Metadata Documentation available. + /// + [BrowsableAttribute(false)] + [DataMemberAttribute()] + public EntityReference ProductsReference + { + get + { + return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference("northwindEFModel.FK_OrderDetails_ProductID_ProductID", "Products"); + } + set + { + if ((value != null)) + { + ((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedReference("northwindEFModel.FK_OrderDetails_ProductID_ProductID", "Products", value); + } + } + } + + #endregion + } + + /// + /// No Metadata Documentation available. + /// + [EdmEntityTypeAttribute(NamespaceName="northwindEFModel", Name="Orders")] + [Serializable()] + [DataContractAttribute(IsReference=true)] + public partial class Orders : EntityObject + { + #region Factory Method + + /// + /// Create a new Orders object. + /// + /// Initial value of the OrderID property. + public static Orders CreateOrders(global::System.Int64 orderID) + { + Orders orders = new Orders(); + orders.OrderID = orderID; + return orders; + } + + #endregion + #region Primitive Properties + + /// + /// No Metadata Documentation available. + /// + [EdmScalarPropertyAttribute(EntityKeyProperty=true, IsNullable=false)] + [DataMemberAttribute()] + public global::System.Int64 OrderID + { + get + { + return _OrderID; + } + set + { + if (_OrderID != value) + { + OnOrderIDChanging(value); + ReportPropertyChanging("OrderID"); + _OrderID = StructuralObject.SetValidValue(value); + ReportPropertyChanged("OrderID"); + OnOrderIDChanged(); + } + } + } + private global::System.Int64 _OrderID; + partial void OnOrderIDChanging(global::System.Int64 value); + partial void OnOrderIDChanged(); + + /// + /// No Metadata Documentation available. + /// + [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)] + [DataMemberAttribute()] + public Nullable EmployeeID + { + get + { + return _EmployeeID; + } + set + { + OnEmployeeIDChanging(value); + ReportPropertyChanging("EmployeeID"); + _EmployeeID = StructuralObject.SetValidValue(value); + ReportPropertyChanged("EmployeeID"); + OnEmployeeIDChanged(); + } + } + private Nullable _EmployeeID; + partial void OnEmployeeIDChanging(Nullable value); + partial void OnEmployeeIDChanged(); + + /// + /// No Metadata Documentation available. + /// + [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)] + [DataMemberAttribute()] + public Nullable OrderDate + { + get + { + return _OrderDate; + } + set + { + OnOrderDateChanging(value); + ReportPropertyChanging("OrderDate"); + _OrderDate = StructuralObject.SetValidValue(value); + ReportPropertyChanged("OrderDate"); + OnOrderDateChanged(); + } + } + private Nullable _OrderDate; + partial void OnOrderDateChanging(Nullable value); + partial void OnOrderDateChanged(); + + /// + /// No Metadata Documentation available. + /// + [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)] + [DataMemberAttribute()] + public Nullable RequiredDate + { + get + { + return _RequiredDate; + } + set + { + OnRequiredDateChanging(value); + ReportPropertyChanging("RequiredDate"); + _RequiredDate = StructuralObject.SetValidValue(value); + ReportPropertyChanged("RequiredDate"); + OnRequiredDateChanged(); + } + } + private Nullable _RequiredDate; + partial void OnRequiredDateChanging(Nullable value); + partial void OnRequiredDateChanged(); + + /// + /// No Metadata Documentation available. + /// + [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)] + [DataMemberAttribute()] + public Nullable ShippedDate + { + get + { + return _ShippedDate; + } + set + { + OnShippedDateChanging(value); + ReportPropertyChanging("ShippedDate"); + _ShippedDate = StructuralObject.SetValidValue(value); + ReportPropertyChanged("ShippedDate"); + OnShippedDateChanged(); + } + } + private Nullable _ShippedDate; + partial void OnShippedDateChanging(Nullable value); + partial void OnShippedDateChanged(); + + /// + /// No Metadata Documentation available. + /// + [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)] + [DataMemberAttribute()] + public Nullable Freight + { + get + { + return _Freight; + } + set + { + OnFreightChanging(value); + ReportPropertyChanging("Freight"); + _Freight = StructuralObject.SetValidValue(value); + ReportPropertyChanged("Freight"); + OnFreightChanged(); + } + } + private Nullable _Freight; + partial void OnFreightChanging(Nullable value); + partial void OnFreightChanged(); + + /// + /// No Metadata Documentation available. + /// + [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)] + [DataMemberAttribute()] + public global::System.String ShipName + { + get + { + return _ShipName; + } + set + { + OnShipNameChanging(value); + ReportPropertyChanging("ShipName"); + _ShipName = StructuralObject.SetValidValue(value, true); + ReportPropertyChanged("ShipName"); + OnShipNameChanged(); + } + } + private global::System.String _ShipName; + partial void OnShipNameChanging(global::System.String value); + partial void OnShipNameChanged(); + + /// + /// No Metadata Documentation available. + /// + [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)] + [DataMemberAttribute()] + public global::System.String ShipAddress + { + get + { + return _ShipAddress; + } + set + { + OnShipAddressChanging(value); + ReportPropertyChanging("ShipAddress"); + _ShipAddress = StructuralObject.SetValidValue(value, true); + ReportPropertyChanged("ShipAddress"); + OnShipAddressChanged(); + } + } + private global::System.String _ShipAddress; + partial void OnShipAddressChanging(global::System.String value); + partial void OnShipAddressChanged(); + + /// + /// No Metadata Documentation available. + /// + [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)] + [DataMemberAttribute()] + public global::System.String ShipCity + { + get + { + return _ShipCity; + } + set + { + OnShipCityChanging(value); + ReportPropertyChanging("ShipCity"); + _ShipCity = StructuralObject.SetValidValue(value, true); + ReportPropertyChanged("ShipCity"); + OnShipCityChanged(); + } + } + private global::System.String _ShipCity; + partial void OnShipCityChanging(global::System.String value); + partial void OnShipCityChanged(); + + /// + /// No Metadata Documentation available. + /// + [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)] + [DataMemberAttribute()] + public global::System.String ShipRegion + { + get + { + return _ShipRegion; + } + set + { + OnShipRegionChanging(value); + ReportPropertyChanging("ShipRegion"); + _ShipRegion = StructuralObject.SetValidValue(value, true); + ReportPropertyChanged("ShipRegion"); + OnShipRegionChanged(); + } + } + private global::System.String _ShipRegion; + partial void OnShipRegionChanging(global::System.String value); + partial void OnShipRegionChanged(); + + /// + /// No Metadata Documentation available. + /// + [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)] + [DataMemberAttribute()] + public global::System.String ShipPostalCode + { + get + { + return _ShipPostalCode; + } + set + { + OnShipPostalCodeChanging(value); + ReportPropertyChanging("ShipPostalCode"); + _ShipPostalCode = StructuralObject.SetValidValue(value, true); + ReportPropertyChanged("ShipPostalCode"); + OnShipPostalCodeChanged(); + } + } + private global::System.String _ShipPostalCode; + partial void OnShipPostalCodeChanging(global::System.String value); + partial void OnShipPostalCodeChanged(); + + /// + /// No Metadata Documentation available. + /// + [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)] + [DataMemberAttribute()] + public global::System.String ShipCountry + { + get + { + return _ShipCountry; + } + set + { + OnShipCountryChanging(value); + ReportPropertyChanging("ShipCountry"); + _ShipCountry = StructuralObject.SetValidValue(value, true); + ReportPropertyChanged("ShipCountry"); + OnShipCountryChanged(); + } + } + private global::System.String _ShipCountry; + partial void OnShipCountryChanging(global::System.String value); + partial void OnShipCountryChanged(); + + #endregion + + #region Navigation Properties + + /// + /// No Metadata Documentation available. + /// + [XmlIgnoreAttribute()] + [SoapIgnoreAttribute()] + [DataMemberAttribute()] + [EdmRelationshipNavigationPropertyAttribute("northwindEFModel", "FK_Orders_CustomerID_CustomerID", "Customers")] + public Customers Customers + { + get + { + return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference("northwindEFModel.FK_Orders_CustomerID_CustomerID", "Customers").Value; + } + set + { + ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference("northwindEFModel.FK_Orders_CustomerID_CustomerID", "Customers").Value = value; + } + } + /// + /// No Metadata Documentation available. + /// + [BrowsableAttribute(false)] + [DataMemberAttribute()] + public EntityReference CustomersReference + { + get + { + return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference("northwindEFModel.FK_Orders_CustomerID_CustomerID", "Customers"); + } + set + { + if ((value != null)) + { + ((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedReference("northwindEFModel.FK_Orders_CustomerID_CustomerID", "Customers", value); + } + } + } + + /// + /// No Metadata Documentation available. + /// + [XmlIgnoreAttribute()] + [SoapIgnoreAttribute()] + [DataMemberAttribute()] + [EdmRelationshipNavigationPropertyAttribute("northwindEFModel", "FK_InternationalOrders_OrderID_OrderID", "InternationalOrders")] + public InternationalOrders InternationalOrders + { + get + { + return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference("northwindEFModel.FK_InternationalOrders_OrderID_OrderID", "InternationalOrders").Value; + } + set + { + ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference("northwindEFModel.FK_InternationalOrders_OrderID_OrderID", "InternationalOrders").Value = value; + } + } + /// + /// No Metadata Documentation available. + /// + [BrowsableAttribute(false)] + [DataMemberAttribute()] + public EntityReference InternationalOrdersReference + { + get + { + return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference("northwindEFModel.FK_InternationalOrders_OrderID_OrderID", "InternationalOrders"); + } + set + { + if ((value != null)) + { + ((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedReference("northwindEFModel.FK_InternationalOrders_OrderID_OrderID", "InternationalOrders", value); + } + } + } + + /// + /// No Metadata Documentation available. + /// + [XmlIgnoreAttribute()] + [SoapIgnoreAttribute()] + [DataMemberAttribute()] + [EdmRelationshipNavigationPropertyAttribute("northwindEFModel", "FK_OrderDetails_OrderID_OrderID", "OrderDetails")] + public EntityCollection OrderDetails + { + get + { + return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedCollection("northwindEFModel.FK_OrderDetails_OrderID_OrderID", "OrderDetails"); + } + set + { + if ((value != null)) + { + ((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedCollection("northwindEFModel.FK_OrderDetails_OrderID_OrderID", "OrderDetails", value); + } + } + } + + #endregion + } + + /// + /// No Metadata Documentation available. + /// + [EdmEntityTypeAttribute(NamespaceName="northwindEFModel", Name="PreviousEmployees")] + [Serializable()] + [DataContractAttribute(IsReference=true)] + public partial class PreviousEmployees : EntityObject + { + #region Factory Method + + /// + /// Create a new PreviousEmployees object. + /// + /// Initial value of the EmployeeID property. + /// Initial value of the LastName property. + /// Initial value of the FirstName property. + public static PreviousEmployees CreatePreviousEmployees(global::System.Int64 employeeID, global::System.String lastName, global::System.String firstName) + { + PreviousEmployees previousEmployees = new PreviousEmployees(); + previousEmployees.EmployeeID = employeeID; + previousEmployees.LastName = lastName; + previousEmployees.FirstName = firstName; + return previousEmployees; + } + + #endregion + #region Primitive Properties + + /// + /// No Metadata Documentation available. + /// + [EdmScalarPropertyAttribute(EntityKeyProperty=true, IsNullable=false)] + [DataMemberAttribute()] + public global::System.Int64 EmployeeID + { + get + { + return _EmployeeID; + } + set + { + if (_EmployeeID != value) + { + OnEmployeeIDChanging(value); + ReportPropertyChanging("EmployeeID"); + _EmployeeID = StructuralObject.SetValidValue(value); + ReportPropertyChanged("EmployeeID"); + OnEmployeeIDChanged(); + } + } + } + private global::System.Int64 _EmployeeID; + partial void OnEmployeeIDChanging(global::System.Int64 value); + partial void OnEmployeeIDChanged(); + + /// + /// No Metadata Documentation available. + /// + [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)] + [DataMemberAttribute()] + public global::System.String LastName + { + get + { + return _LastName; + } + set + { + OnLastNameChanging(value); + ReportPropertyChanging("LastName"); + _LastName = StructuralObject.SetValidValue(value, false); + ReportPropertyChanged("LastName"); + OnLastNameChanged(); + } + } + private global::System.String _LastName; + partial void OnLastNameChanging(global::System.String value); + partial void OnLastNameChanged(); + + /// + /// No Metadata Documentation available. + /// + [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)] + [DataMemberAttribute()] + public global::System.String FirstName + { + get + { + return _FirstName; + } + set + { + OnFirstNameChanging(value); + ReportPropertyChanging("FirstName"); + _FirstName = StructuralObject.SetValidValue(value, false); + ReportPropertyChanged("FirstName"); + OnFirstNameChanged(); + } + } + private global::System.String _FirstName; + partial void OnFirstNameChanging(global::System.String value); + partial void OnFirstNameChanged(); + + /// + /// No Metadata Documentation available. + /// + [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)] + [DataMemberAttribute()] + public global::System.String Title + { + get + { + return _Title; + } + set + { + OnTitleChanging(value); + ReportPropertyChanging("Title"); + _Title = StructuralObject.SetValidValue(value, true); + ReportPropertyChanged("Title"); + OnTitleChanged(); + } + } + private global::System.String _Title; + partial void OnTitleChanging(global::System.String value); + partial void OnTitleChanged(); + + /// + /// No Metadata Documentation available. + /// + [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)] + [DataMemberAttribute()] + public global::System.String TitleOfCourtesy + { + get + { + return _TitleOfCourtesy; + } + set + { + OnTitleOfCourtesyChanging(value); + ReportPropertyChanging("TitleOfCourtesy"); + _TitleOfCourtesy = StructuralObject.SetValidValue(value, true); + ReportPropertyChanged("TitleOfCourtesy"); + OnTitleOfCourtesyChanged(); + } + } + private global::System.String _TitleOfCourtesy; + partial void OnTitleOfCourtesyChanging(global::System.String value); + partial void OnTitleOfCourtesyChanged(); + + /// + /// No Metadata Documentation available. + /// + [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)] + [DataMemberAttribute()] + public Nullable BirthDate + { + get + { + return _BirthDate; + } + set + { + OnBirthDateChanging(value); + ReportPropertyChanging("BirthDate"); + _BirthDate = StructuralObject.SetValidValue(value); + ReportPropertyChanged("BirthDate"); + OnBirthDateChanged(); + } + } + private Nullable _BirthDate; + partial void OnBirthDateChanging(Nullable value); + partial void OnBirthDateChanged(); + + /// + /// No Metadata Documentation available. + /// + [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)] + [DataMemberAttribute()] + public Nullable HireDate + { + get + { + return _HireDate; + } + set + { + OnHireDateChanging(value); + ReportPropertyChanging("HireDate"); + _HireDate = StructuralObject.SetValidValue(value); + ReportPropertyChanged("HireDate"); + OnHireDateChanged(); + } + } + private Nullable _HireDate; + partial void OnHireDateChanging(Nullable value); + partial void OnHireDateChanged(); + + /// + /// No Metadata Documentation available. + /// + [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)] + [DataMemberAttribute()] + public global::System.String Address + { + get + { + return _Address; + } + set + { + OnAddressChanging(value); + ReportPropertyChanging("Address"); + _Address = StructuralObject.SetValidValue(value, true); + ReportPropertyChanged("Address"); + OnAddressChanged(); + } + } + private global::System.String _Address; + partial void OnAddressChanging(global::System.String value); + partial void OnAddressChanged(); + + /// + /// No Metadata Documentation available. + /// + [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)] + [DataMemberAttribute()] + public global::System.String City + { + get + { + return _City; + } + set + { + OnCityChanging(value); + ReportPropertyChanging("City"); + _City = StructuralObject.SetValidValue(value, true); + ReportPropertyChanged("City"); + OnCityChanged(); + } + } + private global::System.String _City; + partial void OnCityChanging(global::System.String value); + partial void OnCityChanged(); + + /// + /// No Metadata Documentation available. + /// + [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)] + [DataMemberAttribute()] + public global::System.String Region + { + get + { + return _Region; + } + set + { + OnRegionChanging(value); + ReportPropertyChanging("Region"); + _Region = StructuralObject.SetValidValue(value, true); + ReportPropertyChanged("Region"); + OnRegionChanged(); + } + } + private global::System.String _Region; + partial void OnRegionChanging(global::System.String value); + partial void OnRegionChanged(); + + /// + /// No Metadata Documentation available. + /// + [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)] + [DataMemberAttribute()] + public global::System.String PostalCode + { + get + { + return _PostalCode; + } + set + { + OnPostalCodeChanging(value); + ReportPropertyChanging("PostalCode"); + _PostalCode = StructuralObject.SetValidValue(value, true); + ReportPropertyChanged("PostalCode"); + OnPostalCodeChanged(); + } + } + private global::System.String _PostalCode; + partial void OnPostalCodeChanging(global::System.String value); + partial void OnPostalCodeChanged(); + + /// + /// No Metadata Documentation available. + /// + [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)] + [DataMemberAttribute()] + public global::System.String Country + { + get + { + return _Country; + } + set + { + OnCountryChanging(value); + ReportPropertyChanging("Country"); + _Country = StructuralObject.SetValidValue(value, true); + ReportPropertyChanged("Country"); + OnCountryChanged(); + } + } + private global::System.String _Country; + partial void OnCountryChanging(global::System.String value); + partial void OnCountryChanged(); + + /// + /// No Metadata Documentation available. + /// + [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)] + [DataMemberAttribute()] + public global::System.String HomePhone + { + get + { + return _HomePhone; + } + set + { + OnHomePhoneChanging(value); + ReportPropertyChanging("HomePhone"); + _HomePhone = StructuralObject.SetValidValue(value, true); + ReportPropertyChanged("HomePhone"); + OnHomePhoneChanged(); + } + } + private global::System.String _HomePhone; + partial void OnHomePhoneChanging(global::System.String value); + partial void OnHomePhoneChanged(); + + /// + /// No Metadata Documentation available. + /// + [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)] + [DataMemberAttribute()] + public global::System.String Extension + { + get + { + return _Extension; + } + set + { + OnExtensionChanging(value); + ReportPropertyChanging("Extension"); + _Extension = StructuralObject.SetValidValue(value, true); + ReportPropertyChanged("Extension"); + OnExtensionChanged(); + } + } + private global::System.String _Extension; + partial void OnExtensionChanging(global::System.String value); + partial void OnExtensionChanged(); + + /// + /// No Metadata Documentation available. + /// + [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)] + [DataMemberAttribute()] + public global::System.Byte[] Photo + { + get + { + return StructuralObject.GetValidValue(_Photo); + } + set + { + OnPhotoChanging(value); + ReportPropertyChanging("Photo"); + _Photo = StructuralObject.SetValidValue(value, true); + ReportPropertyChanged("Photo"); + OnPhotoChanged(); + } + } + private global::System.Byte[] _Photo; + partial void OnPhotoChanging(global::System.Byte[] value); + partial void OnPhotoChanged(); + + /// + /// No Metadata Documentation available. + /// + [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)] + [DataMemberAttribute()] + public global::System.String Notes + { + get + { + return _Notes; + } + set + { + OnNotesChanging(value); + ReportPropertyChanging("Notes"); + _Notes = StructuralObject.SetValidValue(value, true); + ReportPropertyChanged("Notes"); + OnNotesChanged(); + } + } + private global::System.String _Notes; + partial void OnNotesChanging(global::System.String value); + partial void OnNotesChanged(); + + /// + /// No Metadata Documentation available. + /// + [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)] + [DataMemberAttribute()] + public global::System.String PhotoPath + { + get + { + return _PhotoPath; + } + set + { + OnPhotoPathChanging(value); + ReportPropertyChanging("PhotoPath"); + _PhotoPath = StructuralObject.SetValidValue(value, true); + ReportPropertyChanged("PhotoPath"); + OnPhotoPathChanged(); + } + } + private global::System.String _PhotoPath; + partial void OnPhotoPathChanging(global::System.String value); + partial void OnPhotoPathChanged(); + + #endregion + + } + + /// + /// No Metadata Documentation available. + /// + [EdmEntityTypeAttribute(NamespaceName="northwindEFModel", Name="Products")] + [Serializable()] + [DataContractAttribute(IsReference=true)] + public partial class Products : EntityObject + { + #region Factory Method + + /// + /// Create a new Products object. + /// + /// Initial value of the ProductID property. + /// Initial value of the ProductName property. + /// Initial value of the Discontinued property. + public static Products CreateProducts(global::System.Int64 productID, global::System.String productName, global::System.Boolean discontinued) + { + Products products = new Products(); + products.ProductID = productID; + products.ProductName = productName; + products.Discontinued = discontinued; + return products; + } + + #endregion + #region Primitive Properties + + /// + /// No Metadata Documentation available. + /// + [EdmScalarPropertyAttribute(EntityKeyProperty=true, IsNullable=false)] + [DataMemberAttribute()] + public global::System.Int64 ProductID + { + get + { + return _ProductID; + } + set + { + if (_ProductID != value) + { + OnProductIDChanging(value); + ReportPropertyChanging("ProductID"); + _ProductID = StructuralObject.SetValidValue(value); + ReportPropertyChanged("ProductID"); + OnProductIDChanged(); + } + } + } + private global::System.Int64 _ProductID; + partial void OnProductIDChanging(global::System.Int64 value); + partial void OnProductIDChanged(); + + /// + /// No Metadata Documentation available. + /// + [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)] + [DataMemberAttribute()] + public global::System.String ProductName + { + get + { + return _ProductName; + } + set + { + OnProductNameChanging(value); + ReportPropertyChanging("ProductName"); + _ProductName = StructuralObject.SetValidValue(value, false); + ReportPropertyChanged("ProductName"); + OnProductNameChanged(); + } + } + private global::System.String _ProductName; + partial void OnProductNameChanging(global::System.String value); + partial void OnProductNameChanged(); + + /// + /// No Metadata Documentation available. + /// + [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)] + [DataMemberAttribute()] + public global::System.String QuantityPerUnit + { + get + { + return _QuantityPerUnit; + } + set + { + OnQuantityPerUnitChanging(value); + ReportPropertyChanging("QuantityPerUnit"); + _QuantityPerUnit = StructuralObject.SetValidValue(value, true); + ReportPropertyChanged("QuantityPerUnit"); + OnQuantityPerUnitChanged(); + } + } + private global::System.String _QuantityPerUnit; + partial void OnQuantityPerUnitChanging(global::System.String value); + partial void OnQuantityPerUnitChanged(); + + /// + /// No Metadata Documentation available. + /// + [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)] + [DataMemberAttribute()] + public Nullable UnitPrice + { + get + { + return _UnitPrice; + } + set + { + OnUnitPriceChanging(value); + ReportPropertyChanging("UnitPrice"); + _UnitPrice = StructuralObject.SetValidValue(value); + ReportPropertyChanged("UnitPrice"); + OnUnitPriceChanged(); + } + } + private Nullable _UnitPrice; + partial void OnUnitPriceChanging(Nullable value); + partial void OnUnitPriceChanged(); + + /// + /// No Metadata Documentation available. + /// + [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)] + [DataMemberAttribute()] + public Nullable UnitsInStock + { + get + { + return _UnitsInStock; + } + set + { + OnUnitsInStockChanging(value); + ReportPropertyChanging("UnitsInStock"); + _UnitsInStock = StructuralObject.SetValidValue(value); + ReportPropertyChanged("UnitsInStock"); + OnUnitsInStockChanged(); + } + } + private Nullable _UnitsInStock; + partial void OnUnitsInStockChanging(Nullable value); + partial void OnUnitsInStockChanged(); + + /// + /// No Metadata Documentation available. + /// + [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)] + [DataMemberAttribute()] + public Nullable UnitsOnOrder + { + get + { + return _UnitsOnOrder; + } + set + { + OnUnitsOnOrderChanging(value); + ReportPropertyChanging("UnitsOnOrder"); + _UnitsOnOrder = StructuralObject.SetValidValue(value); + ReportPropertyChanged("UnitsOnOrder"); + OnUnitsOnOrderChanged(); + } + } + private Nullable _UnitsOnOrder; + partial void OnUnitsOnOrderChanging(Nullable value); + partial void OnUnitsOnOrderChanged(); + + /// + /// No Metadata Documentation available. + /// + [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)] + [DataMemberAttribute()] + public Nullable ReorderLevel + { + get + { + return _ReorderLevel; + } + set + { + OnReorderLevelChanging(value); + ReportPropertyChanging("ReorderLevel"); + _ReorderLevel = StructuralObject.SetValidValue(value); + ReportPropertyChanged("ReorderLevel"); + OnReorderLevelChanged(); + } + } + private Nullable _ReorderLevel; + partial void OnReorderLevelChanging(Nullable value); + partial void OnReorderLevelChanged(); + + /// + /// No Metadata Documentation available. + /// + [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)] + [DataMemberAttribute()] + public global::System.Boolean Discontinued + { + get + { + return _Discontinued; + } + set + { + OnDiscontinuedChanging(value); + ReportPropertyChanging("Discontinued"); + _Discontinued = StructuralObject.SetValidValue(value); + ReportPropertyChanged("Discontinued"); + OnDiscontinuedChanged(); + } + } + private global::System.Boolean _Discontinued; + partial void OnDiscontinuedChanging(global::System.Boolean value); + partial void OnDiscontinuedChanged(); + + /// + /// No Metadata Documentation available. + /// + [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)] + [DataMemberAttribute()] + public Nullable DiscontinuedDate + { + get + { + return _DiscontinuedDate; + } + set + { + OnDiscontinuedDateChanging(value); + ReportPropertyChanging("DiscontinuedDate"); + _DiscontinuedDate = StructuralObject.SetValidValue(value); + ReportPropertyChanged("DiscontinuedDate"); + OnDiscontinuedDateChanged(); + } + } + private Nullable _DiscontinuedDate; + partial void OnDiscontinuedDateChanging(Nullable value); + partial void OnDiscontinuedDateChanged(); + + #endregion + + #region Navigation Properties + + /// + /// No Metadata Documentation available. + /// + [XmlIgnoreAttribute()] + [SoapIgnoreAttribute()] + [DataMemberAttribute()] + [EdmRelationshipNavigationPropertyAttribute("northwindEFModel", "FK_Products_CategoryID_CategoryID", "Categories")] + public Categories Categories + { + get + { + return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference("northwindEFModel.FK_Products_CategoryID_CategoryID", "Categories").Value; + } + set + { + ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference("northwindEFModel.FK_Products_CategoryID_CategoryID", "Categories").Value = value; + } + } + /// + /// No Metadata Documentation available. + /// + [BrowsableAttribute(false)] + [DataMemberAttribute()] + public EntityReference CategoriesReference + { + get + { + return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference("northwindEFModel.FK_Products_CategoryID_CategoryID", "Categories"); + } + set + { + if ((value != null)) + { + ((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedReference("northwindEFModel.FK_Products_CategoryID_CategoryID", "Categories", value); + } + } + } + + /// + /// No Metadata Documentation available. + /// + [XmlIgnoreAttribute()] + [SoapIgnoreAttribute()] + [DataMemberAttribute()] + [EdmRelationshipNavigationPropertyAttribute("northwindEFModel", "FK_OrderDetails_ProductID_ProductID", "OrderDetails")] + public EntityCollection OrderDetails + { + get + { + return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedCollection("northwindEFModel.FK_OrderDetails_ProductID_ProductID", "OrderDetails"); + } + set + { + if ((value != null)) + { + ((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedCollection("northwindEFModel.FK_OrderDetails_ProductID_ProductID", "OrderDetails", value); + } + } + } + + /// + /// No Metadata Documentation available. + /// + [XmlIgnoreAttribute()] + [SoapIgnoreAttribute()] + [DataMemberAttribute()] + [EdmRelationshipNavigationPropertyAttribute("northwindEFModel", "FK_Products_SupplierID_SupplierID", "Suppliers")] + public Suppliers Suppliers + { + get + { + return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference("northwindEFModel.FK_Products_SupplierID_SupplierID", "Suppliers").Value; + } + set + { + ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference("northwindEFModel.FK_Products_SupplierID_SupplierID", "Suppliers").Value = value; + } + } + /// + /// No Metadata Documentation available. + /// + [BrowsableAttribute(false)] + [DataMemberAttribute()] + public EntityReference SuppliersReference + { + get + { + return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference("northwindEFModel.FK_Products_SupplierID_SupplierID", "Suppliers"); + } + set + { + if ((value != null)) + { + ((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedReference("northwindEFModel.FK_Products_SupplierID_SupplierID", "Suppliers", value); + } + } + } + + #endregion + } + + /// + /// No Metadata Documentation available. + /// + [EdmEntityTypeAttribute(NamespaceName="northwindEFModel", Name="Regions")] + [Serializable()] + [DataContractAttribute(IsReference=true)] + public partial class Regions : EntityObject + { + #region Factory Method + + /// + /// Create a new Regions object. + /// + /// Initial value of the RegionID property. + /// Initial value of the RegionDescription property. + public static Regions CreateRegions(global::System.Int64 regionID, global::System.String regionDescription) + { + Regions regions = new Regions(); + regions.RegionID = regionID; + regions.RegionDescription = regionDescription; + return regions; + } + + #endregion + #region Primitive Properties + + /// + /// No Metadata Documentation available. + /// + [EdmScalarPropertyAttribute(EntityKeyProperty=true, IsNullable=false)] + [DataMemberAttribute()] + public global::System.Int64 RegionID + { + get + { + return _RegionID; + } + set + { + if (_RegionID != value) + { + OnRegionIDChanging(value); + ReportPropertyChanging("RegionID"); + _RegionID = StructuralObject.SetValidValue(value); + ReportPropertyChanged("RegionID"); + OnRegionIDChanged(); + } + } + } + private global::System.Int64 _RegionID; + partial void OnRegionIDChanging(global::System.Int64 value); + partial void OnRegionIDChanged(); + + /// + /// No Metadata Documentation available. + /// + [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)] + [DataMemberAttribute()] + public global::System.String RegionDescription + { + get + { + return _RegionDescription; + } + set + { + OnRegionDescriptionChanging(value); + ReportPropertyChanging("RegionDescription"); + _RegionDescription = StructuralObject.SetValidValue(value, false); + ReportPropertyChanged("RegionDescription"); + OnRegionDescriptionChanged(); + } + } + private global::System.String _RegionDescription; + partial void OnRegionDescriptionChanging(global::System.String value); + partial void OnRegionDescriptionChanged(); + + #endregion + + #region Navigation Properties + + /// + /// No Metadata Documentation available. + /// + [XmlIgnoreAttribute()] + [SoapIgnoreAttribute()] + [DataMemberAttribute()] + [EdmRelationshipNavigationPropertyAttribute("northwindEFModel", "FK_Territories_RegionID_RegionID", "Territories")] + public EntityCollection Territories + { + get + { + return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedCollection("northwindEFModel.FK_Territories_RegionID_RegionID", "Territories"); + } + set + { + if ((value != null)) + { + ((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedCollection("northwindEFModel.FK_Territories_RegionID_RegionID", "Territories", value); + } + } + } + + #endregion + } + + /// + /// No Metadata Documentation available. + /// + [EdmEntityTypeAttribute(NamespaceName="northwindEFModel", Name="Suppliers")] + [Serializable()] + [DataContractAttribute(IsReference=true)] + public partial class Suppliers : EntityObject + { + #region Factory Method + + /// + /// Create a new Suppliers object. + /// + /// Initial value of the SupplierID property. + /// Initial value of the CompanyName property. + public static Suppliers CreateSuppliers(global::System.Int64 supplierID, global::System.String companyName) + { + Suppliers suppliers = new Suppliers(); + suppliers.SupplierID = supplierID; + suppliers.CompanyName = companyName; + return suppliers; + } + + #endregion + #region Primitive Properties + + /// + /// No Metadata Documentation available. + /// + [EdmScalarPropertyAttribute(EntityKeyProperty=true, IsNullable=false)] + [DataMemberAttribute()] + public global::System.Int64 SupplierID + { + get + { + return _SupplierID; + } + set + { + if (_SupplierID != value) + { + OnSupplierIDChanging(value); + ReportPropertyChanging("SupplierID"); + _SupplierID = StructuralObject.SetValidValue(value); + ReportPropertyChanged("SupplierID"); + OnSupplierIDChanged(); + } + } + } + private global::System.Int64 _SupplierID; + partial void OnSupplierIDChanging(global::System.Int64 value); + partial void OnSupplierIDChanged(); + + /// + /// No Metadata Documentation available. + /// + [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)] + [DataMemberAttribute()] + public global::System.String CompanyName + { + get + { + return _CompanyName; + } + set + { + OnCompanyNameChanging(value); + ReportPropertyChanging("CompanyName"); + _CompanyName = StructuralObject.SetValidValue(value, false); + ReportPropertyChanged("CompanyName"); + OnCompanyNameChanged(); + } + } + private global::System.String _CompanyName; + partial void OnCompanyNameChanging(global::System.String value); + partial void OnCompanyNameChanged(); + + /// + /// No Metadata Documentation available. + /// + [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)] + [DataMemberAttribute()] + public global::System.String ContactName + { + get + { + return _ContactName; + } + set + { + OnContactNameChanging(value); + ReportPropertyChanging("ContactName"); + _ContactName = StructuralObject.SetValidValue(value, true); + ReportPropertyChanged("ContactName"); + OnContactNameChanged(); + } + } + private global::System.String _ContactName; + partial void OnContactNameChanging(global::System.String value); + partial void OnContactNameChanged(); + + /// + /// No Metadata Documentation available. + /// + [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)] + [DataMemberAttribute()] + public global::System.String ContactTitle + { + get + { + return _ContactTitle; + } + set + { + OnContactTitleChanging(value); + ReportPropertyChanging("ContactTitle"); + _ContactTitle = StructuralObject.SetValidValue(value, true); + ReportPropertyChanged("ContactTitle"); + OnContactTitleChanged(); + } + } + private global::System.String _ContactTitle; + partial void OnContactTitleChanging(global::System.String value); + partial void OnContactTitleChanged(); + + /// + /// No Metadata Documentation available. + /// + [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)] + [DataMemberAttribute()] + public global::System.String Address + { + get + { + return _Address; + } + set + { + OnAddressChanging(value); + ReportPropertyChanging("Address"); + _Address = StructuralObject.SetValidValue(value, true); + ReportPropertyChanged("Address"); + OnAddressChanged(); + } + } + private global::System.String _Address; + partial void OnAddressChanging(global::System.String value); + partial void OnAddressChanged(); + + /// + /// No Metadata Documentation available. + /// + [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)] + [DataMemberAttribute()] + public global::System.String City + { + get + { + return _City; + } + set + { + OnCityChanging(value); + ReportPropertyChanging("City"); + _City = StructuralObject.SetValidValue(value, true); + ReportPropertyChanged("City"); + OnCityChanged(); + } + } + private global::System.String _City; + partial void OnCityChanging(global::System.String value); + partial void OnCityChanged(); + + /// + /// No Metadata Documentation available. + /// + [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)] + [DataMemberAttribute()] + public global::System.String Region + { + get + { + return _Region; + } + set + { + OnRegionChanging(value); + ReportPropertyChanging("Region"); + _Region = StructuralObject.SetValidValue(value, true); + ReportPropertyChanged("Region"); + OnRegionChanged(); + } + } + private global::System.String _Region; + partial void OnRegionChanging(global::System.String value); + partial void OnRegionChanged(); + + /// + /// No Metadata Documentation available. + /// + [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)] + [DataMemberAttribute()] + public global::System.String PostalCode + { + get + { + return _PostalCode; + } + set + { + OnPostalCodeChanging(value); + ReportPropertyChanging("PostalCode"); + _PostalCode = StructuralObject.SetValidValue(value, true); + ReportPropertyChanged("PostalCode"); + OnPostalCodeChanged(); + } + } + private global::System.String _PostalCode; + partial void OnPostalCodeChanging(global::System.String value); + partial void OnPostalCodeChanged(); + + /// + /// No Metadata Documentation available. + /// + [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)] + [DataMemberAttribute()] + public global::System.String Country + { + get + { + return _Country; + } + set + { + OnCountryChanging(value); + ReportPropertyChanging("Country"); + _Country = StructuralObject.SetValidValue(value, true); + ReportPropertyChanged("Country"); + OnCountryChanged(); + } + } + private global::System.String _Country; + partial void OnCountryChanging(global::System.String value); + partial void OnCountryChanged(); + + /// + /// No Metadata Documentation available. + /// + [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)] + [DataMemberAttribute()] + public global::System.String Phone + { + get + { + return _Phone; + } + set + { + OnPhoneChanging(value); + ReportPropertyChanging("Phone"); + _Phone = StructuralObject.SetValidValue(value, true); + ReportPropertyChanged("Phone"); + OnPhoneChanged(); + } + } + private global::System.String _Phone; + partial void OnPhoneChanging(global::System.String value); + partial void OnPhoneChanged(); + + /// + /// No Metadata Documentation available. + /// + [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)] + [DataMemberAttribute()] + public global::System.String Fax + { + get + { + return _Fax; + } + set + { + OnFaxChanging(value); + ReportPropertyChanging("Fax"); + _Fax = StructuralObject.SetValidValue(value, true); + ReportPropertyChanged("Fax"); + OnFaxChanged(); + } + } + private global::System.String _Fax; + partial void OnFaxChanging(global::System.String value); + partial void OnFaxChanged(); + + /// + /// No Metadata Documentation available. + /// + [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)] + [DataMemberAttribute()] + public global::System.String HomePage + { + get + { + return _HomePage; + } + set + { + OnHomePageChanging(value); + ReportPropertyChanging("HomePage"); + _HomePage = StructuralObject.SetValidValue(value, true); + ReportPropertyChanged("HomePage"); + OnHomePageChanged(); + } + } + private global::System.String _HomePage; + partial void OnHomePageChanging(global::System.String value); + partial void OnHomePageChanged(); + + #endregion + + #region Navigation Properties + + /// + /// No Metadata Documentation available. + /// + [XmlIgnoreAttribute()] + [SoapIgnoreAttribute()] + [DataMemberAttribute()] + [EdmRelationshipNavigationPropertyAttribute("northwindEFModel", "FK_Products_SupplierID_SupplierID", "Products")] + public EntityCollection Products + { + get + { + return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedCollection("northwindEFModel.FK_Products_SupplierID_SupplierID", "Products"); + } + set + { + if ((value != null)) + { + ((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedCollection("northwindEFModel.FK_Products_SupplierID_SupplierID", "Products", value); + } + } + } + + #endregion + } + + /// + /// No Metadata Documentation available. + /// + [EdmEntityTypeAttribute(NamespaceName="northwindEFModel", Name="Territories")] + [Serializable()] + [DataContractAttribute(IsReference=true)] + public partial class Territories : EntityObject + { + #region Factory Method + + /// + /// Create a new Territories object. + /// + /// Initial value of the TerritoryID property. + /// Initial value of the TerritoryDescription property. + public static Territories CreateTerritories(global::System.Int64 territoryID, global::System.String territoryDescription) + { + Territories territories = new Territories(); + territories.TerritoryID = territoryID; + territories.TerritoryDescription = territoryDescription; + return territories; + } + + #endregion + #region Primitive Properties + + /// + /// No Metadata Documentation available. + /// + [EdmScalarPropertyAttribute(EntityKeyProperty=true, IsNullable=false)] + [DataMemberAttribute()] + public global::System.Int64 TerritoryID + { + get + { + return _TerritoryID; + } + set + { + if (_TerritoryID != value) + { + OnTerritoryIDChanging(value); + ReportPropertyChanging("TerritoryID"); + _TerritoryID = StructuralObject.SetValidValue(value); + ReportPropertyChanged("TerritoryID"); + OnTerritoryIDChanged(); + } + } + } + private global::System.Int64 _TerritoryID; + partial void OnTerritoryIDChanging(global::System.Int64 value); + partial void OnTerritoryIDChanged(); + + /// + /// No Metadata Documentation available. + /// + [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)] + [DataMemberAttribute()] + public global::System.String TerritoryDescription + { + get + { + return _TerritoryDescription; + } + set + { + OnTerritoryDescriptionChanging(value); + ReportPropertyChanging("TerritoryDescription"); + _TerritoryDescription = StructuralObject.SetValidValue(value, false); + ReportPropertyChanged("TerritoryDescription"); + OnTerritoryDescriptionChanged(); + } + } + private global::System.String _TerritoryDescription; + partial void OnTerritoryDescriptionChanging(global::System.String value); + partial void OnTerritoryDescriptionChanged(); + + #endregion + + #region Navigation Properties + + /// + /// No Metadata Documentation available. + /// + [XmlIgnoreAttribute()] + [SoapIgnoreAttribute()] + [DataMemberAttribute()] + [EdmRelationshipNavigationPropertyAttribute("northwindEFModel", "FK_Territories_RegionID_RegionID", "Regions")] + public Regions Regions + { + get + { + return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference("northwindEFModel.FK_Territories_RegionID_RegionID", "Regions").Value; + } + set + { + ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference("northwindEFModel.FK_Territories_RegionID_RegionID", "Regions").Value = value; + } + } + /// + /// No Metadata Documentation available. + /// + [BrowsableAttribute(false)] + [DataMemberAttribute()] + public EntityReference RegionsReference + { + get + { + return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference("northwindEFModel.FK_Territories_RegionID_RegionID", "Regions"); + } + set + { + if ((value != null)) + { + ((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedReference("northwindEFModel.FK_Territories_RegionID_RegionID", "Regions", value); + } + } + } + + /// + /// No Metadata Documentation available. + /// + [XmlIgnoreAttribute()] + [SoapIgnoreAttribute()] + [DataMemberAttribute()] + [EdmRelationshipNavigationPropertyAttribute("northwindEFModel", "EmployeesTerritories", "Employees")] + public EntityCollection Employees + { + get + { + return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedCollection("northwindEFModel.EmployeesTerritories", "Employees"); + } + set + { + if ((value != null)) + { + ((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedCollection("northwindEFModel.EmployeesTerritories", "Employees", value); + } + } + } + + #endregion + } + + #endregion + +} Index: testlinq/NorthwindModel.edmx ================================================================== --- testlinq/NorthwindModel.edmx +++ testlinq/NorthwindModel.edmx @@ -1,899 +1,899 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Index: testlinq/northwindEF.db ================================================================== --- testlinq/northwindEF.db +++ testlinq/northwindEF.db cannot compute difference between binary files Index: testlinq/testlinq.csproj ================================================================== --- testlinq/testlinq.csproj +++ testlinq/testlinq.csproj @@ -1,88 +1,127 @@ - - - - Debug - AnyCPU - 9.0.30729 - 2.0 - {9D3CF7A6-092A-4B05-B0E4-BEF6944525B3} - Exe - Properties - testlinq - testlinq - v3.5 - 512 - - - true - full - false - bin\ - DEBUG;TRACE - prompt - 4 - x86 - false - - - pdbonly - true - bin\ - TRACE - prompt - 4 - false - - - - - 3.5 - - - 3.5 - - - 3.0 - - - - - 3.5 - - - 3.5 - - - - - - - True - True - NorthwindModel.edmx - - - - - - - - Always - - - EntityModelCodeGenerator - NorthwindModel.Designer.cs - - - - - - - + + + + Debug + AnyCPU + 9.0.30729 + 2.0 + {9D3CF7A6-092A-4B05-B0E4-BEF6944525B3} + Exe + Properties + testlinq + testlinq + v4.0 + 512 + + + 3.5 + + publish\ + true + Disk + false + Foreground + 7 + Days + false + false + true + 0 + 1.0.0.%2a + false + false + true + Client + + + true + full + false + bin\ + DEBUG;TRACE + prompt + 4 + x86 + false + AllRules.ruleset + + + pdbonly + true + bin\ + TRACE + prompt + 4 + false + AllRules.ruleset + + + + + 3.5 + + + 3.5 + + + 3.0 + + + + + 3.5 + + + 3.5 + + + + + + + True + True + NorthwindModel.edmx + + + + + + + + Always + + + EntityModelCodeGenerator + NorthwindModel.Designer.cs + + + + + + + + False + .NET Framework 3.5 SP1 Client Profile + false + + + False + .NET Framework 3.5 SP1 + true + + + False + Windows Installer 3.1 + true + + + + Index: testlinq/testlinq.csproj.user ================================================================== --- testlinq/testlinq.csproj.user +++ testlinq/testlinq.csproj.user @@ -1,10 +1,13 @@ - - - false - - - - - true - + + + + + + + + + + en-US + false + Index: tools/install/InstallDesigner.cs ================================================================== --- tools/install/InstallDesigner.cs +++ tools/install/InstallDesigner.cs @@ -1,1031 +1,1031 @@ -/******************************************************** - * ADO.NET 2.0 Data Provider for SQLite Version 3.X - * Written by Robert Simpson (robert@blackcastlesoft.com) - * - * Released to the public domain, use at your own risk! - ********************************************************/ - -namespace install -{ - using System; - using System.ComponentModel; - using System.Data; - using System.Drawing; - using System.Text; - using System.Windows.Forms; - using Microsoft.Win32; - using System.IO; - using System.GACManagedAccess; - using System.Xml; - using System.Diagnostics; - using System.Collections.Generic; - - public partial class InstallDesigner : Form - { - private static Guid standardDataProviderGuid = new Guid("{0EBAAB6E-CA80-4b4a-8DDF-CBE6BF058C70}"); - private static Guid standardDataSourcesGuid = new Guid("{0EBAAB6E-CA80-4b4a-8DDF-CBE6BF058C71}"); - private static Guid standardCFDataSourcesGuid = new Guid("{0EBAAB6E-CA80-4b4a-8DDF-CBE6BF058C72}"); - private static Guid oledbDataProviderGuid = new Guid("{7F041D59-D76A-44ed-9AA2-FBF6B0548B80}"); - private static Guid oledbAltDataProviderGuid = new Guid("{7F041D59-D76A-44ed-9AA2-FBF6B0548B81}"); - private static Guid jetDataSourcesGuid = new Guid("{466CE797-67A4-4495-B75C-A3FD282E7FC3}"); - private static Guid jetAltDataSourcesGuid = new Guid("{466CE797-67A4-4495-B75C-A3FD282E7FC4}"); - private static string[] compactFrameworks = new string[] { "PocketPC", "SmartPhone", "WindowsCE" }; - - internal bool _remove = false; - //private string _regRoot = "8.0"; - private System.Reflection.Assembly _assm = null; - private bool _ignoreChecks = true; - private string _assmLocation; - - private Dictionary _regRoots = new Dictionary(); - private List _frameworks = new List(); - - string SQLiteLocation - { - get - { - System.Reflection.Assembly assm = SQLite; - return _assmLocation; - } - } - - System.Reflection.Assembly SQLite - { - get - { - if (_assm == null) - { - Environment.CurrentDirectory = Path.GetDirectoryName(typeof(InstallDesigner).Assembly.Location); - - try - { - _assmLocation = Path.GetFullPath("..\\System.Data.SQLite.DLL"); - _assm = System.Reflection.Assembly.LoadFrom(_assmLocation); - } - catch - { - } - } - - OpenFileDialog dlg = new OpenFileDialog(); - while (_assm == null) - { - dlg.Multiselect = false; - dlg.InitialDirectory = Environment.CurrentDirectory; - dlg.FileName = "System.Data.SQLite.DLL"; - dlg.Filter = "System.Data.SQLite.DLL|System.Data.SQLite.DLL"; - if (dlg.ShowDialog() == DialogResult.OK) - { - try - { - _assmLocation = dlg.FileName; - _assm = System.Reflection.Assembly.LoadFrom(dlg.FileName); - } - catch - { - } - } - else - throw new ArgumentException("Unable to find or load System.Data.SQLite.DLL"); - } - return _assm; - } - - set - { - _assm = value; - } - } - - public InstallDesigner() - { - string[] args = Environment.GetCommandLineArgs(); - RegistryKey key; - string frameworkpath; - - _regRoots.Add("8.0", "2005"); - _regRoots.Add("9.0", "2008"); - _regRoots.Add("10.0", "2010"); - - using (key = Registry.LocalMachine.OpenSubKey("Software\\Microsoft\\.NETFramework")) - { - frameworkpath = key.GetValue("InstallRoot") as string; - } - - string[] frameworkfolders = Directory.GetDirectories(frameworkpath); - foreach (string framework in frameworkfolders) - { - // Don't do this on frameworks before 2.0 - string version = Path.GetFileNameWithoutExtension(framework); - if (String.Compare(version, "v2.0", StringComparison.OrdinalIgnoreCase) < 0) - continue; - - if (File.Exists(Path.Combine(framework, "CONFIG\\machine.config"))) - _frameworks.Add(Path.GetFileName(framework)); - } - - for (int n = 0; n < args.Length; n++) - { - if (String.Compare(args[n], "/regroot", true) == 0 || - String.Compare(args[n], "-regroot", true) == 0) - { - _regRoots.Add(args[n + 1], args[n + 1]); - break; - } - else if (String.Compare(args[n], "/remove", true) == 0 || - String.Compare(args[n], "-remove", true) == 0) - { - _remove = true; - } - } - - InitializeComponent(); - - foreach (KeyValuePair pair in _regRoots) - { - using (key = Registry.LocalMachine.OpenSubKey("Software\\Microsoft")) - { - AddItem(key, pair.Key, "VisualStudio", String.Format("Visual Studio {0} (full editions)", pair.Value), standardDataProviderGuid, null); - AddItem(key, pair.Key, "VWDExpress", String.Format("Visual Web Developer Express {0} Edition", pair.Value), standardDataProviderGuid, null); - - warningPanel.Visible = (AddItem(key, pair.Key, "VCSExpress", String.Format("Visual C# Express {0} Edition *", pair.Value), oledbDataProviderGuid, oledbAltDataProviderGuid) - | AddItem(key, pair.Key, "VCExpress", String.Format("Visual C++ Express {0} Edition *", pair.Value), oledbDataProviderGuid, oledbAltDataProviderGuid) - | AddItem(key, pair.Key, "VBExpress", String.Format("Visual Basic Express {0} Edition *", pair.Value), oledbDataProviderGuid, oledbAltDataProviderGuid) - | AddItem(key, pair.Key, "VJSExpress", String.Format("Visual J# Express {0} Edition *", pair.Value), oledbDataProviderGuid, oledbAltDataProviderGuid)); - } - GlobalAddRemove(pair.Key); - } - - _ignoreChecks = false; - } - - private bool AddItem(RegistryKey parent, string version, string subkeyname, string itemName, Guid lookFor, object isChecked) - { - RegistryKey subkey; - - try - { - using (subkey = parent.OpenSubKey(String.Format("{0}\\{1}", subkeyname, version))) - { - ListViewItem item = new ListViewItem(itemName); - - item.Tag = new string[] { subkeyname, version }; - - // Verify this edition has been installed and its not a fluke that the key exists - string dir = (string)subkey.GetValue("InstallDir"); - - using (RegistryKey subsubkey = subkey.OpenSubKey("Packages")) - { - if (subsubkey == null) - throw new ArgumentException("Edition not installed"); - if (subsubkey.SubKeyCount < 5) - throw new ArgumentException("Edition not installed"); - } - - using (RegistryKey subsubkey = subkey.OpenSubKey("DataProviders")) - { - if (subsubkey == null) - throw new ArgumentException("Edition not installed"); - } - - using (RegistryKey subsubkey = subkey.OpenSubKey(String.Format("DataProviders\\{0}", (isChecked == null) ? lookFor.ToString("B") : ((Guid)isChecked).ToString("B")))) - { - if (subsubkey == null) - { - DoInstallUninstall(item); - } - else - { - bool itemChecked = (subsubkey.GetValue(null) != null); - DoInstallUninstall(item); - if (_remove == false) item.Checked = itemChecked; - } - } - - installList.Items.Add(item); - if (item.Checked) - { - DoInstallUninstall(item); - } - return true; - } - } - catch - { - return false; - } - } - - private void closeButton_Click(object sender, EventArgs e) - { - this.Close(); - } - - private void installList_ItemChecked(object sender, ItemCheckedEventArgs e) - { - if (_ignoreChecks) return; - - string[] arr = (string[])e.Item.Tag; - - DoInstallUninstall(e.Item); - - GlobalAddRemove(arr[1]); - } - - private void DoInstallUninstall(ListViewItem Item) - { - string[] arr = (string[])Item.Tag; - if (Item.Checked == false) - { - if (Item.Text.IndexOf('*') > -1) - RestoreJet(arr[0], arr[1]); - else - Uninstall(arr[0], arr[1], standardDataProviderGuid, standardDataSourcesGuid); - } - else - { - if (Item.Text.IndexOf('*') > -1) - ReplaceJet(arr[0], arr[1]); - else - Install(arr[0], arr[1], standardDataProviderGuid, standardDataSourcesGuid); - } - } - - private void GlobalAddRemove(string version) - { - bool install = false; -// bool installed; - - //// Check to see if SQLite is installed in the GAC - //try - //{ - // string file = AssemblyCache.QueryAssemblyInfo("System.Data.SQLite"); - // installed = true; - //} - //catch - //{ - // installed = false; - //} - - // Check to see if any checkboxes in the list are checked - for (int n = 0; n < installList.Items.Count; n++) - { - if (installList.Items[n].Checked == true) - { - install = true; - break; - } - } - - // If at least 1 item is checked, then install some global settings - if (install) - { - string path = Path.GetDirectoryName(SQLiteLocation); - - foreach (string framework in _frameworks) - { - using (RegistryKey key = Registry.LocalMachine.CreateSubKey(String.Format("Software\\Microsoft\\.NETFramework\\{0}\\AssemblyFoldersEx\\SQLite", framework), RegistryKeyPermissionCheck.ReadWriteSubTree)) - { - key.SetValue(null, path); - } - } - - while (String.IsNullOrEmpty(path) == false) - { - if (File.Exists(path + "\\CompactFramework\\System.Data.SQLite.DLL") == false) - { - path = Path.GetDirectoryName(path); - } - else break; - } - - if (String.IsNullOrEmpty(path) == false) - { - path += "\\CompactFramework\\"; - - for (int n = 0; n < compactFrameworks.Length; n++) - { - using (RegistryKey key = Registry.LocalMachine.OpenSubKey(String.Format("Software\\Microsoft\\.NETCompactFramework\\v2.0.0.0\\{0}\\AssemblyFoldersEx", compactFrameworks[n]), true)) - { - - if (key != null) - { - using (RegistryKey subkey = key.CreateSubKey("SQLite", RegistryKeyPermissionCheck.ReadWriteSubTree)) - { - subkey.SetValue(null, path); - } - } - } - } - - for (int n = 0; n < compactFrameworks.Length; n++) - { - using (RegistryKey key = Registry.LocalMachine.OpenSubKey(String.Format("Software\\Microsoft\\.NETCompactFramework\\v3.5.0.0\\{0}\\AssemblyFoldersEx", compactFrameworks[n]), true)) - { - - if (key != null) - { - using (RegistryKey subkey = key.CreateSubKey("SQLite", RegistryKeyPermissionCheck.ReadWriteSubTree)) - { - subkey.SetValue(null, path); - } - } - } - } - } - - for (int n = 0; n < 2; n++) - { - foreach (string framework in _frameworks) - { - // Add factory support to the machine.config file. - try - { - string xmlFileName = Environment.ExpandEnvironmentVariables(String.Format("%WinDir%\\Microsoft.NET\\{0}\\{1}\\CONFIG\\machine.config", (n == 0) ? "Framework" : "Framework64", framework)); - XmlDocument xmlDoc = new XmlDocument(); - xmlDoc.PreserveWhitespace = true; - xmlDoc.Load(xmlFileName); - - - XmlNode xmlNode = xmlDoc.SelectSingleNode("configuration/system.data/DbProviderFactories/add[@invariant=\"System.Data.SQLite\"]"); - if (xmlNode == null) - { - XmlNode xmlConfig = xmlDoc.SelectSingleNode("configuration"); - if (xmlConfig != null) - { - XmlNode xmlData = xmlConfig.SelectSingleNode("system.data"); - if (xmlData == null) - { - xmlData = xmlDoc.CreateNode(XmlNodeType.Element, "system.data", ""); - xmlConfig.AppendChild(xmlData); - } - XmlNode xmlParent = xmlData.SelectSingleNode("DbProviderFactories"); - if (xmlParent == null) - { - xmlParent = xmlDoc.CreateNode(XmlNodeType.Element, "DbProviderFactories", ""); - xmlData.AppendChild(xmlParent); - } - - //xmlNode = xmlDoc.CreateNode(XmlNodeType.Element, "remove", ""); - //xmlNode.Attributes.SetNamedItem(xmlDoc.CreateAttribute("invariant")); - //xmlParent.AppendChild(xmlNode); - //xmlNode.Attributes.GetNamedItem("invariant").Value = "System.Data.SQLite"; - - xmlNode = xmlDoc.CreateNode(XmlNodeType.Element, "add", ""); - xmlNode.Attributes.SetNamedItem(xmlDoc.CreateAttribute("name")); - xmlNode.Attributes.SetNamedItem(xmlDoc.CreateAttribute("invariant")); - xmlNode.Attributes.SetNamedItem(xmlDoc.CreateAttribute("description")); - xmlNode.Attributes.SetNamedItem(xmlDoc.CreateAttribute("type")); - xmlParent.AppendChild(xmlNode); - } - } - xmlNode.Attributes.GetNamedItem("name").Value = "SQLite Data Provider"; - xmlNode.Attributes.GetNamedItem("invariant").Value = "System.Data.SQLite"; - xmlNode.Attributes.GetNamedItem("description").Value = ".Net Framework Data Provider for SQLite"; - xmlNode.Attributes.GetNamedItem("type").Value = "System.Data.SQLite.SQLiteFactory, " + SQLite.GetName().FullName; - - xmlDoc.Save(xmlFileName); - } - catch - { - } - } - } - } - else // No checkboxes are checked, remove some global settings - { - try - { - foreach (string framework in _frameworks) - { - Registry.LocalMachine.DeleteSubKey(String.Format("Software\\Microsoft\\.NETFramework\\{0}\\AssemblyFoldersEx\\SQLite", framework)); - } - - string[] versions = { "v2.0.0.0", "v3.5.0.0" }; - for (int x = 0; x < versions.Length; x++) - { - for (int n = 0; n < compactFrameworks.Length; n++) - { - using (RegistryKey key = Registry.LocalMachine.OpenSubKey(String.Format("Software\\Microsoft\\.NETCompactFramework\\{1}\\{0}\\DataProviders", compactFrameworks[n], versions[x]), true)) - { - try - { - if (key != null) key.DeleteSubKey(standardDataProviderGuid.ToString("B")); - } - catch - { - } - } - } - } - - for (int n = 0; n < compactFrameworks.Length; n++) - { - using (RegistryKey key = Registry.LocalMachine.OpenSubKey(String.Format("Software\\Microsoft\\.NETCompactFramework\\v2.0.0.0\\{0}\\AssemblyFoldersEx", compactFrameworks[n]), true)) - { - try - { - if (key != null) key.DeleteSubKey("SQLite"); - } - catch - { - } - } - } - - for (int n = 0; n < 2; n++) - { - try - { - foreach (string framework in _frameworks) - { - // Remove any entries in the machine.config if they're still there - string xmlFileName = Environment.ExpandEnvironmentVariables(String.Format("%WinDir%\\Microsoft.NET\\{0}\\{1}\\CONFIG\\machine.config", (n == 0) ? "Framework" : "Framework64", framework)); - XmlDocument xmlDoc = new XmlDocument(); - xmlDoc.PreserveWhitespace = true; - xmlDoc.Load(xmlFileName); - - XmlNode xmlNode = xmlDoc.SelectSingleNode("configuration/system.data/DbProviderFactories/add[@invariant=\"System.Data.SQLite\"]"); - - if (xmlNode != null) - xmlNode.ParentNode.RemoveChild(xmlNode); - - xmlNode = xmlDoc.SelectSingleNode("configuration/system.data/DbProviderFactories/remove[@invariant=\"System.Data.SQLite\"]"); - if (xmlNode != null) - xmlNode.ParentNode.RemoveChild(xmlNode); - - xmlDoc.Save(xmlFileName); - } - } - catch - { - } - } - } - catch - { - } - } - - try - { - if (!install) // Remove SQLite from the GAC if its there - { - AssemblyCacheUninstallDisposition disp; - - string s; - AssemblyCacheEnum entries = new AssemblyCacheEnum("System.Data.SQLite"); - while (true) - { - s = entries.GetNextAssembly(); - if (String.IsNullOrEmpty(s)) break; - - AssemblyCache.UninstallAssembly(s, null, out disp); - } - - entries = new AssemblyCacheEnum("SQLite.Designer"); - while (true) - { - s = entries.GetNextAssembly(); - if (String.IsNullOrEmpty(s)) break; - - AssemblyCache.UninstallAssembly(s, null, out disp); - } - - entries = new AssemblyCacheEnum("System.Data.SQLite.Linq"); - while (true) - { - s = entries.GetNextAssembly(); - if (String.IsNullOrEmpty(s)) break; - - AssemblyCache.UninstallAssembly(s, null, out disp); - } - - SQLite = null; - } - else // Install SQLite into the GAC - { - byte[] cfdt = Properties.Resources.System_Data_SQLite; - string tempPath = Path.GetTempPath(); - tempPath = Path.Combine(tempPath, "System.Data.SQLite.DLL"); - using (FileStream fs = File.Open(tempPath, FileMode.Create, FileAccess.Write, FileShare.None)) - { - fs.Write(cfdt, 0, cfdt.Length); - } - - try - { - AssemblyCache.InstallAssembly(tempPath, null, AssemblyCommitFlags.Default); - AssemblyCache.InstallAssembly(Path.Combine(Path.GetDirectoryName(SQLiteLocation), "x64\\System.Data.SQLite.DLL"), null, AssemblyCommitFlags.Default); - AssemblyCache.InstallAssembly(Path.Combine(Path.GetDirectoryName(SQLiteLocation), "itanium\\System.Data.SQLite.DLL"), null, AssemblyCommitFlags.Default); - } - catch - { - } - finally - { - File.Delete(tempPath); - if (File.Exists(Path.GetFullPath("..\\System.Data.SQLite.Linq.DLL")) == true) - AssemblyCache.InstallAssembly(Path.GetFullPath("..\\System.Data.SQLite.Linq.DLL"), null, AssemblyCommitFlags.Default); - - AssemblyCache.InstallAssembly(Path.GetFullPath("SQLite.Designer.DLL"), null, AssemblyCommitFlags.Default); - AssemblyCache.InstallAssembly(SQLiteLocation, null, AssemblyCommitFlags.Default); - } - } - } - catch - { - throw; - } - - FixXmlLibPaths(install, version); - } - - private void ReplaceJet(string keyname, string version) - { - using (RegistryKey key = Registry.LocalMachine.OpenSubKey(String.Format("Software\\Microsoft\\{0}\\{1}\\DataProviders", keyname, version), true)) - { - using (RegistryKey source = key.OpenSubKey(oledbDataProviderGuid.ToString("B"))) - { - using (RegistryKey dest = key.CreateSubKey(oledbAltDataProviderGuid.ToString("B"))) - { - if (source == null) return; - CopyKey(source, dest); - } - } - key.DeleteSubKeyTree(oledbDataProviderGuid.ToString("B")); - } - - using (RegistryKey key = Registry.LocalMachine.OpenSubKey(String.Format("Software\\Microsoft\\{0}\\{1}\\DataSources", keyname, version), true)) - { - using (RegistryKey source = key.OpenSubKey(jetDataSourcesGuid.ToString("B"))) - { - using (RegistryKey dest = key.CreateSubKey(jetAltDataSourcesGuid.ToString("B"))) - { - if (source == null) return; - CopyKey(source, dest); - } - } - key.DeleteSubKeyTree(jetDataSourcesGuid.ToString("B")); - } - - Install(keyname, version, oledbDataProviderGuid, jetDataSourcesGuid); - } - - private void RestoreJet(string keyname, string version) - { - using (RegistryKey key = Registry.LocalMachine.OpenSubKey(String.Format("Software\\Microsoft\\{0}\\{1}\\DataProviders", keyname, version), true)) - { - using (RegistryKey source = key.OpenSubKey(oledbAltDataProviderGuid.ToString("B"))) - { - if (source == null) return; - } - } - - Uninstall(keyname, version, oledbDataProviderGuid, jetDataSourcesGuid); - - using (RegistryKey key = Registry.LocalMachine.OpenSubKey(String.Format("Software\\Microsoft\\{0}\\{1}\\DataProviders", keyname, version), true)) - { - using (RegistryKey source = key.OpenSubKey(oledbAltDataProviderGuid.ToString("B"))) - { - if (source != null) - { - using (RegistryKey dest = key.CreateSubKey(oledbDataProviderGuid.ToString("B"))) - { - CopyKey(source, dest); - } - key.DeleteSubKeyTree(oledbAltDataProviderGuid.ToString("B")); - } - } - } - - using (RegistryKey key = Registry.LocalMachine.OpenSubKey(String.Format("Software\\Microsoft\\{0}\\{1}\\DataSources", keyname, version), true)) - { - using (RegistryKey source = key.OpenSubKey(jetAltDataSourcesGuid.ToString("B"))) - { - if (source != null) - { - using (RegistryKey dest = key.CreateSubKey(jetDataSourcesGuid.ToString("B"))) - { - CopyKey(source, dest); - } - key.DeleteSubKeyTree(jetAltDataSourcesGuid.ToString("B")); - } - } - } - } - - private void Install(string keyname, string version, Guid provider, Guid source) - { - bool usePackage = (keyname == "VisualStudio"); - - using (RegistryKey key = Registry.LocalMachine.OpenSubKey(String.Format("Software\\Microsoft\\{0}\\{1}\\DataProviders", keyname, version), true)) - { - using (RegistryKey subkey = key.CreateSubKey(provider.ToString("B"), RegistryKeyPermissionCheck.ReadWriteSubTree)) - { - subkey.SetValue(null, ".NET Framework Data Provider for SQLite"); - subkey.SetValue("InvariantName", "System.Data.SQLite"); - subkey.SetValue("Technology", "{77AB9A9D-78B9-4ba7-91AC-873F5338F1D2}"); - subkey.SetValue("CodeBase", Path.GetFullPath("SQLite.Designer.DLL")); - - - if (usePackage) - subkey.SetValue("FactoryService", "{DCBE6C8D-0E57-4099-A183-98FF74C64D9D}"); - - using (RegistryKey subsubkey = subkey.CreateSubKey("SupportedObjects", RegistryKeyPermissionCheck.ReadWriteSubTree)) - { - using (RegistryKey subsubsubkey = subsubkey.CreateSubKey("DataConnectionUIControl", RegistryKeyPermissionCheck.ReadWriteSubTree)) - { - if (!usePackage) - subsubsubkey.SetValue(null, "SQLite.Designer.SQLiteConnectionUIControl"); - } - using (RegistryKey subsubsubkey = subsubkey.CreateSubKey("DataConnectionProperties", RegistryKeyPermissionCheck.ReadWriteSubTree)) - { - if (!usePackage) - subsubsubkey.SetValue(null, "SQLite.Designer.SQLiteConnectionProperties"); - } - - subsubkey.CreateSubKey("DataObjectSupport").Close(); - subsubkey.CreateSubKey("DataViewSupport").Close(); - using (RegistryKey subsubsubkey = subsubkey.CreateSubKey("DataConnectionSupport", RegistryKeyPermissionCheck.ReadWriteSubTree)) - { - if (!usePackage) - subsubsubkey.SetValue(null, "SQLite.Designer.SQLiteDataConnectionSupport"); - } - } - } - } - - using (RegistryKey key = Registry.LocalMachine.OpenSubKey(String.Format("Software\\Microsoft\\{0}\\{1}\\DataSources", keyname, version), true)) - { - using (RegistryKey subkey = key.CreateSubKey(source.ToString("B"), RegistryKeyPermissionCheck.ReadWriteSubTree)) - { - subkey.SetValue(null, "SQLite Database File"); - using (RegistryKey subsubkey = subkey.CreateSubKey("SupportingProviders", RegistryKeyPermissionCheck.ReadWriteSubTree)) - { - subsubkey.CreateSubKey(provider.ToString("B")).Close(); - } - } - } - - //try - //{ - // using (RegistryKey key = Registry.LocalMachine.OpenSubKey("SYSTEM\\CurrentControlSet\\Control\\Session Manager\\Environment", true)) - // { - // string libpath = (string)key.GetValue("LIB"); - // string path = Path.GetDirectoryName(SQLiteLocation); - - // if (libpath.IndexOf(path, StringComparison.InvariantCultureIgnoreCase) == -1) - // { - // libpath += (";" + path); - // key.SetValue("LIB", libpath); - // } - // } - //} - //catch - //{ - //} - - string[] versions = { "v2.0.0.0", "v3.5.0.0" }; - - for (int x = 0; x < versions.Length; x++) - { - for (int n = 0; n < compactFrameworks.Length; n++) - { - using (RegistryKey key = Registry.LocalMachine.CreateSubKey(String.Format("Software\\Microsoft\\.NETCompactFramework\\{1}\\{0}\\DataProviders", compactFrameworks[n], versions[x]))) - { - if (key != null) - { - using (RegistryKey subkey = key.CreateSubKey(standardDataProviderGuid.ToString("B"), RegistryKeyPermissionCheck.ReadWriteSubTree)) - { - subkey.SetValue(null, ".NET Framework Data Provider for SQLite"); - subkey.SetValue("InvariantName", "System.Data.SQLite"); - subkey.SetValue("RuntimeAssembly", "System.Data.SQLite.DLL"); - } - } - } - } - } - - if (usePackage) - { - using (RegistryKey key = Registry.LocalMachine.OpenSubKey(String.Format("Software\\Microsoft\\{0}\\{1}\\Packages", keyname, version), true)) - { - using (RegistryKey subkey = key.CreateSubKey("{DCBE6C8D-0E57-4099-A183-98FF74C64D9C}", RegistryKeyPermissionCheck.ReadWriteSubTree)) - { - subkey.SetValue(null, "SQLite Designer Package"); - subkey.SetValue("Class", "SQLite.Designer.SQLitePackage"); - subkey.SetValue("CodeBase", Path.GetFullPath("SQLite.Designer.DLL")); - subkey.SetValue("ID", 400); - subkey.SetValue("InprocServer32", "mscoree.dll"); - subkey.SetValue("CompanyName", "Black Castle Software, LLC"); - subkey.SetValue("MinEdition", "standard"); - subkey.SetValue("ProductName", "SQLite Data Provider"); - subkey.SetValue("ProductVersion", "1.0"); - using (RegistryKey toolboxKey = subkey.CreateSubKey("Toolbox")) - { - toolboxKey.SetValue("Default Items", 3); - } - } - } - - using (RegistryKey key = Registry.LocalMachine.OpenSubKey(String.Format("Software\\Microsoft\\{0}\\{1}\\Menus", keyname, version), true)) - { - key.SetValue("{DCBE6C8D-0E57-4099-A183-98FF74C64D9C}", ", 1000, 3"); - } - - using (RegistryKey key = Registry.LocalMachine.OpenSubKey(String.Format("Software\\Microsoft\\{0}\\{1}\\Services", keyname, version), true)) - { - using (RegistryKey subkey = key.CreateSubKey("{DCBE6C8D-0E57-4099-A183-98FF74C64D9D}", RegistryKeyPermissionCheck.ReadWriteSubTree)) - { - subkey.SetValue(null, "{DCBE6C8D-0E57-4099-A183-98FF74C64D9C}"); - subkey.SetValue("Name", "SQLite Provider Object Factory"); - } - } - } - } - - private XmlDocument GetConfig(string keyname, string version, out string xmlFileName) - { - try - { - using (RegistryKey key = Registry.LocalMachine.OpenSubKey(String.Format("Software\\Microsoft\\{0}\\{1}", keyname, version), true)) - { - xmlFileName = (string)key.GetValue("InstallDir"); - if (String.Compare(keyname, "VisualStudio", true) == 0) - xmlFileName += "devenv.exe.config"; - else - xmlFileName += keyname + ".exe.config"; - } - - XmlDocument xmlDoc = new XmlDocument(); - xmlDoc.PreserveWhitespace = true; - xmlDoc.Load(xmlFileName); - - return xmlDoc; - } - catch - { - xmlFileName = null; - } - return null; - } - - private void Uninstall(string keyname, string version, Guid provider, Guid source) - { - try - { - using (RegistryKey key = Registry.LocalMachine.OpenSubKey(String.Format("Software\\Microsoft\\{0}\\{1}\\DataProviders", keyname, version), true)) - { - if (key != null) key.DeleteSubKeyTree(provider.ToString("B")); - } - using (RegistryKey key = Registry.LocalMachine.OpenSubKey(String.Format("Software\\Microsoft\\{0}\\{1}\\DataSources", keyname, version), true)) - { - if (key != null) key.DeleteSubKeyTree(source.ToString("B")); - } - - using (RegistryKey key = Registry.LocalMachine.OpenSubKey(String.Format("Software\\Microsoft\\{0}\\{1}\\Packages", keyname, version), true)) - { - if (key != null) key.DeleteSubKeyTree("{DCBE6C8D-0E57-4099-A183-98FF74C64D9C}"); - } - - using (RegistryKey key = Registry.LocalMachine.OpenSubKey(String.Format("Software\\Microsoft\\{0}\\{1}\\Services", keyname, version), true)) - { - if (key != null) key.DeleteSubKeyTree("{DCBE6C8D-0E57-4099-A183-98FF74C64D9D}"); - } - - using (RegistryKey key = Registry.LocalMachine.OpenSubKey(String.Format("Software\\Microsoft\\{0}\\{1}\\Menus", keyname, version), true)) - { - key.DeleteValue("{DCBE6C8D-0E57-4099-A183-98FF74C64D9C}"); - } - - //using (RegistryKey key = Registry.LocalMachine.OpenSubKey("SYSTEM\\CurrentControlSet\\Control\\Session Manager\\Environment", true)) - //{ - // string libpath = (string)key.GetValue("LIB"); - // string path = ";" + Path.GetDirectoryName(SQLiteLocation); - - // libpath = libpath.Replace(path, ""); - // key.SetValue("LIB", libpath); - //} - } - catch - { - } - - // Remove factory support from the development environment config file - string xmlFileName; - XmlDocument xmlDoc = GetConfig(keyname, version, out xmlFileName); - - if (xmlDoc == null) return; - - XmlNode xmlNode = xmlDoc.SelectSingleNode("configuration/system.data/DbProviderFactories/add[@invariant=\"System.Data.SQLite\"]"); - if (xmlNode != null) - xmlNode.ParentNode.RemoveChild(xmlNode); - - xmlNode = xmlDoc.SelectSingleNode("configuration/system.data/DbProviderFactories/remove[@invariant=\"System.Data.SQLite\"]"); - if (xmlNode != null) - xmlNode.ParentNode.RemoveChild(xmlNode); - - xmlDoc.Save(xmlFileName); - } - - - private static void CopyKey(RegistryKey keySource, RegistryKey keyDest) - { - if (keySource.SubKeyCount > 0) - { - string[] subkeys = keySource.GetSubKeyNames(); - for (int n = 0; n < subkeys.Length; n++) - { - using (RegistryKey subkeysource = keySource.OpenSubKey(subkeys[n])) - { - using (RegistryKey subkeydest = keyDest.CreateSubKey(subkeys[n], RegistryKeyPermissionCheck.ReadWriteSubTree)) - { - CopyKey(subkeysource, subkeydest); - } - } - } - } - string[] values = keySource.GetValueNames(); - for (int n = 0; n < values.Length; n++) - { - keyDest.SetValue(values[n], keySource.GetValue(values[n]), keySource.GetValueKind(values[n])); - } - } - - private void FixXmlLibPaths(bool install, string version) - { - string installDir = null; - RegistryKey key = null; - - try - { - key = Registry.LocalMachine.OpenSubKey(String.Format("Software\\Microsoft\\VisualStudio\\{0}", version)); - if (key != null) - { - try - { - installDir = (string)key.GetValue("InstallDir"); - } - catch - { - } - finally - { - if (String.IsNullOrEmpty(installDir)) - { - ((IDisposable)key).Dispose(); - key = null; - } - } - } - - if (key == null) - { - key = Registry.LocalMachine.OpenSubKey(String.Format("Software\\Microsoft\\VCExpress\\{0}", version)); - if (key == null) return; - } - - try - { - installDir = (string)key.GetValue("InstallDir"); - } - catch - { - } - } - finally - { - if (key != null) ((IDisposable)key).Dispose(); - } - - if (String.IsNullOrEmpty(installDir)) return; - - installDir = Path.Combine(Path.GetDirectoryName(Path.GetDirectoryName(Path.GetDirectoryName(installDir))), "VC"); - - string currentDir; - string[] lookIn = new string[] { "vcpackages", "bin\\amd64", "bin\\ia64" }; - string sqlitePath = Path.GetDirectoryName(SQLiteLocation); - - foreach (string subfolder in lookIn) - { - try - { - currentDir = Path.Combine(installDir, subfolder); - FixXmlLibPaths(currentDir, "VCProjectEngine.DLL*.config", sqlitePath, install); - FixXmlLibPaths(currentDir, "AMD64.VCPlatform.config", Path.Combine(sqlitePath, "x64"), install); - FixXmlLibPaths(currentDir, "Itanium.VCPlatform.config", Path.Combine(sqlitePath, "itanium"), install); - FixXmlLibPaths(currentDir, "WCE.VCPlatform.config", Path.Combine(sqlitePath, "CompactFramework"), install); - } - catch - { - } - } - - FixLocalUserPaths(install); - } - - private void FixLocalUserPaths(bool install) - { - string file = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "Microsoft\\VisualStudio\\8.0\\VCComponents.dat"); - StringBuilder output = new StringBuilder(); - string line; - string sqlitePath = Path.GetDirectoryName(SQLiteLocation); - string currPath = sqlitePath; - - try - { - using (StreamReader rd = new StreamReader(file)) - { - while (rd.EndOfStream == false) - { - line = rd.ReadLine(); - line = line.Trim(); - if (String.IsNullOrEmpty(line)) continue; - if (line[0] == '[') - { - if (line.IndexOf("Win32", StringComparison.InvariantCultureIgnoreCase) != -1) - currPath = sqlitePath; - else if (line.IndexOf("x64", StringComparison.InvariantCultureIgnoreCase) != -1) - currPath = Path.Combine(sqlitePath, "x64"); - else if (line.IndexOf("Itanium", StringComparison.InvariantCultureIgnoreCase) != -1) - currPath = Path.Combine(sqlitePath, "x64"); - else if (line.IndexOf("ARM", StringComparison.InvariantCultureIgnoreCase) != -1) - currPath = Path.Combine(sqlitePath, "CompactFramework"); - } - else if (line.StartsWith("Reference Dirs", StringComparison.InvariantCultureIgnoreCase) == true) - { - int n = line.IndexOf(";" + currPath, StringComparison.InvariantCultureIgnoreCase); - if (n > -1) line = line.Remove(n, currPath.Length + 1); - - if (install) - { - if (line[line.Length - 1] == '=') - line += currPath; - else - line += (";" + currPath); - } - } - - output.AppendLine(line); - } - rd.Close(); - } - - File.Delete(file); - using (StreamWriter writer = new StreamWriter(file, false, Encoding.Unicode)) - { - writer.Write(output.ToString()); - writer.Close(); - } - } - catch - { - } - } - - private void FixXmlLibPaths(string path, string lookFor, string sqlitePath, bool install) - { - // Win32 - string[] files = Directory.GetFiles(path, lookFor); - if (files.Length > 0) - { - foreach (string file in files) - { - FixXmlLibPath(file, sqlitePath, install); - } - } - } - - private void FixXmlLibPath(string fileName, string sqlitePath, bool install) - { - XmlDocument xmlDoc = new XmlDocument(); - xmlDoc.PreserveWhitespace = true; - xmlDoc.Load(fileName); - - XmlNodeList xmlNodes = xmlDoc.SelectNodes("VCPlatformConfigurationFile/Platform/Directories"); - if (xmlNodes == null) return; - - foreach(XmlNode xmlNode in xmlNodes) - { - string libpath = xmlNode.Attributes.GetNamedItem("Reference").Value; - if (String.Compare(libpath, sqlitePath, true) == 0) - libpath = ""; - else - { - int n = libpath.IndexOf(";" + sqlitePath, StringComparison.InvariantCultureIgnoreCase); - if (n > -1) libpath = libpath.Remove(n, sqlitePath.Length + 1); - } - - if (install) - { - if (String.IsNullOrEmpty(libpath)) libpath = sqlitePath; - else libpath += (";" + sqlitePath); - } - xmlNode.Attributes.GetNamedItem("Reference").Value = libpath; - } - - xmlDoc.Save(fileName); - } - } +/******************************************************** + * ADO.NET 2.0 Data Provider for SQLite Version 3.X + * Written by Robert Simpson (robert@blackcastlesoft.com) + * + * Released to the public domain, use at your own risk! + ********************************************************/ + +namespace install +{ + using System; + using System.ComponentModel; + using System.Data; + using System.Drawing; + using System.Text; + using System.Windows.Forms; + using Microsoft.Win32; + using System.IO; + using System.GACManagedAccess; + using System.Xml; + using System.Diagnostics; + using System.Collections.Generic; + + public partial class InstallDesigner : Form + { + private static Guid standardDataProviderGuid = new Guid("{0EBAAB6E-CA80-4b4a-8DDF-CBE6BF058C70}"); + private static Guid standardDataSourcesGuid = new Guid("{0EBAAB6E-CA80-4b4a-8DDF-CBE6BF058C71}"); + private static Guid standardCFDataSourcesGuid = new Guid("{0EBAAB6E-CA80-4b4a-8DDF-CBE6BF058C72}"); + private static Guid oledbDataProviderGuid = new Guid("{7F041D59-D76A-44ed-9AA2-FBF6B0548B80}"); + private static Guid oledbAltDataProviderGuid = new Guid("{7F041D59-D76A-44ed-9AA2-FBF6B0548B81}"); + private static Guid jetDataSourcesGuid = new Guid("{466CE797-67A4-4495-B75C-A3FD282E7FC3}"); + private static Guid jetAltDataSourcesGuid = new Guid("{466CE797-67A4-4495-B75C-A3FD282E7FC4}"); + private static string[] compactFrameworks = new string[] { /*"PocketPC", "SmartPhone", "WindowsCE"*/ }; + + internal bool _remove = false; + //private string _regRoot = "8.0"; + private System.Reflection.Assembly _assm = null; + private bool _ignoreChecks = true; + private string _assmLocation; + + private Dictionary _regRoots = new Dictionary(); + private List _frameworks = new List(); + + string SQLiteLocation + { + get + { + System.Reflection.Assembly assm = SQLite; + return _assmLocation; + } + } + + System.Reflection.Assembly SQLite + { + get + { + if (_assm == null) + { + Environment.CurrentDirectory = Path.GetDirectoryName(typeof(InstallDesigner).Assembly.Location); + + try + { + _assmLocation = Path.GetFullPath("..\\System.Data.SQLite.DLL"); + _assm = System.Reflection.Assembly.LoadFrom(_assmLocation); + } + catch + { + } + } + + OpenFileDialog dlg = new OpenFileDialog(); + while (_assm == null) + { + dlg.Multiselect = false; + dlg.InitialDirectory = Environment.CurrentDirectory; + dlg.FileName = "System.Data.SQLite.DLL"; + dlg.Filter = "System.Data.SQLite.DLL|System.Data.SQLite.DLL"; + if (dlg.ShowDialog() == DialogResult.OK) + { + try + { + _assmLocation = dlg.FileName; + _assm = System.Reflection.Assembly.LoadFrom(dlg.FileName); + } + catch + { + } + } + else + throw new ArgumentException("Unable to find or load System.Data.SQLite.DLL"); + } + return _assm; + } + + set + { + _assm = value; + } + } + + public InstallDesigner() + { + string[] args = Environment.GetCommandLineArgs(); + RegistryKey key; + string frameworkpath; + + //_regRoots.Add("8.0", "2005"); + //_regRoots.Add("9.0", "2008"); + _regRoots.Add("10.0", "2010"); + + using (key = Registry.LocalMachine.OpenSubKey("Software\\Microsoft\\.NETFramework")) + { + frameworkpath = key.GetValue("InstallRoot") as string; + } + + string[] frameworkfolders = Directory.GetDirectories(frameworkpath); + foreach (string framework in frameworkfolders) + { + // Don't do this on frameworks before 4.0 + string version = Path.GetFileNameWithoutExtension(framework); + if (String.Compare(version, "v4.0", StringComparison.OrdinalIgnoreCase) < 0) + continue; + + if (File.Exists(Path.Combine(framework, "CONFIG\\machine.config"))) + _frameworks.Add(Path.GetFileName(framework)); + } + + for (int n = 0; n < args.Length; n++) + { + if (String.Compare(args[n], "/regroot", true) == 0 || + String.Compare(args[n], "-regroot", true) == 0) + { + _regRoots.Add(args[n + 1], args[n + 1]); + break; + } + else if (String.Compare(args[n], "/remove", true) == 0 || + String.Compare(args[n], "-remove", true) == 0) + { + _remove = true; + } + } + + InitializeComponent(); + + foreach (KeyValuePair pair in _regRoots) + { + using (key = Registry.LocalMachine.OpenSubKey("Software\\Microsoft")) + { + AddItem(key, pair.Key, "VisualStudio", String.Format("Visual Studio {0} (full editions)", pair.Value), standardDataProviderGuid, null); + AddItem(key, pair.Key, "VWDExpress", String.Format("Visual Web Developer Express {0} Edition", pair.Value), standardDataProviderGuid, null); + + warningPanel.Visible = (AddItem(key, pair.Key, "VCSExpress", String.Format("Visual C# Express {0} Edition *", pair.Value), oledbDataProviderGuid, oledbAltDataProviderGuid) + | AddItem(key, pair.Key, "VCExpress", String.Format("Visual C++ Express {0} Edition *", pair.Value), oledbDataProviderGuid, oledbAltDataProviderGuid) + | AddItem(key, pair.Key, "VBExpress", String.Format("Visual Basic Express {0} Edition *", pair.Value), oledbDataProviderGuid, oledbAltDataProviderGuid) + | AddItem(key, pair.Key, "VJSExpress", String.Format("Visual J# Express {0} Edition *", pair.Value), oledbDataProviderGuid, oledbAltDataProviderGuid)); + } + GlobalAddRemove(pair.Key); + } + + _ignoreChecks = false; + } + + private bool AddItem(RegistryKey parent, string version, string subkeyname, string itemName, Guid lookFor, object isChecked) + { + RegistryKey subkey; + + try + { + using (subkey = parent.OpenSubKey(String.Format("{0}\\{1}", subkeyname, version))) + { + ListViewItem item = new ListViewItem(itemName); + + item.Tag = new string[] { subkeyname, version }; + + // Verify this edition has been installed and its not a fluke that the key exists + string dir = (string)subkey.GetValue("InstallDir"); + + using (RegistryKey subsubkey = subkey.OpenSubKey("Packages")) + { + if (subsubkey == null) + throw new ArgumentException("Edition not installed"); + if (subsubkey.SubKeyCount < 5) + throw new ArgumentException("Edition not installed"); + } + + using (RegistryKey subsubkey = subkey.OpenSubKey("DataProviders")) + { + if (subsubkey == null) + throw new ArgumentException("Edition not installed"); + } + + using (RegistryKey subsubkey = subkey.OpenSubKey(String.Format("DataProviders\\{0}", (isChecked == null) ? lookFor.ToString("B") : ((Guid)isChecked).ToString("B")))) + { + if (subsubkey == null) + { + DoInstallUninstall(item); + } + else + { + bool itemChecked = (subsubkey.GetValue(null) != null); + DoInstallUninstall(item); + if (_remove == false) item.Checked = itemChecked; + } + } + + installList.Items.Add(item); + if (item.Checked) + { + DoInstallUninstall(item); + } + return true; + } + } + catch + { + return false; + } + } + + private void closeButton_Click(object sender, EventArgs e) + { + this.Close(); + } + + private void installList_ItemChecked(object sender, ItemCheckedEventArgs e) + { + if (_ignoreChecks) return; + + string[] arr = (string[])e.Item.Tag; + + DoInstallUninstall(e.Item); + + GlobalAddRemove(arr[1]); + } + + private void DoInstallUninstall(ListViewItem Item) + { + string[] arr = (string[])Item.Tag; + if (Item.Checked == false) + { + if (Item.Text.IndexOf('*') > -1) + RestoreJet(arr[0], arr[1]); + else + Uninstall(arr[0], arr[1], standardDataProviderGuid, standardDataSourcesGuid); + } + else + { + if (Item.Text.IndexOf('*') > -1) + ReplaceJet(arr[0], arr[1]); + else + Install(arr[0], arr[1], standardDataProviderGuid, standardDataSourcesGuid); + } + } + + private void GlobalAddRemove(string version) + { + bool install = false; +// bool installed; + + //// Check to see if SQLite is installed in the GAC + //try + //{ + // string file = AssemblyCache.QueryAssemblyInfo("System.Data.SQLite"); + // installed = true; + //} + //catch + //{ + // installed = false; + //} + + // Check to see if any checkboxes in the list are checked + for (int n = 0; n < installList.Items.Count; n++) + { + if (installList.Items[n].Checked == true) + { + install = true; + break; + } + } + + // If at least 1 item is checked, then install some global settings + if (install) + { + string path = Path.GetDirectoryName(SQLiteLocation); + + foreach (string framework in _frameworks) + { + using (RegistryKey key = Registry.LocalMachine.CreateSubKey(String.Format("Software\\Microsoft\\.NETFramework\\{0}\\AssemblyFoldersEx\\SQLite", framework), RegistryKeyPermissionCheck.ReadWriteSubTree)) + { + key.SetValue(null, path); + } + } + + while (String.IsNullOrEmpty(path) == false) + { + if (File.Exists(path + "\\CompactFramework\\System.Data.SQLite.DLL") == false) + { + path = Path.GetDirectoryName(path); + } + else break; + } + + if (String.IsNullOrEmpty(path) == false) + { + path += "\\CompactFramework\\"; + + for (int n = 0; n < compactFrameworks.Length; n++) + { + using (RegistryKey key = Registry.LocalMachine.OpenSubKey(String.Format("Software\\Microsoft\\.NETCompactFramework\\v2.0.0.0\\{0}\\AssemblyFoldersEx", compactFrameworks[n]), true)) + { + + if (key != null) + { + using (RegistryKey subkey = key.CreateSubKey("SQLite", RegistryKeyPermissionCheck.ReadWriteSubTree)) + { + subkey.SetValue(null, path); + } + } + } + } + + for (int n = 0; n < compactFrameworks.Length; n++) + { + using (RegistryKey key = Registry.LocalMachine.OpenSubKey(String.Format("Software\\Microsoft\\.NETCompactFramework\\v3.5.0.0\\{0}\\AssemblyFoldersEx", compactFrameworks[n]), true)) + { + + if (key != null) + { + using (RegistryKey subkey = key.CreateSubKey("SQLite", RegistryKeyPermissionCheck.ReadWriteSubTree)) + { + subkey.SetValue(null, path); + } + } + } + } + } + + for (int n = 0; n < 2; n++) + { + foreach (string framework in _frameworks) + { + // Add factory support to the machine.config file. + try + { + string xmlFileName = Environment.ExpandEnvironmentVariables(String.Format("%WinDir%\\Microsoft.NET\\{0}\\{1}\\CONFIG\\machine.config", (n == 0) ? "Framework" : "Framework64", framework)); + XmlDocument xmlDoc = new XmlDocument(); + xmlDoc.PreserveWhitespace = true; + xmlDoc.Load(xmlFileName); + + + XmlNode xmlNode = xmlDoc.SelectSingleNode("configuration/system.data/DbProviderFactories/add[@invariant=\"System.Data.SQLite\"]"); + if (xmlNode == null) + { + XmlNode xmlConfig = xmlDoc.SelectSingleNode("configuration"); + if (xmlConfig != null) + { + XmlNode xmlData = xmlConfig.SelectSingleNode("system.data"); + if (xmlData == null) + { + xmlData = xmlDoc.CreateNode(XmlNodeType.Element, "system.data", ""); + xmlConfig.AppendChild(xmlData); + } + XmlNode xmlParent = xmlData.SelectSingleNode("DbProviderFactories"); + if (xmlParent == null) + { + xmlParent = xmlDoc.CreateNode(XmlNodeType.Element, "DbProviderFactories", ""); + xmlData.AppendChild(xmlParent); + } + + //xmlNode = xmlDoc.CreateNode(XmlNodeType.Element, "remove", ""); + //xmlNode.Attributes.SetNamedItem(xmlDoc.CreateAttribute("invariant")); + //xmlParent.AppendChild(xmlNode); + //xmlNode.Attributes.GetNamedItem("invariant").Value = "System.Data.SQLite"; + + xmlNode = xmlDoc.CreateNode(XmlNodeType.Element, "add", ""); + xmlNode.Attributes.SetNamedItem(xmlDoc.CreateAttribute("name")); + xmlNode.Attributes.SetNamedItem(xmlDoc.CreateAttribute("invariant")); + xmlNode.Attributes.SetNamedItem(xmlDoc.CreateAttribute("description")); + xmlNode.Attributes.SetNamedItem(xmlDoc.CreateAttribute("type")); + xmlParent.AppendChild(xmlNode); + } + } + xmlNode.Attributes.GetNamedItem("name").Value = "SQLite Data Provider"; + xmlNode.Attributes.GetNamedItem("invariant").Value = "System.Data.SQLite"; + xmlNode.Attributes.GetNamedItem("description").Value = ".Net Framework Data Provider for SQLite"; + xmlNode.Attributes.GetNamedItem("type").Value = "System.Data.SQLite.SQLiteFactory, " + SQLite.GetName().FullName; + + xmlDoc.Save(xmlFileName); + } + catch + { + } + } + } + } + else // No checkboxes are checked, remove some global settings + { + try + { + foreach (string framework in _frameworks) + { + Registry.LocalMachine.DeleteSubKey(String.Format("Software\\Microsoft\\.NETFramework\\{0}\\AssemblyFoldersEx\\SQLite", framework)); + } + + string[] versions = { /*"v2.0.0.0", "v3.5.0.0"*/ }; + for (int x = 0; x < versions.Length; x++) + { + for (int n = 0; n < compactFrameworks.Length; n++) + { + using (RegistryKey key = Registry.LocalMachine.OpenSubKey(String.Format("Software\\Microsoft\\.NETCompactFramework\\{1}\\{0}\\DataProviders", compactFrameworks[n], versions[x]), true)) + { + try + { + if (key != null) key.DeleteSubKey(standardDataProviderGuid.ToString("B")); + } + catch + { + } + } + } + } + + for (int n = 0; n < compactFrameworks.Length; n++) + { + using (RegistryKey key = Registry.LocalMachine.OpenSubKey(String.Format("Software\\Microsoft\\.NETCompactFramework\\v2.0.0.0\\{0}\\AssemblyFoldersEx", compactFrameworks[n]), true)) + { + try + { + if (key != null) key.DeleteSubKey("SQLite"); + } + catch + { + } + } + } + + for (int n = 0; n < 2; n++) + { + try + { + foreach (string framework in _frameworks) + { + // Remove any entries in the machine.config if they're still there + string xmlFileName = Environment.ExpandEnvironmentVariables(String.Format("%WinDir%\\Microsoft.NET\\{0}\\{1}\\CONFIG\\machine.config", (n == 0) ? "Framework" : "Framework64", framework)); + XmlDocument xmlDoc = new XmlDocument(); + xmlDoc.PreserveWhitespace = true; + xmlDoc.Load(xmlFileName); + + XmlNode xmlNode = xmlDoc.SelectSingleNode("configuration/system.data/DbProviderFactories/add[@invariant=\"System.Data.SQLite\"]"); + + if (xmlNode != null) + xmlNode.ParentNode.RemoveChild(xmlNode); + + xmlNode = xmlDoc.SelectSingleNode("configuration/system.data/DbProviderFactories/remove[@invariant=\"System.Data.SQLite\"]"); + if (xmlNode != null) + xmlNode.ParentNode.RemoveChild(xmlNode); + + xmlDoc.Save(xmlFileName); + } + } + catch + { + } + } + } + catch + { + } + } + + try + { + if (!install) // Remove SQLite from the GAC if its there + { + AssemblyCacheUninstallDisposition disp; + + string s; + AssemblyCacheEnum entries = new AssemblyCacheEnum("System.Data.SQLite"); + while (true) + { + s = entries.GetNextAssembly(); + if (String.IsNullOrEmpty(s)) break; + + AssemblyCache.UninstallAssembly(s, null, out disp); + } + + entries = new AssemblyCacheEnum("SQLite.Designer"); + while (true) + { + s = entries.GetNextAssembly(); + if (String.IsNullOrEmpty(s)) break; + + AssemblyCache.UninstallAssembly(s, null, out disp); + } + + entries = new AssemblyCacheEnum("System.Data.SQLite.Linq"); + while (true) + { + s = entries.GetNextAssembly(); + if (String.IsNullOrEmpty(s)) break; + + AssemblyCache.UninstallAssembly(s, null, out disp); + } + + SQLite = null; + } + else // Install SQLite into the GAC + { + byte[] cfdt = Properties.Resources.System_Data_SQLite; + string tempPath = Path.GetTempPath(); + tempPath = Path.Combine(tempPath, "System.Data.SQLite.DLL"); + using (FileStream fs = File.Open(tempPath, FileMode.Create, FileAccess.Write, FileShare.None)) + { + fs.Write(cfdt, 0, cfdt.Length); + } + + try + { + AssemblyCache.InstallAssembly(tempPath, null, AssemblyCommitFlags.Default); + AssemblyCache.InstallAssembly(Path.Combine(Path.GetDirectoryName(SQLiteLocation), "x64\\System.Data.SQLite.DLL"), null, AssemblyCommitFlags.Default); + AssemblyCache.InstallAssembly(Path.Combine(Path.GetDirectoryName(SQLiteLocation), "itanium\\System.Data.SQLite.DLL"), null, AssemblyCommitFlags.Default); + } + catch + { + } + finally + { + File.Delete(tempPath); + if (File.Exists(Path.GetFullPath("..\\System.Data.SQLite.Linq.DLL")) == true) + AssemblyCache.InstallAssembly(Path.GetFullPath("..\\System.Data.SQLite.Linq.DLL"), null, AssemblyCommitFlags.Default); + + AssemblyCache.InstallAssembly(Path.GetFullPath("SQLite.Designer.DLL"), null, AssemblyCommitFlags.Default); + AssemblyCache.InstallAssembly(SQLiteLocation, null, AssemblyCommitFlags.Default); + } + } + } + catch + { + throw; + } + + FixXmlLibPaths(install, version); + } + + private void ReplaceJet(string keyname, string version) + { + using (RegistryKey key = Registry.LocalMachine.OpenSubKey(String.Format("Software\\Microsoft\\{0}\\{1}\\DataProviders", keyname, version), true)) + { + using (RegistryKey source = key.OpenSubKey(oledbDataProviderGuid.ToString("B"))) + { + using (RegistryKey dest = key.CreateSubKey(oledbAltDataProviderGuid.ToString("B"))) + { + if (source == null) return; + CopyKey(source, dest); + } + } + key.DeleteSubKeyTree(oledbDataProviderGuid.ToString("B")); + } + + using (RegistryKey key = Registry.LocalMachine.OpenSubKey(String.Format("Software\\Microsoft\\{0}\\{1}\\DataSources", keyname, version), true)) + { + using (RegistryKey source = key.OpenSubKey(jetDataSourcesGuid.ToString("B"))) + { + using (RegistryKey dest = key.CreateSubKey(jetAltDataSourcesGuid.ToString("B"))) + { + if (source == null) return; + CopyKey(source, dest); + } + } + key.DeleteSubKeyTree(jetDataSourcesGuid.ToString("B")); + } + + Install(keyname, version, oledbDataProviderGuid, jetDataSourcesGuid); + } + + private void RestoreJet(string keyname, string version) + { + using (RegistryKey key = Registry.LocalMachine.OpenSubKey(String.Format("Software\\Microsoft\\{0}\\{1}\\DataProviders", keyname, version), true)) + { + using (RegistryKey source = key.OpenSubKey(oledbAltDataProviderGuid.ToString("B"))) + { + if (source == null) return; + } + } + + Uninstall(keyname, version, oledbDataProviderGuid, jetDataSourcesGuid); + + using (RegistryKey key = Registry.LocalMachine.OpenSubKey(String.Format("Software\\Microsoft\\{0}\\{1}\\DataProviders", keyname, version), true)) + { + using (RegistryKey source = key.OpenSubKey(oledbAltDataProviderGuid.ToString("B"))) + { + if (source != null) + { + using (RegistryKey dest = key.CreateSubKey(oledbDataProviderGuid.ToString("B"))) + { + CopyKey(source, dest); + } + key.DeleteSubKeyTree(oledbAltDataProviderGuid.ToString("B")); + } + } + } + + using (RegistryKey key = Registry.LocalMachine.OpenSubKey(String.Format("Software\\Microsoft\\{0}\\{1}\\DataSources", keyname, version), true)) + { + using (RegistryKey source = key.OpenSubKey(jetAltDataSourcesGuid.ToString("B"))) + { + if (source != null) + { + using (RegistryKey dest = key.CreateSubKey(jetDataSourcesGuid.ToString("B"))) + { + CopyKey(source, dest); + } + key.DeleteSubKeyTree(jetAltDataSourcesGuid.ToString("B")); + } + } + } + } + + private void Install(string keyname, string version, Guid provider, Guid source) + { + bool usePackage = (keyname == "VisualStudio"); + + using (RegistryKey key = Registry.LocalMachine.OpenSubKey(String.Format("Software\\Microsoft\\{0}\\{1}\\DataProviders", keyname, version), true)) + { + using (RegistryKey subkey = key.CreateSubKey(provider.ToString("B"), RegistryKeyPermissionCheck.ReadWriteSubTree)) + { + subkey.SetValue(null, ".NET Framework Data Provider for SQLite"); + subkey.SetValue("InvariantName", "System.Data.SQLite"); + subkey.SetValue("Technology", "{77AB9A9D-78B9-4ba7-91AC-873F5338F1D2}"); + subkey.SetValue("CodeBase", Path.GetFullPath("SQLite.Designer.DLL")); + + + if (usePackage) + subkey.SetValue("FactoryService", "{DCBE6C8D-0E57-4099-A183-98FF74C64D9D}"); + + using (RegistryKey subsubkey = subkey.CreateSubKey("SupportedObjects", RegistryKeyPermissionCheck.ReadWriteSubTree)) + { + using (RegistryKey subsubsubkey = subsubkey.CreateSubKey("DataConnectionUIControl", RegistryKeyPermissionCheck.ReadWriteSubTree)) + { + if (!usePackage) + subsubsubkey.SetValue(null, "SQLite.Designer.SQLiteConnectionUIControl"); + } + using (RegistryKey subsubsubkey = subsubkey.CreateSubKey("DataConnectionProperties", RegistryKeyPermissionCheck.ReadWriteSubTree)) + { + if (!usePackage) + subsubsubkey.SetValue(null, "SQLite.Designer.SQLiteConnectionProperties"); + } + + subsubkey.CreateSubKey("DataObjectSupport").Close(); + subsubkey.CreateSubKey("DataViewSupport").Close(); + using (RegistryKey subsubsubkey = subsubkey.CreateSubKey("DataConnectionSupport", RegistryKeyPermissionCheck.ReadWriteSubTree)) + { + if (!usePackage) + subsubsubkey.SetValue(null, "SQLite.Designer.SQLiteDataConnectionSupport"); + } + } + } + } + + using (RegistryKey key = Registry.LocalMachine.OpenSubKey(String.Format("Software\\Microsoft\\{0}\\{1}\\DataSources", keyname, version), true)) + { + using (RegistryKey subkey = key.CreateSubKey(source.ToString("B"), RegistryKeyPermissionCheck.ReadWriteSubTree)) + { + subkey.SetValue(null, "SQLite Database File"); + using (RegistryKey subsubkey = subkey.CreateSubKey("SupportingProviders", RegistryKeyPermissionCheck.ReadWriteSubTree)) + { + subsubkey.CreateSubKey(provider.ToString("B")).Close(); + } + } + } + + //try + //{ + // using (RegistryKey key = Registry.LocalMachine.OpenSubKey("SYSTEM\\CurrentControlSet\\Control\\Session Manager\\Environment", true)) + // { + // string libpath = (string)key.GetValue("LIB"); + // string path = Path.GetDirectoryName(SQLiteLocation); + + // if (libpath.IndexOf(path, StringComparison.InvariantCultureIgnoreCase) == -1) + // { + // libpath += (";" + path); + // key.SetValue("LIB", libpath); + // } + // } + //} + //catch + //{ + //} + + string[] versions = { /*"v2.0.0.0", "v3.5.0.0"*/ }; + + for (int x = 0; x < versions.Length; x++) + { + for (int n = 0; n < compactFrameworks.Length; n++) + { + using (RegistryKey key = Registry.LocalMachine.CreateSubKey(String.Format("Software\\Microsoft\\.NETCompactFramework\\{1}\\{0}\\DataProviders", compactFrameworks[n], versions[x]))) + { + if (key != null) + { + using (RegistryKey subkey = key.CreateSubKey(standardDataProviderGuid.ToString("B"), RegistryKeyPermissionCheck.ReadWriteSubTree)) + { + subkey.SetValue(null, ".NET Framework Data Provider for SQLite"); + subkey.SetValue("InvariantName", "System.Data.SQLite"); + subkey.SetValue("RuntimeAssembly", "System.Data.SQLite.DLL"); + } + } + } + } + } + + if (usePackage) + { + using (RegistryKey key = Registry.LocalMachine.OpenSubKey(String.Format("Software\\Microsoft\\{0}\\{1}\\Packages", keyname, version), true)) + { + using (RegistryKey subkey = key.CreateSubKey("{DCBE6C8D-0E57-4099-A183-98FF74C64D9C}", RegistryKeyPermissionCheck.ReadWriteSubTree)) + { + subkey.SetValue(null, "SQLite Designer Package"); + subkey.SetValue("Class", "SQLite.Designer.SQLitePackage"); + subkey.SetValue("CodeBase", Path.GetFullPath("SQLite.Designer.DLL")); + subkey.SetValue("ID", 400); + subkey.SetValue("InprocServer32", "mscoree.dll"); + subkey.SetValue("CompanyName", "Black Castle Software, LLC"); + subkey.SetValue("MinEdition", "standard"); + subkey.SetValue("ProductName", "SQLite Data Provider"); + subkey.SetValue("ProductVersion", "1.0"); + using (RegistryKey toolboxKey = subkey.CreateSubKey("Toolbox")) + { + toolboxKey.SetValue("Default Items", 3); + } + } + } + + using (RegistryKey key = Registry.LocalMachine.OpenSubKey(String.Format("Software\\Microsoft\\{0}\\{1}\\Menus", keyname, version), true)) + { + key.SetValue("{DCBE6C8D-0E57-4099-A183-98FF74C64D9C}", ", 1000, 3"); + } + + using (RegistryKey key = Registry.LocalMachine.OpenSubKey(String.Format("Software\\Microsoft\\{0}\\{1}\\Services", keyname, version), true)) + { + using (RegistryKey subkey = key.CreateSubKey("{DCBE6C8D-0E57-4099-A183-98FF74C64D9D}", RegistryKeyPermissionCheck.ReadWriteSubTree)) + { + subkey.SetValue(null, "{DCBE6C8D-0E57-4099-A183-98FF74C64D9C}"); + subkey.SetValue("Name", "SQLite Provider Object Factory"); + } + } + } + } + + private XmlDocument GetConfig(string keyname, string version, out string xmlFileName) + { + try + { + using (RegistryKey key = Registry.LocalMachine.OpenSubKey(String.Format("Software\\Microsoft\\{0}\\{1}", keyname, version), true)) + { + xmlFileName = (string)key.GetValue("InstallDir"); + if (String.Compare(keyname, "VisualStudio", true) == 0) + xmlFileName += "devenv.exe.config"; + else + xmlFileName += keyname + ".exe.config"; + } + + XmlDocument xmlDoc = new XmlDocument(); + xmlDoc.PreserveWhitespace = true; + xmlDoc.Load(xmlFileName); + + return xmlDoc; + } + catch + { + xmlFileName = null; + } + return null; + } + + private void Uninstall(string keyname, string version, Guid provider, Guid source) + { + try + { + using (RegistryKey key = Registry.LocalMachine.OpenSubKey(String.Format("Software\\Microsoft\\{0}\\{1}\\DataProviders", keyname, version), true)) + { + if (key != null) key.DeleteSubKeyTree(provider.ToString("B")); + } + using (RegistryKey key = Registry.LocalMachine.OpenSubKey(String.Format("Software\\Microsoft\\{0}\\{1}\\DataSources", keyname, version), true)) + { + if (key != null) key.DeleteSubKeyTree(source.ToString("B")); + } + + using (RegistryKey key = Registry.LocalMachine.OpenSubKey(String.Format("Software\\Microsoft\\{0}\\{1}\\Packages", keyname, version), true)) + { + if (key != null) key.DeleteSubKeyTree("{DCBE6C8D-0E57-4099-A183-98FF74C64D9C}"); + } + + using (RegistryKey key = Registry.LocalMachine.OpenSubKey(String.Format("Software\\Microsoft\\{0}\\{1}\\Services", keyname, version), true)) + { + if (key != null) key.DeleteSubKeyTree("{DCBE6C8D-0E57-4099-A183-98FF74C64D9D}"); + } + + using (RegistryKey key = Registry.LocalMachine.OpenSubKey(String.Format("Software\\Microsoft\\{0}\\{1}\\Menus", keyname, version), true)) + { + key.DeleteValue("{DCBE6C8D-0E57-4099-A183-98FF74C64D9C}"); + } + + //using (RegistryKey key = Registry.LocalMachine.OpenSubKey("SYSTEM\\CurrentControlSet\\Control\\Session Manager\\Environment", true)) + //{ + // string libpath = (string)key.GetValue("LIB"); + // string path = ";" + Path.GetDirectoryName(SQLiteLocation); + + // libpath = libpath.Replace(path, ""); + // key.SetValue("LIB", libpath); + //} + } + catch + { + } + + // Remove factory support from the development environment config file + string xmlFileName; + XmlDocument xmlDoc = GetConfig(keyname, version, out xmlFileName); + + if (xmlDoc == null) return; + + XmlNode xmlNode = xmlDoc.SelectSingleNode("configuration/system.data/DbProviderFactories/add[@invariant=\"System.Data.SQLite\"]"); + if (xmlNode != null) + xmlNode.ParentNode.RemoveChild(xmlNode); + + xmlNode = xmlDoc.SelectSingleNode("configuration/system.data/DbProviderFactories/remove[@invariant=\"System.Data.SQLite\"]"); + if (xmlNode != null) + xmlNode.ParentNode.RemoveChild(xmlNode); + + xmlDoc.Save(xmlFileName); + } + + + private static void CopyKey(RegistryKey keySource, RegistryKey keyDest) + { + if (keySource.SubKeyCount > 0) + { + string[] subkeys = keySource.GetSubKeyNames(); + for (int n = 0; n < subkeys.Length; n++) + { + using (RegistryKey subkeysource = keySource.OpenSubKey(subkeys[n])) + { + using (RegistryKey subkeydest = keyDest.CreateSubKey(subkeys[n], RegistryKeyPermissionCheck.ReadWriteSubTree)) + { + CopyKey(subkeysource, subkeydest); + } + } + } + } + string[] values = keySource.GetValueNames(); + for (int n = 0; n < values.Length; n++) + { + keyDest.SetValue(values[n], keySource.GetValue(values[n]), keySource.GetValueKind(values[n])); + } + } + + private void FixXmlLibPaths(bool install, string version) + { + string installDir = null; + RegistryKey key = null; + + try + { + key = Registry.LocalMachine.OpenSubKey(String.Format("Software\\Microsoft\\VisualStudio\\{0}", version)); + if (key != null) + { + try + { + installDir = (string)key.GetValue("InstallDir"); + } + catch + { + } + finally + { + if (String.IsNullOrEmpty(installDir)) + { + ((IDisposable)key).Dispose(); + key = null; + } + } + } + + if (key == null) + { + key = Registry.LocalMachine.OpenSubKey(String.Format("Software\\Microsoft\\VCExpress\\{0}", version)); + if (key == null) return; + } + + try + { + installDir = (string)key.GetValue("InstallDir"); + } + catch + { + } + } + finally + { + if (key != null) ((IDisposable)key).Dispose(); + } + + if (String.IsNullOrEmpty(installDir)) return; + + installDir = Path.Combine(Path.GetDirectoryName(Path.GetDirectoryName(Path.GetDirectoryName(installDir))), "VC"); + + string currentDir; + string[] lookIn = new string[] { "vcpackages", "bin\\amd64", "bin\\ia64" }; + string sqlitePath = Path.GetDirectoryName(SQLiteLocation); + + foreach (string subfolder in lookIn) + { + try + { + currentDir = Path.Combine(installDir, subfolder); + FixXmlLibPaths(currentDir, "VCProjectEngine.DLL*.config", sqlitePath, install); + FixXmlLibPaths(currentDir, "AMD64.VCPlatform.config", Path.Combine(sqlitePath, "x64"), install); + FixXmlLibPaths(currentDir, "Itanium.VCPlatform.config", Path.Combine(sqlitePath, "itanium"), install); + FixXmlLibPaths(currentDir, "WCE.VCPlatform.config", Path.Combine(sqlitePath, "CompactFramework"), install); + } + catch + { + } + } + + FixLocalUserPaths(install); + } + + private void FixLocalUserPaths(bool install) + { + string file = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "Microsoft\\VisualStudio\\8.0\\VCComponents.dat"); + StringBuilder output = new StringBuilder(); + string line; + string sqlitePath = Path.GetDirectoryName(SQLiteLocation); + string currPath = sqlitePath; + + try + { + using (StreamReader rd = new StreamReader(file)) + { + while (rd.EndOfStream == false) + { + line = rd.ReadLine(); + line = line.Trim(); + if (String.IsNullOrEmpty(line)) continue; + if (line[0] == '[') + { + if (line.IndexOf("Win32", StringComparison.InvariantCultureIgnoreCase) != -1) + currPath = sqlitePath; + else if (line.IndexOf("x64", StringComparison.InvariantCultureIgnoreCase) != -1) + currPath = Path.Combine(sqlitePath, "x64"); + else if (line.IndexOf("Itanium", StringComparison.InvariantCultureIgnoreCase) != -1) + currPath = Path.Combine(sqlitePath, "x64"); + else if (line.IndexOf("ARM", StringComparison.InvariantCultureIgnoreCase) != -1) + currPath = Path.Combine(sqlitePath, "CompactFramework"); + } + else if (line.StartsWith("Reference Dirs", StringComparison.InvariantCultureIgnoreCase) == true) + { + int n = line.IndexOf(";" + currPath, StringComparison.InvariantCultureIgnoreCase); + if (n > -1) line = line.Remove(n, currPath.Length + 1); + + if (install) + { + if (line[line.Length - 1] == '=') + line += currPath; + else + line += (";" + currPath); + } + } + + output.AppendLine(line); + } + rd.Close(); + } + + File.Delete(file); + using (StreamWriter writer = new StreamWriter(file, false, Encoding.Unicode)) + { + writer.Write(output.ToString()); + writer.Close(); + } + } + catch + { + } + } + + private void FixXmlLibPaths(string path, string lookFor, string sqlitePath, bool install) + { + // Win32 + string[] files = Directory.GetFiles(path, lookFor); + if (files.Length > 0) + { + foreach (string file in files) + { + FixXmlLibPath(file, sqlitePath, install); + } + } + } + + private void FixXmlLibPath(string fileName, string sqlitePath, bool install) + { + XmlDocument xmlDoc = new XmlDocument(); + xmlDoc.PreserveWhitespace = true; + xmlDoc.Load(fileName); + + XmlNodeList xmlNodes = xmlDoc.SelectNodes("VCPlatformConfigurationFile/Platform/Directories"); + if (xmlNodes == null) return; + + foreach(XmlNode xmlNode in xmlNodes) + { + string libpath = xmlNode.Attributes.GetNamedItem("Reference").Value; + if (String.Compare(libpath, sqlitePath, true) == 0) + libpath = ""; + else + { + int n = libpath.IndexOf(";" + sqlitePath, StringComparison.InvariantCultureIgnoreCase); + if (n > -1) libpath = libpath.Remove(n, sqlitePath.Length + 1); + } + + if (install) + { + if (String.IsNullOrEmpty(libpath)) libpath = sqlitePath; + else libpath += (";" + sqlitePath); + } + xmlNode.Attributes.GetNamedItem("Reference").Value = libpath; + } + + xmlDoc.Save(fileName); + } + } } Index: tools/install/Properties/AssemblyInfo.cs ================================================================== --- tools/install/Properties/AssemblyInfo.cs +++ tools/install/Properties/AssemblyInfo.cs @@ -1,30 +1,30 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("SQLite Installer")] -[assembly: AssemblyDescription("SQLite ADO.NET 2.0 Design-Time Installer")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("http://sqlite.phxsoftware.com")] -[assembly: AssemblyProduct("SQLite Installer")] -[assembly: AssemblyCopyright("Public Domain")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -[assembly: AssemblyVersion("1.0.0.*")] -[assembly: AssemblyFileVersion("1.0.0.0")] +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("SQLite Installer")] +[assembly: AssemblyDescription("SQLite ADO.NET 4.0 Design-Time Installer")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("http://sqlite.phxsoftware.com")] +[assembly: AssemblyProduct("SQLite Installer")] +[assembly: AssemblyCopyright("Public Domain")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +[assembly: AssemblyVersion("1.0.0.*")] +[assembly: AssemblyFileVersion("1.0.0.0")] Index: tools/install/Properties/Resources.Designer.cs ================================================================== --- tools/install/Properties/Resources.Designer.cs +++ tools/install/Properties/Resources.Designer.cs @@ -1,70 +1,70 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// Runtime Version:2.0.50727.3053 -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -namespace install.Properties { - using System; - - - /// - /// A strongly-typed resource class, for looking up localized strings, etc. - /// - // This class was auto-generated by the StronglyTypedResourceBuilder - // class via a tool like ResGen or Visual Studio. - // To add or remove a member, edit your .ResX file then rerun ResGen - // with the /str option, or rebuild your VS project. - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "2.0.0.0")] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - internal class Resources { - - private static global::System.Resources.ResourceManager resourceMan; - - private static global::System.Globalization.CultureInfo resourceCulture; - - [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - internal Resources() { - } - - /// - /// Returns the cached ResourceManager instance used by this class. - /// - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Resources.ResourceManager ResourceManager { - get { - if (object.ReferenceEquals(resourceMan, null)) { - global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("install.Properties.Resources", typeof(Resources).Assembly); - resourceMan = temp; - } - return resourceMan; - } - } - - /// - /// Overrides the current thread's CurrentUICulture property for all - /// resource lookups using this strongly typed resource class. - /// - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Globalization.CultureInfo Culture { - get { - return resourceCulture; - } - set { - resourceCulture = value; - } - } - - internal static byte[] System_Data_SQLite { - get { - object obj = ResourceManager.GetObject("System_Data_SQLite", resourceCulture); - return ((byte[])(obj)); - } - } - } -} +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.1 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace install.Properties { + using System; + + + /// + /// A strongly-typed resource class, for looking up localized strings, etc. + /// + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class Resources { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal Resources() { + } + + /// + /// Returns the cached ResourceManager instance used by this class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager { + get { + if (object.ReferenceEquals(resourceMan, null)) { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("install.Properties.Resources", typeof(Resources).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + + internal static byte[] System_Data_SQLite { + get { + object obj = ResourceManager.GetObject("System_Data_SQLite", resourceCulture); + return ((byte[])(obj)); + } + } + } +} Index: tools/install/Resources/System.Data.SQLite.dll ================================================================== --- tools/install/Resources/System.Data.SQLite.dll +++ tools/install/Resources/System.Data.SQLite.dll cannot compute difference between binary files Index: tools/install/install.csproj ================================================================== --- tools/install/install.csproj +++ tools/install/install.csproj @@ -1,129 +1,177 @@ - - - Debug - AnyCPU - 9.0.30729 - 2.0 - {71EED886-B5BF-488E-A4AA-1403E393D224} - WinExe - Properties - install - install - - - 2.0 - - - http://localhost/install/ - true - Web - true - Foreground - 7 - Days - false - false - true - 0 - 1.0.0.%2a - true - false - true - install.exe.manifest - install.ico - - - true - full - false - ..\..\bin\designer\ - TRACE;DEBUG - prompt - 4 - x86 - false - - - none - true - ..\..\bin\designer\ - TRACE - prompt - 4 - 512 - x86 - false - - - - - - - - - - - - Code - - - Form - - - InstallDesigner.cs - - - - - - True - True - Resources.resx - - - Designer - InstallDesigner.cs - - - ResXFileCodeGenerator - Resources.Designer.cs - - - - - - - - - False - .NET Framework 2.0 %28x86%29 - true - - - False - .NET Framework 3.0 %28x86%29 - false - - - False - .NET Framework 3.5 - false - - - - - - - - - - - - + + + + Debug + AnyCPU + 9.0.30729 + 2.0 + {71EED886-B5BF-488E-A4AA-1403E393D224} + WinExe + Properties + install + install + + + 3.5 + + + true + install.exe.manifest + install.ico + v4.0 + Client + http://localhost/install/ + true + Web + true + Foreground + 7 + Days + false + false + true + 0 + 1.0.0.%2a + false + true + + + true + full + false + ..\..\bin\designer\ + TRACE;DEBUG + prompt + 4 + x86 + false + AllRules.ruleset + + + none + true + ..\..\bin\designer\ + TRACE + prompt + 4 + 512 + x86 + false + AllRules.ruleset + + + true + bin\x86\Debug\ + TRACE;DEBUG + full + x86 + ..\..\bin\designer\install.exe.CodeAnalysisLog.xml + true + GlobalSuppressions.cs + false + prompt + AllRules.ruleset + ;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\\Rule Sets + false + ;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\FxCop\\Rules + false + + + bin\ + TRACE + true + x86 + ..\..\bin\designer\install.exe.CodeAnalysisLog.xml + true + GlobalSuppressions.cs + false + prompt + AllRules.ruleset + ;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\\Rule Sets + true + ;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\FxCop\\Rules + true + + + + + + + + + + + + Code + + + Form + + + InstallDesigner.cs + + + + + + True + True + Resources.resx + + + Designer + InstallDesigner.cs + + + ResXFileCodeGenerator + Resources.Designer.cs + + + + + + + + + False + .NET Framework 3.5 SP1 Client Profile + false + + + False + .NET Framework 2.0 %28x86%29 + true + + + False + .NET Framework 3.0 %28x86%29 + false + + + False + .NET Framework 3.5 + false + + + False + .NET Framework 3.5 SP1 + false + + + + + + + + + + + + Index: tools/setup/exe/setup/setup.rc ================================================================== --- tools/setup/exe/setup/setup.rc +++ tools/setup/exe/setup/setup.rc @@ -1,122 +1,122 @@ -// Microsoft Visual C++ generated resource script. -// -#include "resource.h" - -#define APSTUDIO_READONLY_SYMBOLS -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 2 resource. -// -#define APSTUDIO_HIDDEN_SYMBOLS -#include "windows.h" -#undef APSTUDIO_HIDDEN_SYMBOLS - -///////////////////////////////////////////////////////////////////////////// -#undef APSTUDIO_READONLY_SYMBOLS - -///////////////////////////////////////////////////////////////////////////// -// English (U.S.) resources - -#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) -#ifdef _WIN32 -LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US -#pragma code_page(1252) -#endif //_WIN32 - -#ifdef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// TEXTINCLUDE -// - -1 TEXTINCLUDE -BEGIN - "resource.h\0" -END - -2 TEXTINCLUDE -BEGIN - "#define APSTUDIO_HIDDEN_SYMBOLS\r\n" - "#include ""windows.h""\r\n" - "#undef APSTUDIO_HIDDEN_SYMBOLS\r\n" - "\0" -END - -3 TEXTINCLUDE -BEGIN - "\r\n" - "\0" -END - -#endif // APSTUDIO_INVOKED - - -///////////////////////////////////////////////////////////////////////////// -// -// Version -// - -VS_VERSION_INFO VERSIONINFO - FILEVERSION 1,0,66,0 - PRODUCTVERSION 1,0,0,0 - FILEFLAGSMASK 0x17L -#ifdef _DEBUG - FILEFLAGS 0x1L -#else - FILEFLAGS 0x0L -#endif - FILEOS 0x4L - FILETYPE 0x1L - FILESUBTYPE 0x0L -BEGIN - BLOCK "StringFileInfo" - BEGIN - BLOCK "040904b0" - BEGIN - VALUE "Comments", "http://sqlite.phxsoftware.com" - VALUE "FileDescription", "SQLite ADO.NET 2.0/3.5 Setup" - VALUE "FileVersion", "1.0.66.0" - VALUE "InternalName", "setup" - VALUE "LegalCopyright", "Released to the public domain" - VALUE "OriginalFilename", "setup.exe" - VALUE "ProductName", "System.Data.SQLite" - VALUE "ProductVersion", "1.0" - END - END - BLOCK "VarFileInfo" - BEGIN - VALUE "Translation", 0x409, 1200 - END -END - - -///////////////////////////////////////////////////////////////////////////// -// -// Icon -// - -// Icon with lowest ID value placed first to ensure application icon -// remains consistent on all systems. -IDI_SETUP ICON ".\\install.ico" - -///////////////////////////////////////////////////////////////////////////// -// -// MSI -// - -1 MSI "..\\..\\sqlite_setup.msi" -#endif // English (U.S.) resources -///////////////////////////////////////////////////////////////////////////// - - - -#ifndef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 3 resource. -// - - -///////////////////////////////////////////////////////////////////////////// -#endif // not APSTUDIO_INVOKED - +// Microsoft Visual C++ generated resource script. +// +#include "resource.h" + +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 2 resource. +// +#define APSTUDIO_HIDDEN_SYMBOLS +#include "windows.h" +#undef APSTUDIO_HIDDEN_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +// English (U.S.) resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) +#ifdef _WIN32 +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US +#pragma code_page(1252) +#endif //_WIN32 + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +1 TEXTINCLUDE +BEGIN + "resource.h\0" +END + +2 TEXTINCLUDE +BEGIN + "#define APSTUDIO_HIDDEN_SYMBOLS\r\n" + "#include ""windows.h""\r\n" + "#undef APSTUDIO_HIDDEN_SYMBOLS\r\n" + "\0" +END + +3 TEXTINCLUDE +BEGIN + "\r\n" + "\0" +END + +#endif // APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// +// Version +// + +VS_VERSION_INFO VERSIONINFO + FILEVERSION 1,0,66,1 + PRODUCTVERSION 1,0,0,0 + FILEFLAGSMASK 0x17L +#ifdef _DEBUG + FILEFLAGS 0x1L +#else + FILEFLAGS 0x0L +#endif + FILEOS 0x4L + FILETYPE 0x1L + FILESUBTYPE 0x0L +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904b0" + BEGIN + VALUE "Comments", "http://sqlite.phxsoftware.com" + VALUE "FileDescription", "SQLite ADO.NET 4.0 Setup" + VALUE "FileVersion", "1.0.66.1" + VALUE "InternalName", "setup" + VALUE "LegalCopyright", "Released to the public domain" + VALUE "OriginalFilename", "setup.exe" + VALUE "ProductName", "System.Data.SQLite" + VALUE "ProductVersion", "1.0" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x409, 1200 + END +END + + +///////////////////////////////////////////////////////////////////////////// +// +// Icon +// + +// Icon with lowest ID value placed first to ensure application icon +// remains consistent on all systems. +IDI_SETUP ICON ".\\install.ico" + +///////////////////////////////////////////////////////////////////////////// +// +// MSI +// + +1 MSI "..\\..\\sqlite_setup.msi" +#endif // English (U.S.) resources +///////////////////////////////////////////////////////////////////////////// + + + +#ifndef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 3 resource. +// + + +///////////////////////////////////////////////////////////////////////////// +#endif // not APSTUDIO_INVOKED + Index: tools/setup/sqlite_setup.sln ================================================================== --- tools/setup/sqlite_setup.sln +++ tools/setup/sqlite_setup.sln @@ -1,29 +1,26 @@ - -Microsoft Visual Studio Solution File, Format Version 10.00 -# Visual Studio 2008 -Project("{54435603-DBB4-11D2-8724-00A0C9A8B90C}") = "sqlite", "sqlite_setup.vdproj", "{B2C2F7A0-FD29-4249-9AB1-4A38BDA1AB94}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "setup", "exe\setup\setup.vcproj", "{BA304689-521B-4E60-A4B7-09558602C1BC}" - ProjectSection(ProjectDependencies) = postProject - {B2C2F7A0-FD29-4249-9AB1-4A38BDA1AB94} = {B2C2F7A0-FD29-4249-9AB1-4A38BDA1AB94} - EndProjectSection -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Win32 = Debug|Win32 - Release|Win32 = Release|Win32 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {B2C2F7A0-FD29-4249-9AB1-4A38BDA1AB94}.Debug|Win32.ActiveCfg = Debug - {B2C2F7A0-FD29-4249-9AB1-4A38BDA1AB94}.Debug|Win32.Build.0 = Debug - {B2C2F7A0-FD29-4249-9AB1-4A38BDA1AB94}.Release|Win32.ActiveCfg = Release - {B2C2F7A0-FD29-4249-9AB1-4A38BDA1AB94}.Release|Win32.Build.0 = Release - {BA304689-521B-4E60-A4B7-09558602C1BC}.Debug|Win32.ActiveCfg = Debug|Win32 - {BA304689-521B-4E60-A4B7-09558602C1BC}.Debug|Win32.Build.0 = Debug|Win32 - {BA304689-521B-4E60-A4B7-09558602C1BC}.Release|Win32.ActiveCfg = Release|Win32 - {BA304689-521B-4E60-A4B7-09558602C1BC}.Release|Win32.Build.0 = Release|Win32 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal + +Microsoft Visual Studio Solution File, Format Version 11.00 +# Visual Studio 2010 +Project("{54435603-DBB4-11D2-8724-00A0C9A8B90C}") = "sqlite", "sqlite_setup.vdproj", "{B2C2F7A0-FD29-4249-9AB1-4A38BDA1AB94}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "setup", "exe\setup\setup.vcxproj", "{BA304689-521B-4E60-A4B7-09558602C1BC}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Win32 = Debug|Win32 + Release|Win32 = Release|Win32 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {B2C2F7A0-FD29-4249-9AB1-4A38BDA1AB94}.Debug|Win32.ActiveCfg = Debug + {B2C2F7A0-FD29-4249-9AB1-4A38BDA1AB94}.Debug|Win32.Build.0 = Debug + {B2C2F7A0-FD29-4249-9AB1-4A38BDA1AB94}.Release|Win32.ActiveCfg = Release + {B2C2F7A0-FD29-4249-9AB1-4A38BDA1AB94}.Release|Win32.Build.0 = Release + {BA304689-521B-4E60-A4B7-09558602C1BC}.Debug|Win32.ActiveCfg = Debug|Win32 + {BA304689-521B-4E60-A4B7-09558602C1BC}.Debug|Win32.Build.0 = Debug|Win32 + {BA304689-521B-4E60-A4B7-09558602C1BC}.Release|Win32.ActiveCfg = Release|Win32 + {BA304689-521B-4E60-A4B7-09558602C1BC}.Release|Win32.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal Index: tools/setup/sqlite_setup.vdproj ================================================================== --- tools/setup/sqlite_setup.vdproj +++ tools/setup/sqlite_setup.vdproj @@ -1,1965 +1,1737 @@ -"DeployProject" -{ -"VSVersion" = "3:800" -"ProjectType" = "8:{978C614F-708E-4E1A-B201-565925725DBA}" -"IsWebType" = "8:FALSE" -"ProjectName" = "8:sqlite" -"LanguageId" = "3:1033" -"CodePage" = "3:1252" -"UILanguageId" = "3:1033" -"SccProjectName" = "8:" -"SccLocalPath" = "8:" -"SccAuxPath" = "8:" -"SccProvider" = "8:" - "Hierarchy" - { - "Entry" - { - "MsmKey" = "8:_055B2BCD025C40A08F3B155843F41702" - "OwnerKey" = "8:_UNDEFINED" - "MsmSig" = "8:_UNDEFINED" - } - "Entry" - { - "MsmKey" = "8:_17D200EF10AB73D2A0E2D26B279AF28F" - "OwnerKey" = "8:_A7448E608040319F6C5E12637881B1F6" - "MsmSig" = "8:_UNDEFINED" - } - "Entry" - { - "MsmKey" = "8:_1A571C82DAEBE73A54E0D256CAAD80DF" - "OwnerKey" = "8:_3578C7AADEF926410602B18EDBBEFFF9" - "MsmSig" = "8:_UNDEFINED" - } - "Entry" - { - "MsmKey" = "8:_2220AA4B8FC0414FAC08D27E052E7953" - "OwnerKey" = "8:_UNDEFINED" - "MsmSig" = "8:_UNDEFINED" - } - "Entry" - { - "MsmKey" = "8:_244D4945EA335F5E4E54085BFD020CC1" - "OwnerKey" = "8:_A7448E608040319F6C5E12637881B1F6" - "MsmSig" = "8:_UNDEFINED" - } - "Entry" - { - "MsmKey" = "8:_26E74AC417994018832F9B82462AA3AF" - "OwnerKey" = "8:_UNDEFINED" - "MsmSig" = "8:_UNDEFINED" - } - "Entry" - { - "MsmKey" = "8:_2C7EDFF06B61482393D94E3A63D90113" - "OwnerKey" = "8:_UNDEFINED" - "MsmSig" = "8:_UNDEFINED" - } - "Entry" - { - "MsmKey" = "8:_2F1B8EFE95EB431689C8DA9D5BD6B27C" - "OwnerKey" = "8:_UNDEFINED" - "MsmSig" = "8:_UNDEFINED" - } - "Entry" - { - "MsmKey" = "8:_33349D46CCFB4E16A3F7C6CE1FE6F6C9" - "OwnerKey" = "8:_UNDEFINED" - "MsmSig" = "8:_UNDEFINED" - } - "Entry" - { - "MsmKey" = "8:_3578C7AADEF926410602B18EDBBEFFF9" - "OwnerKey" = "8:_244D4945EA335F5E4E54085BFD020CC1" - "MsmSig" = "8:_UNDEFINED" - } - "Entry" - { - "MsmKey" = "8:_40DFF08BA903482D807E715A041CA8B1" - "OwnerKey" = "8:_UNDEFINED" - "MsmSig" = "8:_UNDEFINED" - } - "Entry" - { - "MsmKey" = "8:_40F352185F3B41A485F42BFC64BF9162" - "OwnerKey" = "8:_UNDEFINED" - "MsmSig" = "8:_UNDEFINED" - } - "Entry" - { - "MsmKey" = "8:_5E1053CD325EBB535F3F247A35B38F2F" - "OwnerKey" = "8:_CD3CE5CDAB13405EA6EAAADC95F88D2E" - "MsmSig" = "8:_UNDEFINED" - } - "Entry" - { - "MsmKey" = "8:_5E1053CD325EBB535F3F247A35B38F2F" - "OwnerKey" = "8:_3578C7AADEF926410602B18EDBBEFFF9" - "MsmSig" = "8:_UNDEFINED" - } - "Entry" - { - "MsmKey" = "8:_5E1053CD325EBB535F3F247A35B38F2F" - "OwnerKey" = "8:_244D4945EA335F5E4E54085BFD020CC1" - "MsmSig" = "8:_UNDEFINED" - } - "Entry" - { - "MsmKey" = "8:_5E1053CD325EBB535F3F247A35B38F2F" - "OwnerKey" = "8:_A7448E608040319F6C5E12637881B1F6" - "MsmSig" = "8:_UNDEFINED" - } - "Entry" - { - "MsmKey" = "8:_5E1053CD325EBB535F3F247A35B38F2F" - "OwnerKey" = "8:_D02FA65544C54EDE80CFCBDE5F083939" - "MsmSig" = "8:_UNDEFINED" - } - "Entry" - { - "MsmKey" = "8:_5E1053CD325EBB535F3F247A35B38F2F" - "OwnerKey" = "8:_E6DB5A9B08AC4645A19C948BBFDD0348" - "MsmSig" = "8:_UNDEFINED" - } - "Entry" - { - "MsmKey" = "8:_60C2B7171C4DE2785B2909B93E746B5F" - "OwnerKey" = "8:_A7448E608040319F6C5E12637881B1F6" - "MsmSig" = "8:_UNDEFINED" - } - "Entry" - { - "MsmKey" = "8:_60E2C442F77C48DE8150EBFC86663225" - "OwnerKey" = "8:_UNDEFINED" - "MsmSig" = "8:_UNDEFINED" - } - "Entry" - { - "MsmKey" = "8:_67BCC20EB4B5AFB1D823AF28F05F85EF" - "OwnerKey" = "8:_40F352185F3B41A485F42BFC64BF9162" - "MsmSig" = "8:_UNDEFINED" - } - "Entry" - { - "MsmKey" = "8:_823D5E0236764C498DFE3D984D1920B6" - "OwnerKey" = "8:_UNDEFINED" - "MsmSig" = "8:_UNDEFINED" - } - "Entry" - { - "MsmKey" = "8:_9352653B827F735B8C3BE81D11522ECC" - "OwnerKey" = "8:_B00FB4712154B7A5894294702C96689D" - "MsmSig" = "8:_UNDEFINED" - } - "Entry" - { - "MsmKey" = "8:_A7448E608040319F6C5E12637881B1F6" - "OwnerKey" = "8:_CD3CE5CDAB13405EA6EAAADC95F88D2E" - "MsmSig" = "8:_UNDEFINED" - } - "Entry" - { - "MsmKey" = "8:_B00FB4712154B7A5894294702C96689D" - "OwnerKey" = "8:_A7448E608040319F6C5E12637881B1F6" - "MsmSig" = "8:_UNDEFINED" - } - "Entry" - { - "MsmKey" = "8:_B00FB4712154B7A5894294702C96689D" - "OwnerKey" = "8:_CD3CE5CDAB13405EA6EAAADC95F88D2E" - "MsmSig" = "8:_UNDEFINED" - } - "Entry" - { - "MsmKey" = "8:_B29C75F5F4D24817846DCEF9951068E1" - "OwnerKey" = "8:_UNDEFINED" - "MsmSig" = "8:_UNDEFINED" - } - "Entry" - { - "MsmKey" = "8:_B6156897CBBB4E929D9C1F7358CE9E90" - "OwnerKey" = "8:_UNDEFINED" - "MsmSig" = "8:_UNDEFINED" - } - "Entry" - { - "MsmKey" = "8:_C8E329AC56AD4C88A986481E639F72A5" - "OwnerKey" = "8:_UNDEFINED" - "MsmSig" = "8:_UNDEFINED" - } - "Entry" - { - "MsmKey" = "8:_CCB664E21F5133181FD1271CE9E1806D" - "OwnerKey" = "8:_2C7EDFF06B61482393D94E3A63D90113" - "MsmSig" = "8:_UNDEFINED" - } - "Entry" - { - "MsmKey" = "8:_CCB664E21F5133181FD1271CE9E1806D" - "OwnerKey" = "8:_CE9E3EF0722342DB8DE0860C0DDCD39E" - "MsmSig" = "8:_UNDEFINED" - } - "Entry" - { - "MsmKey" = "8:_CD3CE5CDAB13405EA6EAAADC95F88D2E" - "OwnerKey" = "8:_UNDEFINED" - "MsmSig" = "8:_UNDEFINED" - } - "Entry" - { - "MsmKey" = "8:_CE9E3EF0722342DB8DE0860C0DDCD39E" - "OwnerKey" = "8:_UNDEFINED" - "MsmSig" = "8:_UNDEFINED" - } - "Entry" - { - "MsmKey" = "8:_CEFA203C4DAE4417B0E17113DA2684CD" - "OwnerKey" = "8:_UNDEFINED" - "MsmSig" = "8:_UNDEFINED" - } - "Entry" - { - "MsmKey" = "8:_D02FA65544C54EDE80CFCBDE5F083939" - "OwnerKey" = "8:_E6DB5A9B08AC4645A19C948BBFDD0348" - "MsmSig" = "8:_UNDEFINED" - } - "Entry" - { - "MsmKey" = "8:_D02FA65544C54EDE80CFCBDE5F083939" - "OwnerKey" = "8:_A7448E608040319F6C5E12637881B1F6" - "MsmSig" = "8:_UNDEFINED" - } - "Entry" - { - "MsmKey" = "8:_D02FA65544C54EDE80CFCBDE5F083939" - "OwnerKey" = "8:_244D4945EA335F5E4E54085BFD020CC1" - "MsmSig" = "8:_UNDEFINED" - } - "Entry" - { - "MsmKey" = "8:_D02FA65544C54EDE80CFCBDE5F083939" - "OwnerKey" = "8:_3578C7AADEF926410602B18EDBBEFFF9" - "MsmSig" = "8:_UNDEFINED" - } - "Entry" - { - "MsmKey" = "8:_D7FECFD3C8164DA7B3712AF54D0CDDAD" - "OwnerKey" = "8:_UNDEFINED" - "MsmSig" = "8:_UNDEFINED" - } - "Entry" - { - "MsmKey" = "8:_E6DB5A9B08AC4645A19C948BBFDD0348" - "OwnerKey" = "8:_CD3CE5CDAB13405EA6EAAADC95F88D2E" - "MsmSig" = "8:_UNDEFINED" - } - "Entry" - { - "MsmKey" = "8:_E6DB5A9B08AC4645A19C948BBFDD0348" - "OwnerKey" = "8:_A7448E608040319F6C5E12637881B1F6" - "MsmSig" = "8:_UNDEFINED" - } - "Entry" - { - "MsmKey" = "8:_E6DB5A9B08AC4645A19C948BBFDD0348" - "OwnerKey" = "8:_3578C7AADEF926410602B18EDBBEFFF9" - "MsmSig" = "8:_UNDEFINED" - } - "Entry" - { - "MsmKey" = "8:_E6DB5A9B08AC4645A19C948BBFDD0348" - "OwnerKey" = "8:_244D4945EA335F5E4E54085BFD020CC1" - "MsmSig" = "8:_UNDEFINED" - } - "Entry" - { - "MsmKey" = "8:_UNDEFINED" - "OwnerKey" = "8:_B29C75F5F4D24817846DCEF9951068E1" - "MsmSig" = "8:_UNDEFINED" - } - "Entry" - { - "MsmKey" = "8:_UNDEFINED" - "OwnerKey" = "8:_E6DB5A9B08AC4645A19C948BBFDD0348" - "MsmSig" = "8:_UNDEFINED" - } - "Entry" - { - "MsmKey" = "8:_UNDEFINED" - "OwnerKey" = "8:_D02FA65544C54EDE80CFCBDE5F083939" - "MsmSig" = "8:_UNDEFINED" - } - "Entry" - { - "MsmKey" = "8:_UNDEFINED" - "OwnerKey" = "8:_CE9E3EF0722342DB8DE0860C0DDCD39E" - "MsmSig" = "8:_UNDEFINED" - } - "Entry" - { - "MsmKey" = "8:_UNDEFINED" - "OwnerKey" = "8:_CD3CE5CDAB13405EA6EAAADC95F88D2E" - "MsmSig" = "8:_UNDEFINED" - } - "Entry" - { - "MsmKey" = "8:_UNDEFINED" - "OwnerKey" = "8:_B00FB4712154B7A5894294702C96689D" - "MsmSig" = "8:_UNDEFINED" - } - "Entry" - { - "MsmKey" = "8:_UNDEFINED" - "OwnerKey" = "8:_A7448E608040319F6C5E12637881B1F6" - "MsmSig" = "8:_UNDEFINED" - } - "Entry" - { - "MsmKey" = "8:_UNDEFINED" - "OwnerKey" = "8:_60C2B7171C4DE2785B2909B93E746B5F" - "MsmSig" = "8:_UNDEFINED" - } - "Entry" - { - "MsmKey" = "8:_UNDEFINED" - "OwnerKey" = "8:_5E1053CD325EBB535F3F247A35B38F2F" - "MsmSig" = "8:_UNDEFINED" - } - "Entry" - { - "MsmKey" = "8:_UNDEFINED" - "OwnerKey" = "8:_40F352185F3B41A485F42BFC64BF9162" - "MsmSig" = "8:_UNDEFINED" - } - "Entry" - { - "MsmKey" = "8:_UNDEFINED" - "OwnerKey" = "8:_67BCC20EB4B5AFB1D823AF28F05F85EF" - "MsmSig" = "8:_UNDEFINED" - } - "Entry" - { - "MsmKey" = "8:_UNDEFINED" - "OwnerKey" = "8:_40DFF08BA903482D807E715A041CA8B1" - "MsmSig" = "8:_UNDEFINED" - } - "Entry" - { - "MsmKey" = "8:_UNDEFINED" - "OwnerKey" = "8:_3578C7AADEF926410602B18EDBBEFFF9" - "MsmSig" = "8:_UNDEFINED" - } - "Entry" - { - "MsmKey" = "8:_UNDEFINED" - "OwnerKey" = "8:_2C7EDFF06B61482393D94E3A63D90113" - "MsmSig" = "8:_UNDEFINED" - } - "Entry" - { - "MsmKey" = "8:_UNDEFINED" - "OwnerKey" = "8:_CCB664E21F5133181FD1271CE9E1806D" - "MsmSig" = "8:_UNDEFINED" - } - "Entry" - { - "MsmKey" = "8:_UNDEFINED" - "OwnerKey" = "8:_244D4945EA335F5E4E54085BFD020CC1" - "MsmSig" = "8:_UNDEFINED" - } - "Entry" - { - "MsmKey" = "8:_UNDEFINED" - "OwnerKey" = "8:_1A571C82DAEBE73A54E0D256CAAD80DF" - "MsmSig" = "8:_UNDEFINED" - } - "Entry" - { - "MsmKey" = "8:_UNDEFINED" - "OwnerKey" = "8:_17D200EF10AB73D2A0E2D26B279AF28F" - "MsmSig" = "8:_UNDEFINED" - } - "Entry" - { - "MsmKey" = "8:_UNDEFINED" - "OwnerKey" = "8:_2F1B8EFE95EB431689C8DA9D5BD6B27C" - "MsmSig" = "8:_UNDEFINED" - } - } - "Configurations" - { - "Debug" - { - "DisplayName" = "8:Debug" - "IsDebugOnly" = "11:TRUE" - "IsReleaseOnly" = "11:FALSE" - "OutputFilename" = "8:Debug\\sqlite_setup.msi" - "PackageFilesAs" = "3:4" - "PackageFileSize" = "3:-2147483648" - "CabType" = "3:1" - "Compression" = "3:3" - "SignOutput" = "11:FALSE" - "CertificateFile" = "8:" - "PrivateKeyFile" = "8:" - "TimeStampServer" = "8:" - "InstallerBootstrapper" = "3:2" - "BootstrapperCfg:{63ACBE69-63AA-4F98-B2B6-99F9E24495F2}" - { - "Enabled" = "11:TRUE" - "PromptEnabled" = "11:TRUE" - "PrerequisitesLocation" = "2:1" - "Url" = "8:" - "ComponentsUrl" = "8:" - "Items" - { - } - } - } - "Release" - { - "DisplayName" = "8:Release" - "IsDebugOnly" = "11:FALSE" - "IsReleaseOnly" = "11:TRUE" - "OutputFilename" = "8:sqlite_setup.msi" - "PackageFilesAs" = "3:2" - "PackageFileSize" = "3:-2147483648" - "CabType" = "3:1" - "Compression" = "3:3" - "SignOutput" = "11:FALSE" - "CertificateFile" = "8:" - "PrivateKeyFile" = "8:" - "TimeStampServer" = "8:" - "InstallerBootstrapper" = "3:2" - "BootstrapperCfg:{63ACBE69-63AA-4F98-B2B6-99F9E24495F2}" - { - "Enabled" = "11:FALSE" - "PromptEnabled" = "11:TRUE" - "PrerequisitesLocation" = "2:1" - "Url" = "8:" - "ComponentsUrl" = "8:" - "Items" - { - "{EDC2488A-8267-493A-A98E-7D9C3B36CDF3}:Microsoft.Net.Framework.2.0" - { - "Name" = "8:.NET Framework 2.0" - "ProductCode" = "8:Microsoft.Net.Framework.2.0" - } - } - } - } - } - "Deployable" - { - "CustomAction" - { - "{4AA51A2D-7D85-4A59-BA75-B0809FC8B380}:_70EF89170C604410AAB199512D4194A9" - { - "Name" = "8:install.exe" - "Condition" = "8:" - "Object" = "8:_40DFF08BA903482D807E715A041CA8B1" - "FileType" = "3:2" - "InstallAction" = "3:2" - "Arguments" = "8:" - "EntryPoint" = "8:" - "Sequence" = "3:1" - "Identifier" = "8:_2FB4763D_3341_48AE_8AE5_AC7B45119699" - "InstallerClass" = "11:FALSE" - "CustomActionData" = "8:" - } - "{4AA51A2D-7D85-4A59-BA75-B0809FC8B380}:_C386182ABAD545D288F427FBAFC865FE" - { - "Name" = "8:install.exe" - "Condition" = "8:" - "Object" = "8:_40DFF08BA903482D807E715A041CA8B1" - "FileType" = "3:2" - "InstallAction" = "3:4" - "Arguments" = "8:/remove" - "EntryPoint" = "8:" - "Sequence" = "3:1" - "Identifier" = "8:_F0391075_ECEB_4EA0_9EA9_DA922A93406D" - "InstallerClass" = "11:FALSE" - "CustomActionData" = "8:" - } - } - "DefaultFeature" - { - "Name" = "8:DefaultFeature" - "Title" = "8:" - "Description" = "8:" - } - "ExternalPersistence" - { - "LaunchCondition" - { - "{A06ECF26-33A3-4562-8140-9B0E340D4F24}:_2A5202AB8FA440F9AA45DF7B9C7CEAD5" - { - "Name" = "8:.NET Framework" - "Message" = "8:[VSDNETMSG]" - "Version" = "8:2.0.50727" - "AllowLaterVersions" = "11:TRUE" - "InstallUrl" = "8:http://go.microsoft.com/fwlink/?LinkId=9832" - } - } - } - "File" - { - "{1FB2D0AE-D3B9-43D4-B9DD-F88EC61E35DE}:_055B2BCD025C40A08F3B155843F41702" - { - "SourcePath" = "8:..\\..\\bin\\test.exe.config" - "TargetName" = "8:test.exe.config" - "Tag" = "8:" - "Folder" = "8:_30C77BF2E6E84D01ADE5FB8BA2F81504" - "Condition" = "8:" - "Transitive" = "11:FALSE" - "Vital" = "11:TRUE" - "ReadOnly" = "11:FALSE" - "Hidden" = "11:FALSE" - "System" = "11:FALSE" - "Permanent" = "11:FALSE" - "SharedLegacy" = "11:FALSE" - "PackageAs" = "3:1" - "Register" = "3:1" - "Exclude" = "11:FALSE" - "IsDependency" = "11:FALSE" - "IsolateTo" = "8:" - } - "{9F6F8455-1EF1-4B85-886A-4223BCC8E7F7}:_17D200EF10AB73D2A0E2D26B279AF28F" - { - "AssemblyRegister" = "3:1" - "AssemblyIsInGAC" = "11:TRUE" - "AssemblyAsmDisplayName" = "8:Microsoft.VisualStudio.VSHelp, Version=7.0.3300.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" - "ScatterAssemblies" - { - "_17D200EF10AB73D2A0E2D26B279AF28F" - { - "Name" = "8:Microsoft.VisualStudio.VSHelp.dll" - "Attributes" = "3:512" - } - } - "SourcePath" = "8:Microsoft.VisualStudio.VSHelp.dll" - "TargetName" = "8:" - "Tag" = "8:" - "Folder" = "8:_F11D54EE0EEA4BF59B52E621630B6A2E" - "Condition" = "8:" - "Transitive" = "11:FALSE" - "Vital" = "11:TRUE" - "ReadOnly" = "11:FALSE" - "Hidden" = "11:FALSE" - "System" = "11:FALSE" - "Permanent" = "11:FALSE" - "SharedLegacy" = "11:FALSE" - "PackageAs" = "3:1" - "Register" = "3:1" - "Exclude" = "11:TRUE" - "IsDependency" = "11:TRUE" - "IsolateTo" = "8:" - } - "{9F6F8455-1EF1-4B85-886A-4223BCC8E7F7}:_1A571C82DAEBE73A54E0D256CAAD80DF" - { - "AssemblyRegister" = "3:1" - "AssemblyIsInGAC" = "11:TRUE" - "AssemblyAsmDisplayName" = "8:Microsoft.MSXML, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" - "ScatterAssemblies" - { - "_1A571C82DAEBE73A54E0D256CAAD80DF" - { - "Name" = "8:Microsoft.MSXML.dll" - "Attributes" = "3:512" - } - } - "SourcePath" = "8:Microsoft.MSXML.dll" - "TargetName" = "8:" - "Tag" = "8:" - "Folder" = "8:_F11D54EE0EEA4BF59B52E621630B6A2E" - "Condition" = "8:" - "Transitive" = "11:FALSE" - "Vital" = "11:TRUE" - "ReadOnly" = "11:FALSE" - "Hidden" = "11:FALSE" - "System" = "11:FALSE" - "Permanent" = "11:FALSE" - "SharedLegacy" = "11:FALSE" - "PackageAs" = "3:1" - "Register" = "3:1" - "Exclude" = "11:TRUE" - "IsDependency" = "11:TRUE" - "IsolateTo" = "8:" - } - "{1FB2D0AE-D3B9-43D4-B9DD-F88EC61E35DE}:_2220AA4B8FC0414FAC08D27E052E7953" - { - "SourcePath" = "8:..\\..\\bin\\CompactFramework\\SQLite.Interop.066.DLL" - "TargetName" = "8:SQLite.Interop.066.DLL" - "Tag" = "8:" - "Folder" = "8:_10C8E86E2EEF451BB40F774C35C5466F" - "Condition" = "8:" - "Transitive" = "11:FALSE" - "Vital" = "11:TRUE" - "ReadOnly" = "11:FALSE" - "Hidden" = "11:FALSE" - "System" = "11:FALSE" - "Permanent" = "11:FALSE" - "SharedLegacy" = "11:FALSE" - "PackageAs" = "3:1" - "Register" = "3:1" - "Exclude" = "11:FALSE" - "IsDependency" = "11:FALSE" - "IsolateTo" = "8:" - } - "{9F6F8455-1EF1-4B85-886A-4223BCC8E7F7}:_244D4945EA335F5E4E54085BFD020CC1" - { - "AssemblyRegister" = "3:1" - "AssemblyIsInGAC" = "11:TRUE" - "AssemblyAsmDisplayName" = "8:Microsoft.VisualStudio.Shell.Interop.8.0, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" - "ScatterAssemblies" - { - "_244D4945EA335F5E4E54085BFD020CC1" - { - "Name" = "8:Microsoft.VisualStudio.Shell.Interop.8.0.dll" - "Attributes" = "3:512" - } - } - "SourcePath" = "8:Microsoft.VisualStudio.Shell.Interop.8.0.dll" - "TargetName" = "8:" - "Tag" = "8:" - "Folder" = "8:_F11D54EE0EEA4BF59B52E621630B6A2E" - "Condition" = "8:" - "Transitive" = "11:FALSE" - "Vital" = "11:TRUE" - "ReadOnly" = "11:FALSE" - "Hidden" = "11:FALSE" - "System" = "11:FALSE" - "Permanent" = "11:FALSE" - "SharedLegacy" = "11:FALSE" - "PackageAs" = "3:1" - "Register" = "3:1" - "Exclude" = "11:TRUE" - "IsDependency" = "11:TRUE" - "IsolateTo" = "8:" - } - "{1FB2D0AE-D3B9-43D4-B9DD-F88EC61E35DE}:_26E74AC417994018832F9B82462AA3AF" - { - "SourcePath" = "8:..\\..\\bin\\x64\\System.Data.SQLite.lib" - "TargetName" = "8:System.Data.SQLite.lib" - "Tag" = "8:" - "Folder" = "8:_66DBD0998AA8499691D4F5E42417697D" - "Condition" = "8:" - "Transitive" = "11:FALSE" - "Vital" = "11:TRUE" - "ReadOnly" = "11:FALSE" - "Hidden" = "11:FALSE" - "System" = "11:FALSE" - "Permanent" = "11:FALSE" - "SharedLegacy" = "11:FALSE" - "PackageAs" = "3:1" - "Register" = "3:1" - "Exclude" = "11:FALSE" - "IsDependency" = "11:FALSE" - "IsolateTo" = "8:" - } - "{9F6F8455-1EF1-4B85-886A-4223BCC8E7F7}:_2C7EDFF06B61482393D94E3A63D90113" - { - "AssemblyRegister" = "3:1" - "AssemblyIsInGAC" = "11:FALSE" - "AssemblyAsmDisplayName" = "8:test, Version=1.0.0.27314, Culture=neutral, processorArchitecture=x86" - "ScatterAssemblies" - { - "_2C7EDFF06B61482393D94E3A63D90113" - { - "Name" = "8:test.exe" - "Attributes" = "3:512" - } - } - "SourcePath" = "8:..\\..\\bin\\test.exe" - "TargetName" = "8:" - "Tag" = "8:" - "Folder" = "8:_30C77BF2E6E84D01ADE5FB8BA2F81504" - "Condition" = "8:" - "Transitive" = "11:FALSE" - "Vital" = "11:TRUE" - "ReadOnly" = "11:FALSE" - "Hidden" = "11:FALSE" - "System" = "11:FALSE" - "Permanent" = "11:FALSE" - "SharedLegacy" = "11:FALSE" - "PackageAs" = "3:1" - "Register" = "3:1" - "Exclude" = "11:FALSE" - "IsDependency" = "11:FALSE" - "IsolateTo" = "8:" - } - "{1FB2D0AE-D3B9-43D4-B9DD-F88EC61E35DE}:_2F1B8EFE95EB431689C8DA9D5BD6B27C" - { - "SourcePath" = "8:..\\..\\bin\\itanium\\System.Data.SQLite.DLL" - "TargetName" = "8:System.Data.SQLite.DLL" - "Tag" = "8:" - "Folder" = "8:_0A3DFFBE592540FAA6FF90CCE3B32CA4" - "Condition" = "8:" - "Transitive" = "11:FALSE" - "Vital" = "11:TRUE" - "ReadOnly" = "11:FALSE" - "Hidden" = "11:FALSE" - "System" = "11:FALSE" - "Permanent" = "11:FALSE" - "SharedLegacy" = "11:FALSE" - "PackageAs" = "3:1" - "Register" = "3:1" - "Exclude" = "11:FALSE" - "IsDependency" = "11:FALSE" - "IsolateTo" = "8:" - "AssemblyAsmDisplayName" = "8:System.Data.SQLite, Version=1.0.27.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139, processorArchitecture=IA64" - "AssemblyIsInGAC" = "11:FALSE" - "AssemblyRegister" = "3:1" - "ScatterAssemblies" - { - "_2F1B8EFE95EB431689C8DA9D5BD6B27C" - { - "Attributes" = "3:512" - "Name" = "8:System.Data.SQLite.DLL" - } - } - } - "{1FB2D0AE-D3B9-43D4-B9DD-F88EC61E35DE}:_33349D46CCFB4E16A3F7C6CE1FE6F6C9" - { - "SourcePath" = "8:..\\..\\bin\\System.Data.SQLite.XML" - "TargetName" = "8:System.Data.SQLite.XML" - "Tag" = "8:" - "Folder" = "8:_30C77BF2E6E84D01ADE5FB8BA2F81504" - "Condition" = "8:" - "Transitive" = "11:FALSE" - "Vital" = "11:TRUE" - "ReadOnly" = "11:FALSE" - "Hidden" = "11:FALSE" - "System" = "11:FALSE" - "Permanent" = "11:FALSE" - "SharedLegacy" = "11:FALSE" - "PackageAs" = "3:1" - "Register" = "3:1" - "Exclude" = "11:FALSE" - "IsDependency" = "11:FALSE" - "IsolateTo" = "8:" - } - "{9F6F8455-1EF1-4B85-886A-4223BCC8E7F7}:_3578C7AADEF926410602B18EDBBEFFF9" - { - "AssemblyRegister" = "3:1" - "AssemblyIsInGAC" = "11:TRUE" - "AssemblyAsmDisplayName" = "8:Microsoft.VisualStudio.TextManager.Interop.8.0, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" - "ScatterAssemblies" - { - "_3578C7AADEF926410602B18EDBBEFFF9" - { - "Name" = "8:Microsoft.VisualStudio.TextManager.Interop.8.0.dll" - "Attributes" = "3:512" - } - } - "SourcePath" = "8:Microsoft.VisualStudio.TextManager.Interop.8.0.dll" - "TargetName" = "8:" - "Tag" = "8:" - "Folder" = "8:_F11D54EE0EEA4BF59B52E621630B6A2E" - "Condition" = "8:" - "Transitive" = "11:FALSE" - "Vital" = "11:TRUE" - "ReadOnly" = "11:FALSE" - "Hidden" = "11:FALSE" - "System" = "11:FALSE" - "Permanent" = "11:FALSE" - "SharedLegacy" = "11:FALSE" - "PackageAs" = "3:1" - "Register" = "3:1" - "Exclude" = "11:TRUE" - "IsDependency" = "11:TRUE" - "IsolateTo" = "8:" - } - "{9F6F8455-1EF1-4B85-886A-4223BCC8E7F7}:_40DFF08BA903482D807E715A041CA8B1" - { - "AssemblyRegister" = "3:1" - "AssemblyIsInGAC" = "11:FALSE" - "AssemblyAsmDisplayName" = "8:install, Version=1.0.0.28513, Culture=neutral, processorArchitecture=x86" - "ScatterAssemblies" - { - "_40DFF08BA903482D807E715A041CA8B1" - { - "Name" = "8:install.exe" - "Attributes" = "3:512" - } - } - "SourcePath" = "8:..\\..\\bin\\Designer\\install.exe" - "TargetName" = "8:" - "Tag" = "8:" - "Folder" = "8:_F11D54EE0EEA4BF59B52E621630B6A2E" - "Condition" = "8:" - "Transitive" = "11:FALSE" - "Vital" = "11:TRUE" - "ReadOnly" = "11:FALSE" - "Hidden" = "11:FALSE" - "System" = "11:FALSE" - "Permanent" = "11:FALSE" - "SharedLegacy" = "11:FALSE" - "PackageAs" = "3:1" - "Register" = "3:1" - "Exclude" = "11:FALSE" - "IsDependency" = "11:FALSE" - "IsolateTo" = "8:" - } - "{9F6F8455-1EF1-4B85-886A-4223BCC8E7F7}:_40F352185F3B41A485F42BFC64BF9162" - { - "AssemblyRegister" = "3:1" - "AssemblyIsInGAC" = "11:FALSE" - "AssemblyAsmDisplayName" = "8:testce, Version=1.0.0.27290, Culture=neutral, processorArchitecture=MSIL" - "ScatterAssemblies" - { - "_40F352185F3B41A485F42BFC64BF9162" - { - "Name" = "8:testce.exe" - "Attributes" = "3:512" - } - } - "SourcePath" = "8:..\\..\\bin\\CompactFramework\\testce.exe" - "TargetName" = "8:" - "Tag" = "8:" - "Folder" = "8:_10C8E86E2EEF451BB40F774C35C5466F" - "Condition" = "8:" - "Transitive" = "11:FALSE" - "Vital" = "11:TRUE" - "ReadOnly" = "11:FALSE" - "Hidden" = "11:FALSE" - "System" = "11:FALSE" - "Permanent" = "11:FALSE" - "SharedLegacy" = "11:FALSE" - "PackageAs" = "3:1" - "Register" = "3:1" - "Exclude" = "11:FALSE" - "IsDependency" = "11:FALSE" - "IsolateTo" = "8:" - } - "{9F6F8455-1EF1-4B85-886A-4223BCC8E7F7}:_5E1053CD325EBB535F3F247A35B38F2F" - { - "AssemblyRegister" = "3:1" - "AssemblyIsInGAC" = "11:TRUE" - "AssemblyAsmDisplayName" = "8:Microsoft.VisualStudio.OLE.Interop, Version=7.1.40304.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" - "ScatterAssemblies" - { - "_5E1053CD325EBB535F3F247A35B38F2F" - { - "Name" = "8:Microsoft.VisualStudio.OLE.Interop.dll" - "Attributes" = "3:512" - } - } - "SourcePath" = "8:Microsoft.VisualStudio.OLE.Interop.dll" - "TargetName" = "8:" - "Tag" = "8:" - "Folder" = "8:_F11D54EE0EEA4BF59B52E621630B6A2E" - "Condition" = "8:" - "Transitive" = "11:FALSE" - "Vital" = "11:TRUE" - "ReadOnly" = "11:FALSE" - "Hidden" = "11:FALSE" - "System" = "11:FALSE" - "Permanent" = "11:FALSE" - "SharedLegacy" = "11:FALSE" - "PackageAs" = "3:1" - "Register" = "3:1" - "Exclude" = "11:TRUE" - "IsDependency" = "11:TRUE" - "IsolateTo" = "8:" - } - "{9F6F8455-1EF1-4B85-886A-4223BCC8E7F7}:_60C2B7171C4DE2785B2909B93E746B5F" - { - "AssemblyRegister" = "3:1" - "AssemblyIsInGAC" = "11:TRUE" - "AssemblyAsmDisplayName" = "8:Microsoft.VisualStudio.ProjectAggregator, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" - "ScatterAssemblies" - { - "_60C2B7171C4DE2785B2909B93E746B5F" - { - "Name" = "8:Microsoft.VisualStudio.ProjectAggregator.dll" - "Attributes" = "3:512" - } - } - "SourcePath" = "8:Microsoft.VisualStudio.ProjectAggregator.dll" - "TargetName" = "8:" - "Tag" = "8:" - "Folder" = "8:_F11D54EE0EEA4BF59B52E621630B6A2E" - "Condition" = "8:" - "Transitive" = "11:FALSE" - "Vital" = "11:TRUE" - "ReadOnly" = "11:FALSE" - "Hidden" = "11:FALSE" - "System" = "11:FALSE" - "Permanent" = "11:FALSE" - "SharedLegacy" = "11:FALSE" - "PackageAs" = "3:1" - "Register" = "3:1" - "Exclude" = "11:TRUE" - "IsDependency" = "11:TRUE" - "IsolateTo" = "8:" - } - "{1FB2D0AE-D3B9-43D4-B9DD-F88EC61E35DE}:_60E2C442F77C48DE8150EBFC86663225" - { - "SourcePath" = "8:..\\..\\Doc\\SQLite.NET.chm" - "TargetName" = "8:SQLite.NET.chm" - "Tag" = "8:" - "Folder" = "8:_CA5E61837F5B452B8169C698979CF05C" - "Condition" = "8:" - "Transitive" = "11:FALSE" - "Vital" = "11:TRUE" - "ReadOnly" = "11:FALSE" - "Hidden" = "11:FALSE" - "System" = "11:FALSE" - "Permanent" = "11:FALSE" - "SharedLegacy" = "11:FALSE" - "PackageAs" = "3:1" - "Register" = "3:1" - "Exclude" = "11:FALSE" - "IsDependency" = "11:FALSE" - "IsolateTo" = "8:" - } - "{9F6F8455-1EF1-4B85-886A-4223BCC8E7F7}:_67BCC20EB4B5AFB1D823AF28F05F85EF" - { - "AssemblyRegister" = "3:1" - "AssemblyIsInGAC" = "11:FALSE" - "AssemblyAsmDisplayName" = "8:System.Data.SQLite, Version=1.0.66.0, Culture=neutral, PublicKeyToken=1fdb50b1b62b4c84, processorArchitecture=MSIL" - "ScatterAssemblies" - { - "_67BCC20EB4B5AFB1D823AF28F05F85EF" - { - "Name" = "8:System.Data.SQLite.DLL" - "Attributes" = "3:512" - } - } - "SourcePath" = "8:System.Data.SQLite.DLL" - "TargetName" = "8:" - "Tag" = "8:" - "Folder" = "8:_10C8E86E2EEF451BB40F774C35C5466F" - "Condition" = "8:" - "Transitive" = "11:FALSE" - "Vital" = "11:TRUE" - "ReadOnly" = "11:FALSE" - "Hidden" = "11:FALSE" - "System" = "11:FALSE" - "Permanent" = "11:FALSE" - "SharedLegacy" = "11:FALSE" - "PackageAs" = "3:1" - "Register" = "3:1" - "Exclude" = "11:FALSE" - "IsDependency" = "11:TRUE" - "IsolateTo" = "8:" - } - "{1FB2D0AE-D3B9-43D4-B9DD-F88EC61E35DE}:_823D5E0236764C498DFE3D984D1920B6" - { - "SourcePath" = "8:..\\..\\bin\\CompactFramework\\SQLite.Interop.066.lib" - "TargetName" = "8:SQLite.Interop.066.lib" - "Tag" = "8:" - "Folder" = "8:_10C8E86E2EEF451BB40F774C35C5466F" - "Condition" = "8:" - "Transitive" = "11:FALSE" - "Vital" = "11:TRUE" - "ReadOnly" = "11:FALSE" - "Hidden" = "11:FALSE" - "System" = "11:FALSE" - "Permanent" = "11:FALSE" - "SharedLegacy" = "11:FALSE" - "PackageAs" = "3:1" - "Register" = "3:1" - "Exclude" = "11:FALSE" - "IsDependency" = "11:FALSE" - "IsolateTo" = "8:" - } - "{1FB2D0AE-D3B9-43D4-B9DD-F88EC61E35DE}:_9352653B827F735B8C3BE81D11522ECC" - { - "SourcePath" = "8:dte80a.olb" - "TargetName" = "8:dte80a.olb" - "Tag" = "8:" - "Folder" = "8:_F11D54EE0EEA4BF59B52E621630B6A2E" - "Condition" = "8:" - "Transitive" = "11:FALSE" - "Vital" = "11:TRUE" - "ReadOnly" = "11:FALSE" - "Hidden" = "11:FALSE" - "System" = "11:FALSE" - "Permanent" = "11:FALSE" - "SharedLegacy" = "11:FALSE" - "PackageAs" = "3:1" - "Register" = "3:1" - "Exclude" = "11:TRUE" - "IsDependency" = "11:TRUE" - "IsolateTo" = "8:" - } - "{9F6F8455-1EF1-4B85-886A-4223BCC8E7F7}:_A7448E608040319F6C5E12637881B1F6" - { - "AssemblyRegister" = "3:1" - "AssemblyIsInGAC" = "11:TRUE" - "AssemblyAsmDisplayName" = "8:Microsoft.VisualStudio.Shell, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" - "ScatterAssemblies" - { - "_A7448E608040319F6C5E12637881B1F6" - { - "Name" = "8:Microsoft.VisualStudio.Shell.dll" - "Attributes" = "3:512" - } - } - "SourcePath" = "8:Microsoft.VisualStudio.Shell.dll" - "TargetName" = "8:" - "Tag" = "8:" - "Folder" = "8:_F11D54EE0EEA4BF59B52E621630B6A2E" - "Condition" = "8:" - "Transitive" = "11:FALSE" - "Vital" = "11:TRUE" - "ReadOnly" = "11:FALSE" - "Hidden" = "11:FALSE" - "System" = "11:FALSE" - "Permanent" = "11:FALSE" - "SharedLegacy" = "11:FALSE" - "PackageAs" = "3:1" - "Register" = "3:1" - "Exclude" = "11:TRUE" - "IsDependency" = "11:TRUE" - "IsolateTo" = "8:" - } - "{9F6F8455-1EF1-4B85-886A-4223BCC8E7F7}:_B00FB4712154B7A5894294702C96689D" - { - "AssemblyRegister" = "3:1" - "AssemblyIsInGAC" = "11:TRUE" - "AssemblyAsmDisplayName" = "8:EnvDTE, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" - "ScatterAssemblies" - { - "_B00FB4712154B7A5894294702C96689D" - { - "Name" = "8:EnvDTE.dll" - "Attributes" = "3:512" - } - } - "SourcePath" = "8:EnvDTE.dll" - "TargetName" = "8:" - "Tag" = "8:" - "Folder" = "8:_F11D54EE0EEA4BF59B52E621630B6A2E" - "Condition" = "8:" - "Transitive" = "11:FALSE" - "Vital" = "11:TRUE" - "ReadOnly" = "11:FALSE" - "Hidden" = "11:FALSE" - "System" = "11:FALSE" - "Permanent" = "11:FALSE" - "SharedLegacy" = "11:FALSE" - "PackageAs" = "3:1" - "Register" = "3:1" - "Exclude" = "11:TRUE" - "IsDependency" = "11:TRUE" - "IsolateTo" = "8:" - } - "{1FB2D0AE-D3B9-43D4-B9DD-F88EC61E35DE}:_B29C75F5F4D24817846DCEF9951068E1" - { - "SourcePath" = "8:..\\..\\bin\\x64\\System.Data.SQLite.DLL" - "TargetName" = "8:System.Data.SQLite.DLL" - "Tag" = "8:" - "Folder" = "8:_66DBD0998AA8499691D4F5E42417697D" - "Condition" = "8:" - "Transitive" = "11:FALSE" - "Vital" = "11:TRUE" - "ReadOnly" = "11:FALSE" - "Hidden" = "11:FALSE" - "System" = "11:FALSE" - "Permanent" = "11:FALSE" - "SharedLegacy" = "11:FALSE" - "PackageAs" = "3:1" - "Register" = "3:1" - "Exclude" = "11:FALSE" - "IsDependency" = "11:FALSE" - "IsolateTo" = "8:" - "AssemblyAsmDisplayName" = "8:System.Data.SQLite, Version=1.0.27.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139, processorArchitecture=AMD64" - "AssemblyIsInGAC" = "11:FALSE" - "AssemblyRegister" = "3:1" - "ScatterAssemblies" - { - "_B29C75F5F4D24817846DCEF9951068E1" - { - "Attributes" = "3:512" - "Name" = "8:System.Data.SQLite.DLL" - } - } - } - "{1FB2D0AE-D3B9-43D4-B9DD-F88EC61E35DE}:_B6156897CBBB4E929D9C1F7358CE9E90" - { - "SourcePath" = "8:topband.jpg" - "TargetName" = "8:topband.jpg" - "Tag" = "8:" - "Folder" = "8:_A0841E79B7874F7288672343934C7657" - "Condition" = "8:" - "Transitive" = "11:FALSE" - "Vital" = "11:TRUE" - "ReadOnly" = "11:FALSE" - "Hidden" = "11:FALSE" - "System" = "11:FALSE" - "Permanent" = "11:FALSE" - "SharedLegacy" = "11:FALSE" - "PackageAs" = "3:1" - "Register" = "3:1" - "Exclude" = "11:TRUE" - "IsDependency" = "11:FALSE" - "IsolateTo" = "8:" - } - "{1FB2D0AE-D3B9-43D4-B9DD-F88EC61E35DE}:_C8E329AC56AD4C88A986481E639F72A5" - { - "SourcePath" = "8:..\\..\\readme.htm" - "TargetName" = "8:readme.htm" - "Tag" = "8:" - "Folder" = "8:_A0841E79B7874F7288672343934C7657" - "Condition" = "8:" - "Transitive" = "11:FALSE" - "Vital" = "11:TRUE" - "ReadOnly" = "11:FALSE" - "Hidden" = "11:FALSE" - "System" = "11:FALSE" - "Permanent" = "11:FALSE" - "SharedLegacy" = "11:FALSE" - "PackageAs" = "3:1" - "Register" = "3:1" - "Exclude" = "11:FALSE" - "IsDependency" = "11:FALSE" - "IsolateTo" = "8:" - } - "{9F6F8455-1EF1-4B85-886A-4223BCC8E7F7}:_CCB664E21F5133181FD1271CE9E1806D" - { - "AssemblyRegister" = "3:1" - "AssemblyIsInGAC" = "11:FALSE" - "AssemblyAsmDisplayName" = "8:System.Data.SQLite, Version=1.0.66.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139, processorArchitecture=x86" - "ScatterAssemblies" - { - "_CCB664E21F5133181FD1271CE9E1806D" - { - "Name" = "8:System.Data.SQLite.DLL" - "Attributes" = "3:512" - } - } - "SourcePath" = "8:System.Data.SQLite.DLL" - "TargetName" = "8:" - "Tag" = "8:" - "Folder" = "8:_30C77BF2E6E84D01ADE5FB8BA2F81504" - "Condition" = "8:" - "Transitive" = "11:FALSE" - "Vital" = "11:TRUE" - "ReadOnly" = "11:FALSE" - "Hidden" = "11:FALSE" - "System" = "11:FALSE" - "Permanent" = "11:FALSE" - "SharedLegacy" = "11:FALSE" - "PackageAs" = "3:1" - "Register" = "3:1" - "Exclude" = "11:FALSE" - "IsDependency" = "11:TRUE" - "IsolateTo" = "8:" - } - "{9F6F8455-1EF1-4B85-886A-4223BCC8E7F7}:_CD3CE5CDAB13405EA6EAAADC95F88D2E" - { - "AssemblyRegister" = "3:1" - "AssemblyIsInGAC" = "11:FALSE" - "AssemblyAsmDisplayName" = "8:SQLite.Designer, Version=1.0.37.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139, processorArchitecture=x86" - "ScatterAssemblies" - { - "_CD3CE5CDAB13405EA6EAAADC95F88D2E" - { - "Name" = "8:SQLite.Designer.dll" - "Attributes" = "3:512" - } - } - "SourcePath" = "8:..\\..\\bin\\Designer\\SQLite.Designer.dll" - "TargetName" = "8:" - "Tag" = "8:" - "Folder" = "8:_F11D54EE0EEA4BF59B52E621630B6A2E" - "Condition" = "8:" - "Transitive" = "11:FALSE" - "Vital" = "11:TRUE" - "ReadOnly" = "11:FALSE" - "Hidden" = "11:FALSE" - "System" = "11:FALSE" - "Permanent" = "11:FALSE" - "SharedLegacy" = "11:FALSE" - "PackageAs" = "3:1" - "Register" = "3:1" - "Exclude" = "11:FALSE" - "IsDependency" = "11:FALSE" - "IsolateTo" = "8:" - } - "{9F6F8455-1EF1-4B85-886A-4223BCC8E7F7}:_CE9E3EF0722342DB8DE0860C0DDCD39E" - { - "AssemblyRegister" = "3:1" - "AssemblyIsInGAC" = "11:FALSE" - "AssemblyAsmDisplayName" = "8:System.Data.SQLite.Linq, Version=2.0.38.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139, processorArchitecture=MSIL" - "ScatterAssemblies" - { - "_CE9E3EF0722342DB8DE0860C0DDCD39E" - { - "Name" = "8:System.Data.SQLite.Linq.dll" - "Attributes" = "3:512" - } - } - "SourcePath" = "8:..\\..\\bin\\System.Data.SQLite.Linq.dll" - "TargetName" = "8:" - "Tag" = "8:" - "Folder" = "8:_30C77BF2E6E84D01ADE5FB8BA2F81504" - "Condition" = "8:" - "Transitive" = "11:FALSE" - "Vital" = "11:TRUE" - "ReadOnly" = "11:FALSE" - "Hidden" = "11:FALSE" - "System" = "11:FALSE" - "Permanent" = "11:FALSE" - "SharedLegacy" = "11:FALSE" - "PackageAs" = "3:1" - "Register" = "3:1" - "Exclude" = "11:FALSE" - "IsDependency" = "11:FALSE" - "IsolateTo" = "8:" - } - "{1FB2D0AE-D3B9-43D4-B9DD-F88EC61E35DE}:_CEFA203C4DAE4417B0E17113DA2684CD" - { - "SourcePath" = "8:..\\..\\bin\\itanium\\System.Data.SQLite.lib" - "TargetName" = "8:System.Data.SQLite.lib" - "Tag" = "8:" - "Folder" = "8:_0A3DFFBE592540FAA6FF90CCE3B32CA4" - "Condition" = "8:" - "Transitive" = "11:FALSE" - "Vital" = "11:TRUE" - "ReadOnly" = "11:FALSE" - "Hidden" = "11:FALSE" - "System" = "11:FALSE" - "Permanent" = "11:FALSE" - "SharedLegacy" = "11:FALSE" - "PackageAs" = "3:1" - "Register" = "3:1" - "Exclude" = "11:FALSE" - "IsDependency" = "11:FALSE" - "IsolateTo" = "8:" - } - "{9F6F8455-1EF1-4B85-886A-4223BCC8E7F7}:_D02FA65544C54EDE80CFCBDE5F083939" - { - "AssemblyRegister" = "3:1" - "AssemblyIsInGAC" = "11:TRUE" - "AssemblyAsmDisplayName" = "8:Microsoft.VisualStudio.TextManager.Interop, Version=7.1.40304.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" - "ScatterAssemblies" - { - "_D02FA65544C54EDE80CFCBDE5F083939" - { - "Name" = "8:Microsoft.VisualStudio.TextManager.Interop.dll" - "Attributes" = "3:512" - } - } - "SourcePath" = "8:Microsoft.VisualStudio.TextManager.Interop.dll" - "TargetName" = "8:" - "Tag" = "8:" - "Folder" = "8:_F11D54EE0EEA4BF59B52E621630B6A2E" - "Condition" = "8:" - "Transitive" = "11:FALSE" - "Vital" = "11:TRUE" - "ReadOnly" = "11:FALSE" - "Hidden" = "11:FALSE" - "System" = "11:FALSE" - "Permanent" = "11:FALSE" - "SharedLegacy" = "11:FALSE" - "PackageAs" = "3:1" - "Register" = "3:1" - "Exclude" = "11:TRUE" - "IsDependency" = "11:TRUE" - "IsolateTo" = "8:" - } - "{1FB2D0AE-D3B9-43D4-B9DD-F88EC61E35DE}:_D7FECFD3C8164DA7B3712AF54D0CDDAD" - { - "SourcePath" = "8:..\\..\\bin\\System.Data.SQLite.lib" - "TargetName" = "8:System.Data.SQLite.lib" - "Tag" = "8:" - "Folder" = "8:_30C77BF2E6E84D01ADE5FB8BA2F81504" - "Condition" = "8:" - "Transitive" = "11:FALSE" - "Vital" = "11:TRUE" - "ReadOnly" = "11:FALSE" - "Hidden" = "11:FALSE" - "System" = "11:FALSE" - "Permanent" = "11:FALSE" - "SharedLegacy" = "11:FALSE" - "PackageAs" = "3:1" - "Register" = "3:1" - "Exclude" = "11:FALSE" - "IsDependency" = "11:FALSE" - "IsolateTo" = "8:" - } - "{9F6F8455-1EF1-4B85-886A-4223BCC8E7F7}:_E6DB5A9B08AC4645A19C948BBFDD0348" - { - "AssemblyRegister" = "3:1" - "AssemblyIsInGAC" = "11:TRUE" - "AssemblyAsmDisplayName" = "8:Microsoft.VisualStudio.Shell.Interop, Version=7.1.40304.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" - "ScatterAssemblies" - { - "_E6DB5A9B08AC4645A19C948BBFDD0348" - { - "Name" = "8:Microsoft.VisualStudio.Shell.Interop.dll" - "Attributes" = "3:512" - } - } - "SourcePath" = "8:Microsoft.VisualStudio.Shell.Interop.dll" - "TargetName" = "8:" - "Tag" = "8:" - "Folder" = "8:_F11D54EE0EEA4BF59B52E621630B6A2E" - "Condition" = "8:" - "Transitive" = "11:FALSE" - "Vital" = "11:TRUE" - "ReadOnly" = "11:FALSE" - "Hidden" = "11:FALSE" - "System" = "11:FALSE" - "Permanent" = "11:FALSE" - "SharedLegacy" = "11:FALSE" - "PackageAs" = "3:1" - "Register" = "3:1" - "Exclude" = "11:TRUE" - "IsDependency" = "11:TRUE" - "IsolateTo" = "8:" - } - } - "FileType" - { - } - "Folder" - { - "{3C67513D-01DD-4637-8A68-80971EB9504F}:_A0841E79B7874F7288672343934C7657" - { - "DefaultLocation" = "8:[ProgramFilesFolder]SQLite.NET" - "Name" = "8:#1925" - "AlwaysCreate" = "11:FALSE" - "Condition" = "8:" - "Transitive" = "11:FALSE" - "Property" = "8:TARGETDIR" - "Folders" - { - "{9EF0B969-E518-4E46-987F-47570745A589}:_30C77BF2E6E84D01ADE5FB8BA2F81504" - { - "Name" = "8:bin" - "AlwaysCreate" = "11:FALSE" - "Condition" = "8:" - "Transitive" = "11:FALSE" - "Property" = "8:_BD4105DB73B04559A56BB70C4E151056" - "Folders" - { - "{9EF0B969-E518-4E46-987F-47570745A589}:_0A3DFFBE592540FAA6FF90CCE3B32CA4" - { - "Name" = "8:Itanium" - "AlwaysCreate" = "11:FALSE" - "Condition" = "8:" - "Transitive" = "11:FALSE" - "Property" = "8:_A0744D082A534C0D8F343965933775F9" - "Folders" - { - } - } - "{9EF0B969-E518-4E46-987F-47570745A589}:_10C8E86E2EEF451BB40F774C35C5466F" - { - "Name" = "8:CompactFramework" - "AlwaysCreate" = "11:FALSE" - "Condition" = "8:" - "Transitive" = "11:FALSE" - "Property" = "8:_ADFF37E4EEE146F2AE9609C07339779A" - "Folders" - { - } - } - "{9EF0B969-E518-4E46-987F-47570745A589}:_66DBD0998AA8499691D4F5E42417697D" - { - "Name" = "8:x64" - "AlwaysCreate" = "11:FALSE" - "Condition" = "8:" - "Transitive" = "11:FALSE" - "Property" = "8:_7C07DE0299AB478C8BC7AFB40E220305" - "Folders" - { - } - } - "{9EF0B969-E518-4E46-987F-47570745A589}:_F11D54EE0EEA4BF59B52E621630B6A2E" - { - "Name" = "8:Designer" - "AlwaysCreate" = "11:FALSE" - "Condition" = "8:" - "Transitive" = "11:FALSE" - "Property" = "8:_CA865020181A40EEB518ACF5F89BD66A" - "Folders" - { - } - } - } - } - "{9EF0B969-E518-4E46-987F-47570745A589}:_CA5E61837F5B452B8169C698979CF05C" - { - "Name" = "8:Doc" - "AlwaysCreate" = "11:FALSE" - "Condition" = "8:" - "Transitive" = "11:FALSE" - "Property" = "8:_B787482AA405492D998CAAD43761AF61" - "Folders" - { - } - } - } - } - "{1525181F-901A-416C-8A58-119130FE478E}:_AB7F365F78A44DE79C7007FB08F7343E" - { - "Name" = "8:#1916" - "AlwaysCreate" = "11:FALSE" - "Condition" = "8:" - "Transitive" = "11:FALSE" - "Property" = "8:DesktopFolder" - "Folders" - { - } - } - "{1525181F-901A-416C-8A58-119130FE478E}:_E420345AA61B4AF780EEA7BC8AFAF268" - { - "Name" = "8:#1919" - "AlwaysCreate" = "11:FALSE" - "Condition" = "8:" - "Transitive" = "11:FALSE" - "Property" = "8:ProgramMenuFolder" - "Folders" - { - "{9EF0B969-E518-4E46-987F-47570745A589}:_1B562A9F876E47058AB813C418E24FBF" - { - "Name" = "8:SQLite.NET" - "AlwaysCreate" = "11:FALSE" - "Condition" = "8:" - "Transitive" = "11:FALSE" - "Property" = "8:_85ED61DA38214E1C9AB39E119A89D75B" - "Folders" - { - } - } - } - } - } - "LaunchCondition" - { - } - "Locator" - { - } - "MsiBootstrapper" - { - "LangId" = "3:1033" - "RequiresElevation" = "11:FALSE" - } - "Product" - { - "Name" = "8:Microsoft Visual Studio" - "ProductName" = "8:SQLite ADO.NET 2.0/3.5 Provider" - "ProductCode" = "8:{00257FA9-3622-45E4-8B4B-A792CC5169EB}" - "PackageCode" = "8:{BCF9616D-927F-4004-8AC3-9A126619FE25}" - "UpgradeCode" = "8:{78329A82-AFB1-453B-AF00-D46AC911DA89}" - "RestartWWWService" = "11:FALSE" - "RemovePreviousVersions" = "11:TRUE" - "DetectNewerInstalledVersion" = "11:TRUE" - "InstallAllUsers" = "11:TRUE" - "ProductVersion" = "8:1.066.0" - "Manufacturer" = "8:Phoenix Software Solutions, LLC" - "ARPHELPTELEPHONE" = "8:" - "ARPHELPLINK" = "8:http://sqlite.phxsoftware.com" - "Title" = "8:SQLite ADO.NET 2.0/3.5 Provider" - "Subject" = "8:" - "ARPCONTACT" = "8:Phoenix Software Solutions, LLC" - "Keywords" = "8:" - "ARPCOMMENTS" = "8:" - "ARPURLINFOABOUT" = "8:" - "ARPPRODUCTICON" = "8:" - "ARPIconIndex" = "3:0" - "SearchPath" = "8:" - "UseSystemSearchPath" = "11:TRUE" - "TargetPlatform" = "3:0" - "PreBuildEvent" = "8:" - "PostBuildEvent" = "8:" - "RunPostBuildEvent" = "3:0" - } - "Registry" - { - "HKLM" - { - "Keys" - { - } - } - "HKCU" - { - "Keys" - { - } - } - "HKCR" - { - "Keys" - { - } - } - "HKU" - { - "Keys" - { - } - } - "HKPU" - { - "Keys" - { - } - } - } - "Sequences" - { - } - "Shortcut" - { - "{970C0BB2-C7D0-45D7-ABFA-7EC378858BC0}:_1D4C9AFDF229479AABE410DD0C754667" - { - "Name" = "8:Design-Time Configuration" - "Arguments" = "8:" - "Description" = "8:" - "ShowCmd" = "3:1" - "IconIndex" = "3:32512" - "Transitive" = "11:FALSE" - "Target" = "8:_40DFF08BA903482D807E715A041CA8B1" - "Folder" = "8:_1B562A9F876E47058AB813C418E24FBF" - "WorkingFolder" = "8:_F11D54EE0EEA4BF59B52E621630B6A2E" - "Icon" = "8:_40DFF08BA903482D807E715A041CA8B1" - "Feature" = "8:" - } - "{970C0BB2-C7D0-45D7-ABFA-7EC378858BC0}:_920202B002F9475288A945B0C8361A44" - { - "Name" = "8:SQLite Test Application" - "Arguments" = "8:" - "Description" = "8:" - "ShowCmd" = "3:1" - "IconIndex" = "3:0" - "Transitive" = "11:FALSE" - "Target" = "8:_2C7EDFF06B61482393D94E3A63D90113" - "Folder" = "8:_1B562A9F876E47058AB813C418E24FBF" - "WorkingFolder" = "8:_30C77BF2E6E84D01ADE5FB8BA2F81504" - "Icon" = "8:" - "Feature" = "8:" - } - "{970C0BB2-C7D0-45D7-ABFA-7EC378858BC0}:_CC64AEB6D8A643F7BC8EB95EBC803EB5" - { - "Name" = "8:Help" - "Arguments" = "8:" - "Description" = "8:" - "ShowCmd" = "3:1" - "IconIndex" = "3:0" - "Transitive" = "11:FALSE" - "Target" = "8:_60E2C442F77C48DE8150EBFC86663225" - "Folder" = "8:_1B562A9F876E47058AB813C418E24FBF" - "WorkingFolder" = "8:_CA5E61837F5B452B8169C698979CF05C" - "Icon" = "8:" - "Feature" = "8:" - } - } - "UserInterface" - { - "{2479F3F5-0309-486D-8047-8187E2CE5BA0}:_027E806A39AD4FCD8E7A4EBE86AD3DF3" - { - "UseDynamicProperties" = "11:FALSE" - "IsDependency" = "11:FALSE" - "SourcePath" = "8:\\VsdUserInterface.wim" - } - "{DF760B10-853B-4699-99F2-AFF7185B4A62}:_349E960F62F043E79FD080CB87E24922" - { - "Name" = "8:#1902" - "Sequence" = "3:2" - "Attributes" = "3:3" - "Dialogs" - { - "{688940B3-5CA9-4162-8DEE-2993FA9D8CBC}:_F1CAA16A464043FBB06804165AB31D0C" - { - "Sequence" = "3:100" - "DisplayName" = "8:Finished" - "UseDynamicProperties" = "11:TRUE" - "IsDependency" = "11:FALSE" - "SourcePath" = "8:\\VsdAdminFinishedDlg.wid" - "Properties" - { - "BannerBitmap" - { - "Name" = "8:BannerBitmap" - "DisplayName" = "8:#1001" - "Description" = "8:#1101" - "Type" = "3:8" - "ContextData" = "8:Bitmap" - "Attributes" = "3:4" - "Setting" = "3:2" - "Value" = "8:_B6156897CBBB4E929D9C1F7358CE9E90" - "UsePlugInResources" = "11:TRUE" - } - } - } - } - } - "{DF760B10-853B-4699-99F2-AFF7185B4A62}:_3CB3696DF5D54FCA98E2BF3D4579451E" - { - "Name" = "8:#1901" - "Sequence" = "3:1" - "Attributes" = "3:2" - "Dialogs" - { - "{688940B3-5CA9-4162-8DEE-2993FA9D8CBC}:_1DBE83588B574F75A6233D46A3234D69" - { - "Sequence" = "3:100" - "DisplayName" = "8:Progress" - "UseDynamicProperties" = "11:TRUE" - "IsDependency" = "11:FALSE" - "SourcePath" = "8:\\VsdProgressDlg.wid" - "Properties" - { - "BannerBitmap" - { - "Name" = "8:BannerBitmap" - "DisplayName" = "8:#1001" - "Description" = "8:#1101" - "Type" = "3:8" - "ContextData" = "8:Bitmap" - "Attributes" = "3:4" - "Setting" = "3:2" - "Value" = "8:_B6156897CBBB4E929D9C1F7358CE9E90" - "UsePlugInResources" = "11:TRUE" - } - "ShowProgress" - { - "Name" = "8:ShowProgress" - "DisplayName" = "8:#1009" - "Description" = "8:#1109" - "Type" = "3:5" - "ContextData" = "8:1;True=1;False=0" - "Attributes" = "3:0" - "Setting" = "3:0" - "Value" = "3:1" - "DefaultValue" = "3:1" - "UsePlugInResources" = "11:TRUE" - } - } - } - } - } - "{DF760B10-853B-4699-99F2-AFF7185B4A62}:_573543E04AA54E9387CD1AAF21220444" - { - "Name" = "8:#1902" - "Sequence" = "3:1" - "Attributes" = "3:3" - "Dialogs" - { - "{688940B3-5CA9-4162-8DEE-2993FA9D8CBC}:_991B7280E37E4C23A54CC7027F774891" - { - "Sequence" = "3:100" - "DisplayName" = "8:Finished" - "UseDynamicProperties" = "11:TRUE" - "IsDependency" = "11:FALSE" - "SourcePath" = "8:\\VsdFinishedDlg.wid" - "Properties" - { - "BannerBitmap" - { - "Name" = "8:BannerBitmap" - "DisplayName" = "8:#1001" - "Description" = "8:#1101" - "Type" = "3:8" - "ContextData" = "8:Bitmap" - "Attributes" = "3:4" - "Setting" = "3:2" - "Value" = "8:_B6156897CBBB4E929D9C1F7358CE9E90" - "UsePlugInResources" = "11:TRUE" - } - "UpdateText" - { - "Name" = "8:UpdateText" - "DisplayName" = "8:#1058" - "Description" = "8:#1158" - "Type" = "3:15" - "ContextData" = "8:" - "Attributes" = "3:0" - "Setting" = "3:1" - "Value" = "8:#1258" - "DefaultValue" = "8:#1258" - "UsePlugInResources" = "11:TRUE" - } - } - } - } - } - "{DF760B10-853B-4699-99F2-AFF7185B4A62}:_5E0AF2B2658547308882EEE91399D911" - { - "Name" = "8:#1901" - "Sequence" = "3:2" - "Attributes" = "3:2" - "Dialogs" - { - "{688940B3-5CA9-4162-8DEE-2993FA9D8CBC}:_82FCCA944F324BA18F0E3E01BCA1E60B" - { - "Sequence" = "3:100" - "DisplayName" = "8:Progress" - "UseDynamicProperties" = "11:TRUE" - "IsDependency" = "11:FALSE" - "SourcePath" = "8:\\VsdAdminProgressDlg.wid" - "Properties" - { - "BannerBitmap" - { - "Name" = "8:BannerBitmap" - "DisplayName" = "8:#1001" - "Description" = "8:#1101" - "Type" = "3:8" - "ContextData" = "8:Bitmap" - "Attributes" = "3:4" - "Setting" = "3:2" - "Value" = "8:_B6156897CBBB4E929D9C1F7358CE9E90" - "UsePlugInResources" = "11:TRUE" - } - "ShowProgress" - { - "Name" = "8:ShowProgress" - "DisplayName" = "8:#1009" - "Description" = "8:#1109" - "Type" = "3:5" - "ContextData" = "8:1;True=1;False=0" - "Attributes" = "3:0" - "Setting" = "3:0" - "Value" = "3:1" - "DefaultValue" = "3:1" - "UsePlugInResources" = "11:TRUE" - } - } - } - } - } - "{DF760B10-853B-4699-99F2-AFF7185B4A62}:_7046F6E46106420BA50AA9A9ED86389A" - { - "Name" = "8:#1900" - "Sequence" = "3:1" - "Attributes" = "3:1" - "Dialogs" - { - "{688940B3-5CA9-4162-8DEE-2993FA9D8CBC}:_03C4F0FAD7804F3DAE9A980E584F691E" - { - "Sequence" = "3:300" - "DisplayName" = "8:Confirm Installation" - "UseDynamicProperties" = "11:TRUE" - "IsDependency" = "11:FALSE" - "SourcePath" = "8:\\VsdConfirmDlg.wid" - "Properties" - { - "BannerBitmap" - { - "Name" = "8:BannerBitmap" - "DisplayName" = "8:#1001" - "Description" = "8:#1101" - "Type" = "3:8" - "ContextData" = "8:Bitmap" - "Attributes" = "3:4" - "Setting" = "3:2" - "Value" = "8:_B6156897CBBB4E929D9C1F7358CE9E90" - "UsePlugInResources" = "11:TRUE" - } - } - } - "{688940B3-5CA9-4162-8DEE-2993FA9D8CBC}:_4B4F0FAA5A094FCC952CA8A93DEA0F04" - { - "Sequence" = "3:100" - "DisplayName" = "8:Welcome" - "UseDynamicProperties" = "11:TRUE" - "IsDependency" = "11:FALSE" - "SourcePath" = "8:\\VsdWelcomeDlg.wid" - "Properties" - { - "BannerBitmap" - { - "Name" = "8:BannerBitmap" - "DisplayName" = "8:#1001" - "Description" = "8:#1101" - "Type" = "3:8" - "ContextData" = "8:Bitmap" - "Attributes" = "3:4" - "Setting" = "3:2" - "Value" = "8:_B6156897CBBB4E929D9C1F7358CE9E90" - "UsePlugInResources" = "11:TRUE" - } - "CopyrightWarning" - { - "Name" = "8:CopyrightWarning" - "DisplayName" = "8:#1002" - "Description" = "8:#1102" - "Type" = "3:3" - "ContextData" = "8:" - "Attributes" = "3:0" - "Setting" = "3:2" - "Value" = "8:" - "DefaultValue" = "8:#1202" - "UsePlugInResources" = "11:TRUE" - } - "Welcome" - { - "Name" = "8:Welcome" - "DisplayName" = "8:#1003" - "Description" = "8:#1103" - "Type" = "3:3" - "ContextData" = "8:" - "Attributes" = "3:0" - "Setting" = "3:1" - "Value" = "8:#1203" - "DefaultValue" = "8:#1203" - "UsePlugInResources" = "11:TRUE" - } - } - } - "{688940B3-5CA9-4162-8DEE-2993FA9D8CBC}:_CAD4CD70D47945E7A7FCD4428405F7FD" - { - "Sequence" = "3:200" - "DisplayName" = "8:Installation Folder" - "UseDynamicProperties" = "11:TRUE" - "IsDependency" = "11:FALSE" - "SourcePath" = "8:\\VsdFolderDlg.wid" - "Properties" - { - "BannerBitmap" - { - "Name" = "8:BannerBitmap" - "DisplayName" = "8:#1001" - "Description" = "8:#1101" - "Type" = "3:8" - "ContextData" = "8:Bitmap" - "Attributes" = "3:4" - "Setting" = "3:2" - "Value" = "8:_B6156897CBBB4E929D9C1F7358CE9E90" - "UsePlugInResources" = "11:TRUE" - } - "InstallAllUsersVisible" - { - "Name" = "8:InstallAllUsersVisible" - "DisplayName" = "8:#1059" - "Description" = "8:#1159" - "Type" = "3:5" - "ContextData" = "8:1;True=1;False=0" - "Attributes" = "3:0" - "Setting" = "3:0" - "Value" = "3:1" - "DefaultValue" = "3:1" - "UsePlugInResources" = "11:TRUE" - } - } - } - } - } - "{DF760B10-853B-4699-99F2-AFF7185B4A62}:_A95B4EFD2C5249848F009D88CBA3739B" - { - "Name" = "8:#1900" - "Sequence" = "3:2" - "Attributes" = "3:1" - "Dialogs" - { - "{688940B3-5CA9-4162-8DEE-2993FA9D8CBC}:_101B4B845E67488FB6A0AC097773DA38" - { - "Sequence" = "3:300" - "DisplayName" = "8:Confirm Installation" - "UseDynamicProperties" = "11:TRUE" - "IsDependency" = "11:FALSE" - "SourcePath" = "8:\\VsdAdminConfirmDlg.wid" - "Properties" - { - "BannerBitmap" - { - "Name" = "8:BannerBitmap" - "DisplayName" = "8:#1001" - "Description" = "8:#1101" - "Type" = "3:8" - "ContextData" = "8:Bitmap" - "Attributes" = "3:4" - "Setting" = "3:2" - "Value" = "8:_B6156897CBBB4E929D9C1F7358CE9E90" - "UsePlugInResources" = "11:TRUE" - } - } - } - "{688940B3-5CA9-4162-8DEE-2993FA9D8CBC}:_1AD3D10EBB64435985C57A85063E6CDF" - { - "Sequence" = "3:100" - "DisplayName" = "8:Welcome" - "UseDynamicProperties" = "11:TRUE" - "IsDependency" = "11:FALSE" - "SourcePath" = "8:\\VsdAdminWelcomeDlg.wid" - "Properties" - { - "BannerBitmap" - { - "Name" = "8:BannerBitmap" - "DisplayName" = "8:#1001" - "Description" = "8:#1101" - "Type" = "3:8" - "ContextData" = "8:Bitmap" - "Attributes" = "3:4" - "Setting" = "3:2" - "Value" = "8:_B6156897CBBB4E929D9C1F7358CE9E90" - "UsePlugInResources" = "11:TRUE" - } - "CopyrightWarning" - { - "Name" = "8:CopyrightWarning" - "DisplayName" = "8:#1002" - "Description" = "8:#1102" - "Type" = "3:3" - "ContextData" = "8:" - "Attributes" = "3:0" - "Setting" = "3:2" - "Value" = "8:" - "DefaultValue" = "8:#1202" - "UsePlugInResources" = "11:TRUE" - } - "Welcome" - { - "Name" = "8:Welcome" - "DisplayName" = "8:#1003" - "Description" = "8:#1103" - "Type" = "3:3" - "ContextData" = "8:" - "Attributes" = "3:0" - "Setting" = "3:1" - "Value" = "8:#1203" - "DefaultValue" = "8:#1203" - "UsePlugInResources" = "11:TRUE" - } - } - } - "{688940B3-5CA9-4162-8DEE-2993FA9D8CBC}:_F5C2368EB13F47EF8808B4E5855A647B" - { - "Sequence" = "3:200" - "DisplayName" = "8:Installation Folder" - "UseDynamicProperties" = "11:TRUE" - "IsDependency" = "11:FALSE" - "SourcePath" = "8:\\VsdAdminFolderDlg.wid" - "Properties" - { - "BannerBitmap" - { - "Name" = "8:BannerBitmap" - "DisplayName" = "8:#1001" - "Description" = "8:#1101" - "Type" = "3:8" - "ContextData" = "8:Bitmap" - "Attributes" = "3:4" - "Setting" = "3:2" - "Value" = "8:_B6156897CBBB4E929D9C1F7358CE9E90" - "UsePlugInResources" = "11:TRUE" - } - } - } - } - } - "{2479F3F5-0309-486D-8047-8187E2CE5BA0}:_F02FDE6DA53449159DF6E6441E2314C9" - { - "UseDynamicProperties" = "11:FALSE" - "IsDependency" = "11:FALSE" - "SourcePath" = "8:\\VsdBasicDialogs.wim" - } - } - "MergeModule" - { - } - "ProjectOutput" - { - } - } -} +"DeployProject" +{ +"VSVersion" = "3:800" +"ProjectType" = "8:{978C614F-708E-4E1A-B201-565925725DBA}" +"IsWebType" = "8:FALSE" +"ProjectName" = "8:sqlite" +"LanguageId" = "3:1033" +"CodePage" = "3:1252" +"UILanguageId" = "3:1033" +"SccProjectName" = "8:" +"SccLocalPath" = "8:" +"SccAuxPath" = "8:" +"SccProvider" = "8:" + "Hierarchy" + { + "Entry" + { + "MsmKey" = "8:_010277651E8814DD43DB3B36C8296DDA" + "OwnerKey" = "8:_1D4F110D867D9CB4C054CDB9C618E78B" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { + "MsmKey" = "8:_055B2BCD025C40A08F3B155843F41702" + "OwnerKey" = "8:_UNDEFINED" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { + "MsmKey" = "8:_121526E7A4D6A84A5865CDAAD11C6CB1" + "OwnerKey" = "8:_010277651E8814DD43DB3B36C8296DDA" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { + "MsmKey" = "8:_1D4F110D867D9CB4C054CDB9C618E78B" + "OwnerKey" = "8:_CD3CE5CDAB13405EA6EAAADC95F88D2E" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { + "MsmKey" = "8:_26E74AC417994018832F9B82462AA3AF" + "OwnerKey" = "8:_UNDEFINED" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { + "MsmKey" = "8:_2C7EDFF06B61482393D94E3A63D90113" + "OwnerKey" = "8:_UNDEFINED" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { + "MsmKey" = "8:_33349D46CCFB4E16A3F7C6CE1FE6F6C9" + "OwnerKey" = "8:_UNDEFINED" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { + "MsmKey" = "8:_40DFF08BA903482D807E715A041CA8B1" + "OwnerKey" = "8:_UNDEFINED" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { + "MsmKey" = "8:_428546FA993CAEB944F36668D1218916" + "OwnerKey" = "8:_CD3CE5CDAB13405EA6EAAADC95F88D2E" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { + "MsmKey" = "8:_428546FA993CAEB944F36668D1218916" + "OwnerKey" = "8:_121526E7A4D6A84A5865CDAAD11C6CB1" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { + "MsmKey" = "8:_428546FA993CAEB944F36668D1218916" + "OwnerKey" = "8:_010277651E8814DD43DB3B36C8296DDA" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { + "MsmKey" = "8:_428546FA993CAEB944F36668D1218916" + "OwnerKey" = "8:_1D4F110D867D9CB4C054CDB9C618E78B" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { + "MsmKey" = "8:_428546FA993CAEB944F36668D1218916" + "OwnerKey" = "8:_5FEA03E3FEAB71E144A2C11ACB040D27" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { + "MsmKey" = "8:_428546FA993CAEB944F36668D1218916" + "OwnerKey" = "8:_E71D3475B26636C20B485CB69B7A1C23" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { + "MsmKey" = "8:_593B70B1213324CF028F005C1838D5E0" + "OwnerKey" = "8:_2C7EDFF06B61482393D94E3A63D90113" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { + "MsmKey" = "8:_593B70B1213324CF028F005C1838D5E0" + "OwnerKey" = "8:_CE9E3EF0722342DB8DE0860C0DDCD39E" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { + "MsmKey" = "8:_5FEA03E3FEAB71E144A2C11ACB040D27" + "OwnerKey" = "8:_E71D3475B26636C20B485CB69B7A1C23" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { + "MsmKey" = "8:_5FEA03E3FEAB71E144A2C11ACB040D27" + "OwnerKey" = "8:_1D4F110D867D9CB4C054CDB9C618E78B" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { + "MsmKey" = "8:_5FEA03E3FEAB71E144A2C11ACB040D27" + "OwnerKey" = "8:_010277651E8814DD43DB3B36C8296DDA" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { + "MsmKey" = "8:_5FEA03E3FEAB71E144A2C11ACB040D27" + "OwnerKey" = "8:_121526E7A4D6A84A5865CDAAD11C6CB1" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { + "MsmKey" = "8:_60E2C442F77C48DE8150EBFC86663225" + "OwnerKey" = "8:_UNDEFINED" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { + "MsmKey" = "8:_6C0821166AFC48AEDEF3ED6BCD3FA983" + "OwnerKey" = "8:_121526E7A4D6A84A5865CDAAD11C6CB1" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { + "MsmKey" = "8:_7F664A101324A70B92BD1686FD41AE05" + "OwnerKey" = "8:_B4E34F75CDDBFD247895A0E7D80F6852" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { + "MsmKey" = "8:_92BF82EA98459EB608F94502D5FDFB76" + "OwnerKey" = "8:_1D4F110D867D9CB4C054CDB9C618E78B" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { + "MsmKey" = "8:_B29C75F5F4D24817846DCEF9951068E1" + "OwnerKey" = "8:_UNDEFINED" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { + "MsmKey" = "8:_B4E34F75CDDBFD247895A0E7D80F6852" + "OwnerKey" = "8:_CD3CE5CDAB13405EA6EAAADC95F88D2E" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { + "MsmKey" = "8:_B4E34F75CDDBFD247895A0E7D80F6852" + "OwnerKey" = "8:_1D4F110D867D9CB4C054CDB9C618E78B" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { + "MsmKey" = "8:_B6156897CBBB4E929D9C1F7358CE9E90" + "OwnerKey" = "8:_UNDEFINED" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { + "MsmKey" = "8:_C8E329AC56AD4C88A986481E639F72A5" + "OwnerKey" = "8:_UNDEFINED" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { + "MsmKey" = "8:_CD3CE5CDAB13405EA6EAAADC95F88D2E" + "OwnerKey" = "8:_UNDEFINED" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { + "MsmKey" = "8:_CE9E3EF0722342DB8DE0860C0DDCD39E" + "OwnerKey" = "8:_UNDEFINED" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { + "MsmKey" = "8:_D7FECFD3C8164DA7B3712AF54D0CDDAD" + "OwnerKey" = "8:_UNDEFINED" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { + "MsmKey" = "8:_E1FD53130BACBD504D48E23D4875903E" + "OwnerKey" = "8:_1D4F110D867D9CB4C054CDB9C618E78B" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { + "MsmKey" = "8:_E71D3475B26636C20B485CB69B7A1C23" + "OwnerKey" = "8:_CD3CE5CDAB13405EA6EAAADC95F88D2E" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { + "MsmKey" = "8:_E71D3475B26636C20B485CB69B7A1C23" + "OwnerKey" = "8:_1D4F110D867D9CB4C054CDB9C618E78B" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { + "MsmKey" = "8:_E71D3475B26636C20B485CB69B7A1C23" + "OwnerKey" = "8:_121526E7A4D6A84A5865CDAAD11C6CB1" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { + "MsmKey" = "8:_E71D3475B26636C20B485CB69B7A1C23" + "OwnerKey" = "8:_010277651E8814DD43DB3B36C8296DDA" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { + "MsmKey" = "8:_UNDEFINED" + "OwnerKey" = "8:_B29C75F5F4D24817846DCEF9951068E1" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { + "MsmKey" = "8:_UNDEFINED" + "OwnerKey" = "8:_E71D3475B26636C20B485CB69B7A1C23" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { + "MsmKey" = "8:_UNDEFINED" + "OwnerKey" = "8:_E1FD53130BACBD504D48E23D4875903E" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { + "MsmKey" = "8:_UNDEFINED" + "OwnerKey" = "8:_CE9E3EF0722342DB8DE0860C0DDCD39E" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { + "MsmKey" = "8:_UNDEFINED" + "OwnerKey" = "8:_CD3CE5CDAB13405EA6EAAADC95F88D2E" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { + "MsmKey" = "8:_UNDEFINED" + "OwnerKey" = "8:_B4E34F75CDDBFD247895A0E7D80F6852" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { + "MsmKey" = "8:_UNDEFINED" + "OwnerKey" = "8:_92BF82EA98459EB608F94502D5FDFB76" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { + "MsmKey" = "8:_UNDEFINED" + "OwnerKey" = "8:_6C0821166AFC48AEDEF3ED6BCD3FA983" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { + "MsmKey" = "8:_UNDEFINED" + "OwnerKey" = "8:_5FEA03E3FEAB71E144A2C11ACB040D27" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { + "MsmKey" = "8:_UNDEFINED" + "OwnerKey" = "8:_428546FA993CAEB944F36668D1218916" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { + "MsmKey" = "8:_UNDEFINED" + "OwnerKey" = "8:_40DFF08BA903482D807E715A041CA8B1" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { + "MsmKey" = "8:_UNDEFINED" + "OwnerKey" = "8:_2C7EDFF06B61482393D94E3A63D90113" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { + "MsmKey" = "8:_UNDEFINED" + "OwnerKey" = "8:_593B70B1213324CF028F005C1838D5E0" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { + "MsmKey" = "8:_UNDEFINED" + "OwnerKey" = "8:_1D4F110D867D9CB4C054CDB9C618E78B" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { + "MsmKey" = "8:_UNDEFINED" + "OwnerKey" = "8:_121526E7A4D6A84A5865CDAAD11C6CB1" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { + "MsmKey" = "8:_UNDEFINED" + "OwnerKey" = "8:_010277651E8814DD43DB3B36C8296DDA" + "MsmSig" = "8:_UNDEFINED" + } + } + "Configurations" + { + "Debug" + { + "DisplayName" = "8:Debug" + "IsDebugOnly" = "11:TRUE" + "IsReleaseOnly" = "11:FALSE" + "OutputFilename" = "8:Debug\\sqlite_setup.msi" + "PackageFilesAs" = "3:4" + "PackageFileSize" = "3:-2147483648" + "CabType" = "3:1" + "Compression" = "3:3" + "SignOutput" = "11:FALSE" + "CertificateFile" = "8:" + "PrivateKeyFile" = "8:" + "TimeStampServer" = "8:" + "InstallerBootstrapper" = "3:2" + "BootstrapperCfg:{63ACBE69-63AA-4F98-B2B6-99F9E24495F2}" + { + "Enabled" = "11:TRUE" + "PromptEnabled" = "11:TRUE" + "PrerequisitesLocation" = "2:1" + "Url" = "8:" + "ComponentsUrl" = "8:" + "Items" + { + } + } + } + "Release" + { + "DisplayName" = "8:Release" + "IsDebugOnly" = "11:FALSE" + "IsReleaseOnly" = "11:TRUE" + "OutputFilename" = "8:sqlite_setup.msi" + "PackageFilesAs" = "3:2" + "PackageFileSize" = "3:-2147483648" + "CabType" = "3:1" + "Compression" = "3:3" + "SignOutput" = "11:FALSE" + "CertificateFile" = "8:" + "PrivateKeyFile" = "8:" + "TimeStampServer" = "8:" + "InstallerBootstrapper" = "3:2" + "BootstrapperCfg:{63ACBE69-63AA-4F98-B2B6-99F9E24495F2}" + { + "Enabled" = "11:FALSE" + "PromptEnabled" = "11:TRUE" + "PrerequisitesLocation" = "2:1" + "Url" = "8:" + "ComponentsUrl" = "8:" + "Items" + { + "{EDC2488A-8267-493A-A98E-7D9C3B36CDF3}:Microsoft.Net.Framework.2.0" + { + "Name" = "8:.NET Framework 2.0" + "ProductCode" = "8:Microsoft.Net.Framework.2.0" + } + } + } + } + } + "Deployable" + { + "CustomAction" + { + "{4AA51A2D-7D85-4A59-BA75-B0809FC8B380}:_70EF89170C604410AAB199512D4194A9" + { + "Name" = "8:install.exe" + "Condition" = "8:" + "Object" = "8:_40DFF08BA903482D807E715A041CA8B1" + "FileType" = "3:2" + "InstallAction" = "3:2" + "Arguments" = "8:" + "EntryPoint" = "8:" + "Sequence" = "3:1" + "Identifier" = "8:_2FB4763D_3341_48AE_8AE5_AC7B45119699" + "InstallerClass" = "11:FALSE" + "CustomActionData" = "8:" + } + "{4AA51A2D-7D85-4A59-BA75-B0809FC8B380}:_C386182ABAD545D288F427FBAFC865FE" + { + "Name" = "8:install.exe" + "Condition" = "8:" + "Object" = "8:_40DFF08BA903482D807E715A041CA8B1" + "FileType" = "3:2" + "InstallAction" = "3:4" + "Arguments" = "8:/remove" + "EntryPoint" = "8:" + "Sequence" = "3:1" + "Identifier" = "8:_F0391075_ECEB_4EA0_9EA9_DA922A93406D" + "InstallerClass" = "11:FALSE" + "CustomActionData" = "8:" + } + } + "DefaultFeature" + { + "Name" = "8:DefaultFeature" + "Title" = "8:" + "Description" = "8:" + } + "ExternalPersistence" + { + "LaunchCondition" + { + "{A06ECF26-33A3-4562-8140-9B0E340D4F24}:_2A5202AB8FA440F9AA45DF7B9C7CEAD5" + { + "Name" = "8:.NET Framework" + "Message" = "8:[VSDNETMSG]" + "FrameworkVersion" = "8:2.0.50727 " + "AllowLaterVersions" = "11:TRUE" + "InstallUrl" = "8:http://go.microsoft.com/fwlink/?LinkId=9832" + } + } + } + "File" + { + "{9F6F8455-1EF1-4B85-886A-4223BCC8E7F7}:_010277651E8814DD43DB3B36C8296DDA" + { + "AssemblyRegister" = "3:1" + "AssemblyIsInGAC" = "11:TRUE" + "AssemblyAsmDisplayName" = "8:Microsoft.VisualStudio.Shell.Interop.8.0, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" + "ScatterAssemblies" + { + "_010277651E8814DD43DB3B36C8296DDA" + { + "Name" = "8:Microsoft.VisualStudio.Shell.Interop.8.0.dll" + "Attributes" = "3:512" + } + } + "SourcePath" = "8:Microsoft.VisualStudio.Shell.Interop.8.0.dll" + "TargetName" = "8:" + "Tag" = "8:" + "Folder" = "8:_F11D54EE0EEA4BF59B52E621630B6A2E" + "Condition" = "8:" + "Transitive" = "11:FALSE" + "Vital" = "11:TRUE" + "ReadOnly" = "11:FALSE" + "Hidden" = "11:FALSE" + "System" = "11:FALSE" + "Permanent" = "11:FALSE" + "SharedLegacy" = "11:FALSE" + "PackageAs" = "3:1" + "Register" = "3:1" + "Exclude" = "11:TRUE" + "IsDependency" = "11:TRUE" + "IsolateTo" = "8:" + } + "{1FB2D0AE-D3B9-43D4-B9DD-F88EC61E35DE}:_055B2BCD025C40A08F3B155843F41702" + { + "SourcePath" = "8:..\\..\\bin\\test.exe.config" + "TargetName" = "8:test.exe.config" + "Tag" = "8:" + "Folder" = "8:_30C77BF2E6E84D01ADE5FB8BA2F81504" + "Condition" = "8:" + "Transitive" = "11:FALSE" + "Vital" = "11:TRUE" + "ReadOnly" = "11:FALSE" + "Hidden" = "11:FALSE" + "System" = "11:FALSE" + "Permanent" = "11:FALSE" + "SharedLegacy" = "11:FALSE" + "PackageAs" = "3:1" + "Register" = "3:1" + "Exclude" = "11:FALSE" + "IsDependency" = "11:FALSE" + "IsolateTo" = "8:" + } + "{9F6F8455-1EF1-4B85-886A-4223BCC8E7F7}:_121526E7A4D6A84A5865CDAAD11C6CB1" + { + "AssemblyRegister" = "3:1" + "AssemblyIsInGAC" = "11:TRUE" + "AssemblyAsmDisplayName" = "8:Microsoft.VisualStudio.TextManager.Interop.8.0, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" + "ScatterAssemblies" + { + "_121526E7A4D6A84A5865CDAAD11C6CB1" + { + "Name" = "8:Microsoft.VisualStudio.TextManager.Interop.8.0.dll" + "Attributes" = "3:512" + } + } + "SourcePath" = "8:Microsoft.VisualStudio.TextManager.Interop.8.0.dll" + "TargetName" = "8:" + "Tag" = "8:" + "Folder" = "8:_F11D54EE0EEA4BF59B52E621630B6A2E" + "Condition" = "8:" + "Transitive" = "11:FALSE" + "Vital" = "11:TRUE" + "ReadOnly" = "11:FALSE" + "Hidden" = "11:FALSE" + "System" = "11:FALSE" + "Permanent" = "11:FALSE" + "SharedLegacy" = "11:FALSE" + "PackageAs" = "3:1" + "Register" = "3:1" + "Exclude" = "11:TRUE" + "IsDependency" = "11:TRUE" + "IsolateTo" = "8:" + } + "{9F6F8455-1EF1-4B85-886A-4223BCC8E7F7}:_1D4F110D867D9CB4C054CDB9C618E78B" + { + "AssemblyRegister" = "3:1" + "AssemblyIsInGAC" = "11:TRUE" + "AssemblyAsmDisplayName" = "8:Microsoft.VisualStudio.Shell, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" + "ScatterAssemblies" + { + "_1D4F110D867D9CB4C054CDB9C618E78B" + { + "Name" = "8:Microsoft.VisualStudio.Shell.dll" + "Attributes" = "3:512" + } + } + "SourcePath" = "8:Microsoft.VisualStudio.Shell.dll" + "TargetName" = "8:" + "Tag" = "8:" + "Folder" = "8:_F11D54EE0EEA4BF59B52E621630B6A2E" + "Condition" = "8:" + "Transitive" = "11:FALSE" + "Vital" = "11:TRUE" + "ReadOnly" = "11:FALSE" + "Hidden" = "11:FALSE" + "System" = "11:FALSE" + "Permanent" = "11:FALSE" + "SharedLegacy" = "11:FALSE" + "PackageAs" = "3:1" + "Register" = "3:1" + "Exclude" = "11:TRUE" + "IsDependency" = "11:TRUE" + "IsolateTo" = "8:" + } + "{1FB2D0AE-D3B9-43D4-B9DD-F88EC61E35DE}:_26E74AC417994018832F9B82462AA3AF" + { + "SourcePath" = "8:..\\..\\bin\\x64\\System.Data.SQLite.lib" + "TargetName" = "8:System.Data.SQLite.lib" + "Tag" = "8:" + "Folder" = "8:_66DBD0998AA8499691D4F5E42417697D" + "Condition" = "8:" + "Transitive" = "11:FALSE" + "Vital" = "11:TRUE" + "ReadOnly" = "11:FALSE" + "Hidden" = "11:FALSE" + "System" = "11:FALSE" + "Permanent" = "11:FALSE" + "SharedLegacy" = "11:FALSE" + "PackageAs" = "3:1" + "Register" = "3:1" + "Exclude" = "11:FALSE" + "IsDependency" = "11:FALSE" + "IsolateTo" = "8:" + } + "{9F6F8455-1EF1-4B85-886A-4223BCC8E7F7}:_2C7EDFF06B61482393D94E3A63D90113" + { + "AssemblyRegister" = "3:1" + "AssemblyIsInGAC" = "11:FALSE" + "AssemblyAsmDisplayName" = "8:test, Version=1.0.0.37796, Culture=neutral, processorArchitecture=x86" + "ScatterAssemblies" + { + "_2C7EDFF06B61482393D94E3A63D90113" + { + "Name" = "8:test.exe" + "Attributes" = "3:512" + } + } + "SourcePath" = "8:..\\..\\bin\\test.exe" + "TargetName" = "8:" + "Tag" = "8:" + "Folder" = "8:_30C77BF2E6E84D01ADE5FB8BA2F81504" + "Condition" = "8:" + "Transitive" = "11:FALSE" + "Vital" = "11:TRUE" + "ReadOnly" = "11:FALSE" + "Hidden" = "11:FALSE" + "System" = "11:FALSE" + "Permanent" = "11:FALSE" + "SharedLegacy" = "11:FALSE" + "PackageAs" = "3:1" + "Register" = "3:1" + "Exclude" = "11:FALSE" + "IsDependency" = "11:FALSE" + "IsolateTo" = "8:" + } + "{1FB2D0AE-D3B9-43D4-B9DD-F88EC61E35DE}:_33349D46CCFB4E16A3F7C6CE1FE6F6C9" + { + "SourcePath" = "8:..\\..\\bin\\System.Data.SQLite.XML" + "TargetName" = "8:System.Data.SQLite.XML" + "Tag" = "8:" + "Folder" = "8:_30C77BF2E6E84D01ADE5FB8BA2F81504" + "Condition" = "8:" + "Transitive" = "11:FALSE" + "Vital" = "11:TRUE" + "ReadOnly" = "11:FALSE" + "Hidden" = "11:FALSE" + "System" = "11:FALSE" + "Permanent" = "11:FALSE" + "SharedLegacy" = "11:FALSE" + "PackageAs" = "3:1" + "Register" = "3:1" + "Exclude" = "11:FALSE" + "IsDependency" = "11:FALSE" + "IsolateTo" = "8:" + } + "{9F6F8455-1EF1-4B85-886A-4223BCC8E7F7}:_40DFF08BA903482D807E715A041CA8B1" + { + "AssemblyRegister" = "3:1" + "AssemblyIsInGAC" = "11:FALSE" + "AssemblyAsmDisplayName" = "8:install, Version=1.0.0.37805, Culture=neutral, processorArchitecture=x86" + "ScatterAssemblies" + { + "_40DFF08BA903482D807E715A041CA8B1" + { + "Name" = "8:install.exe" + "Attributes" = "3:512" + } + } + "SourcePath" = "8:..\\..\\bin\\Designer\\install.exe" + "TargetName" = "8:" + "Tag" = "8:" + "Folder" = "8:_F11D54EE0EEA4BF59B52E621630B6A2E" + "Condition" = "8:" + "Transitive" = "11:FALSE" + "Vital" = "11:TRUE" + "ReadOnly" = "11:FALSE" + "Hidden" = "11:FALSE" + "System" = "11:FALSE" + "Permanent" = "11:FALSE" + "SharedLegacy" = "11:FALSE" + "PackageAs" = "3:1" + "Register" = "3:1" + "Exclude" = "11:FALSE" + "IsDependency" = "11:FALSE" + "IsolateTo" = "8:" + } + "{9F6F8455-1EF1-4B85-886A-4223BCC8E7F7}:_428546FA993CAEB944F36668D1218916" + { + "AssemblyRegister" = "3:1" + "AssemblyIsInGAC" = "11:TRUE" + "AssemblyAsmDisplayName" = "8:Microsoft.VisualStudio.OLE.Interop, Version=7.1.40304.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" + "ScatterAssemblies" + { + "_428546FA993CAEB944F36668D1218916" + { + "Name" = "8:Microsoft.VisualStudio.OLE.Interop.dll" + "Attributes" = "3:512" + } + } + "SourcePath" = "8:Microsoft.VisualStudio.OLE.Interop.dll" + "TargetName" = "8:" + "Tag" = "8:" + "Folder" = "8:_F11D54EE0EEA4BF59B52E621630B6A2E" + "Condition" = "8:" + "Transitive" = "11:FALSE" + "Vital" = "11:TRUE" + "ReadOnly" = "11:FALSE" + "Hidden" = "11:FALSE" + "System" = "11:FALSE" + "Permanent" = "11:FALSE" + "SharedLegacy" = "11:FALSE" + "PackageAs" = "3:1" + "Register" = "3:1" + "Exclude" = "11:TRUE" + "IsDependency" = "11:TRUE" + "IsolateTo" = "8:" + } + "{9F6F8455-1EF1-4B85-886A-4223BCC8E7F7}:_593B70B1213324CF028F005C1838D5E0" + { + "AssemblyRegister" = "3:1" + "AssemblyIsInGAC" = "11:FALSE" + "AssemblyAsmDisplayName" = "8:System.Data.SQLite, Version=1.0.66.1, Culture=neutral, PublicKeyToken=db937bc2d44ff139, processorArchitecture=x86" + "ScatterAssemblies" + { + "_593B70B1213324CF028F005C1838D5E0" + { + "Name" = "8:System.Data.SQLite.DLL" + "Attributes" = "3:512" + } + } + "SourcePath" = "8:System.Data.SQLite.DLL" + "TargetName" = "8:" + "Tag" = "8:" + "Folder" = "8:_30C77BF2E6E84D01ADE5FB8BA2F81504" + "Condition" = "8:" + "Transitive" = "11:FALSE" + "Vital" = "11:TRUE" + "ReadOnly" = "11:FALSE" + "Hidden" = "11:FALSE" + "System" = "11:FALSE" + "Permanent" = "11:FALSE" + "SharedLegacy" = "11:FALSE" + "PackageAs" = "3:1" + "Register" = "3:1" + "Exclude" = "11:FALSE" + "IsDependency" = "11:TRUE" + "IsolateTo" = "8:" + } + "{9F6F8455-1EF1-4B85-886A-4223BCC8E7F7}:_5FEA03E3FEAB71E144A2C11ACB040D27" + { + "AssemblyRegister" = "3:1" + "AssemblyIsInGAC" = "11:TRUE" + "AssemblyAsmDisplayName" = "8:Microsoft.VisualStudio.TextManager.Interop, Version=7.1.40304.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" + "ScatterAssemblies" + { + "_5FEA03E3FEAB71E144A2C11ACB040D27" + { + "Name" = "8:Microsoft.VisualStudio.TextManager.Interop.dll" + "Attributes" = "3:512" + } + } + "SourcePath" = "8:Microsoft.VisualStudio.TextManager.Interop.dll" + "TargetName" = "8:" + "Tag" = "8:" + "Folder" = "8:_F11D54EE0EEA4BF59B52E621630B6A2E" + "Condition" = "8:" + "Transitive" = "11:FALSE" + "Vital" = "11:TRUE" + "ReadOnly" = "11:FALSE" + "Hidden" = "11:FALSE" + "System" = "11:FALSE" + "Permanent" = "11:FALSE" + "SharedLegacy" = "11:FALSE" + "PackageAs" = "3:1" + "Register" = "3:1" + "Exclude" = "11:TRUE" + "IsDependency" = "11:TRUE" + "IsolateTo" = "8:" + } + "{1FB2D0AE-D3B9-43D4-B9DD-F88EC61E35DE}:_60E2C442F77C48DE8150EBFC86663225" + { + "SourcePath" = "8:..\\..\\Doc\\SQLite.NET.chm" + "TargetName" = "8:SQLite.NET.chm" + "Tag" = "8:" + "Folder" = "8:_CA5E61837F5B452B8169C698979CF05C" + "Condition" = "8:" + "Transitive" = "11:FALSE" + "Vital" = "11:TRUE" + "ReadOnly" = "11:FALSE" + "Hidden" = "11:FALSE" + "System" = "11:FALSE" + "Permanent" = "11:FALSE" + "SharedLegacy" = "11:FALSE" + "PackageAs" = "3:1" + "Register" = "3:1" + "Exclude" = "11:FALSE" + "IsDependency" = "11:FALSE" + "IsolateTo" = "8:" + } + "{9F6F8455-1EF1-4B85-886A-4223BCC8E7F7}:_6C0821166AFC48AEDEF3ED6BCD3FA983" + { + "AssemblyRegister" = "3:1" + "AssemblyIsInGAC" = "11:TRUE" + "AssemblyAsmDisplayName" = "8:Microsoft.MSXML, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" + "ScatterAssemblies" + { + "_6C0821166AFC48AEDEF3ED6BCD3FA983" + { + "Name" = "8:Microsoft.MSXML.dll" + "Attributes" = "3:512" + } + } + "SourcePath" = "8:Microsoft.MSXML.dll" + "TargetName" = "8:" + "Tag" = "8:" + "Folder" = "8:_F11D54EE0EEA4BF59B52E621630B6A2E" + "Condition" = "8:" + "Transitive" = "11:FALSE" + "Vital" = "11:TRUE" + "ReadOnly" = "11:FALSE" + "Hidden" = "11:FALSE" + "System" = "11:FALSE" + "Permanent" = "11:FALSE" + "SharedLegacy" = "11:FALSE" + "PackageAs" = "3:1" + "Register" = "3:1" + "Exclude" = "11:TRUE" + "IsDependency" = "11:TRUE" + "IsolateTo" = "8:" + } + "{1FB2D0AE-D3B9-43D4-B9DD-F88EC61E35DE}:_7F664A101324A70B92BD1686FD41AE05" + { + "SourcePath" = "8:dte80a.olb" + "TargetName" = "8:dte80a.olb" + "Tag" = "8:" + "Folder" = "8:_F11D54EE0EEA4BF59B52E621630B6A2E" + "Condition" = "8:" + "Transitive" = "11:FALSE" + "Vital" = "11:TRUE" + "ReadOnly" = "11:FALSE" + "Hidden" = "11:FALSE" + "System" = "11:FALSE" + "Permanent" = "11:FALSE" + "SharedLegacy" = "11:FALSE" + "PackageAs" = "3:1" + "Register" = "3:1" + "Exclude" = "11:TRUE" + "IsDependency" = "11:TRUE" + "IsolateTo" = "8:" + } + "{9F6F8455-1EF1-4B85-886A-4223BCC8E7F7}:_92BF82EA98459EB608F94502D5FDFB76" + { + "AssemblyRegister" = "3:1" + "AssemblyIsInGAC" = "11:TRUE" + "AssemblyAsmDisplayName" = "8:Microsoft.VisualStudio.VSHelp, Version=7.0.3300.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" + "ScatterAssemblies" + { + "_92BF82EA98459EB608F94502D5FDFB76" + { + "Name" = "8:Microsoft.VisualStudio.VSHelp.dll" + "Attributes" = "3:512" + } + } + "SourcePath" = "8:Microsoft.VisualStudio.VSHelp.dll" + "TargetName" = "8:" + "Tag" = "8:" + "Folder" = "8:_F11D54EE0EEA4BF59B52E621630B6A2E" + "Condition" = "8:" + "Transitive" = "11:FALSE" + "Vital" = "11:TRUE" + "ReadOnly" = "11:FALSE" + "Hidden" = "11:FALSE" + "System" = "11:FALSE" + "Permanent" = "11:FALSE" + "SharedLegacy" = "11:FALSE" + "PackageAs" = "3:1" + "Register" = "3:1" + "Exclude" = "11:TRUE" + "IsDependency" = "11:TRUE" + "IsolateTo" = "8:" + } + "{1FB2D0AE-D3B9-43D4-B9DD-F88EC61E35DE}:_B29C75F5F4D24817846DCEF9951068E1" + { + "SourcePath" = "8:..\\..\\bin\\x64\\System.Data.SQLite.DLL" + "TargetName" = "8:System.Data.SQLite.DLL" + "Tag" = "8:" + "Folder" = "8:_66DBD0998AA8499691D4F5E42417697D" + "Condition" = "8:" + "Transitive" = "11:FALSE" + "Vital" = "11:TRUE" + "ReadOnly" = "11:FALSE" + "Hidden" = "11:FALSE" + "System" = "11:FALSE" + "Permanent" = "11:FALSE" + "SharedLegacy" = "11:FALSE" + "PackageAs" = "3:1" + "Register" = "3:1" + "Exclude" = "11:FALSE" + "IsDependency" = "11:FALSE" + "IsolateTo" = "8:" + "AssemblyAsmDisplayName" = "8:System.Data.SQLite, Version=1.0.27.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139, processorArchitecture=AMD64" + "AssemblyIsInGAC" = "11:FALSE" + "AssemblyRegister" = "3:1" + "ScatterAssemblies" + { + "_B29C75F5F4D24817846DCEF9951068E1" + { + "Attributes" = "3:512" + "Name" = "8:System.Data.SQLite.DLL" + } + } + } + "{9F6F8455-1EF1-4B85-886A-4223BCC8E7F7}:_B4E34F75CDDBFD247895A0E7D80F6852" + { + "AssemblyRegister" = "3:1" + "AssemblyIsInGAC" = "11:TRUE" + "AssemblyAsmDisplayName" = "8:EnvDTE, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" + "ScatterAssemblies" + { + "_B4E34F75CDDBFD247895A0E7D80F6852" + { + "Name" = "8:EnvDTE.dll" + "Attributes" = "3:512" + } + } + "SourcePath" = "8:EnvDTE.dll" + "TargetName" = "8:" + "Tag" = "8:" + "Folder" = "8:_F11D54EE0EEA4BF59B52E621630B6A2E" + "Condition" = "8:" + "Transitive" = "11:FALSE" + "Vital" = "11:TRUE" + "ReadOnly" = "11:FALSE" + "Hidden" = "11:FALSE" + "System" = "11:FALSE" + "Permanent" = "11:FALSE" + "SharedLegacy" = "11:FALSE" + "PackageAs" = "3:1" + "Register" = "3:1" + "Exclude" = "11:TRUE" + "IsDependency" = "11:TRUE" + "IsolateTo" = "8:" + } + "{1FB2D0AE-D3B9-43D4-B9DD-F88EC61E35DE}:_B6156897CBBB4E929D9C1F7358CE9E90" + { + "SourcePath" = "8:topband.jpg" + "TargetName" = "8:topband.jpg" + "Tag" = "8:" + "Folder" = "8:_A0841E79B7874F7288672343934C7657" + "Condition" = "8:" + "Transitive" = "11:FALSE" + "Vital" = "11:TRUE" + "ReadOnly" = "11:FALSE" + "Hidden" = "11:FALSE" + "System" = "11:FALSE" + "Permanent" = "11:FALSE" + "SharedLegacy" = "11:FALSE" + "PackageAs" = "3:1" + "Register" = "3:1" + "Exclude" = "11:TRUE" + "IsDependency" = "11:FALSE" + "IsolateTo" = "8:" + } + "{1FB2D0AE-D3B9-43D4-B9DD-F88EC61E35DE}:_C8E329AC56AD4C88A986481E639F72A5" + { + "SourcePath" = "8:..\\..\\readme.htm" + "TargetName" = "8:readme.htm" + "Tag" = "8:" + "Folder" = "8:_A0841E79B7874F7288672343934C7657" + "Condition" = "8:" + "Transitive" = "11:FALSE" + "Vital" = "11:TRUE" + "ReadOnly" = "11:FALSE" + "Hidden" = "11:FALSE" + "System" = "11:FALSE" + "Permanent" = "11:FALSE" + "SharedLegacy" = "11:FALSE" + "PackageAs" = "3:1" + "Register" = "3:1" + "Exclude" = "11:FALSE" + "IsDependency" = "11:FALSE" + "IsolateTo" = "8:" + } + "{9F6F8455-1EF1-4B85-886A-4223BCC8E7F7}:_CD3CE5CDAB13405EA6EAAADC95F88D2E" + { + "AssemblyRegister" = "3:1" + "AssemblyIsInGAC" = "11:FALSE" + "AssemblyAsmDisplayName" = "8:SQLite.Designer, Version=1.0.38.1, Culture=neutral, PublicKeyToken=db937bc2d44ff139, processorArchitecture=x86" + "ScatterAssemblies" + { + "_CD3CE5CDAB13405EA6EAAADC95F88D2E" + { + "Name" = "8:SQLite.Designer.dll" + "Attributes" = "3:512" + } + } + "SourcePath" = "8:..\\..\\bin\\Designer\\SQLite.Designer.dll" + "TargetName" = "8:" + "Tag" = "8:" + "Folder" = "8:_F11D54EE0EEA4BF59B52E621630B6A2E" + "Condition" = "8:" + "Transitive" = "11:FALSE" + "Vital" = "11:TRUE" + "ReadOnly" = "11:FALSE" + "Hidden" = "11:FALSE" + "System" = "11:FALSE" + "Permanent" = "11:FALSE" + "SharedLegacy" = "11:FALSE" + "PackageAs" = "3:1" + "Register" = "3:1" + "Exclude" = "11:FALSE" + "IsDependency" = "11:FALSE" + "IsolateTo" = "8:" + } + "{9F6F8455-1EF1-4B85-886A-4223BCC8E7F7}:_CE9E3EF0722342DB8DE0860C0DDCD39E" + { + "AssemblyRegister" = "3:1" + "AssemblyIsInGAC" = "11:FALSE" + "AssemblyAsmDisplayName" = "8:System.Data.SQLite.Linq, Version=1.0.38.1, Culture=neutral, PublicKeyToken=db937bc2d44ff139, processorArchitecture=MSIL" + "ScatterAssemblies" + { + "_CE9E3EF0722342DB8DE0860C0DDCD39E" + { + "Name" = "8:System.Data.SQLite.Linq.dll" + "Attributes" = "3:512" + } + } + "SourcePath" = "8:..\\..\\bin\\System.Data.SQLite.Linq.dll" + "TargetName" = "8:" + "Tag" = "8:" + "Folder" = "8:_30C77BF2E6E84D01ADE5FB8BA2F81504" + "Condition" = "8:" + "Transitive" = "11:FALSE" + "Vital" = "11:TRUE" + "ReadOnly" = "11:FALSE" + "Hidden" = "11:FALSE" + "System" = "11:FALSE" + "Permanent" = "11:FALSE" + "SharedLegacy" = "11:FALSE" + "PackageAs" = "3:1" + "Register" = "3:1" + "Exclude" = "11:FALSE" + "IsDependency" = "11:FALSE" + "IsolateTo" = "8:" + } + "{1FB2D0AE-D3B9-43D4-B9DD-F88EC61E35DE}:_D7FECFD3C8164DA7B3712AF54D0CDDAD" + { + "SourcePath" = "8:..\\..\\bin\\System.Data.SQLite.lib" + "TargetName" = "8:System.Data.SQLite.lib" + "Tag" = "8:" + "Folder" = "8:_30C77BF2E6E84D01ADE5FB8BA2F81504" + "Condition" = "8:" + "Transitive" = "11:FALSE" + "Vital" = "11:TRUE" + "ReadOnly" = "11:FALSE" + "Hidden" = "11:FALSE" + "System" = "11:FALSE" + "Permanent" = "11:FALSE" + "SharedLegacy" = "11:FALSE" + "PackageAs" = "3:1" + "Register" = "3:1" + "Exclude" = "11:FALSE" + "IsDependency" = "11:FALSE" + "IsolateTo" = "8:" + } + "{9F6F8455-1EF1-4B85-886A-4223BCC8E7F7}:_E1FD53130BACBD504D48E23D4875903E" + { + "AssemblyRegister" = "3:1" + "AssemblyIsInGAC" = "11:TRUE" + "AssemblyAsmDisplayName" = "8:Microsoft.VisualStudio.ProjectAggregator, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" + "ScatterAssemblies" + { + "_E1FD53130BACBD504D48E23D4875903E" + { + "Name" = "8:Microsoft.VisualStudio.ProjectAggregator.dll" + "Attributes" = "3:512" + } + } + "SourcePath" = "8:Microsoft.VisualStudio.ProjectAggregator.dll" + "TargetName" = "8:" + "Tag" = "8:" + "Folder" = "8:_F11D54EE0EEA4BF59B52E621630B6A2E" + "Condition" = "8:" + "Transitive" = "11:FALSE" + "Vital" = "11:TRUE" + "ReadOnly" = "11:FALSE" + "Hidden" = "11:FALSE" + "System" = "11:FALSE" + "Permanent" = "11:FALSE" + "SharedLegacy" = "11:FALSE" + "PackageAs" = "3:1" + "Register" = "3:1" + "Exclude" = "11:TRUE" + "IsDependency" = "11:TRUE" + "IsolateTo" = "8:" + } + "{9F6F8455-1EF1-4B85-886A-4223BCC8E7F7}:_E71D3475B26636C20B485CB69B7A1C23" + { + "AssemblyRegister" = "3:1" + "AssemblyIsInGAC" = "11:TRUE" + "AssemblyAsmDisplayName" = "8:Microsoft.VisualStudio.Shell.Interop, Version=7.1.40304.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" + "ScatterAssemblies" + { + "_E71D3475B26636C20B485CB69B7A1C23" + { + "Name" = "8:Microsoft.VisualStudio.Shell.Interop.dll" + "Attributes" = "3:512" + } + } + "SourcePath" = "8:Microsoft.VisualStudio.Shell.Interop.dll" + "TargetName" = "8:" + "Tag" = "8:" + "Folder" = "8:_F11D54EE0EEA4BF59B52E621630B6A2E" + "Condition" = "8:" + "Transitive" = "11:FALSE" + "Vital" = "11:TRUE" + "ReadOnly" = "11:FALSE" + "Hidden" = "11:FALSE" + "System" = "11:FALSE" + "Permanent" = "11:FALSE" + "SharedLegacy" = "11:FALSE" + "PackageAs" = "3:1" + "Register" = "3:1" + "Exclude" = "11:TRUE" + "IsDependency" = "11:TRUE" + "IsolateTo" = "8:" + } + } + "FileType" + { + } + "Folder" + { + "{3C67513D-01DD-4637-8A68-80971EB9504F}:_A0841E79B7874F7288672343934C7657" + { + "DefaultLocation" = "8:[ProgramFilesFolder]SQLite.NET4" + "Name" = "8:#1925" + "AlwaysCreate" = "11:FALSE" + "Condition" = "8:" + "Transitive" = "11:FALSE" + "Property" = "8:TARGETDIR" + "Folders" + { + "{9EF0B969-E518-4E46-987F-47570745A589}:_30C77BF2E6E84D01ADE5FB8BA2F81504" + { + "Name" = "8:bin" + "AlwaysCreate" = "11:FALSE" + "Condition" = "8:" + "Transitive" = "11:FALSE" + "Property" = "8:_BD4105DB73B04559A56BB70C4E151056" + "Folders" + { + "{9EF0B969-E518-4E46-987F-47570745A589}:_66DBD0998AA8499691D4F5E42417697D" + { + "Name" = "8:x64" + "AlwaysCreate" = "11:FALSE" + "Condition" = "8:" + "Transitive" = "11:FALSE" + "Property" = "8:_7C07DE0299AB478C8BC7AFB40E220305" + "Folders" + { + } + } + "{9EF0B969-E518-4E46-987F-47570745A589}:_F11D54EE0EEA4BF59B52E621630B6A2E" + { + "Name" = "8:Designer" + "AlwaysCreate" = "11:FALSE" + "Condition" = "8:" + "Transitive" = "11:FALSE" + "Property" = "8:_CA865020181A40EEB518ACF5F89BD66A" + "Folders" + { + } + } + } + } + "{9EF0B969-E518-4E46-987F-47570745A589}:_CA5E61837F5B452B8169C698979CF05C" + { + "Name" = "8:Doc" + "AlwaysCreate" = "11:FALSE" + "Condition" = "8:" + "Transitive" = "11:FALSE" + "Property" = "8:_B787482AA405492D998CAAD43761AF61" + "Folders" + { + } + } + } + } + "{1525181F-901A-416C-8A58-119130FE478E}:_AB7F365F78A44DE79C7007FB08F7343E" + { + "Name" = "8:#1916" + "AlwaysCreate" = "11:FALSE" + "Condition" = "8:" + "Transitive" = "11:FALSE" + "Property" = "8:DesktopFolder" + "Folders" + { + } + } + "{1525181F-901A-416C-8A58-119130FE478E}:_E420345AA61B4AF780EEA7BC8AFAF268" + { + "Name" = "8:#1919" + "AlwaysCreate" = "11:FALSE" + "Condition" = "8:" + "Transitive" = "11:FALSE" + "Property" = "8:ProgramMenuFolder" + "Folders" + { + "{9EF0B969-E518-4E46-987F-47570745A589}:_1B562A9F876E47058AB813C418E24FBF" + { + "Name" = "8:SQLite.NET4" + "AlwaysCreate" = "11:FALSE" + "Condition" = "8:" + "Transitive" = "11:FALSE" + "Property" = "8:_85ED61DA38214E1C9AB39E119A89D75B" + "Folders" + { + } + } + } + } + } + "LaunchCondition" + { + } + "Locator" + { + } + "MsiBootstrapper" + { + "LangId" = "3:1033" + "RequiresElevation" = "11:FALSE" + } + "Product" + { + "Name" = "8:Microsoft Visual Studio" + "ProductName" = "8:SQLite ADO.NET 4.0 Provider" + "ProductCode" = "8:{902C69AF-5B0C-4E21-89F2-064462C2BBC4}" + "PackageCode" = "8:{A25EDA65-7FB2-4CF8-A3DD-5B9142474C03}" + "UpgradeCode" = "8:{E779C0FF-CCE2-493A-B8C2-6DD04E26072C}" + "AspNetVersion" = "8:4.0.30319.0" + "RestartWWWService" = "11:FALSE" + "RemovePreviousVersions" = "11:TRUE" + "DetectNewerInstalledVersion" = "11:TRUE" + "InstallAllUsers" = "11:TRUE" + "ProductVersion" = "8:1.066.1" + "Manufacturer" = "8:Phoenix Software Solutions, LLC" + "ARPHELPTELEPHONE" = "8:" + "ARPHELPLINK" = "8:http://sqlite.phxsoftware.com" + "Title" = "8:SQLite ADO.NET 4.0 Provider" + "Subject" = "8:" + "ARPCONTACT" = "8:Phoenix Software Solutions, LLC" + "Keywords" = "8:" + "ARPCOMMENTS" = "8:" + "ARPURLINFOABOUT" = "8:" + "ARPPRODUCTICON" = "8:" + "ARPIconIndex" = "3:0" + "SearchPath" = "8:" + "UseSystemSearchPath" = "11:TRUE" + "TargetPlatform" = "3:0" + "PreBuildEvent" = "8:" + "PostBuildEvent" = "8:" + "RunPostBuildEvent" = "3:0" + } + "Registry" + { + "HKLM" + { + "Keys" + { + } + } + "HKCU" + { + "Keys" + { + } + } + "HKCR" + { + "Keys" + { + } + } + "HKU" + { + "Keys" + { + } + } + "HKPU" + { + "Keys" + { + } + } + } + "Sequences" + { + } + "Shortcut" + { + "{970C0BB2-C7D0-45D7-ABFA-7EC378858BC0}:_1D4C9AFDF229479AABE410DD0C754667" + { + "Name" = "8:Design-Time Configuration" + "Arguments" = "8:" + "Description" = "8:" + "ShowCmd" = "3:1" + "IconIndex" = "3:32512" + "Transitive" = "11:FALSE" + "Target" = "8:_40DFF08BA903482D807E715A041CA8B1" + "Folder" = "8:_1B562A9F876E47058AB813C418E24FBF" + "WorkingFolder" = "8:_F11D54EE0EEA4BF59B52E621630B6A2E" + "Icon" = "8:_40DFF08BA903482D807E715A041CA8B1" + "Feature" = "8:" + } + "{970C0BB2-C7D0-45D7-ABFA-7EC378858BC0}:_920202B002F9475288A945B0C8361A44" + { + "Name" = "8:SQLite Test Application" + "Arguments" = "8:" + "Description" = "8:" + "ShowCmd" = "3:1" + "IconIndex" = "3:0" + "Transitive" = "11:FALSE" + "Target" = "8:_2C7EDFF06B61482393D94E3A63D90113" + "Folder" = "8:_1B562A9F876E47058AB813C418E24FBF" + "WorkingFolder" = "8:_30C77BF2E6E84D01ADE5FB8BA2F81504" + "Icon" = "8:" + "Feature" = "8:" + } + "{970C0BB2-C7D0-45D7-ABFA-7EC378858BC0}:_CC64AEB6D8A643F7BC8EB95EBC803EB5" + { + "Name" = "8:Help" + "Arguments" = "8:" + "Description" = "8:" + "ShowCmd" = "3:1" + "IconIndex" = "3:0" + "Transitive" = "11:FALSE" + "Target" = "8:_60E2C442F77C48DE8150EBFC86663225" + "Folder" = "8:_1B562A9F876E47058AB813C418E24FBF" + "WorkingFolder" = "8:_CA5E61837F5B452B8169C698979CF05C" + "Icon" = "8:" + "Feature" = "8:" + } + } + "UserInterface" + { + "{2479F3F5-0309-486D-8047-8187E2CE5BA0}:_027E806A39AD4FCD8E7A4EBE86AD3DF3" + { + "UseDynamicProperties" = "11:FALSE" + "IsDependency" = "11:FALSE" + "SourcePath" = "8:\\VsdUserInterface.wim" + } + "{DF760B10-853B-4699-99F2-AFF7185B4A62}:_349E960F62F043E79FD080CB87E24922" + { + "Name" = "8:#1902" + "Sequence" = "3:2" + "Attributes" = "3:3" + "Dialogs" + { + "{688940B3-5CA9-4162-8DEE-2993FA9D8CBC}:_F1CAA16A464043FBB06804165AB31D0C" + { + "Sequence" = "3:100" + "DisplayName" = "8:Finished" + "UseDynamicProperties" = "11:TRUE" + "IsDependency" = "11:FALSE" + "SourcePath" = "8:\\VsdAdminFinishedDlg.wid" + "Properties" + { + "BannerBitmap" + { + "Name" = "8:BannerBitmap" + "DisplayName" = "8:#1001" + "Description" = "8:#1101" + "Type" = "3:8" + "ContextData" = "8:Bitmap" + "Attributes" = "3:4" + "Setting" = "3:2" + "Value" = "8:_B6156897CBBB4E929D9C1F7358CE9E90" + "UsePlugInResources" = "11:TRUE" + } + } + } + } + } + "{DF760B10-853B-4699-99F2-AFF7185B4A62}:_3CB3696DF5D54FCA98E2BF3D4579451E" + { + "Name" = "8:#1901" + "Sequence" = "3:1" + "Attributes" = "3:2" + "Dialogs" + { + "{688940B3-5CA9-4162-8DEE-2993FA9D8CBC}:_1DBE83588B574F75A6233D46A3234D69" + { + "Sequence" = "3:100" + "DisplayName" = "8:Progress" + "UseDynamicProperties" = "11:TRUE" + "IsDependency" = "11:FALSE" + "SourcePath" = "8:\\VsdProgressDlg.wid" + "Properties" + { + "BannerBitmap" + { + "Name" = "8:BannerBitmap" + "DisplayName" = "8:#1001" + "Description" = "8:#1101" + "Type" = "3:8" + "ContextData" = "8:Bitmap" + "Attributes" = "3:4" + "Setting" = "3:2" + "Value" = "8:_B6156897CBBB4E929D9C1F7358CE9E90" + "UsePlugInResources" = "11:TRUE" + } + "ShowProgress" + { + "Name" = "8:ShowProgress" + "DisplayName" = "8:#1009" + "Description" = "8:#1109" + "Type" = "3:5" + "ContextData" = "8:1;True=1;False=0" + "Attributes" = "3:0" + "Setting" = "3:0" + "Value" = "3:1" + "DefaultValue" = "3:1" + "UsePlugInResources" = "11:TRUE" + } + } + } + } + } + "{DF760B10-853B-4699-99F2-AFF7185B4A62}:_573543E04AA54E9387CD1AAF21220444" + { + "Name" = "8:#1902" + "Sequence" = "3:1" + "Attributes" = "3:3" + "Dialogs" + { + "{688940B3-5CA9-4162-8DEE-2993FA9D8CBC}:_991B7280E37E4C23A54CC7027F774891" + { + "Sequence" = "3:100" + "DisplayName" = "8:Finished" + "UseDynamicProperties" = "11:TRUE" + "IsDependency" = "11:FALSE" + "SourcePath" = "8:\\VsdFinishedDlg.wid" + "Properties" + { + "BannerBitmap" + { + "Name" = "8:BannerBitmap" + "DisplayName" = "8:#1001" + "Description" = "8:#1101" + "Type" = "3:8" + "ContextData" = "8:Bitmap" + "Attributes" = "3:4" + "Setting" = "3:2" + "Value" = "8:_B6156897CBBB4E929D9C1F7358CE9E90" + "UsePlugInResources" = "11:TRUE" + } + "UpdateText" + { + "Name" = "8:UpdateText" + "DisplayName" = "8:#1058" + "Description" = "8:#1158" + "Type" = "3:15" + "ContextData" = "8:" + "Attributes" = "3:0" + "Setting" = "3:1" + "Value" = "8:#1258" + "DefaultValue" = "8:#1258" + "UsePlugInResources" = "11:TRUE" + } + } + } + } + } + "{DF760B10-853B-4699-99F2-AFF7185B4A62}:_5E0AF2B2658547308882EEE91399D911" + { + "Name" = "8:#1901" + "Sequence" = "3:2" + "Attributes" = "3:2" + "Dialogs" + { + "{688940B3-5CA9-4162-8DEE-2993FA9D8CBC}:_82FCCA944F324BA18F0E3E01BCA1E60B" + { + "Sequence" = "3:100" + "DisplayName" = "8:Progress" + "UseDynamicProperties" = "11:TRUE" + "IsDependency" = "11:FALSE" + "SourcePath" = "8:\\VsdAdminProgressDlg.wid" + "Properties" + { + "BannerBitmap" + { + "Name" = "8:BannerBitmap" + "DisplayName" = "8:#1001" + "Description" = "8:#1101" + "Type" = "3:8" + "ContextData" = "8:Bitmap" + "Attributes" = "3:4" + "Setting" = "3:2" + "Value" = "8:_B6156897CBBB4E929D9C1F7358CE9E90" + "UsePlugInResources" = "11:TRUE" + } + "ShowProgress" + { + "Name" = "8:ShowProgress" + "DisplayName" = "8:#1009" + "Description" = "8:#1109" + "Type" = "3:5" + "ContextData" = "8:1;True=1;False=0" + "Attributes" = "3:0" + "Setting" = "3:0" + "Value" = "3:1" + "DefaultValue" = "3:1" + "UsePlugInResources" = "11:TRUE" + } + } + } + } + } + "{DF760B10-853B-4699-99F2-AFF7185B4A62}:_7046F6E46106420BA50AA9A9ED86389A" + { + "Name" = "8:#1900" + "Sequence" = "3:1" + "Attributes" = "3:1" + "Dialogs" + { + "{688940B3-5CA9-4162-8DEE-2993FA9D8CBC}:_03C4F0FAD7804F3DAE9A980E584F691E" + { + "Sequence" = "3:300" + "DisplayName" = "8:Confirm Installation" + "UseDynamicProperties" = "11:TRUE" + "IsDependency" = "11:FALSE" + "SourcePath" = "8:\\VsdConfirmDlg.wid" + "Properties" + { + "BannerBitmap" + { + "Name" = "8:BannerBitmap" + "DisplayName" = "8:#1001" + "Description" = "8:#1101" + "Type" = "3:8" + "ContextData" = "8:Bitmap" + "Attributes" = "3:4" + "Setting" = "3:2" + "Value" = "8:_B6156897CBBB4E929D9C1F7358CE9E90" + "UsePlugInResources" = "11:TRUE" + } + } + } + "{688940B3-5CA9-4162-8DEE-2993FA9D8CBC}:_4B4F0FAA5A094FCC952CA8A93DEA0F04" + { + "Sequence" = "3:100" + "DisplayName" = "8:Welcome" + "UseDynamicProperties" = "11:TRUE" + "IsDependency" = "11:FALSE" + "SourcePath" = "8:\\VsdWelcomeDlg.wid" + "Properties" + { + "BannerBitmap" + { + "Name" = "8:BannerBitmap" + "DisplayName" = "8:#1001" + "Description" = "8:#1101" + "Type" = "3:8" + "ContextData" = "8:Bitmap" + "Attributes" = "3:4" + "Setting" = "3:2" + "Value" = "8:_B6156897CBBB4E929D9C1F7358CE9E90" + "UsePlugInResources" = "11:TRUE" + } + "CopyrightWarning" + { + "Name" = "8:CopyrightWarning" + "DisplayName" = "8:#1002" + "Description" = "8:#1102" + "Type" = "3:3" + "ContextData" = "8:" + "Attributes" = "3:0" + "Setting" = "3:2" + "Value" = "8:" + "DefaultValue" = "8:#1202" + "UsePlugInResources" = "11:TRUE" + } + "Welcome" + { + "Name" = "8:Welcome" + "DisplayName" = "8:#1003" + "Description" = "8:#1103" + "Type" = "3:3" + "ContextData" = "8:" + "Attributes" = "3:0" + "Setting" = "3:1" + "Value" = "8:#1203" + "DefaultValue" = "8:#1203" + "UsePlugInResources" = "11:TRUE" + } + } + } + "{688940B3-5CA9-4162-8DEE-2993FA9D8CBC}:_CAD4CD70D47945E7A7FCD4428405F7FD" + { + "Sequence" = "3:200" + "DisplayName" = "8:Installation Folder" + "UseDynamicProperties" = "11:TRUE" + "IsDependency" = "11:FALSE" + "SourcePath" = "8:\\VsdFolderDlg.wid" + "Properties" + { + "BannerBitmap" + { + "Name" = "8:BannerBitmap" + "DisplayName" = "8:#1001" + "Description" = "8:#1101" + "Type" = "3:8" + "ContextData" = "8:Bitmap" + "Attributes" = "3:4" + "Setting" = "3:2" + "Value" = "8:_B6156897CBBB4E929D9C1F7358CE9E90" + "UsePlugInResources" = "11:TRUE" + } + "InstallAllUsersVisible" + { + "Name" = "8:InstallAllUsersVisible" + "DisplayName" = "8:#1059" + "Description" = "8:#1159" + "Type" = "3:5" + "ContextData" = "8:1;True=1;False=0" + "Attributes" = "3:0" + "Setting" = "3:0" + "Value" = "3:1" + "DefaultValue" = "3:1" + "UsePlugInResources" = "11:TRUE" + } + } + } + } + } + "{DF760B10-853B-4699-99F2-AFF7185B4A62}:_A95B4EFD2C5249848F009D88CBA3739B" + { + "Name" = "8:#1900" + "Sequence" = "3:2" + "Attributes" = "3:1" + "Dialogs" + { + "{688940B3-5CA9-4162-8DEE-2993FA9D8CBC}:_101B4B845E67488FB6A0AC097773DA38" + { + "Sequence" = "3:300" + "DisplayName" = "8:Confirm Installation" + "UseDynamicProperties" = "11:TRUE" + "IsDependency" = "11:FALSE" + "SourcePath" = "8:\\VsdAdminConfirmDlg.wid" + "Properties" + { + "BannerBitmap" + { + "Name" = "8:BannerBitmap" + "DisplayName" = "8:#1001" + "Description" = "8:#1101" + "Type" = "3:8" + "ContextData" = "8:Bitmap" + "Attributes" = "3:4" + "Setting" = "3:2" + "Value" = "8:_B6156897CBBB4E929D9C1F7358CE9E90" + "UsePlugInResources" = "11:TRUE" + } + } + } + "{688940B3-5CA9-4162-8DEE-2993FA9D8CBC}:_1AD3D10EBB64435985C57A85063E6CDF" + { + "Sequence" = "3:100" + "DisplayName" = "8:Welcome" + "UseDynamicProperties" = "11:TRUE" + "IsDependency" = "11:FALSE" + "SourcePath" = "8:\\VsdAdminWelcomeDlg.wid" + "Properties" + { + "BannerBitmap" + { + "Name" = "8:BannerBitmap" + "DisplayName" = "8:#1001" + "Description" = "8:#1101" + "Type" = "3:8" + "ContextData" = "8:Bitmap" + "Attributes" = "3:4" + "Setting" = "3:2" + "Value" = "8:_B6156897CBBB4E929D9C1F7358CE9E90" + "UsePlugInResources" = "11:TRUE" + } + "CopyrightWarning" + { + "Name" = "8:CopyrightWarning" + "DisplayName" = "8:#1002" + "Description" = "8:#1102" + "Type" = "3:3" + "ContextData" = "8:" + "Attributes" = "3:0" + "Setting" = "3:2" + "Value" = "8:" + "DefaultValue" = "8:#1202" + "UsePlugInResources" = "11:TRUE" + } + "Welcome" + { + "Name" = "8:Welcome" + "DisplayName" = "8:#1003" + "Description" = "8:#1103" + "Type" = "3:3" + "ContextData" = "8:" + "Attributes" = "3:0" + "Setting" = "3:1" + "Value" = "8:#1203" + "DefaultValue" = "8:#1203" + "UsePlugInResources" = "11:TRUE" + } + } + } + "{688940B3-5CA9-4162-8DEE-2993FA9D8CBC}:_F5C2368EB13F47EF8808B4E5855A647B" + { + "Sequence" = "3:200" + "DisplayName" = "8:Installation Folder" + "UseDynamicProperties" = "11:TRUE" + "IsDependency" = "11:FALSE" + "SourcePath" = "8:\\VsdAdminFolderDlg.wid" + "Properties" + { + "BannerBitmap" + { + "Name" = "8:BannerBitmap" + "DisplayName" = "8:#1001" + "Description" = "8:#1101" + "Type" = "3:8" + "ContextData" = "8:Bitmap" + "Attributes" = "3:4" + "Setting" = "3:2" + "Value" = "8:_B6156897CBBB4E929D9C1F7358CE9E90" + "UsePlugInResources" = "11:TRUE" + } + } + } + } + } + "{2479F3F5-0309-486D-8047-8187E2CE5BA0}:_F02FDE6DA53449159DF6E6441E2314C9" + { + "UseDynamicProperties" = "11:FALSE" + "IsDependency" = "11:FALSE" + "SourcePath" = "8:\\VsdBasicDialogs.wim" + } + } + "MergeModule" + { + } + "ProjectOutput" + { + } + } +}