diff --git a/MatterControlLib/DataStorage/SQLiteUnix.cs b/MatterControl.Winforms/DataStorage/SQLiteUnix.cs
similarity index 100%
rename from MatterControlLib/DataStorage/SQLiteUnix.cs
rename to MatterControl.Winforms/DataStorage/SQLiteUnix.cs
diff --git a/MatterControlLib/DataStorage/SQLiteWin32.cs b/MatterControl.Winforms/DataStorage/SQLiteWin32.cs
similarity index 99%
rename from MatterControlLib/DataStorage/SQLiteWin32.cs
rename to MatterControl.Winforms/DataStorage/SQLiteWin32.cs
index 934dbac09..e43768f54 100644
--- a/MatterControlLib/DataStorage/SQLiteWin32.cs
+++ b/MatterControl.Winforms/DataStorage/SQLiteWin32.cs
@@ -44,9 +44,35 @@ using Sqlite3Statement = System.IntPtr;
using MatterHackers.MatterControl.DataStorage;
using System.Runtime.InteropServices;
+using MatterHackers.Agg.Platform;
namespace SQLiteWin32
{
+ public static class DesktopSqlite
+ {
+ public static ISQLite CreateInstance()
+ {
+ ISQLite dbSQLite;
+
+ string datastoreLocation = ApplicationDataStorage.Instance.DatastorePath;
+ switch (AggContext.OperatingSystem)
+ {
+
+ case OSType.Mac:
+ return new SQLiteUnix.SQLiteConnection(datastoreLocation);
+ break;
+
+ case OSType.X11:
+ return new SQLiteUnix.SQLiteConnection(datastoreLocation);
+ break;
+
+ default:
+ return new SQLiteWin32.SQLiteConnection(datastoreLocation);
+ break;
+ }
+ }
+ }
+
public class SQLiteException : System.Exception
{
public SQLite3.Result Result { get; private set; }
diff --git a/MatterControl.Winforms/MatterControl.Winforms.csproj b/MatterControl.Winforms/MatterControl.Winforms.csproj
index 3bcab6e54..0c3337fde 100644
--- a/MatterControl.Winforms/MatterControl.Winforms.csproj
+++ b/MatterControl.Winforms/MatterControl.Winforms.csproj
@@ -18,7 +18,7 @@
fullfalse..\bin\Debug\
- DEBUG;TRACE
+ TRACE;DEBUG;USE_OPENGL;IS_WINDOWS;IS_WINDOWS_FORMSprompt4AnyCPU
@@ -45,6 +45,8 @@
+
+ Form
@@ -56,6 +58,10 @@
+
+ {f1653f20-d47d-4f29-8c55-3c835542af5f}
+ Community.CsharpSqlite
+ {D557B079-612F-467F-AE0D-3F77BCD627F7}MatterControlLib
diff --git a/MatterControl.csproj b/MatterControl.csproj
index d0ea09bb4..fc6074c4a 100644
--- a/MatterControl.csproj
+++ b/MatterControl.csproj
@@ -76,6 +76,10 @@
{97d5ade3-c1b4-4b46-8a3e-718a4f7f079f}MatterControl.Printing
+
+ {D6DC2669-7B1F-40FE-89BF-45D4C94473E3}
+ MatterControl.Winforms
+ {93bebfdf-b81a-4344-ab82-0dbf58b234cd}MatterControlLib
diff --git a/MatterControlLib/DataStorage/ApplicationDataStorage.cs b/MatterControlLib/DataStorage/ApplicationDataStorage.cs
index d268a73d2..72d7bfe3a 100644
--- a/MatterControlLib/DataStorage/ApplicationDataStorage.cs
+++ b/MatterControlLib/DataStorage/ApplicationDataStorage.cs
@@ -103,12 +103,10 @@ namespace MatterHackers.MatterControl.DataStorage
///
public string DatastorePath => Path.Combine(EnsurePath(_applicationUserDataPath), datastoreName);
-#if __ANDROID__
///
/// Returns the public storage folder (ex. download folder on Android)
///
- public string PublicDataStoragePath { get; } = Android.OS.Environment.GetExternalStoragePublicDirectory(Android.OS.Environment.DirectoryDownloads).AbsolutePath;
-#endif
+ public string PublicDataStoragePath { get; set; }
///
/// Invokes CreateDirectory on all paths, creating if missing, before returning
@@ -124,7 +122,7 @@ namespace MatterHackers.MatterControl.DataStorage
/// Overrides the AppData location. Used by tests to set a non-standard AppData location
///
/// The new AppData path.
- internal void OverrideAppDataLocation(string path)
+ internal void OverrideAppDataLocation(string path, ISQLite sqlite)
{
Console.WriteLine(" Overriding ApplicationUserDataPath: " + path);
@@ -135,7 +133,7 @@ namespace MatterHackers.MatterControl.DataStorage
// Initialize a fresh datastore instance after overriding the AppData path
Datastore.Instance = new Datastore();
- Datastore.Instance.Initialize();
+ Datastore.Instance.Initialize(sqlite);
}
public string GetTempFileName(string fileExtension = null)
diff --git a/MatterControlLib/DataStorage/Datastore.cs b/MatterControlLib/DataStorage/Datastore.cs
index f3d9a68e0..b5c89202a 100644
--- a/MatterControlLib/DataStorage/Datastore.cs
+++ b/MatterControlLib/DataStorage/Datastore.cs
@@ -66,29 +66,6 @@ namespace MatterHackers.MatterControl.DataStorage
{
ApplicationDataStorage.Instance.FirstRun = true;
}
-
- OSType osType = AggContext.OperatingSystem;
- switch (osType)
- {
- case OSType.Windows:
- dbSQLite = new SQLiteWin32.SQLiteConnection(datastoreLocation);
- break;
-
- case OSType.Mac:
- dbSQLite = new SQLiteUnix.SQLiteConnection(datastoreLocation);
- break;
-
- case OSType.X11:
- dbSQLite = new SQLiteUnix.SQLiteConnection(datastoreLocation);
- break;
-
- case OSType.Android:
- dbSQLite = new SQLiteAndroid.SQLiteConnection(datastoreLocation);
- break;
-
- default:
- throw new NotImplementedException();
- }
}
public static Datastore Instance
@@ -102,7 +79,7 @@ namespace MatterHackers.MatterControl.DataStorage
return globalInstance;
}
- // Special case to allow tests to set custom application paths
+ // Special case to allow tests to set custom application paths
internal set
{
globalInstance = value;
@@ -146,8 +123,9 @@ namespace MatterHackers.MatterControl.DataStorage
}
//Run initial checks and operations on sqlite datastore
- public void Initialize()
+ public void Initialize(ISQLite dbSQLite)
{
+ this.dbSQLite = dbSQLite;
ValidateSchema();
// Construct the root library collection if missing
diff --git a/MatterControlLib/DataStorage/SQLiteAndroid.cs b/MatterControlLib/DataStorage/SQLiteAndroid.cs
deleted file mode 100644
index eab975ee1..000000000
--- a/MatterControlLib/DataStorage/SQLiteAndroid.cs
+++ /dev/null
@@ -1,3257 +0,0 @@
-//
-// Copyright (c) 2009-2012 Krueger Systems, Inc.
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-//
-
-//#define USE_CSHARP_SQLITE
-
-#if NETFX_CORE
-#define USE_NEW_REFLECTION_API
-#endif
-
-using System;
-using System.Diagnostics;
-
-#if !USE_SQLITEPCL_RAW
-
-using System.Runtime.InteropServices;
-
-#endif
-
-using System.Collections.Generic;
-using System.Reflection;
-using System.Linq;
-using System.Linq.Expressions;
-using System.Threading;
-
-#if USE_CSHARP_SQLITE
-using Sqlite3 = Community.CsharpSqlite.Sqlite3;
-using Sqlite3DatabaseHandle = Community.CsharpSqlite.Sqlite3.sqlite3;
-using Sqlite3Statement = Community.CsharpSqlite.Sqlite3.Vdbe;
-#elif USE_WP8_NATIVE_SQLITE
-using Sqlite3 = Sqlite.Sqlite3;
-using Sqlite3DatabaseHandle = Sqlite.Database;
-using Sqlite3Statement = Sqlite.Statement;
-#elif USE_SQLITEPCL_RAW
-using Sqlite3DatabaseHandle = SQLitePCL.sqlite3;
-using Sqlite3Statement = SQLitePCL.sqlite3_stmt;
-using Sqlite3 = SQLitePCL.raw;
-#else
-
-using Sqlite3DatabaseHandle = System.IntPtr;
-
-using Sqlite3Statement = System.IntPtr;
-#endif
-
-using MatterHackers.MatterControl.DataStorage;
-
-namespace SQLiteAndroid
-{
- public class SQLiteException : System.Exception
- {
- public SQLite3.Result Result { get; private set; }
-
- protected SQLiteException(SQLite3.Result r, string message)
- : base(message)
- {
- Result = r;
- }
-
- public static SQLiteException New(SQLite3.Result r, string message)
- {
- return new SQLiteException(r, message);
- }
- }
-
- [Flags]
- public enum SQLiteOpenFlags
- {
- ReadOnly = 1, ReadWrite = 2, Create = 4,
- NoMutex = 0x8000, FullMutex = 0x10000,
- SharedCache = 0x20000, PrivateCache = 0x40000,
- ProtectionComplete = 0x00100000,
- ProtectionCompleteUnlessOpen = 0x00200000,
- ProtectionCompleteUntilFirstUserAuthentication = 0x00300000,
- ProtectionNone = 0x00400000
- }
-
- ///
- /// Represents an open connection to a SQLite database.
- ///
- public partial class SQLiteConnection : IDisposable, ISQLite
- {
- private bool _open;
- private TimeSpan _busyTimeout;
- private Dictionary _mappings = null;
- private Dictionary _tables = null;
- private System.Diagnostics.Stopwatch _sw;
- private long _elapsedMilliseconds = 0;
-
- private int _trasactionDepth = 0;
- private Random _rand = new Random();
-
- public Sqlite3DatabaseHandle Handle { get; private set; }
-
-#if USE_CSHARP_SQLITE
- internal static readonly Sqlite3DatabaseHandle NullHandle = null;
-#else
- internal static readonly Sqlite3DatabaseHandle NullHandle = IntPtr.Zero;
-#endif
-
- public string DatabasePath { get; private set; }
-
- public bool TimeExecution { get; set; }
-
- public bool Trace { get; set; }
-
- public bool StoreDateTimeAsTicks { get; private set; }
-
- ///
- /// Constructs a new SQLiteConnection and opens a SQLite database specified by databasePath.
- ///
- ///
- /// Specifies the path to the database file.
- ///
- ///
- /// Specifies whether to store DateTime properties as ticks (true) or strings (false). You
- /// absolutely do want to store them as Ticks in all new projects. The default of false is
- /// only here for backwards compatibility. There is a *significant* speed advantage, with no
- /// down sides, when setting storeDateTimeAsTicks = true.
- ///
- public SQLiteConnection(string databasePath, bool storeDateTimeAsTicks = false)
- : this(databasePath, SQLiteOpenFlags.ReadWrite | SQLiteOpenFlags.Create, storeDateTimeAsTicks)
- {
- }
-
- ///
- /// Constructs a new SQLiteConnection and opens a SQLite database specified by databasePath.
- ///
- ///
- /// Specifies the path to the database file.
- ///
- ///
- /// Specifies whether to store DateTime properties as ticks (true) or strings (false). You
- /// absolutely do want to store them as Ticks in all new projects. The default of false is
- /// only here for backwards compatibility. There is a *significant* speed advantage, with no
- /// down sides, when setting storeDateTimeAsTicks = true.
- ///
- public SQLiteConnection(string databasePath, SQLiteOpenFlags openFlags, bool storeDateTimeAsTicks = false)
- {
- DatabasePath = databasePath;
-
-#if NETFX_CORE
- SQLite3.SetDirectory(/*temp directory type*/2, Windows.Storage.ApplicationData.Current.TemporaryFolder.Path);
-#endif
-
- Sqlite3DatabaseHandle handle;
-
-#if SILVERLIGHT || USE_CSHARP_SQLITE
- var r = SQLite3.Open (databasePath, out handle, (int)openFlags, IntPtr.Zero);
-#else
- // open using the byte[]
- // in the case where the path may include Unicode
- // force open to using UTF-8 using sqlite3_open_v2
- var databasePathAsBytes = GetNullTerminatedUtf8(DatabasePath);
- var r = SQLite3.Open(databasePathAsBytes, out handle, (int)openFlags, IntPtr.Zero);
-#endif
-
- Handle = handle;
- if (r != SQLite3.Result.OK)
- {
- throw SQLiteException.New(r, String.Format("Could not open database file: {0} ({1})", DatabasePath, r));
- }
- _open = true;
-
- StoreDateTimeAsTicks = storeDateTimeAsTicks;
-
- BusyTimeout = TimeSpan.FromSeconds(0.1);
- }
-
- static SQLiteConnection()
- {
- if (_preserveDuringLinkMagic)
- {
- var ti = new ColumnInfo();
- ti.Name = "magic";
- }
- }
-
- private static byte[] GetNullTerminatedUtf8(string s)
- {
- var utf8Length = System.Text.Encoding.UTF8.GetByteCount(s);
- var bytes = new byte[utf8Length + 1];
- utf8Length = System.Text.Encoding.UTF8.GetBytes(s, 0, s.Length, bytes, 0);
- return bytes;
- }
-
- ///
- /// Used to list some code that we want the MonoTouch linker
- /// to see, but that we never want to actually execute.
- ///
- private static bool _preserveDuringLinkMagic = false;
-
- ///
- /// Sets a busy handler to sleep the specified amount of time when a table is locked.
- /// The handler will sleep multiple times until a total time of has accumulated.
- ///
- public TimeSpan BusyTimeout
- {
- get { return _busyTimeout; }
- set
- {
- _busyTimeout = value;
- if (Handle != NullHandle)
- {
- SQLite3.BusyTimeout(Handle, (int)_busyTimeout.TotalMilliseconds);
- }
- }
- }
-
- ///
- /// Returns the mappings from types to tables that the connection
- /// currently understands.
- ///
- public IEnumerable TableMappings
- {
- get
- {
- if (_tables == null)
- {
- return Enumerable.Empty();
- }
- else
- {
- return _tables.Values;
- }
- }
- }
-
- ///
- /// Retrieves the mapping that is automatically generated for the given type.
- ///
- ///
- /// The type whose mapping to the database is returned.
- ///
- ///
- /// The mapping represents the schema of the columns of the database and contains
- /// methods to set and get properties of objects.
- ///
- public TableMapping GetMapping(Type type)
- {
- if (_mappings == null)
- {
- _mappings = new Dictionary();
- }
- TableMapping map;
- if (!_mappings.TryGetValue(type.FullName, out map))
- {
- map = new TableMapping(type);
- _mappings[type.FullName] = map;
- }
- return map;
- }
-
- ///
- /// Retrieves the mapping that is automatically generated for the given type.
- ///
- ///
- /// The mapping represents the schema of the columns of the database and contains
- /// methods to set and get properties of objects.
- ///
- public TableMapping GetMapping()
- {
- return GetMapping(typeof(T));
- }
-
- private struct IndexedColumn
- {
- public int Order;
- public string ColumnName;
- }
-
- private struct IndexInfo
- {
- public string IndexName;
- public string TableName;
- public bool Unique;
- public List Columns;
- }
-
- ///
- /// Executes a "drop table" on the database. This is non-recoverable.
- ///
- public int DropTable()
- {
- return DropTable(typeof(T));
- }
-
- ///
- /// Executes a "drop table" on the database. This is non-recoverable.
- ///
- /// Type to reflect to a database table.
- public int DropTable(Type ty)
- {
- lock (locker)
- {
- TableMapping map = GetMapping(ty);
- var query = string.Format("drop table if exists \"{0}\"", map.TableName);
-
- return Execute(query);
- }
- }
-
- ///
- /// Executes a "create table if not exists" on the database. It also
- /// creates any specified indexes on the columns of the table. It uses
- /// a schema automatically generated from the specified type. You can
- /// later access this schema by calling GetMapping.
- ///
- ///
- /// The number of entries added to the database schema.
- ///
- public int CreateTable()
- {
- return CreateTable(typeof(T));
- }
-
- ///
- /// Executes a "create table if not exists" on the database. It also
- /// creates any specified indexes on the columns of the table. It uses
- /// a schema automatically generated from the specified type. You can
- /// later access this schema by calling GetMapping.
- ///
- /// Type to reflect to a database table.
- ///
- /// The number of entries added to the database schema.
- ///
- public int CreateTable(Type ty)
- {
- lock (locker)
- {
- if (_tables == null)
- {
- _tables = new Dictionary();
- }
- TableMapping map;
- if (!_tables.TryGetValue(ty.FullName, out map))
- {
- map = GetMapping(ty);
- _tables.Add(ty.FullName, map);
- }
- var query = "create table if not exists \"" + map.TableName + "\"(\n";
-
- var decls = map.Columns.Select(p => Orm.SqlDecl(p, StoreDateTimeAsTicks));
- var decl = string.Join(",\n", decls.ToArray());
- query += decl;
- query += ")";
-
- var count = Execute(query);
-
- if (count == 0)
- { //Possible bug: This always seems to return 0?
- // Table already exists, migrate it
- MigrateTable(map);
- }
-
- var indexes = new Dictionary();
- foreach (var c in map.Columns)
- {
- foreach (var i in c.Indices)
- {
- var iname = i.Name ?? map.TableName + "_" + c.Name;
- IndexInfo iinfo;
- if (!indexes.TryGetValue(iname, out iinfo))
- {
- iinfo = new IndexInfo
- {
- IndexName = iname,
- TableName = map.TableName,
- Unique = i.Unique,
- Columns = new List()
- };
- indexes.Add(iname, iinfo);
- }
-
- if (i.Unique != iinfo.Unique)
- throw new Exception("All the columns in an index must have the same value for their Unique property");
-
- iinfo.Columns.Add(new IndexedColumn
- {
- Order = i.Order,
- ColumnName = c.Name
- });
- }
- }
-
- foreach (var indexName in indexes.Keys)
- {
- var index = indexes[indexName];
- const string sqlFormat = "create {3} index if not exists \"{0}\" on \"{1}\"(\"{2}\")";
- var columns = String.Join("\",\"", index.Columns.OrderBy(i => i.Order).Select(i => i.ColumnName).ToArray());
- var sql = String.Format(sqlFormat, indexName, index.TableName, columns, index.Unique ? "unique" : "");
- count += Execute(sql);
- }
-
- return count;
- }
- }
-
- public class ColumnInfo
- {
- // public int cid { get; set; }
-
- [Column("name")]
- public string Name { get; set; }
-
- // [Column ("type")]
- // public string ColumnType { get; set; }
-
- // public int notnull { get; set; }
-
- // public string dflt_value { get; set; }
-
- // public int pk { get; set; }
-
- public override string ToString()
- {
- return Name;
- }
- }
-
- public IEnumerable GetTableInfo(string tableName)
- {
- var query = "pragma table_info(\"" + tableName + "\")";
- return Query(query);
- }
-
- private void MigrateTable(TableMapping map)
- {
- var existingCols = GetTableInfo(map.TableName);
-
- var toBeAdded = new List();
-
- foreach (var p in map.Columns)
- {
- var found = false;
- foreach (var c in existingCols)
- {
- found = (string.Compare(p.Name, c.Name, StringComparison.InvariantCultureIgnoreCase) == 0);
- if (found)
- break;
- }
- if (!found)
- {
- toBeAdded.Add(p);
- }
- }
-
- foreach (var p in toBeAdded)
- {
- var addCol = "alter table \"" + map.TableName + "\" add column " + Orm.SqlDecl(p, StoreDateTimeAsTicks);
- Execute(addCol);
- }
- }
-
- ///
- /// Creates a new SQLiteCommand. Can be overridden to provide a sub-class.
- ///
- ///
- protected virtual SQLiteCommand NewCommand()
- {
- return new SQLiteCommand(this);
- }
-
- ///
- /// Creates a new SQLiteCommand given the command text with arguments. Place a '?'
- /// in the command text for each of the arguments.
- ///
- ///
- /// The fully escaped SQL.
- ///
- ///
- /// Arguments to substitute for the occurrences of '?' in the command text.
- ///
- ///
- /// A
- ///
- public SQLiteCommand CreateCommand(string cmdText, params object[] ps)
- {
- if (!_open)
- {
- throw SQLiteException.New(SQLite3.Result.Error, "Cannot create commands from unopened database");
- }
- else
- {
- var cmd = NewCommand();
- cmd.CommandText = cmdText;
- foreach (var o in ps)
- {
- cmd.Bind(o);
- }
- return cmd;
- }
- }
-
- ///
- /// Creates a SQLiteCommand given the command text (SQL) with arguments. Place a '?'
- /// in the command text for each of the arguments and then executes that command.
- /// Use this method instead of Query when you don't expect rows back. Such cases include
- /// INSERTs, UPDATEs, and DELETEs.
- /// You can set the Trace or TimeExecution properties of the connection
- /// to profile execution.
- ///
- ///
- /// The fully escaped SQL.
- ///
- ///
- /// Arguments to substitute for the occurrences of '?' in the query.
- ///
- ///
- /// The number of rows modified in the database as a result of this execution.
- ///
- public int Execute(string query, params object[] args)
- {
- var cmd = CreateCommand(query, args);
-
- if (TimeExecution)
- {
- if (_sw == null)
- {
- _sw = new System.Diagnostics.Stopwatch();
- }
- _sw.Reset();
- _sw.Start();
- }
-
- var r = cmd.ExecuteNonQuery();
-
- if (TimeExecution)
- {
- _sw.Stop();
- _elapsedMilliseconds += _sw.ElapsedMilliseconds;
- Debug.WriteLine(string.Format("Finished in {0} ms ({1:0.0} s total)", _sw.ElapsedMilliseconds, _elapsedMilliseconds / 1000.0));
- }
-
- return r;
- }
-
- public T ExecuteScalar(string query, params object[] args)
- {
- lock (locker)
- {
- var cmd = CreateCommand(query, args);
-
- if (TimeExecution)
- {
- if (_sw == null)
- {
- _sw = new System.Diagnostics.Stopwatch();
- }
- _sw.Reset();
- _sw.Start();
- }
-
- var r = cmd.ExecuteScalar();
-
- if (TimeExecution)
- {
- _sw.Stop();
- _elapsedMilliseconds += _sw.ElapsedMilliseconds;
- Debug.WriteLine(string.Format("Finished in {0} ms ({1:0.0} s total)", _sw.ElapsedMilliseconds, _elapsedMilliseconds / 1000.0));
- }
-
- return r;
- }
- }
-
- ///
- /// Creates a SQLiteCommand given the command text (SQL) with arguments. Place a '?'
- /// in the command text for each of the arguments and then executes that command.
- /// It returns each row of the result using the mapping automatically generated for
- /// the given type.
- ///
- ///
- /// The fully escaped SQL.
- ///
- ///
- /// Arguments to substitute for the occurrences of '?' in the query.
- ///
- ///
- /// An enumerable with one result for each row returned by the query.
- ///
- public List Query(string query, params object[] args) where T : new()
- {
- var cmd = CreateCommand(query, args);
- lock (locker)
- {
- return cmd.ExecuteQuery();
- }
- }
-
- ///
- /// Creates a SQLiteCommand given the command text (SQL) with arguments. Place a '?'
- /// in the command text for each of the arguments and then executes that command.
- /// It returns each row of the result using the mapping automatically generated for
- /// the given type.
- ///
- ///
- /// The fully escaped SQL.
- ///
- ///
- /// Arguments to substitute for the occurrences of '?' in the query.
- ///
- ///
- /// An enumerable with one result for each row returned by the query.
- /// The enumerator will call sqlite3_step on each call to MoveNext, so the database
- /// connection must remain open for the lifetime of the enumerator.
- ///
- public IEnumerable DeferredQuery(string query, params object[] args) where T : new()
- {
- var cmd = CreateCommand(query, args);
- return cmd.ExecuteDeferredQuery();
- }
-
- ///
- /// Creates a SQLiteCommand given the command text (SQL) with arguments. Place a '?'
- /// in the command text for each of the arguments and then executes that command.
- /// It returns each row of the result using the specified mapping. This function is
- /// only used by libraries in order to query the database via introspection. It is
- /// normally not used.
- ///
- ///
- /// A to use to convert the resulting rows
- /// into objects.
- ///
- ///
- /// The fully escaped SQL.
- ///
- ///
- /// Arguments to substitute for the occurrences of '?' in the query.
- ///
- ///
- /// An enumerable with one result for each row returned by the query.
- ///
- public List