resources/MetaDataCollections.xml \
$(wildcard resources/*.bmp)
-run-test-local: test.db
+test-local: test.db
test.db: Test/test.sql
rm -f $@
using System.Globalization;\r
using System.ComponentModel;\r
\r
- public sealed partial class SQLiteConnection\r
+ public sealed partial class SqliteConnection\r
{\r
/// <summary>\r
/// Returns a SQLiteProviderFactory object.\r
/// </summary>\r
protected override DbProviderFactory DbProviderFactory\r
{\r
- get { return SQLiteFactory.Instance; }\r
+ get { return SqliteFactory.Instance; }\r
}\r
}\r
}\r
/// <summary>\r
/// SQLite implementation of DbProviderFactory.\r
/// </summary>\r
- public sealed partial class SQLiteFactory : IServiceProvider\r
+ public sealed partial class SqliteFactory : IServiceProvider\r
{\r
private static Type _dbProviderServicesType;\r
private static object _sqliteServices;\r
\r
- static SQLiteFactory()\r
+ static SqliteFactory()\r
{\r
_dbProviderServicesType = Type.GetType("System.Data.Common.DbProviderServices, System.Data.Entity, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089", false);\r
}\r
/// <summary>\r
/// The opaque pointer returned to us by the sqlite provider\r
/// </summary>\r
- protected SQLiteConnectionHandle _sql;\r
+ protected SqliteConnectionHandle _sql;\r
protected string _fileName;\r
protected bool _usePool;\r
protected int _poolVersion = 0;\r
/// <summary>\r
/// The user-defined functions registered on this connection\r
/// </summary>\r
- protected SQLiteFunction[] _functionsArray;\r
+ protected SqliteFunction[] _functionsArray;\r
\r
internal SQLite3(SQLiteDateFormats fmt)\r
: base(fmt)\r
\r
// It isn't necessary to cleanup any functions we've registered. If the connection\r
// goes to the pool and is resurrected later, re-registered functions will overwrite the\r
- // previous functions. The SQLiteFunctionCookieHandle will take care of freeing unmanaged\r
+ // previous functions. The SqliteFunctionCookieHandle will take care of freeing unmanaged\r
// resources belonging to the previously-registered functions.\r
internal override void Close()\r
{\r
if (_usePool)\r
{\r
SQLiteBase.ResetConnection(_sql);\r
- SQLiteConnectionPool.Add(_fileName, _sql, _poolVersion);\r
+ SqliteConnectionPool.Add(_fileName, _sql, _poolVersion);\r
}\r
else\r
_sql.Dispose();\r
if (usePool)\r
{\r
_fileName = strFilename;\r
- _sql = SQLiteConnectionPool.Remove(strFilename, maxPoolSize, out _poolVersion);\r
+ _sql = SqliteConnectionPool.Remove(strFilename, maxPoolSize, out _poolVersion);\r
}\r
\r
if (_sql == null)\r
#else\r
int n = UnsafeNativeMethods.sqlite3_open_v2(ToUTF8(strFilename), out db, (int)flags, IntPtr.Zero);\r
#endif\r
- if (n > 0) throw new SQLiteException(n, null);\r
+ if (n > 0) throw new SqliteException(n, null);\r
\r
_sql = db;\r
}\r
// Bind functions to this connection. If any previous functions of the same name\r
// were already bound, then the new bindings replace the old.\r
- _functionsArray = SQLiteFunction.BindFunctions(this);\r
+ _functionsArray = SqliteFunction.BindFunctions(this);\r
SetTimeout(0);\r
}\r
\r
internal override void ClearPool()\r
{\r
- SQLiteConnectionPool.ClearPool(_fileName);\r
+ SqliteConnectionPool.ClearPool(_fileName);\r
}\r
\r
internal override void SetTimeout(int nTimeoutMS)\r
{\r
int n = UnsafeNativeMethods.sqlite3_busy_timeout(_sql, nTimeoutMS);\r
- if (n > 0) throw new SQLiteException(n, SQLiteLastError());\r
+ if (n > 0) throw new SqliteException(n, SQLiteLastError());\r
}\r
\r
- internal override bool Step(SQLiteStatement stmt)\r
+ internal override bool Step(SqliteStatement stmt)\r
{\r
int n;\r
Random rnd = null;\r
r = Reset(stmt);\r
\r
if (r == 0)\r
- throw new SQLiteException(n, SQLiteLastError());\r
+ throw new SqliteException(n, SQLiteLastError());\r
\r
else if ((r == 6 || r == 5) && stmt._command != null) // SQLITE_LOCKED || SQLITE_BUSY\r
{\r
// If we've exceeded the command's timeout, give up and throw an error\r
if ((uint)Environment.TickCount - starttick > timeout)\r
{\r
- throw new SQLiteException(r, SQLiteLastError());\r
+ throw new SqliteException(r, SQLiteLastError());\r
}\r
else\r
{\r
}\r
}\r
\r
- internal override int Reset(SQLiteStatement stmt)\r
+ internal override int Reset(SqliteStatement stmt)\r
{\r
int n;\r
\r
{\r
// Recreate a dummy statement\r
string str;\r
- using (SQLiteStatement tmp = Prepare(null, stmt._sqlStatement, null, (uint)(stmt._command._commandTimeout * 1000), out str))\r
+ using (SqliteStatement tmp = Prepare(null, stmt._sqlStatement, null, (uint)(stmt._command._commandTimeout * 1000), out str))\r
{\r
// Finalize the existing statement\r
stmt._sqlite_stmt.Dispose();\r
return n;\r
\r
if (n > 0)\r
- throw new SQLiteException(n, SQLiteLastError());\r
+ throw new SqliteException(n, SQLiteLastError());\r
\r
return 0; // We reset OK, no schema changes\r
}\r
return SQLiteBase.SQLiteLastError(_sql);\r
}\r
\r
- internal override SQLiteStatement Prepare(SQLiteConnection cnn, string strSql, SQLiteStatement previous, uint timeoutMS, out string strRemain)\r
+ internal override SqliteStatement Prepare(SqliteConnection cnn, string strSql, SqliteStatement previous, uint timeoutMS, out string strRemain)\r
{\r
IntPtr stmt = IntPtr.Zero;\r
IntPtr ptr = IntPtr.Zero;\r
int retries = 0;\r
byte[] b = ToUTF8(strSql);\r
string typedefs = null;\r
- SQLiteStatement cmd = null;\r
+ SqliteStatement cmd = null;\r
Random rnd = null;\r
uint starttick = (uint)Environment.TickCount;\r
\r
_buildingSchema = true;\r
try\r
{\r
- ISQLiteSchemaExtensions ext = ((IServiceProvider)SQLiteFactory.Instance).GetService(typeof(ISQLiteSchemaExtensions)) as ISQLiteSchemaExtensions;\r
+ ISQLiteSchemaExtensions ext = ((IServiceProvider)SqliteFactory.Instance).GetService(typeof(ISQLiteSchemaExtensions)) as ISQLiteSchemaExtensions;\r
\r
if (ext != null)\r
ext.BuildTempSchema(cnn);\r
// If we've exceeded the command's timeout, give up and throw an error\r
if ((uint)Environment.TickCount - starttick > timeoutMS)\r
{\r
- throw new SQLiteException(n, SQLiteLastError());\r
+ throw new SqliteException(n, SQLiteLastError());\r
}\r
else\r
{\r
}\r
}\r
\r
- if (n > 0) throw new SQLiteException(n, SQLiteLastError());\r
+ if (n > 0) throw new SqliteException(n, SQLiteLastError());\r
\r
strRemain = UTF8ToString(ptr, len);\r
\r
- if (stmt != IntPtr.Zero) cmd = new SQLiteStatement(this, stmt, strSql.Substring(0, strSql.Length - strRemain.Length), previous);\r
+ if (stmt != IntPtr.Zero) cmd = new SqliteStatement(this, stmt, strSql.Substring(0, strSql.Length - strRemain.Length), previous);\r
\r
return cmd;\r
}\r
}\r
}\r
\r
- internal override void Bind_Double(SQLiteStatement stmt, int index, double value)\r
+ internal override void Bind_Double(SqliteStatement stmt, int index, double value)\r
{\r
#if !PLATFORM_COMPACTFRAMEWORK\r
int n = UnsafeNativeMethods.sqlite3_bind_double(stmt._sqlite_stmt, index, value);\r
#else\r
int n = UnsafeNativeMethods.sqlite3_bind_double_interop(stmt._sqlite_stmt, index, ref value);\r
#endif\r
- if (n > 0) throw new SQLiteException(n, SQLiteLastError());\r
+ if (n > 0) throw new SqliteException(n, SQLiteLastError());\r
}\r
\r
- internal override void Bind_Int32(SQLiteStatement stmt, int index, int value)\r
+ internal override void Bind_Int32(SqliteStatement stmt, int index, int value)\r
{\r
int n = UnsafeNativeMethods.sqlite3_bind_int(stmt._sqlite_stmt, index, value);\r
- if (n > 0) throw new SQLiteException(n, SQLiteLastError());\r
+ if (n > 0) throw new SqliteException(n, SQLiteLastError());\r
}\r
\r
- internal override void Bind_Int64(SQLiteStatement stmt, int index, long value)\r
+ internal override void Bind_Int64(SqliteStatement stmt, int index, long value)\r
{\r
#if !PLATFORM_COMPACTFRAMEWORK\r
int n = UnsafeNativeMethods.sqlite3_bind_int64(stmt._sqlite_stmt, index, value);\r
#else\r
int n = UnsafeNativeMethods.sqlite3_bind_int64_interop(stmt._sqlite_stmt, index, ref value);\r
#endif\r
- if (n > 0) throw new SQLiteException(n, SQLiteLastError());\r
+ if (n > 0) throw new SqliteException(n, SQLiteLastError());\r
}\r
\r
- internal override void Bind_Text(SQLiteStatement stmt, int index, string value)\r
+ internal override void Bind_Text(SqliteStatement stmt, int index, string value)\r
{\r
byte[] b = ToUTF8(value);\r
int n = UnsafeNativeMethods.sqlite3_bind_text(stmt._sqlite_stmt, index, b, b.Length - 1, (IntPtr)(-1));\r
- if (n > 0) throw new SQLiteException(n, SQLiteLastError());\r
+ if (n > 0) throw new SqliteException(n, SQLiteLastError());\r
}\r
\r
- internal override void Bind_DateTime(SQLiteStatement stmt, int index, DateTime dt)\r
+ internal override void Bind_DateTime(SqliteStatement stmt, int index, DateTime dt)\r
{\r
byte[] b = ToUTF8(dt);\r
int n = UnsafeNativeMethods.sqlite3_bind_text(stmt._sqlite_stmt, index, b, b.Length - 1, (IntPtr)(-1));\r
- if (n > 0) throw new SQLiteException(n, SQLiteLastError());\r
+ if (n > 0) throw new SqliteException(n, SQLiteLastError());\r
}\r
\r
- internal override void Bind_Blob(SQLiteStatement stmt, int index, byte[] blobData)\r
+ internal override void Bind_Blob(SqliteStatement stmt, int index, byte[] blobData)\r
{\r
int n = UnsafeNativeMethods.sqlite3_bind_blob(stmt._sqlite_stmt, index, blobData, blobData.Length, (IntPtr)(-1));\r
- if (n > 0) throw new SQLiteException(n, SQLiteLastError());\r
+ if (n > 0) throw new SqliteException(n, SQLiteLastError());\r
}\r
\r
- internal override void Bind_Null(SQLiteStatement stmt, int index)\r
+ internal override void Bind_Null(SqliteStatement stmt, int index)\r
{\r
int n = UnsafeNativeMethods.sqlite3_bind_null(stmt._sqlite_stmt, index);\r
- if (n > 0) throw new SQLiteException(n, SQLiteLastError());\r
+ if (n > 0) throw new SqliteException(n, SQLiteLastError());\r
}\r
\r
- internal override int Bind_ParamCount(SQLiteStatement stmt)\r
+ internal override int Bind_ParamCount(SqliteStatement stmt)\r
{\r
return UnsafeNativeMethods.sqlite3_bind_parameter_count(stmt._sqlite_stmt);\r
}\r
\r
- internal override string Bind_ParamName(SQLiteStatement stmt, int index)\r
+ internal override string Bind_ParamName(SqliteStatement stmt, int index)\r
{\r
#if !SQLITE_STANDARD\r
int len;\r
#endif\r
}\r
\r
- internal override int Bind_ParamIndex(SQLiteStatement stmt, string paramName)\r
+ internal override int Bind_ParamIndex(SqliteStatement stmt, string paramName)\r
{\r
return UnsafeNativeMethods.sqlite3_bind_parameter_index(stmt._sqlite_stmt, ToUTF8(paramName));\r
}\r
\r
- internal override int ColumnCount(SQLiteStatement stmt)\r
+ internal override int ColumnCount(SqliteStatement stmt)\r
{\r
return UnsafeNativeMethods.sqlite3_column_count(stmt._sqlite_stmt);\r
}\r
\r
- internal override string ColumnName(SQLiteStatement stmt, int index)\r
+ internal override string ColumnName(SqliteStatement stmt, int index)\r
{\r
#if !SQLITE_STANDARD\r
int len;\r
#endif\r
}\r
\r
- internal override TypeAffinity ColumnAffinity(SQLiteStatement stmt, int index)\r
+ internal override TypeAffinity ColumnAffinity(SqliteStatement stmt, int index)\r
{\r
return UnsafeNativeMethods.sqlite3_column_type(stmt._sqlite_stmt, index);\r
}\r
\r
- internal override string ColumnType(SQLiteStatement stmt, int index, out TypeAffinity nAffinity)\r
+ internal override string ColumnType(SqliteStatement stmt, int index, out TypeAffinity nAffinity)\r
{\r
int len;\r
#if !SQLITE_STANDARD\r
}\r
}\r
\r
- internal override int ColumnIndex(SQLiteStatement stmt, string columnName)\r
+ internal override int ColumnIndex(SqliteStatement stmt, string columnName)\r
{\r
int x = ColumnCount(stmt);\r
\r
return -1;\r
}\r
\r
- internal override string ColumnOriginalName(SQLiteStatement stmt, int index)\r
+ internal override string ColumnOriginalName(SqliteStatement stmt, int index)\r
{\r
#if !SQLITE_STANDARD\r
int len;\r
#endif\r
}\r
\r
- internal override string ColumnDatabaseName(SQLiteStatement stmt, int index)\r
+ internal override string ColumnDatabaseName(SqliteStatement stmt, int index)\r
{\r
#if !SQLITE_STANDARD\r
int len;\r
#endif\r
}\r
\r
- internal override string ColumnTableName(SQLiteStatement stmt, int index)\r
+ internal override string ColumnTableName(SqliteStatement stmt, int index)\r
{\r
#if !SQLITE_STANDARD\r
int len;\r
csLen = -1;\r
n = UnsafeNativeMethods.sqlite3_table_column_metadata(_sql, ToUTF8(dataBase), ToUTF8(table), ToUTF8(column), out dataTypePtr, out collSeqPtr, out nnotNull, out nprimaryKey, out nautoInc);\r
#endif\r
- if (n > 0) throw new SQLiteException(n, SQLiteLastError());\r
+ if (n > 0) throw new SqliteException(n, SQLiteLastError());\r
\r
dataType = UTF8ToString(dataTypePtr, dtLen);\r
collateSequence = UTF8ToString(collSeqPtr, csLen);\r
autoIncrement = (nautoInc == 1);\r
}\r
\r
- internal override double GetDouble(SQLiteStatement stmt, int index)\r
+ internal override double GetDouble(SqliteStatement stmt, int index)\r
{\r
double value;\r
#if !PLATFORM_COMPACTFRAMEWORK\r
return value;\r
}\r
\r
- internal override int GetInt32(SQLiteStatement stmt, int index)\r
+ internal override int GetInt32(SqliteStatement stmt, int index)\r
{\r
return UnsafeNativeMethods.sqlite3_column_int(stmt._sqlite_stmt, index);\r
}\r
\r
- internal override long GetInt64(SQLiteStatement stmt, int index)\r
+ internal override long GetInt64(SqliteStatement stmt, int index)\r
{\r
long value;\r
#if !PLATFORM_COMPACTFRAMEWORK\r
return value;\r
}\r
\r
- internal override string GetText(SQLiteStatement stmt, int index)\r
+ internal override string GetText(SqliteStatement stmt, int index)\r
{\r
#if !SQLITE_STANDARD\r
int len;\r
#endif\r
}\r
\r
- internal override DateTime GetDateTime(SQLiteStatement stmt, int index)\r
+ internal override DateTime GetDateTime(SqliteStatement stmt, int index)\r
{\r
#if !SQLITE_STANDARD\r
int len;\r
#endif\r
}\r
\r
- internal override long GetBytes(SQLiteStatement stmt, int index, int nDataOffset, byte[] bDest, int nStart, int nLength)\r
+ internal override long GetBytes(SqliteStatement stmt, int index, int nDataOffset, byte[] bDest, int nStart, int nLength)\r
{\r
IntPtr ptr;\r
int nlen;\r
if (nCopied + nStart > bDest.Length) nCopied = bDest.Length - nStart;\r
if (nCopied + nDataOffset > nlen) nCopied = nlen - nDataOffset;\r
\r
- if (nCopied > 0)\r
- Marshal.Copy((IntPtr)(ptr.ToInt32() + nDataOffset), bDest, nStart, nCopied);\r
- else nCopied = 0;\r
+ unsafe {\r
+ if (nCopied > 0)\r
+ Marshal.Copy((IntPtr)((byte*)ptr + nDataOffset), bDest, nStart, nCopied);\r
+ else nCopied = 0;\r
+ }\r
\r
return nCopied;\r
}\r
\r
- internal override long GetChars(SQLiteStatement stmt, int index, int nDataOffset, char[] bDest, int nStart, int nLength)\r
+ internal override long GetChars(SqliteStatement stmt, int index, int nDataOffset, char[] bDest, int nStart, int nLength)\r
{\r
int nlen;\r
int nCopied = nLength;\r
return nCopied;\r
}\r
\r
- internal override bool IsNull(SQLiteStatement stmt, int index)\r
+ internal override bool IsNull(SqliteStatement stmt, int index)\r
{\r
return (ColumnAffinity(stmt, index) == TypeAffinity.Null);\r
}\r
n = UnsafeNativeMethods.sqlite3_create_function(_sql, ToUTF8(strFunction), nArgs, 4, IntPtr.Zero, func, funcstep, funcfinal);\r
if (n == 0) n = UnsafeNativeMethods.sqlite3_create_function(_sql, ToUTF8(strFunction), nArgs, 1, IntPtr.Zero, func, funcstep, funcfinal);\r
#endif\r
- if (n > 0) throw new SQLiteException(n, SQLiteLastError());\r
+ if (n > 0) throw new SqliteException(n, SQLiteLastError());\r
}\r
\r
internal override void CreateCollation(string strCollation, SQLiteCollation func, SQLiteCollation func16)\r
{\r
int n = UnsafeNativeMethods.sqlite3_create_collation(_sql, ToUTF8(strCollation), 2, IntPtr.Zero, func16);\r
if (n == 0) UnsafeNativeMethods.sqlite3_create_collation(_sql, ToUTF8(strCollation), 1, IntPtr.Zero, func);\r
- if (n > 0) throw new SQLiteException(n, SQLiteLastError());\r
+ if (n > 0) throw new SqliteException(n, SQLiteLastError());\r
}\r
\r
internal override int ContextCollateCompare(CollationEncodingEnum enc, IntPtr context, string s1, string s2)\r
#endif\r
}\r
\r
- internal override CollationSequence GetCollationSequence(SQLiteFunction func, IntPtr context)\r
+ internal override CollationSequence GetCollationSequence(SqliteFunction func, IntPtr context)\r
{\r
#if !SQLITE_STANDARD\r
CollationSequence seq = new CollationSequence();\r
if (nCopied + nStart > bDest.Length) nCopied = bDest.Length - nStart;\r
if (nCopied + nDataOffset > nlen) nCopied = nlen - nDataOffset;\r
\r
- if (nCopied > 0)\r
- Marshal.Copy((IntPtr)(ptr.ToInt32() + nDataOffset), bDest, nStart, nCopied);\r
- else nCopied = 0;\r
+ unsafe {\r
+ if (nCopied > 0)\r
+ Marshal.Copy((IntPtr)((byte*)ptr + nDataOffset), bDest, nStart, nCopied);\r
+ else nCopied = 0;\r
+ }\r
\r
return nCopied;\r
}\r
internal override void SetPassword(byte[] passwordBytes)\r
{\r
int n = UnsafeNativeMethods.sqlite3_key(_sql, passwordBytes, passwordBytes.Length);\r
- if (n > 0) throw new SQLiteException(n, SQLiteLastError());\r
+ if (n > 0) throw new SqliteException(n, SQLiteLastError());\r
}\r
\r
internal override void ChangePassword(byte[] newPasswordBytes)\r
{\r
int n = UnsafeNativeMethods.sqlite3_rekey(_sql, newPasswordBytes, (newPasswordBytes == null) ? 0 : newPasswordBytes.Length);\r
- if (n > 0) throw new SQLiteException(n, SQLiteLastError());\r
+ if (n > 0) throw new SqliteException(n, SQLiteLastError());\r
}\r
\r
internal override void SetUpdateHook(SQLiteUpdateCallback func)\r
/// <param name="index">The column index to retrieve</param>\r
/// <param name="typ">The type of data contained in the column. If Uninitialized, this function will retrieve the datatype information.</param>\r
/// <returns>Returns the data in the column</returns>\r
- internal override object GetValue(SQLiteStatement stmt, int index, SQLiteType typ)\r
+ internal override object GetValue(SqliteStatement stmt, int index, SQLiteType typ)\r
{\r
if (IsNull(stmt, index)) return DBNull.Value;\r
TypeAffinity aff = typ.Affinity;\r
\r
if (typ.Type != DbType.Object)\r
{\r
- t = SQLiteConvert.SQLiteTypeToType(typ);\r
+ t = SqliteConvert.SQLiteTypeToType(typ);\r
aff = TypeToAffinity(t);\r
}\r
\r
}\r
}\r
\r
- internal override int GetCursorForTable(SQLiteStatement stmt, int db, int rootPage)\r
+ internal override int GetCursorForTable(SqliteStatement stmt, int db, int rootPage)\r
{\r
#if !SQLITE_STANDARD\r
return UnsafeNativeMethods.sqlite3_table_cursor(stmt._sqlite_stmt, db, rootPage);\r
#endif\r
}\r
\r
- internal override long GetRowIdForCursor(SQLiteStatement stmt, int cursor)\r
+ internal override long GetRowIdForCursor(SqliteStatement stmt, int cursor)\r
{\r
#if !SQLITE_STANDARD\r
long rowid;\r
int rc;\r
\r
rc = UnsafeNativeMethods.sqlite3_index_column_info_interop(_sql, ToUTF8(database), ToUTF8(index), ToUTF8(column), out sortMode, out onError, out coll, out colllen);\r
- if (rc != 0) throw new SQLiteException(rc, "");\r
+ if (rc != 0) throw new SqliteException(rc, "");\r
\r
collationSequence = UTF8ToString(coll, colllen);\r
#else\r
}\r
\r
/// <summary>\r
- /// Overrides SQLiteConvert.ToString() to marshal UTF-16 strings instead of UTF-8\r
+ /// Overrides SqliteConvert.ToString() to marshal UTF-16 strings instead of UTF-8\r
/// </summary>\r
/// <param name="b">A pointer to a UTF-16 string</param>\r
/// <param name="nbytelen">The length (IN BYTES) of the string</param>\r
if (usePool)\r
{\r
_fileName = strFilename;\r
- _sql = SQLiteConnectionPool.Remove(strFilename, maxPoolSize, out _poolVersion);\r
+ _sql = SqliteConnectionPool.Remove(strFilename, maxPoolSize, out _poolVersion);\r
}\r
\r
if (_sql == null)\r
int n = UnsafeNativeMethods.sqlite3_open16_interop(ToUTF8(strFilename), (int)flags, out db);\r
#else\r
if ((flags & SQLiteOpenFlagsEnum.Create) == 0 && System.IO.File.Exists(strFilename) == false)\r
- throw new SQLiteException((int)SQLiteErrorCode.CantOpen, strFilename);\r
+ throw new SqliteException((int)SQLiteErrorCode.CantOpen, strFilename);\r
\r
int n = UnsafeNativeMethods.sqlite3_open16(strFilename, out db);\r
#endif\r
- if (n > 0) throw new SQLiteException(n, null);\r
+ if (n > 0) throw new SqliteException(n, null);\r
\r
_sql = db;\r
}\r
- _functionsArray = SQLiteFunction.BindFunctions(this);\r
+ _functionsArray = SqliteFunction.BindFunctions(this);\r
}\r
\r
- internal override void Bind_DateTime(SQLiteStatement stmt, int index, DateTime dt)\r
+ internal override void Bind_DateTime(SqliteStatement stmt, int index, DateTime dt)\r
{\r
Bind_Text(stmt, index, ToString(dt));\r
}\r
\r
- internal override void Bind_Text(SQLiteStatement stmt, int index, string value)\r
+ internal override void Bind_Text(SqliteStatement stmt, int index, string value)\r
{\r
int n = UnsafeNativeMethods.sqlite3_bind_text16(stmt._sqlite_stmt, index, value, value.Length * 2, (IntPtr)(-1));\r
- if (n > 0) throw new SQLiteException(n, SQLiteLastError());\r
+ if (n > 0) throw new SqliteException(n, SQLiteLastError());\r
}\r
\r
- internal override DateTime GetDateTime(SQLiteStatement stmt, int index)\r
+ internal override DateTime GetDateTime(SqliteStatement stmt, int index)\r
{\r
return ToDateTime(GetText(stmt, index));\r
}\r
\r
- internal override string ColumnName(SQLiteStatement stmt, int index)\r
+ internal override string ColumnName(SqliteStatement stmt, int index)\r
{\r
#if !SQLITE_STANDARD\r
int len;\r
#endif\r
}\r
\r
- internal override string GetText(SQLiteStatement stmt, int index)\r
+ internal override string GetText(SqliteStatement stmt, int index)\r
{\r
#if !SQLITE_STANDARD\r
int len;\r
#endif\r
}\r
\r
- internal override string ColumnOriginalName(SQLiteStatement stmt, int index)\r
+ internal override string ColumnOriginalName(SqliteStatement stmt, int index)\r
{\r
#if !SQLITE_STANDARD\r
int len;\r
#endif\r
}\r
\r
- internal override string ColumnDatabaseName(SQLiteStatement stmt, int index)\r
+ internal override string ColumnDatabaseName(SqliteStatement stmt, int index)\r
{\r
#if !SQLITE_STANDARD\r
int len;\r
#endif\r
}\r
\r
- internal override string ColumnTableName(SQLiteStatement stmt, int index)\r
+ internal override string ColumnTableName(SqliteStatement stmt, int index)\r
{\r
#if !SQLITE_STANDARD\r
int len;\r
\r
/// <summary>\r
/// This internal class provides the foundation of SQLite support. It defines all the abstract members needed to implement\r
- /// a SQLite data provider, and inherits from SQLiteConvert which allows for simple translations of string to and from SQLite.\r
+ /// a SQLite data provider, and inherits from SqliteConvert which allows for simple translations of string to and from SQLite.\r
/// </summary>\r
- internal abstract class SQLiteBase : SQLiteConvert, IDisposable\r
+ internal abstract class SQLiteBase : SqliteConvert, IDisposable\r
{\r
internal SQLiteBase(SQLiteDateFormats fmt)\r
: base(fmt) { }\r
/// Opens a database.\r
/// </summary>\r
/// <remarks>\r
- /// Implementers should call SQLiteFunction.BindFunctions() and save the array after opening a connection\r
+ /// Implementers should call SqliteFunction.BindFunctions() and save the array after opening a connection\r
/// to bind all attributed user-defined functions and collating sequences to the new connection.\r
/// </remarks>\r
/// <param name="strFilename">The filename of the database to open. SQLite automatically creates it if it doesn't exist.</param>\r
/// Closes the currently-open database.\r
/// </summary>\r
/// <remarks>\r
- /// After the database has been closed implemeters should call SQLiteFunction.UnbindFunctions() to deallocate all interop allocated\r
+ /// After the database has been closed implemeters should call SqliteFunction.UnbindFunctions() to deallocate all interop allocated\r
/// memory associated with the user-defined functions and collating sequences tied to the closed connection.\r
/// </remarks>\r
internal abstract void Close();\r
/// <summary>\r
- /// Sets the busy timeout on the connection. SQLiteCommand will call this before executing any command.\r
+ /// Sets the busy timeout on the connection. SqliteCommand will call this before executing any command.\r
/// </summary>\r
/// <param name="nTimeoutMS">The number of milliseconds to wait before returning SQLITE_BUSY</param>\r
internal abstract void SetTimeout(int nTimeoutMS);\r
/// <param name="strRemain">The remainder of the statement that was not processed. Each call to prepare parses the\r
/// SQL up to to either the end of the text or to the first semi-colon delimiter. The remaining text is returned\r
/// here for a subsequent call to Prepare() until all the text has been processed.</param>\r
- /// <returns>Returns an initialized SQLiteStatement.</returns>\r
- internal abstract SQLiteStatement Prepare(SQLiteConnection cnn, string strSql, SQLiteStatement previous, uint timeoutMS, out string strRemain);\r
+ /// <returns>Returns an initialized SqliteStatement.</returns>\r
+ internal abstract SqliteStatement Prepare(SqliteConnection cnn, string strSql, SqliteStatement previous, uint timeoutMS, out string strRemain);\r
/// <summary>\r
/// Steps through a prepared statement.\r
/// </summary>\r
- /// <param name="stmt">The SQLiteStatement to step through</param>\r
+ /// <param name="stmt">The SqliteStatement to step through</param>\r
/// <returns>True if a row was returned, False if not.</returns>\r
- internal abstract bool Step(SQLiteStatement stmt);\r
+ internal abstract bool Step(SqliteStatement stmt);\r
/// <summary>\r
/// Resets a prepared statement so it can be executed again. If the error returned is SQLITE_SCHEMA, \r
/// transparently attempt to rebuild the SQL statement and throw an error if that was not possible.\r
/// </summary>\r
/// <param name="stmt">The statement to reset</param>\r
/// <returns>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</returns>\r
- internal abstract int Reset(SQLiteStatement stmt);\r
+ internal abstract int Reset(SqliteStatement stmt);\r
internal abstract void Cancel();\r
\r
- internal abstract void Bind_Double(SQLiteStatement stmt, int index, double value);\r
- internal abstract void Bind_Int32(SQLiteStatement stmt, int index, Int32 value);\r
- internal abstract void Bind_Int64(SQLiteStatement stmt, int index, Int64 value);\r
- internal abstract void Bind_Text(SQLiteStatement stmt, int index, string value);\r
- internal abstract void Bind_Blob(SQLiteStatement stmt, int index, byte[] blobData);\r
- internal abstract void Bind_DateTime(SQLiteStatement stmt, int index, DateTime dt);\r
- internal abstract void Bind_Null(SQLiteStatement stmt, int index);\r
+ internal abstract void Bind_Double(SqliteStatement stmt, int index, double value);\r
+ internal abstract void Bind_Int32(SqliteStatement stmt, int index, Int32 value);\r
+ internal abstract void Bind_Int64(SqliteStatement stmt, int index, Int64 value);\r
+ internal abstract void Bind_Text(SqliteStatement stmt, int index, string value);\r
+ internal abstract void Bind_Blob(SqliteStatement stmt, int index, byte[] blobData);\r
+ internal abstract void Bind_DateTime(SqliteStatement stmt, int index, DateTime dt);\r
+ internal abstract void Bind_Null(SqliteStatement stmt, int index);\r
\r
- internal abstract int Bind_ParamCount(SQLiteStatement stmt);\r
- internal abstract string Bind_ParamName(SQLiteStatement stmt, int index);\r
- internal abstract int Bind_ParamIndex(SQLiteStatement stmt, string paramName);\r
+ internal abstract int Bind_ParamCount(SqliteStatement stmt);\r
+ internal abstract string Bind_ParamName(SqliteStatement stmt, int index);\r
+ internal abstract int Bind_ParamIndex(SqliteStatement stmt, string paramName);\r
\r
- internal abstract int ColumnCount(SQLiteStatement stmt);\r
- internal abstract string ColumnName(SQLiteStatement stmt, int index);\r
- internal abstract TypeAffinity ColumnAffinity(SQLiteStatement stmt, int index);\r
- internal abstract string ColumnType(SQLiteStatement stmt, int index, out TypeAffinity nAffinity);\r
- internal abstract int ColumnIndex(SQLiteStatement stmt, string columnName);\r
- internal abstract string ColumnOriginalName(SQLiteStatement stmt, int index);\r
- internal abstract string ColumnDatabaseName(SQLiteStatement stmt, int index);\r
- internal abstract string ColumnTableName(SQLiteStatement stmt, int index);\r
+ internal abstract int ColumnCount(SqliteStatement stmt);\r
+ internal abstract string ColumnName(SqliteStatement stmt, int index);\r
+ internal abstract TypeAffinity ColumnAffinity(SqliteStatement stmt, int index);\r
+ internal abstract string ColumnType(SqliteStatement stmt, int index, out TypeAffinity nAffinity);\r
+ internal abstract int ColumnIndex(SqliteStatement stmt, string columnName);\r
+ internal abstract string ColumnOriginalName(SqliteStatement stmt, int index);\r
+ internal abstract string ColumnDatabaseName(SqliteStatement stmt, int index);\r
+ internal abstract string ColumnTableName(SqliteStatement stmt, int index);\r
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);\r
internal abstract void GetIndexColumnExtendedInfo(string database, string index, string column, out int sortMode, out int onError, out string collationSequence);\r
\r
- internal abstract double GetDouble(SQLiteStatement stmt, int index);\r
- internal abstract Int32 GetInt32(SQLiteStatement stmt, int index);\r
- internal abstract Int64 GetInt64(SQLiteStatement stmt, int index);\r
- internal abstract string GetText(SQLiteStatement stmt, int index);\r
- internal abstract long GetBytes(SQLiteStatement stmt, int index, int nDataoffset, byte[] bDest, int nStart, int nLength);\r
- internal abstract long GetChars(SQLiteStatement stmt, int index, int nDataoffset, char[] bDest, int nStart, int nLength);\r
- internal abstract DateTime GetDateTime(SQLiteStatement stmt, int index);\r
- internal abstract bool IsNull(SQLiteStatement stmt, int index);\r
+ internal abstract double GetDouble(SqliteStatement stmt, int index);\r
+ internal abstract Int32 GetInt32(SqliteStatement stmt, int index);\r
+ internal abstract Int64 GetInt64(SqliteStatement stmt, int index);\r
+ internal abstract string GetText(SqliteStatement stmt, int index);\r
+ internal abstract long GetBytes(SqliteStatement stmt, int index, int nDataoffset, byte[] bDest, int nStart, int nLength);\r
+ internal abstract long GetChars(SqliteStatement stmt, int index, int nDataoffset, char[] bDest, int nStart, int nLength);\r
+ internal abstract DateTime GetDateTime(SqliteStatement stmt, int index);\r
+ internal abstract bool IsNull(SqliteStatement stmt, int index);\r
\r
internal abstract void CreateCollation(string strCollation, SQLiteCollation func, SQLiteCollation func16);\r
internal abstract void CreateFunction(string strFunction, int nArgs, bool needCollSeq, SQLiteCallback func, SQLiteCallback funcstep, SQLiteFinalCallback funcfinal);\r
- internal abstract CollationSequence GetCollationSequence(SQLiteFunction func, IntPtr context);\r
+ internal abstract CollationSequence GetCollationSequence(SqliteFunction func, IntPtr context);\r
internal abstract int ContextCollateCompare(CollationEncodingEnum enc, IntPtr context, string s1, string s2);\r
internal abstract int ContextCollateCompare(CollationEncodingEnum enc, IntPtr context, char[] c1, char[] c2);\r
\r
internal abstract void SetCommitHook(SQLiteCommitCallback func);\r
internal abstract void SetRollbackHook(SQLiteRollbackCallback func);\r
\r
- internal abstract int GetCursorForTable(SQLiteStatement stmt, int database, int rootPage);\r
- internal abstract long GetRowIdForCursor(SQLiteStatement stmt, int cursor);\r
+ internal abstract int GetCursorForTable(SqliteStatement stmt, int database, int rootPage);\r
+ internal abstract long GetRowIdForCursor(SqliteStatement stmt, int cursor);\r
\r
- internal abstract object GetValue(SQLiteStatement stmt, int index, SQLiteType typ);\r
+ internal abstract object GetValue(SqliteStatement stmt, int index, SQLiteType typ);\r
\r
protected virtual void Dispose(bool bDisposing)\r
{\r
\r
// These statics are here for lack of a better place to put them.\r
// They exist here because they are called during the finalization of\r
- // a SQLiteStatementHandle, SQLiteConnectionHandle, and SQLiteFunctionCookieHandle.\r
+ // a SqliteStatementHandle, SqliteConnectionHandle, and SqliteFunctionCookieHandle.\r
// Therefore these functions have to be static, and have to be low-level.\r
\r
- internal static string SQLiteLastError(SQLiteConnectionHandle db)\r
+ internal static string SQLiteLastError(SqliteConnectionHandle db)\r
{\r
#if !SQLITE_STANDARD\r
int len;\r
#endif\r
}\r
\r
- internal static void FinalizeStatement(SQLiteStatementHandle stmt)\r
+ internal static void FinalizeStatement(SqliteStatementHandle stmt)\r
{\r
lock (_lock)\r
{\r
#else\r
int n = UnsafeNativeMethods.sqlite3_finalize(stmt);\r
#endif\r
- if (n > 0) throw new SQLiteException(n, null);\r
+ if (n > 0) throw new SqliteException(n, null);\r
}\r
}\r
\r
- internal static void CloseConnection(SQLiteConnectionHandle db)\r
+ internal static void CloseConnection(SqliteConnectionHandle db)\r
{\r
lock (_lock)\r
{\r
ResetConnection(db);\r
int n = UnsafeNativeMethods.sqlite3_close(db);\r
#endif\r
- if (n > 0) throw new SQLiteException(n, SQLiteLastError(db));\r
+ if (n > 0) throw new SqliteException(n, SQLiteLastError(db));\r
}\r
}\r
\r
- internal static void ResetConnection(SQLiteConnectionHandle db)\r
+ internal static void ResetConnection(SqliteConnectionHandle db)\r
{\r
lock (_lock)\r
{\r
\r
internal interface ISQLiteSchemaExtensions\r
{\r
- void BuildTempSchema(SQLiteConnection cnn);\r
+ void BuildTempSchema(SqliteConnection cnn);\r
}\r
\r
[Flags]\r
/// SQLite implementation of DbCommand.\r
/// </summary>\r
#if !PLATFORM_COMPACTFRAMEWORK\r
- [Designer("SQLite.Designer.SQLiteCommandDesigner, SQLite.Designer, Version=1.0.36.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139"), ToolboxItem(true)]\r
+ [Designer("SQLite.Designer.SqliteCommandDesigner, SQLite.Designer, Version=1.0.36.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139"), ToolboxItem(true)]\r
#endif\r
- public sealed class SQLiteCommand : DbCommand, ICloneable\r
+ public sealed class SqliteCommand : DbCommand, ICloneable\r
{\r
/// <summary>\r
/// The command text this command is based on\r
/// <summary>\r
/// The connection the command is associated with\r
/// </summary>\r
- private SQLiteConnection _cnn;\r
+ private SqliteConnection _cnn;\r
/// <summary>\r
/// The version of the connection the command is associated with\r
/// </summary>\r
/// <summary>\r
/// The collection of parameters for the command\r
/// </summary>\r
- private SQLiteParameterCollection _parameterCollection;\r
+ private SqliteParameterCollection _parameterCollection;\r
/// <summary>\r
/// The SQL command text, broken into individual SQL statements as they are executed\r
/// </summary>\r
- internal List<SQLiteStatement> _statementList;\r
+ internal List<SqliteStatement> _statementList;\r
/// <summary>\r
/// Unprocessed SQL text that has not been executed\r
/// </summary>\r
/// <summary>\r
/// Transaction associated with this command\r
/// </summary>\r
- private SQLiteTransaction _transaction;\r
+ private SqliteTransaction _transaction;\r
\r
///<overloads>\r
- /// Constructs a new SQLiteCommand\r
+ /// Constructs a new SqliteCommand\r
/// </overloads>\r
/// <summary>\r
/// Default constructor\r
/// </summary>\r
- public SQLiteCommand() :this(null, null)\r
+ public SqliteCommand() :this(null, null)\r
{\r
}\r
\r
/// Initializes the command with the given command text\r
/// </summary>\r
/// <param name="commandText">The SQL command text</param>\r
- public SQLiteCommand(string commandText) \r
+ public SqliteCommand(string commandText) \r
: this(commandText, null, null)\r
{\r
}\r
/// </summary>\r
/// <param name="commandText">The SQL command text</param>\r
/// <param name="connection">The connection to associate with the command</param>\r
- public SQLiteCommand(string commandText, SQLiteConnection connection)\r
+ public SqliteCommand(string commandText, SqliteConnection connection)\r
: this(commandText, connection, null)\r
{\r
}\r
/// Initializes the command and associates it with the specified connection.\r
/// </summary>\r
/// <param name="connection">The connection to associate with the command</param>\r
- public SQLiteCommand(SQLiteConnection connection) \r
+ public SqliteCommand(SqliteConnection connection) \r
: this(null, connection, null)\r
{\r
}\r
\r
- private SQLiteCommand(SQLiteCommand source) : this(source.CommandText, source.Connection, source.Transaction)\r
+ private SqliteCommand(SqliteCommand source) : this(source.CommandText, source.Connection, source.Transaction)\r
{\r
CommandTimeout = source.CommandTimeout;\r
DesignTimeVisible = source.DesignTimeVisible;\r
UpdatedRowSource = source.UpdatedRowSource;\r
\r
- foreach (SQLiteParameter param in source._parameterCollection)\r
+ foreach (SqliteParameter param in source._parameterCollection)\r
{\r
Parameters.Add(param.Clone());\r
}\r
/// <param name="commandText">The SQL command text</param>\r
/// <param name="connection">The connection to associate with the command</param>\r
/// <param name="transaction">The transaction the command should be associated with</param>\r
- public SQLiteCommand(string commandText, SQLiteConnection connection, SQLiteTransaction transaction)\r
+ public SqliteCommand(string commandText, SqliteConnection connection, SqliteTransaction transaction)\r
{\r
_statementList = null;\r
_activeReader = null;\r
_commandTimeout = 30;\r
- _parameterCollection = new SQLiteParameterCollection(this);\r
+ _parameterCollection = new SqliteParameterCollection(this);\r
_designTimeVisible = true;\r
_updateRowSource = UpdateRowSource.None;\r
_transaction = null;\r
if (disposing)\r
{\r
// If a reader is active on this command, don't destroy the command, instead let the reader do it\r
- SQLiteDataReader reader = null;\r
+ SqliteDataReader reader = null;\r
if (_activeReader != null)\r
{\r
try\r
{\r
- reader = _activeReader.Target as SQLiteDataReader;\r
+ reader = _activeReader.Target as SqliteDataReader;\r
}\r
catch\r
{\r
{\r
if (_activeReader != null)\r
{\r
- SQLiteDataReader reader = null;\r
+ SqliteDataReader reader = null;\r
try\r
{\r
- reader = _activeReader.Target as SQLiteDataReader;\r
+ reader = _activeReader.Target as SqliteDataReader;\r
}\r
catch\r
{\r
/// <summary>\r
/// Builds an array of prepared statements for each complete SQL statement in the command text\r
/// </summary>\r
- internal SQLiteStatement BuildNextCommand()\r
+ internal SqliteStatement BuildNextCommand()\r
{\r
- SQLiteStatement stmt = null;\r
+ SqliteStatement stmt = null;\r
\r
try\r
{\r
{\r
stmt._command = this;\r
if (_statementList == null)\r
- _statementList = new List<SQLiteStatement>();\r
+ _statementList = new List<SqliteStatement>();\r
\r
_statementList.Add(stmt);\r
\r
}\r
}\r
\r
- internal SQLiteStatement GetStatement(int index)\r
+ internal SqliteStatement GetStatement(int index)\r
{\r
// Haven't built any statements yet\r
if (_statementList == null) return BuildNextCommand();\r
else return null; // No more commands\r
}\r
\r
- SQLiteStatement stmt = _statementList[index];\r
+ SqliteStatement stmt = _statementList[index];\r
stmt.BindParameters();\r
\r
return stmt;\r
{\r
if (_activeReader != null)\r
{\r
- SQLiteDataReader reader = _activeReader.Target as SQLiteDataReader;\r
+ SqliteDataReader reader = _activeReader.Target as SqliteDataReader;\r
if (reader != null)\r
reader.Cancel();\r
}\r
/// Create a new parameter\r
/// </summary>\r
/// <returns></returns>\r
- public new SQLiteParameter CreateParameter()\r
+ public new SqliteParameter CreateParameter()\r
{\r
- return new SQLiteParameter();\r
+ return new SqliteParameter();\r
}\r
\r
/// <summary>\r
#if !PLATFORM_COMPACTFRAMEWORK\r
[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")]\r
#endif\r
- public new SQLiteConnection Connection\r
+ public new SqliteConnection Connection\r
{\r
get { return _cnn; }\r
set\r
}\r
set\r
{\r
- Connection = (SQLiteConnection)value;\r
+ Connection = (SqliteConnection)value;\r
}\r
}\r
\r
/// <summary>\r
- /// Returns the SQLiteParameterCollection for the given command\r
+ /// Returns the SqliteParameterCollection for the given command\r
/// </summary>\r
#if !PLATFORM_COMPACTFRAMEWORK\r
[DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]\r
#endif\r
- public new SQLiteParameterCollection Parameters\r
+ public new SqliteParameterCollection Parameters\r
{\r
get { return _parameterCollection; }\r
}\r
#if !PLATFORM_COMPACTFRAMEWORK\r
[Browsable(false), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]\r
#endif\r
- public new SQLiteTransaction Transaction\r
+ public new SqliteTransaction Transaction\r
{\r
get { return _transaction; }\r
set\r
}\r
set\r
{\r
- Transaction = (SQLiteTransaction)value;\r
+ Transaction = (SqliteTransaction)value;\r
}\r
}\r
\r
}\r
\r
/// <summary>\r
- /// Creates a new SQLiteDataReader to execute/iterate the array of SQLite prepared statements\r
+ /// Creates a new SqliteDataReader to execute/iterate the array of SQLite prepared statements\r
/// </summary>\r
/// <param name="behavior">The behavior the data reader should adopt</param>\r
- /// <returns>Returns a SQLiteDataReader object</returns>\r
+ /// <returns>Returns a SqliteDataReader object</returns>\r
protected override DbDataReader ExecuteDbDataReader(CommandBehavior behavior)\r
{\r
return ExecuteReader(behavior);\r
}\r
\r
/// <summary>\r
- /// Overrides the default behavior to return a SQLiteDataReader specialization class\r
+ /// Overrides the default behavior to return a SqliteDataReader specialization class\r
/// </summary>\r
/// <param name="behavior">The flags to be associated with the reader</param>\r
- /// <returns>A SQLiteDataReader</returns>\r
- public new SQLiteDataReader ExecuteReader(CommandBehavior behavior)\r
+ /// <returns>A SqliteDataReader</returns>\r
+ public new SqliteDataReader ExecuteReader(CommandBehavior behavior)\r
{\r
InitializeForReader();\r
\r
- SQLiteDataReader rd = new SQLiteDataReader(this, behavior);\r
+ SqliteDataReader rd = new SqliteDataReader(this, behavior);\r
_activeReader = new WeakReference(rd, false);\r
\r
return rd;\r
}\r
\r
/// <summary>\r
- /// Overrides the default behavior of DbDataReader to return a specialized SQLiteDataReader class\r
+ /// Overrides the default behavior of DbDataReader to return a specialized SqliteDataReader class\r
/// </summary>\r
- /// <returns>A SQLiteDataReader</returns>\r
- public new SQLiteDataReader ExecuteReader()\r
+ /// <returns>A SqliteDataReader</returns>\r
+ public new SqliteDataReader ExecuteReader()\r
{\r
return ExecuteReader(CommandBehavior.Default);\r
}\r
\r
/// <summary>\r
- /// Called by the SQLiteDataReader when the data reader is closed.\r
+ /// Called by the SqliteDataReader when the data reader is closed.\r
/// </summary>\r
internal void ClearDataReader()\r
{\r
/// <returns></returns>\r
public override int ExecuteNonQuery()\r
{\r
- using (SQLiteDataReader reader = ExecuteReader(CommandBehavior.SingleRow | CommandBehavior.SingleResult))\r
+ using (SqliteDataReader reader = ExecuteReader(CommandBehavior.SingleRow | CommandBehavior.SingleResult))\r
{\r
while (reader.NextResult()) ;\r
return reader.RecordsAffected;\r
/// <returns>The first column of the first row of the first resultset from the query</returns>\r
public override object ExecuteScalar()\r
{\r
- using (SQLiteDataReader reader = ExecuteReader(CommandBehavior.SingleRow | CommandBehavior.SingleResult))\r
+ using (SqliteDataReader reader = ExecuteReader(CommandBehavior.SingleRow | CommandBehavior.SingleResult))\r
{\r
if (reader.Read())\r
return reader[0];\r
}\r
\r
/// <summary>\r
- /// Sets the method the SQLiteCommandBuilder uses to determine how to update inserted or updated rows in a DataTable.\r
+ /// Sets the method the SqliteCommandBuilder uses to determine how to update inserted or updated rows in a DataTable.\r
/// </summary>\r
[DefaultValue(UpdateRowSource.None)]\r
public override UpdateRowSource UpdatedRowSource\r
/// <summary>\r
/// Clones a command, including all its parameters\r
/// </summary>\r
- /// <returns>A new SQLiteCommand with the same commandtext, connection and parameters</returns>\r
+ /// <returns>A new SqliteCommand with the same commandtext, connection and parameters</returns>\r
public object Clone()\r
{\r
- return new SQLiteCommand(this);\r
+ return new SqliteCommand(this);\r
}\r
}\r
}
\ No newline at end of file
/// <summary>\r
/// SQLite implementation of DbCommandBuilder.\r
/// </summary>\r
- public sealed class SQLiteCommandBuilder : DbCommandBuilder\r
+ public sealed class SqliteCommandBuilder : DbCommandBuilder\r
{\r
/// <summary>\r
/// Default constructor\r
/// </summary>\r
- public SQLiteCommandBuilder() : this(null)\r
+ public SqliteCommandBuilder() : this(null)\r
{\r
}\r
\r
/// Initializes the command builder and associates it with the specified data adapter.\r
/// </summary>\r
/// <param name="adp"></param>\r
- public SQLiteCommandBuilder(SQLiteDataAdapter adp)\r
+ public SqliteCommandBuilder(SqliteDataAdapter adp)\r
{\r
QuotePrefix = "[";\r
QuoteSuffix = "]";\r
/// <param name="whereClause">Whether the application of the parameter is part of a WHERE clause</param>\r
protected override void ApplyParameterInfo(DbParameter parameter, DataRow row, StatementType statementType, bool whereClause)\r
{\r
- SQLiteParameter param = (SQLiteParameter)parameter;\r
+ SqliteParameter param = (SqliteParameter)parameter;\r
param.DbType = (DbType)row[SchemaTableColumn.ProviderType];\r
}\r
\r
{\r
if (adapter == base.DataAdapter)\r
{\r
- ((SQLiteDataAdapter)adapter).RowUpdating -= new EventHandler<RowUpdatingEventArgs>(RowUpdatingEventHandler);\r
+ ((SqliteDataAdapter)adapter).RowUpdating -= new EventHandler<RowUpdatingEventArgs>(RowUpdatingEventHandler);\r
}\r
else\r
{\r
- ((SQLiteDataAdapter)adapter).RowUpdating += new EventHandler<RowUpdatingEventArgs>(RowUpdatingEventHandler);\r
+ ((SqliteDataAdapter)adapter).RowUpdating += new EventHandler<RowUpdatingEventArgs>(RowUpdatingEventHandler);\r
}\r
}\r
\r
/// <summary>\r
/// Gets/sets the DataAdapter for this CommandBuilder\r
/// </summary>\r
- public new SQLiteDataAdapter DataAdapter\r
+ public new SqliteDataAdapter DataAdapter\r
{\r
- get { return (SQLiteDataAdapter)base.DataAdapter; }\r
+ get { return (SqliteDataAdapter)base.DataAdapter; }\r
set { base.DataAdapter = value; }\r
}\r
\r
/// Returns the automatically-generated SQLite command to delete rows from the database\r
/// </summary>\r
/// <returns></returns>\r
- public new SQLiteCommand GetDeleteCommand()\r
+ public new SqliteCommand GetDeleteCommand()\r
{\r
- return (SQLiteCommand)base.GetDeleteCommand();\r
+ return (SqliteCommand)base.GetDeleteCommand();\r
}\r
\r
/// <summary>\r
/// </summary>\r
/// <param name="useColumnsForParameterNames"></param>\r
/// <returns></returns>\r
- public new SQLiteCommand GetDeleteCommand(bool useColumnsForParameterNames)\r
+ public new SqliteCommand GetDeleteCommand(bool useColumnsForParameterNames)\r
{\r
- return (SQLiteCommand)base.GetDeleteCommand(useColumnsForParameterNames);\r
+ return (SqliteCommand)base.GetDeleteCommand(useColumnsForParameterNames);\r
}\r
\r
/// <summary>\r
/// Returns the automatically-generated SQLite command to update rows in the database\r
/// </summary>\r
/// <returns></returns>\r
- public new SQLiteCommand GetUpdateCommand()\r
+ public new SqliteCommand GetUpdateCommand()\r
{\r
- return (SQLiteCommand)base.GetUpdateCommand();\r
+ return (SqliteCommand)base.GetUpdateCommand();\r
}\r
\r
/// <summary>\r
/// </summary>\r
/// <param name="useColumnsForParameterNames"></param>\r
/// <returns></returns>\r
- public new SQLiteCommand GetUpdateCommand(bool useColumnsForParameterNames)\r
+ public new SqliteCommand GetUpdateCommand(bool useColumnsForParameterNames)\r
{\r
- return (SQLiteCommand)base.GetUpdateCommand(useColumnsForParameterNames);\r
+ return (SqliteCommand)base.GetUpdateCommand(useColumnsForParameterNames);\r
}\r
\r
/// <summary>\r
/// Returns the automatically-generated SQLite command to insert rows into the database\r
/// </summary>\r
/// <returns></returns>\r
- public new SQLiteCommand GetInsertCommand()\r
+ public new SqliteCommand GetInsertCommand()\r
{\r
- return (SQLiteCommand)base.GetInsertCommand();\r
+ return (SqliteCommand)base.GetInsertCommand();\r
}\r
\r
/// <summary>\r
/// </summary>\r
/// <param name="useColumnsForParameterNames"></param>\r
/// <returns></returns>\r
- public new SQLiteCommand GetInsertCommand(bool useColumnsForParameterNames)\r
+ public new SqliteCommand GetInsertCommand(bool useColumnsForParameterNames)\r
{\r
- return (SQLiteCommand)base.GetInsertCommand(useColumnsForParameterNames);\r
+ return (SqliteCommand)base.GetInsertCommand(useColumnsForParameterNames);\r
}\r
\r
/// <summary>\r
/// SQLite implentation of DbConnection.\r
/// </summary>\r
/// <remarks>\r
- /// The <see cref="ConnectionString">ConnectionString</see> property of the SQLiteConnection class can contain the following parameter(s), delimited with a semi-colon:\r
+ /// The <see cref="ConnectionString">ConnectionString</see> property of the SqliteConnection class can contain the following parameter(s), delimited with a semi-colon:\r
/// <list type="table">\r
/// <listheader>\r
/// <term>Parameter</term>\r
/// </item>\r
/// </list>\r
/// </remarks>\r
- public sealed partial class SQLiteConnection : DbConnection, ICloneable\r
+ public sealed partial class SqliteConnection : DbConnection, ICloneable\r
{\r
private const string _dataDirectory = "|DataDirectory|";\r
private const string _masterdb = "sqlite_master";\r
public override event StateChangeEventHandler StateChange;\r
\r
///<overloads>\r
- /// Constructs a new SQLiteConnection object\r
+ /// Constructs a new SqliteConnection object\r
/// </overloads>\r
/// <summary>\r
/// Default constructor\r
/// </summary>\r
- public SQLiteConnection()\r
+ public SqliteConnection()\r
: this("")\r
{\r
}\r
/// Initializes the connection with the specified connection string\r
/// </summary>\r
/// <param name="connectionString">The connection string to use on the connection</param>\r
- public SQLiteConnection(string connectionString)\r
+ public SqliteConnection(string connectionString)\r
{\r
_sql = null;\r
_connectionState = ConnectionState.Closed;\r
/// attach to them.\r
/// </summary>\r
/// <param name="connection"></param>\r
- public SQLiteConnection(SQLiteConnection connection)\r
+ public SqliteConnection(SqliteConnection connection)\r
: this(connection.ConnectionString)\r
{\r
string str;\r
if (String.Compare(str, "main", true, CultureInfo.InvariantCulture) != 0\r
&& String.Compare(str, "temp", true, CultureInfo.InvariantCulture) != 0)\r
{\r
- using (SQLiteCommand cmd = CreateCommand())\r
+ using (SqliteCommand cmd = CreateCommand())\r
{\r
cmd.CommandText = String.Format(CultureInfo.InvariantCulture, "ATTACH DATABASE '{0}' AS [{1}]", row[1], row[0]);\r
cmd.ExecuteNonQuery();\r
/// <returns></returns>\r
public object Clone()\r
{\r
- return new SQLiteConnection(this);\r
+ return new SqliteConnection(this);\r
}\r
\r
/// <summary>\r
- /// Disposes of the SQLiteConnection, closing it if it is active.\r
+ /// Disposes of the SqliteConnection, closing it if it is active.\r
/// </summary>\r
/// <param name="disposing">True if the connection is being explicitly closed.</param>\r
protected override void Dispose(bool disposing)\r
}\r
\r
/// <summary>\r
- /// OBSOLETE. Creates a new SQLiteTransaction if one isn't already active on the connection.\r
+ /// OBSOLETE. Creates a new SqliteTransaction if one isn't already active on the connection.\r
/// </summary>\r
/// <param name="isolationLevel">This parameter is ignored.</param>\r
/// <param name="deferredLock">When TRUE, SQLite defers obtaining a write lock until a write operation is requested.\r
/// When FALSE, a writelock is obtained immediately. The default is TRUE, but in a multi-threaded multi-writer \r
/// environment, one may instead choose to lock the database immediately to avoid any possible writer deadlock.</param>\r
- /// <returns>Returns a SQLiteTransaction object.</returns>\r
+ /// <returns>Returns a SqliteTransaction object.</returns>\r
[Obsolete("Use one of the standard BeginTransaction methods, this one will be removed soon")]\r
- public SQLiteTransaction BeginTransaction(IsolationLevel isolationLevel, bool deferredLock)\r
+ public SqliteTransaction BeginTransaction(IsolationLevel isolationLevel, bool deferredLock)\r
{\r
- return (SQLiteTransaction)BeginDbTransaction(deferredLock == false ? IsolationLevel.Serializable : IsolationLevel.ReadCommitted);\r
+ return (SqliteTransaction)BeginDbTransaction(deferredLock == false ? IsolationLevel.Serializable : IsolationLevel.ReadCommitted);\r
}\r
\r
/// <summary>\r
- /// OBSOLETE. Creates a new SQLiteTransaction if one isn't already active on the connection.\r
+ /// OBSOLETE. Creates a new SqliteTransaction if one isn't already active on the connection.\r
/// </summary>\r
/// <param name="deferredLock">When TRUE, SQLite defers obtaining a write lock until a write operation is requested.\r
/// When FALSE, a writelock is obtained immediately. The default is false, but in a multi-threaded multi-writer \r
/// environment, one may instead choose to lock the database immediately to avoid any possible writer deadlock.</param>\r
- /// <returns>Returns a SQLiteTransaction object.</returns>\r
+ /// <returns>Returns a SqliteTransaction object.</returns>\r
[Obsolete("Use one of the standard BeginTransaction methods, this one will be removed soon")]\r
- public SQLiteTransaction BeginTransaction(bool deferredLock)\r
+ public SqliteTransaction BeginTransaction(bool deferredLock)\r
{\r
- return (SQLiteTransaction)BeginDbTransaction(deferredLock == false ? IsolationLevel.Serializable : IsolationLevel.ReadCommitted);\r
+ return (SqliteTransaction)BeginDbTransaction(deferredLock == false ? IsolationLevel.Serializable : IsolationLevel.ReadCommitted);\r
}\r
\r
/// <summary>\r
- /// Creates a new SQLiteTransaction if one isn't already active on the connection.\r
+ /// Creates a new SqliteTransaction if one isn't already active on the connection.\r
/// </summary>\r
/// <param name="isolationLevel">Supported isolation levels are Serializable, ReadCommitted and Unspecified.</param>\r
/// <remarks>\r
/// a transaction in ReadCommitted mode, but if a thread attempts to commit a transaction while another thread\r
/// has a ReadCommitted lock, it may timeout or cause a deadlock on both threads until both threads' CommandTimeout's are reached.\r
/// </remarks>\r
- /// <returns>Returns a SQLiteTransaction object.</returns>\r
- public new SQLiteTransaction BeginTransaction(IsolationLevel isolationLevel)\r
+ /// <returns>Returns a SqliteTransaction object.</returns>\r
+ public new SqliteTransaction BeginTransaction(IsolationLevel isolationLevel)\r
{\r
- return (SQLiteTransaction)BeginDbTransaction(isolationLevel);\r
+ return (SqliteTransaction)BeginDbTransaction(isolationLevel);\r
}\r
\r
/// <summary>\r
- /// Creates a new SQLiteTransaction if one isn't already active on the connection.\r
+ /// Creates a new SqliteTransaction if one isn't already active on the connection.\r
/// </summary>\r
- /// <returns>Returns a SQLiteTransaction object.</returns>\r
- public new SQLiteTransaction BeginTransaction()\r
+ /// <returns>Returns a SqliteTransaction object.</returns>\r
+ public new SqliteTransaction BeginTransaction()\r
{\r
- return (SQLiteTransaction)BeginDbTransaction(_defaultIsolation);\r
+ return (SqliteTransaction)BeginDbTransaction(_defaultIsolation);\r
}\r
\r
/// <summary>\r
if (isolationLevel != IsolationLevel.Serializable && isolationLevel != IsolationLevel.ReadCommitted)\r
throw new ArgumentException("isolationLevel");\r
\r
- return new SQLiteTransaction(this, isolationLevel != IsolationLevel.Serializable);\r
+ return new SqliteTransaction(this, isolationLevel != IsolationLevel.Serializable);\r
}\r
\r
/// <summary>\r
// If the connection is enlisted in a transaction scope and the scope is still active,\r
// we cannot truly shut down this connection until the scope has completed. Therefore make a \r
// hidden connection temporarily to hold open the connection until the scope has completed.\r
- SQLiteConnection cnn = new SQLiteConnection();\r
+ SqliteConnection cnn = new SqliteConnection();\r
cnn._sql = _sql;\r
cnn._transactionLevel = _transactionLevel;\r
cnn._enlistment = _enlistment;\r
/// will be discarded instead of returned to the pool when they are closed.\r
/// </summary>\r
/// <param name="connection"></param>\r
- public static void ClearPool(SQLiteConnection connection)\r
+ public static void ClearPool(SqliteConnection connection)\r
{\r
if (connection._sql == null) return;\r
connection._sql.ClearPool();\r
/// </summary>\r
public static void ClearAllPools()\r
{\r
- SQLiteConnectionPool.ClearAllPools();\r
+ SqliteConnectionPool.ClearAllPools();\r
}\r
\r
/// <summary>\r
/// </remarks>\r
#if !PLATFORM_COMPACTFRAMEWORK\r
[RefreshProperties(RefreshProperties.All), DefaultValue("")]\r
- [Editor("SQLite.Designer.SQLiteConnectionStringEditor, SQLite.Designer, Version=1.0.36.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139", "System.Drawing.Design.UITypeEditor, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")]\r
+ [Editor("SQLite.Designer.SqliteConnectionStringEditor, SQLite.Designer, Version=1.0.36.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139", "System.Drawing.Design.UITypeEditor, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")]\r
#endif\r
public override string ConnectionString\r
{\r
}\r
\r
/// <summary>\r
- /// Create a new SQLiteCommand and associate it with this connection.\r
+ /// Create a new SqliteCommand and associate it with this connection.\r
/// </summary>\r
- /// <returns>Returns an instantiated SQLiteCommand object already assigned to this connection.</returns>\r
- public new SQLiteCommand CreateCommand()\r
+ /// <returns>Returns an instantiated SqliteCommand object already assigned to this connection.</returns>\r
+ public new SqliteCommand CreateCommand()\r
{\r
- return new SQLiteCommand(this);\r
+ return new SqliteCommand(this);\r
}\r
\r
/// <summary>\r
}\r
}\r
\r
+ /// <summary>\r
+ /// Maps mono-specific connection string keywords to the standard ones\r
+ /// </summary>\r
+ /// <returns>The mapped keyword name</returns>\r
+ internal static void MapMonoKeyword (string[] arPiece, SortedList<string, string> ls)\r
+ {\r
+ string keyword, value;\r
+ \r
+ switch (arPiece[0].ToLower (CultureInfo.InvariantCulture)) {\r
+ case "uri":\r
+ keyword = "Data Source";\r
+ value = MapMonoUriPath (arPiece[1]);\r
+ break;\r
+ \r
+ default:\r
+ keyword = arPiece[0];\r
+ value = arPiece[1];\r
+ break;\r
+ }\r
+\r
+ ls.Add(keyword, value);\r
+ }\r
+\r
+ internal static string MapMonoUriPath (string path)\r
+ {\r
+ if (path.StartsWith ("file://")) {\r
+ return path.Substring (7);\r
+ } else if (path.StartsWith ("file:")) {\r
+ return path.Substring (5);\r
+ } else if (path.StartsWith ("/")) {\r
+ return path;\r
+ } else {\r
+ throw new InvalidOperationException ("Invalid connection string: invalid URI");\r
+ }\r
+ }\r
+\r
internal static string MapUriPath(string path)\r
{\r
if (path.StartsWith ("file://"))\r
/// <returns>An array of key-value pairs representing each parameter of the connection string</returns>\r
internal static SortedList<string, string> ParseConnectionString(string connectionString)\r
{\r
- string s = connectionString;\r
+ string s = connectionString.Replace (',', ';'); // Mono compatibility\r
int n;\r
SortedList<string, string> ls = new SortedList<string, string>(StringComparer.OrdinalIgnoreCase);\r
\r
// First split into semi-colon delimited values. The Split() function of SQLiteBase accounts for and properly\r
// skips semi-colons in quoted strings\r
- string[] arParts = SQLiteConvert.Split(s, ';');\r
+ string[] arParts = SqliteConvert.Split(s, ';');\r
string[] arPiece;\r
\r
int x = arParts.Length;\r
// For each semi-colon piece, split into key and value pairs by the presence of the = sign\r
for (n = 0; n < x; n++)\r
{\r
- arPiece = SQLiteConvert.Split(arParts[n], '=');\r
+ Console.WriteLine (arParts [n]);\r
+ arPiece = SqliteConvert.Split(arParts[n], '=');\r
if (arPiece.Length == 2)\r
{\r
- ls.Add(arPiece[0], arPiece[1]);\r
+ MapMonoKeyword (arPiece, ls);\r
}\r
else throw new ArgumentException(String.Format(CultureInfo.CurrentCulture, "Invalid ConnectionString format for parameter \"{0}\"", (arPiece.Length > 0) ? arPiece[0] : "null"));\r
}\r
}\r
try\r
{\r
- bool usePooling = (SQLiteConvert.ToBoolean(FindKey(opts, "Pooling", Boolean.FalseString)) == true);\r
- bool bUTF16 = (SQLiteConvert.ToBoolean(FindKey(opts, "UseUTF16Encoding", Boolean.FalseString)) == true);\r
+ bool usePooling = (SqliteConvert.ToBoolean(FindKey(opts, "Pooling", Boolean.FalseString)) == true);\r
+ bool bUTF16 = (SqliteConvert.ToBoolean(FindKey(opts, "UseUTF16Encoding", Boolean.FalseString)) == true);\r
int maxPoolSize = Convert.ToInt32(FindKey(opts, "Max Pool Size", "100"));\r
\r
_defaultTimeout = Convert.ToInt32(FindKey(opts, "Default Timeout", "30"), CultureInfo.CurrentCulture);\r
\r
SQLiteOpenFlagsEnum flags = SQLiteOpenFlagsEnum.None;\r
\r
- if (SQLiteConvert.ToBoolean(FindKey(opts, "FailIfMissing", Boolean.FalseString)) == false)\r
+ if (SqliteConvert.ToBoolean(FindKey(opts, "FailIfMissing", Boolean.FalseString)) == false)\r
flags |= SQLiteOpenFlagsEnum.Create;\r
\r
- if (SQLiteConvert.ToBoolean(FindKey(opts, "Read Only", Boolean.FalseString)) == true)\r
+ if (SqliteConvert.ToBoolean(FindKey(opts, "Read Only", Boolean.FalseString)) == true)\r
flags |= SQLiteOpenFlagsEnum.ReadOnly;\r
else\r
flags |= SQLiteOpenFlagsEnum.ReadWrite;\r
\r
_sql.Open(fileName, flags, maxPoolSize, usePooling);\r
\r
- _binaryGuid = (SQLiteConvert.ToBoolean(FindKey(opts, "BinaryGUID", Boolean.TrueString)) == true);\r
+ _binaryGuid = (SqliteConvert.ToBoolean(FindKey(opts, "BinaryGUID", Boolean.TrueString)) == true);\r
\r
string password = FindKey(opts, "Password", null);\r
\r
OnStateChange(ConnectionState.Open);\r
_version++;\r
\r
- using (SQLiteCommand cmd = CreateCommand())\r
+ using (SqliteCommand cmd = CreateCommand())\r
{\r
string defValue;\r
\r
}\r
\r
defValue = FindKey(opts, "Legacy Format", Boolean.FalseString);\r
- cmd.CommandText = String.Format(CultureInfo.InvariantCulture, "PRAGMA legacy_file_format={0}", SQLiteConvert.ToBoolean(defValue) == true ? "ON" : "OFF");\r
+ cmd.CommandText = String.Format(CultureInfo.InvariantCulture, "PRAGMA legacy_file_format={0}", SqliteConvert.ToBoolean(defValue) == true ? "ON" : "OFF");\r
cmd.ExecuteNonQuery();\r
\r
defValue = FindKey(opts, "Synchronous", "Normal");\r
_sql.SetRollbackHook(_rollbackCallback);\r
\r
#if !PLATFORM_COMPACTFRAMEWORK\r
- if (global::System.Transactions.Transaction.Current != null && SQLiteConvert.ToBoolean(FindKey(opts, "Enlist", Boolean.TrueString)) == true)\r
+ if (global::System.Transactions.Transaction.Current != null && SqliteConvert.ToBoolean(FindKey(opts, "Enlist", Boolean.TrueString)) == true)\r
EnlistTransaction(global::System.Transactions.Transaction.Current);\r
#endif\r
}\r
- catch (SQLiteException)\r
+ catch (SqliteException)\r
{\r
Close();\r
throw;\r
\r
/// <summary>\r
/// Gets/sets the default command timeout for newly-created commands. This is especially useful for \r
- /// commands used internally such as inside a SQLiteTransaction, where setting the timeout is not possible.\r
+ /// commands used internally such as inside a SqliteTransaction, where setting the timeout is not possible.\r
/// This can also be set in the ConnectionString with "Default Timeout"\r
/// </summary>\r
public int DefaultTimeout\r
\r
string master = (String.Compare(strCatalog, "temp", true, CultureInfo.InvariantCulture) == 0) ? _tempmasterdb : _masterdb;\r
\r
- using (SQLiteCommand cmdTables = new SQLiteCommand(String.Format(CultureInfo.InvariantCulture, "SELECT * FROM [{0}].[{1}] WHERE [type] LIKE 'table' OR [type] LIKE 'view'", strCatalog, master), this))\r
- using (SQLiteDataReader rdTables = cmdTables.ExecuteReader())\r
+ using (SqliteCommand cmdTables = new SqliteCommand(String.Format(CultureInfo.InvariantCulture, "SELECT * FROM [{0}].[{1}] WHERE [type] LIKE 'table' OR [type] LIKE 'view'", strCatalog, master), this))\r
+ using (SqliteDataReader rdTables = cmdTables.ExecuteReader())\r
{\r
while (rdTables.Read())\r
{\r
{\r
try\r
{\r
- using (SQLiteCommand cmd = new SQLiteCommand(String.Format(CultureInfo.InvariantCulture, "SELECT * FROM [{0}].[{1}]", strCatalog, rdTables.GetString(2)), this))\r
- using (SQLiteDataReader rd = (SQLiteDataReader)cmd.ExecuteReader(CommandBehavior.SchemaOnly))\r
+ using (SqliteCommand cmd = new SqliteCommand(String.Format(CultureInfo.InvariantCulture, "SELECT * FROM [{0}].[{1}]", strCatalog, rdTables.GetString(2)), this))\r
+ using (SqliteDataReader rd = (SqliteDataReader)cmd.ExecuteReader(CommandBehavior.SchemaOnly))\r
using (DataTable tblSchema = rd.GetSchemaTable(true, true))\r
{\r
foreach (DataRow schemaRow in tblSchema.Rows)\r
row["COLUMN_DEFAULT"] = schemaRow[SchemaTableOptionalColumn.DefaultValue];\r
row["IS_NULLABLE"] = schemaRow[SchemaTableColumn.AllowDBNull];\r
row["DATA_TYPE"] = schemaRow["DataTypeName"].ToString().ToLower(CultureInfo.InvariantCulture);\r
- row["EDM_TYPE"] = SQLiteConvert.DbTypeToTypeName((DbType)schemaRow[SchemaTableColumn.ProviderType]).ToString().ToLower(CultureInfo.InvariantCulture);\r
+ row["EDM_TYPE"] = SqliteConvert.DbTypeToTypeName((DbType)schemaRow[SchemaTableColumn.ProviderType]).ToString().ToLower(CultureInfo.InvariantCulture);\r
row["CHARACTER_MAXIMUM_LENGTH"] = schemaRow[SchemaTableColumn.ColumnSize];\r
row["TABLE_SCHEMA"] = schemaRow[SchemaTableColumn.BaseSchemaName];\r
row["PRIMARY_KEY"] = schemaRow[SchemaTableColumn.IsKey];\r
}\r
}\r
}\r
- catch(SQLiteException)\r
+ catch(SqliteException)\r
{\r
}\r
}\r
\r
string master = (String.Compare(strCatalog, "temp", true, CultureInfo.InvariantCulture) == 0) ? _tempmasterdb : _masterdb;\r
\r
- using (SQLiteCommand cmdTables = new SQLiteCommand(String.Format(CultureInfo.InvariantCulture, "SELECT * FROM [{0}].[{1}] WHERE [type] LIKE 'table'", strCatalog, master), this))\r
- using (SQLiteDataReader rdTables = cmdTables.ExecuteReader())\r
+ using (SqliteCommand cmdTables = new SqliteCommand(String.Format(CultureInfo.InvariantCulture, "SELECT * FROM [{0}].[{1}] WHERE [type] LIKE 'table'", strCatalog, master), this))\r
+ using (SqliteDataReader rdTables = cmdTables.ExecuteReader())\r
{\r
while (rdTables.Read())\r
{\r
// Such indexes are not listed in the indexes list but count as indexes just the same.\r
try\r
{\r
- using (SQLiteCommand cmdTable = new SQLiteCommand(String.Format(CultureInfo.InvariantCulture, "PRAGMA [{0}].table_info([{1}])", strCatalog, rdTables.GetString(2)), this))\r
- using (SQLiteDataReader rdTable = cmdTable.ExecuteReader())\r
+ using (SqliteCommand cmdTable = new SqliteCommand(String.Format(CultureInfo.InvariantCulture, "PRAGMA [{0}].table_info([{1}])", strCatalog, rdTables.GetString(2)), this))\r
+ using (SqliteDataReader rdTable = cmdTable.ExecuteReader())\r
{\r
while (rdTable.Read())\r
{\r
}\r
}\r
}\r
- catch (SQLiteException)\r
+ catch (SqliteException)\r
{\r
}\r
if (primaryKeys.Count == 1 && maybeRowId == true)\r
// Now fetch all the rest of the indexes.\r
try\r
{\r
- using (SQLiteCommand cmd = new SQLiteCommand(String.Format(CultureInfo.InvariantCulture, "PRAGMA [{0}].index_list([{1}])", strCatalog, rdTables.GetString(2)), this))\r
- using (SQLiteDataReader rd = (SQLiteDataReader)cmd.ExecuteReader())\r
+ using (SqliteCommand cmd = new SqliteCommand(String.Format(CultureInfo.InvariantCulture, "PRAGMA [{0}].index_list([{1}])", strCatalog, rdTables.GetString(2)), this))\r
+ using (SqliteDataReader rd = (SqliteDataReader)cmd.ExecuteReader())\r
{\r
while (rd.Read())\r
{\r
row["PRIMARY_KEY"] = false;\r
\r
// get the index definition\r
- 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))\r
- using (SQLiteDataReader rdIndexes = cmdIndexes.ExecuteReader())\r
+ 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))\r
+ using (SqliteDataReader rdIndexes = cmdIndexes.ExecuteReader())\r
{\r
while (rdIndexes.Read())\r
{\r
// primary key, and all the columns in the given index match the primary key columns\r
if (primaryKeys.Count > 0 && rd.GetString(1).StartsWith("sqlite_autoindex_" + rdTables.GetString(2), StringComparison.InvariantCultureIgnoreCase) == true)\r
{\r
- using (SQLiteCommand cmdDetails = new SQLiteCommand(String.Format(CultureInfo.InvariantCulture, "PRAGMA [{0}].index_info([{1}])", strCatalog, rd.GetString(1)), this))\r
- using (SQLiteDataReader rdDetails = cmdDetails.ExecuteReader())\r
+ using (SqliteCommand cmdDetails = new SqliteCommand(String.Format(CultureInfo.InvariantCulture, "PRAGMA [{0}].index_info([{1}])", strCatalog, rd.GetString(1)), this))\r
+ using (SqliteDataReader rdDetails = cmdDetails.ExecuteReader())\r
{\r
int nMatches = 0;\r
while (rdDetails.Read())\r
}\r
}\r
}\r
- catch (SQLiteException)\r
+ catch (SqliteException)\r
{\r
}\r
}\r
if (String.IsNullOrEmpty(catalog)) catalog = "main";\r
string master = (String.Compare(catalog, "temp", true, CultureInfo.InvariantCulture) == 0) ? _tempmasterdb : _masterdb;\r
\r
- 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))\r
- using (SQLiteDataReader rd = (SQLiteDataReader)cmd.ExecuteReader())\r
+ 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))\r
+ using (SqliteDataReader rd = (SqliteDataReader)cmd.ExecuteReader())\r
{\r
while (rd.Read())\r
{\r
\r
string master = (String.Compare(strCatalog, "temp", true, CultureInfo.InvariantCulture) == 0) ? _tempmasterdb : _masterdb;\r
\r
- 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))\r
- using (SQLiteDataReader rd = (SQLiteDataReader)cmd.ExecuteReader())\r
+ 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))\r
+ using (SqliteDataReader rd = (SqliteDataReader)cmd.ExecuteReader())\r
{\r
while (rd.Read())\r
{\r
\r
string master = (String.Compare(strCatalog, "temp", true, CultureInfo.InvariantCulture) == 0) ? _tempmasterdb : _masterdb;\r
\r
- using (SQLiteCommand cmd = new SQLiteCommand(String.Format(CultureInfo.InvariantCulture, "SELECT * FROM [{0}].[{1}] WHERE [type] LIKE 'view'", strCatalog, master), this))\r
- using (SQLiteDataReader rd = (SQLiteDataReader)cmd.ExecuteReader())\r
+ using (SqliteCommand cmd = new SqliteCommand(String.Format(CultureInfo.InvariantCulture, "SELECT * FROM [{0}].[{1}] WHERE [type] LIKE 'view'", strCatalog, master), this))\r
+ using (SqliteDataReader rd = (SqliteDataReader)cmd.ExecuteReader())\r
{\r
while (rd.Read())\r
{\r
\r
tbl.BeginLoadData();\r
\r
- using (SQLiteCommand cmd = new SQLiteCommand("PRAGMA database_list", this))\r
- using (SQLiteDataReader rd = (SQLiteDataReader)cmd.ExecuteReader())\r
+ using (SqliteCommand cmd = new SqliteCommand("PRAGMA database_list", this))\r
+ using (SqliteDataReader rd = (SqliteDataReader)cmd.ExecuteReader())\r
{\r
while (rd.Read())\r
{\r
\r
tbl.BeginLoadData();\r
\r
- using (SQLiteCommand cmdTables = new SQLiteCommand(String.Format(CultureInfo.InvariantCulture, "SELECT * FROM [{0}].[{1}] WHERE [type] LIKE 'table'", strCatalog, master), this))\r
- using (SQLiteDataReader rdTables = cmdTables.ExecuteReader())\r
+ using (SqliteCommand cmdTables = new SqliteCommand(String.Format(CultureInfo.InvariantCulture, "SELECT * FROM [{0}].[{1}] WHERE [type] LIKE 'table'", strCatalog, master), this))\r
+ using (SqliteDataReader rdTables = cmdTables.ExecuteReader())\r
{\r
while (rdTables.Read())\r
{\r
{\r
try\r
{\r
- using (SQLiteCommand cmdTable = new SQLiteCommand(String.Format(CultureInfo.InvariantCulture, "PRAGMA [{0}].table_info([{1}])", strCatalog, rdTables.GetString(2)), this))\r
- using (SQLiteDataReader rdTable = cmdTable.ExecuteReader())\r
+ using (SqliteCommand cmdTable = new SqliteCommand(String.Format(CultureInfo.InvariantCulture, "PRAGMA [{0}].table_info([{1}])", strCatalog, rdTables.GetString(2)), this))\r
+ using (SqliteDataReader rdTable = cmdTable.ExecuteReader())\r
{\r
while (rdTable.Read())\r
{\r
}\r
}\r
}\r
- catch (SQLiteException)\r
+ catch (SqliteException)\r
{\r
}\r
// This is a rowid row\r
tbl.Rows.Add(row);\r
}\r
\r
- 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))\r
- using (SQLiteDataReader rdIndexes = cmdIndexes.ExecuteReader())\r
+ 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))\r
+ using (SqliteDataReader rdIndexes = cmdIndexes.ExecuteReader())\r
{\r
while (rdIndexes.Read())\r
{\r
{\r
try\r
{\r
- using (SQLiteCommand cmdIndex = new SQLiteCommand(String.Format(CultureInfo.InvariantCulture, "PRAGMA [{0}].index_info([{1}])", strCatalog, rdIndexes.GetString(1)), this))\r
- using (SQLiteDataReader rdIndex = cmdIndex.ExecuteReader())\r
+ using (SqliteCommand cmdIndex = new SqliteCommand(String.Format(CultureInfo.InvariantCulture, "PRAGMA [{0}].index_info([{1}])", strCatalog, rdIndexes.GetString(1)), this))\r
+ using (SqliteDataReader rdIndex = cmdIndex.ExecuteReader())\r
{\r
while (rdIndex.Read())\r
{\r
}\r
}\r
}\r
- catch (SQLiteException)\r
+ catch (SqliteException)\r
{\r
}\r
}\r
\r
tbl.BeginLoadData();\r
\r
- using (SQLiteCommand cmdViews = new SQLiteCommand(String.Format(CultureInfo.InvariantCulture, "SELECT * FROM [{0}].[{1}] WHERE [type] LIKE 'view'", strCatalog, master), this))\r
- using (SQLiteDataReader rdViews = cmdViews.ExecuteReader())\r
+ using (SqliteCommand cmdViews = new SqliteCommand(String.Format(CultureInfo.InvariantCulture, "SELECT * FROM [{0}].[{1}] WHERE [type] LIKE 'view'", strCatalog, master), this))\r
+ using (SqliteDataReader rdViews = cmdViews.ExecuteReader())\r
{\r
while (rdViews.Read())\r
{\r
if (String.IsNullOrEmpty(strView) || String.Compare(strView, rdViews.GetString(2), true, CultureInfo.InvariantCulture) == 0)\r
{\r
- using (SQLiteCommand cmdViewSelect = new SQLiteCommand(String.Format(CultureInfo.InvariantCulture, "SELECT * FROM [{0}].[{1}]", strCatalog, rdViews.GetString(2)), this))\r
+ using (SqliteCommand cmdViewSelect = new SqliteCommand(String.Format(CultureInfo.InvariantCulture, "SELECT * FROM [{0}].[{1}]", strCatalog, rdViews.GetString(2)), this))\r
{\r
strSql = rdViews.GetString(4).Replace('\r', ' ').Replace('\n', ' ').Replace('\t', ' ');\r
n = CultureInfo.InvariantCulture.CompareInfo.IndexOf(strSql, " AS ", CompareOptions.IgnoreCase);\r
\r
strSql = strSql.Substring(n + 4);\r
\r
- using (SQLiteCommand cmd = new SQLiteCommand(strSql, this))\r
- using (SQLiteDataReader rdViewSelect = cmdViewSelect.ExecuteReader(CommandBehavior.SchemaOnly))\r
- using (SQLiteDataReader rd = (SQLiteDataReader)cmd.ExecuteReader(CommandBehavior.SchemaOnly))\r
+ using (SqliteCommand cmd = new SqliteCommand(strSql, this))\r
+ using (SqliteDataReader rdViewSelect = cmdViewSelect.ExecuteReader(CommandBehavior.SchemaOnly))\r
+ using (SqliteDataReader rd = (SqliteDataReader)cmd.ExecuteReader(CommandBehavior.SchemaOnly))\r
using (DataTable tblSchemaView = rdViewSelect.GetSchemaTable(false, false))\r
using (DataTable tblSchema = rd.GetSchemaTable(false, false))\r
{\r
row["COLUMN_DEFAULT"] = viewRow[SchemaTableOptionalColumn.DefaultValue];\r
row["ORDINAL_POSITION"] = viewRow[SchemaTableColumn.ColumnOrdinal];\r
row["IS_NULLABLE"] = viewRow[SchemaTableColumn.AllowDBNull];\r
- row["DATA_TYPE"] = viewRow["DataTypeName"]; // SQLiteConvert.DbTypeToType((DbType)viewRow[SchemaTableColumn.ProviderType]).ToString();\r
- row["EDM_TYPE"] = SQLiteConvert.DbTypeToTypeName((DbType)viewRow[SchemaTableColumn.ProviderType]).ToString().ToLower(CultureInfo.InvariantCulture);\r
+ row["DATA_TYPE"] = viewRow["DataTypeName"]; // SqliteConvert.DbTypeToType((DbType)viewRow[SchemaTableColumn.ProviderType]).ToString();\r
+ row["EDM_TYPE"] = SqliteConvert.DbTypeToTypeName((DbType)viewRow[SchemaTableColumn.ProviderType]).ToString().ToLower(CultureInfo.InvariantCulture);\r
row["CHARACTER_MAXIMUM_LENGTH"] = viewRow[SchemaTableColumn.ColumnSize];\r
row["TABLE_SCHEMA"] = viewRow[SchemaTableColumn.BaseSchemaName];\r
row["PRIMARY_KEY"] = viewRow[SchemaTableColumn.IsKey];\r
\r
tbl.BeginLoadData();\r
\r
- using (SQLiteCommand cmdTables = new SQLiteCommand(String.Format(CultureInfo.InvariantCulture, "SELECT * FROM [{0}].[{1}] WHERE [type] LIKE 'table'", strCatalog, master), this))\r
- using (SQLiteDataReader rdTables = cmdTables.ExecuteReader())\r
+ using (SqliteCommand cmdTables = new SqliteCommand(String.Format(CultureInfo.InvariantCulture, "SELECT * FROM [{0}].[{1}] WHERE [type] LIKE 'table'", strCatalog, master), this))\r
+ using (SqliteDataReader rdTables = cmdTables.ExecuteReader())\r
{\r
while (rdTables.Read())\r
{\r
{\r
try\r
{\r
- using (SQLiteCommandBuilder builder = new SQLiteCommandBuilder())\r
- //using (SQLiteCommand cmdTable = new SQLiteCommand(String.Format(CultureInfo.InvariantCulture, "SELECT * FROM [{0}].[{1}]", strCatalog, rdTables.GetString(2)), this))\r
- //using (SQLiteDataReader rdTable = cmdTable.ExecuteReader(CommandBehavior.SchemaOnly))\r
- using (SQLiteCommand cmdKey = new SQLiteCommand(String.Format(CultureInfo.InvariantCulture, "PRAGMA [{0}].foreign_key_list([{1}])", strCatalog, rdTables.GetString(2)), this))\r
- using (SQLiteDataReader rdKey = cmdKey.ExecuteReader())\r
+ using (SqliteCommandBuilder builder = new SqliteCommandBuilder())\r
+ //using (SqliteCommand cmdTable = new SqliteCommand(String.Format(CultureInfo.InvariantCulture, "SELECT * FROM [{0}].[{1}]", strCatalog, rdTables.GetString(2)), this))\r
+ //using (SqliteDataReader rdTable = cmdTable.ExecuteReader(CommandBehavior.SchemaOnly))\r
+ using (SqliteCommand cmdKey = new SqliteCommand(String.Format(CultureInfo.InvariantCulture, "PRAGMA [{0}].foreign_key_list([{1}])", strCatalog, rdTables.GetString(2)), this))\r
+ using (SqliteDataReader rdKey = cmdKey.ExecuteReader())\r
{\r
while (rdKey.Read())\r
{\r
}\r
}\r
}\r
- catch (SQLiteException)\r
+ catch (SqliteException)\r
{\r
}\r
}\r
using System;\r
using System.Collections.Generic;\r
\r
- internal static class SQLiteConnectionPool\r
+ internal static class SqliteConnectionPool\r
{\r
/// <summary>\r
/// Keeps track of connections made on a specified file. The PoolVersion dictates whether old objects get\r
/// <param name="maxPoolSize">The maximum size the connection pool for the filename can be</param>\r
/// <param name="version">The pool version the returned connection will belong to</param>\r
/// <returns>Returns NULL if no connections were available. Even if none are, the poolversion will still be a valid pool version</returns>\r
- internal static SQLiteConnectionHandle Remove(string fileName, int maxPoolSize, out int version)\r
+ internal static SqliteConnectionHandle Remove(string fileName, int maxPoolSize, out int version)\r
{\r
lock (_connections)\r
{\r
while (queue.Queue.Count > 0)\r
{\r
WeakReference cnn = queue.Queue.Dequeue();\r
- SQLiteConnectionHandle hdl = cnn.Target as SQLiteConnectionHandle;\r
+ SqliteConnectionHandle hdl = cnn.Target as SqliteConnectionHandle;\r
if (hdl != null)\r
{\r
return hdl;\r
while (pair.Value.Queue.Count > 0)\r
{\r
WeakReference cnn = pair.Value.Queue.Dequeue();\r
- SQLiteConnectionHandle hdl = cnn.Target as SQLiteConnectionHandle;\r
+ SqliteConnectionHandle hdl = cnn.Target as SqliteConnectionHandle;\r
if (hdl != null)\r
{\r
hdl.Dispose();\r
while (queue.Queue.Count > 0)\r
{\r
WeakReference cnn = queue.Queue.Dequeue();\r
- SQLiteConnectionHandle hdl = cnn.Target as SQLiteConnectionHandle;\r
+ SqliteConnectionHandle hdl = cnn.Target as SqliteConnectionHandle;\r
if (hdl != null)\r
{\r
hdl.Dispose();\r
/// <remarks>\r
/// If the version numbers don't match between the connection and the pool, then the handle is discarded.\r
/// </remarks>\r
- internal static void Add(string fileName, SQLiteConnectionHandle hdl, int version)\r
+ internal static void Add(string fileName, SqliteConnectionHandle hdl, int version)\r
{\r
lock (_connections)\r
{\r
while (queue.Queue.Count > target)\r
{\r
WeakReference cnn = queue.Queue.Dequeue();\r
- SQLiteConnectionHandle hdl = cnn.Target as SQLiteConnectionHandle;\r
+ SqliteConnectionHandle hdl = cnn.Target as SqliteConnectionHandle;\r
if (hdl != null)\r
{\r
hdl.Dispose();\r
/// </summary>\r
[DefaultProperty("DataSource")]\r
[DefaultMember("Item")]\r
- public sealed class SQLiteConnectionStringBuilder : DbConnectionStringBuilder\r
+ public sealed class SqliteConnectionStringBuilder : DbConnectionStringBuilder\r
{\r
/// <summary>\r
/// Properties of this class\r
/// <summary>\r
/// Default constructor\r
/// </summary>\r
- public SQLiteConnectionStringBuilder()\r
+ public SqliteConnectionStringBuilder()\r
{\r
Initialize(null);\r
}\r
/// Constructs a new instance of the class using the specified connection string.\r
/// </summary>\r
/// <param name="connectionString">The connection string to parse</param>\r
- public SQLiteConnectionStringBuilder(string connectionString)\r
+ public SqliteConnectionStringBuilder(string connectionString)\r
{\r
Initialize(connectionString);\r
}\r
{\r
object value;\r
TryGetValue("useutf16encoding", out value);\r
- return SQLiteConvert.ToBoolean(value);\r
+ return SqliteConvert.ToBoolean(value);\r
}\r
set\r
{\r
{\r
object value;\r
TryGetValue("pooling", out value);\r
- return SQLiteConvert.ToBoolean(value);\r
+ return SqliteConvert.ToBoolean(value);\r
}\r
set\r
{\r
{\r
object value;\r
TryGetValue("binaryguid", out value);\r
- return SQLiteConvert.ToBoolean(value);\r
+ return SqliteConvert.ToBoolean(value);\r
}\r
set\r
{\r
\r
/// <summary>\r
/// Gets/sets the default command timeout for newly-created commands. This is especially useful for \r
- /// commands used internally such as inside a SQLiteTransaction, where setting the timeout is not possible.\r
+ /// commands used internally such as inside a SqliteTransaction, where setting the timeout is not possible.\r
/// </summary>\r
[DisplayName("Default Timeout")]\r
[Browsable(true)]\r
{\r
object value;\r
TryGetValue("enlist", out value);\r
- return SQLiteConvert.ToBoolean(value);\r
+ return SqliteConvert.ToBoolean(value);\r
}\r
set\r
{\r
{\r
object value;\r
TryGetValue("failifmissing", out value);\r
- return SQLiteConvert.ToBoolean(value);\r
+ return SqliteConvert.ToBoolean(value);\r
}\r
set\r
{\r
{\r
object value;\r
TryGetValue("legacy format", out value);\r
- return SQLiteConvert.ToBoolean(value);\r
+ return SqliteConvert.ToBoolean(value);\r
}\r
set\r
{\r
{\r
object value;\r
TryGetValue("read only", out value);\r
- return SQLiteConvert.ToBoolean(value);\r
+ return SqliteConvert.ToBoolean(value);\r
}\r
set\r
{\r
if (b)\r
{\r
if (pd.PropertyType == typeof(Boolean))\r
- value = SQLiteConvert.ToBoolean(value);\r
+ value = SqliteConvert.ToBoolean(value);\r
else\r
value = TypeDescriptor.GetConverter(pd.PropertyType).ConvertFrom(value);\r
}\r
/// <summary>\r
/// This base class provides datatype conversion services for the SQLite provider.\r
/// </summary>\r
- public abstract class SQLiteConvert\r
+ public abstract class SqliteConvert\r
{\r
/// <summary>\r
/// An array of ISO8601 datetime formats we support conversion from\r
/// Initializes the conversion class\r
/// </summary>\r
/// <param name="fmt">The default date/time format to use for this instance</param>\r
- internal SQLiteConvert(SQLiteDateFormats fmt)\r
+ internal SqliteConvert(SQLiteDateFormats fmt)\r
{\r
_datetimeFormat = fmt;\r
}\r
/// <param name="stmt">The statement to retrieve information for</param>\r
/// <param name="i">The column to retrieve type information on</param>\r
/// <param name="typ">The SQLiteType to receive the affinity for the given column</param>\r
- internal static void ColumnToType(SQLiteStatement stmt, int i, SQLiteType typ)\r
+ internal static void ColumnToType(SqliteStatement stmt, int i, SQLiteType typ)\r
{\r
typ.Type = TypeNameToDbType(stmt._sql.ColumnType(stmt, i, out typ.Affinity));\r
}\r
if (t.Type == DbType.Object)\r
return _affinitytotype[(int)t.Affinity];\r
else\r
- return SQLiteConvert.DbTypeToType(t.Type);\r
+ return SqliteConvert.DbTypeToType(t.Type);\r
}\r
\r
private static Type[] _affinitytotype = {\r
/// </summary>\r
#if !PLATFORM_COMPACTFRAMEWORK\r
[DefaultEvent("RowUpdated")]\r
- [ToolboxItem("SQLite.Designer.SQLiteDataAdapterToolboxItem, SQLite.Designer, Version=1.0.36.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139")]\r
+ [ToolboxItem("SQLite.Designer.SqliteDataAdapterToolboxItem, SQLite.Designer, Version=1.0.36.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139")]\r
[Designer("Microsoft.VSDesigner.Data.VS.SqlDataAdapterDesigner, Microsoft.VSDesigner, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")]\r
#endif\r
- public sealed class SQLiteDataAdapter : DbDataAdapter\r
+ public sealed class SqliteDataAdapter : DbDataAdapter\r
{\r
private static object _updatingEventPH = new object();\r
private static object _updatedEventPH = new object();\r
/// <summary>\r
/// Default constructor.\r
/// </summary>\r
- public SQLiteDataAdapter()\r
+ public SqliteDataAdapter()\r
{\r
}\r
\r
/// Constructs a data adapter using the specified select command.\r
/// </summary>\r
/// <param name="cmd">The select command to associate with the adapter.</param>\r
- public SQLiteDataAdapter(SQLiteCommand cmd)\r
+ public SqliteDataAdapter(SqliteCommand cmd)\r
{\r
SelectCommand = cmd;\r
}\r
/// </summary>\r
/// <param name="commandText">The select command text to associate with the data adapter.</param>\r
/// <param name="connection">The connection to associate with the select command.</param>\r
- public SQLiteDataAdapter(string commandText, SQLiteConnection connection)\r
+ public SqliteDataAdapter(string commandText, SqliteConnection connection)\r
{\r
- SelectCommand = new SQLiteCommand(commandText, connection);\r
+ SelectCommand = new SqliteCommand(commandText, connection);\r
}\r
\r
/// <summary>\r
/// Constructs a data adapter with the specified select command text, and using the specified database connection string.\r
/// </summary>\r
/// <param name="commandText">The select command text to use to construct a select command.</param>\r
- /// <param name="connectionString">A connection string suitable for passing to a new SQLiteConnection, which is associated with the select command.</param>\r
- public SQLiteDataAdapter(string commandText, string connectionString)\r
+ /// <param name="connectionString">A connection string suitable for passing to a new SqliteConnection, which is associated with the select command.</param>\r
+ public SqliteDataAdapter(string commandText, string connectionString)\r
{\r
- SQLiteConnection cnn = new SQLiteConnection(connectionString);\r
- SelectCommand = new SQLiteCommand(commandText, cnn);\r
+ SqliteConnection cnn = new SqliteConnection(connectionString);\r
+ SelectCommand = new SqliteCommand(commandText, cnn);\r
}\r
\r
/// <summary>\r
#if !PLATFORM_COMPACTFRAMEWORK\r
[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")]\r
#endif\r
- public new SQLiteCommand SelectCommand\r
+ public new SqliteCommand SelectCommand\r
{\r
- get { return (SQLiteCommand)base.SelectCommand; }\r
+ get { return (SqliteCommand)base.SelectCommand; }\r
set { base.SelectCommand = value; }\r
}\r
\r
#if !PLATFORM_COMPACTFRAMEWORK\r
[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")]\r
#endif\r
- public new SQLiteCommand InsertCommand\r
+ public new SqliteCommand InsertCommand\r
{\r
- get { return (SQLiteCommand)base.InsertCommand; }\r
+ get { return (SqliteCommand)base.InsertCommand; }\r
set { base.InsertCommand = value; }\r
}\r
\r
#if !PLATFORM_COMPACTFRAMEWORK\r
[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")]\r
#endif\r
- public new SQLiteCommand UpdateCommand\r
+ public new SqliteCommand UpdateCommand\r
{\r
- get { return (SQLiteCommand)base.UpdateCommand; }\r
+ get { return (SqliteCommand)base.UpdateCommand; }\r
set { base.UpdateCommand = value; }\r
}\r
\r
#if !PLATFORM_COMPACTFRAMEWORK\r
[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")]\r
#endif\r
- public new SQLiteCommand DeleteCommand\r
+ public new SqliteCommand DeleteCommand\r
{\r
- get { return (SQLiteCommand)base.DeleteCommand; }\r
+ get { return (SqliteCommand)base.DeleteCommand; }\r
set { base.DeleteCommand = value; }\r
}\r
}\r
/// <summary>\r
/// SQLite implementation of DbDataReader.\r
/// </summary>\r
- public sealed class SQLiteDataReader : DbDataReader\r
+ public sealed class SqliteDataReader : DbDataReader\r
{\r
/// <summary>\r
/// Underlying command this reader is attached to\r
/// </summary>\r
- private SQLiteCommand _command;\r
+ private SqliteCommand _command;\r
/// <summary>\r
/// Index of the current statement in the command being processed\r
/// </summary>\r
/// <summary>\r
/// Current statement being Read()\r
/// </summary>\r
- private SQLiteStatement _activeStatement;\r
+ private SqliteStatement _activeStatement;\r
/// <summary>\r
/// State of the current statement being processed.\r
/// -1 = First Step() executed, so the first Read() will be ignored\r
/// <summary>\r
/// An array of rowid's for the active statement if CommandBehavior.KeyInfo is specified\r
/// </summary>\r
- private SQLiteKeyReader _keyInfo;\r
+ private SqliteKeyReader _keyInfo;\r
\r
internal long _version; // Matches the version of the connection\r
\r
/// <summary>\r
/// Internal constructor, initializes the datareader and sets up to begin executing statements\r
/// </summary>\r
- /// <param name="cmd">The SQLiteCommand this data reader is for</param>\r
+ /// <param name="cmd">The SqliteCommand this data reader is for</param>\r
/// <param name="behave">The expected behavior of the data reader</param>\r
- internal SQLiteDataReader(SQLiteCommand cmd, CommandBehavior behave)\r
+ internal SqliteDataReader(SqliteCommand cmd, CommandBehavior behave)\r
{\r
_command = cmd;\r
_version = _command.Connection._version;\r
throw new InvalidOperationException("DataReader has been closed");\r
\r
if (_version == 0)\r
- throw new SQLiteException((int)SQLiteErrorCode.Abort, "Execution was aborted by the user");\r
+ throw new SqliteException((int)SQLiteErrorCode.Abort, "Execution was aborted by the user");\r
\r
if (_command.Connection.State != ConnectionState.Open || _command.Connection._version != _version)\r
throw new InvalidOperationException("Connection was closed, statement was terminated");\r
return _keyInfo.GetDataTypeName(i - VisibleFieldCount);\r
\r
SQLiteType typ = GetSQLiteType(i);\r
- if (typ.Type == DbType.Object) return SQLiteConvert.SQLiteTypeToType(typ).Name;\r
+ if (typ.Type == DbType.Object) return SqliteConvert.SQLiteTypeToType(typ).Name;\r
return _activeStatement._sql.ColumnType(_activeStatement, i, out typ.Affinity);\r
}\r
\r
if (i >= VisibleFieldCount && _keyInfo != null)\r
return _keyInfo.GetFieldType(i - VisibleFieldCount);\r
\r
- return SQLiteConvert.SQLiteTypeToType(GetSQLiteType(i));\r
+ return SqliteConvert.SQLiteTypeToType(GetSQLiteType(i));\r
}\r
\r
/// <summary>\r
// Default settings for the column\r
row[SchemaTableColumn.ColumnName] = GetName(n);\r
row[SchemaTableColumn.ColumnOrdinal] = n;\r
- row[SchemaTableColumn.ColumnSize] = SQLiteConvert.DbTypeToColumnSize(typ);\r
- row[SchemaTableColumn.NumericPrecision] = SQLiteConvert.DbTypeToNumericPrecision(typ);\r
- row[SchemaTableColumn.NumericScale] = SQLiteConvert.DbTypeToNumericScale(typ);\r
+ row[SchemaTableColumn.ColumnSize] = SqliteConvert.DbTypeToColumnSize(typ);\r
+ row[SchemaTableColumn.NumericPrecision] = SqliteConvert.DbTypeToNumericPrecision(typ);\r
+ row[SchemaTableColumn.NumericScale] = SqliteConvert.DbTypeToNumericScale(typ);\r
row[SchemaTableColumn.ProviderType] = GetSQLiteType(n).Type;\r
row[SchemaTableColumn.IsLong] = false;\r
row[SchemaTableColumn.AllowDBNull] = true;\r
if (wantDefaultValue)\r
{\r
// Determine the default value for the column, which sucks because we have to query the schema for each column\r
- using (SQLiteCommand cmdTable = new SQLiteCommand(String.Format(CultureInfo.InvariantCulture, "PRAGMA [{0}].TABLE_INFO([{1}])",\r
+ using (SqliteCommand cmdTable = new SqliteCommand(String.Format(CultureInfo.InvariantCulture, "PRAGMA [{0}].TABLE_INFO([{1}])",\r
row[SchemaTableOptionalColumn.BaseCatalogName],\r
row[SchemaTableColumn.BaseTableName]\r
), _command.Connection))\r
{\r
CheckClosed();\r
\r
- SQLiteStatement stmt = null;\r
+ SqliteStatement stmt = null;\r
int fieldCount;\r
\r
while (true)\r
// If not initialized, then fetch the declared column datatype and attempt to convert it \r
// to a known DbType.\r
if (typ.Affinity == TypeAffinity.Uninitialized)\r
- typ.Type = SQLiteConvert.TypeNameToDbType(_activeStatement._sql.ColumnType(_activeStatement, i, out typ.Affinity));\r
+ typ.Type = SqliteConvert.TypeNameToDbType(_activeStatement._sql.ColumnType(_activeStatement, i, out typ.Affinity));\r
else\r
typ.Affinity = _activeStatement._sql.ColumnAffinity(_activeStatement, i);\r
\r
if (_keyInfo != null)\r
_keyInfo.Dispose();\r
\r
- _keyInfo = new SQLiteKeyReader(_command.Connection, this, _activeStatement);\r
+ _keyInfo = new SqliteKeyReader(_command.Connection, this, _activeStatement);\r
}\r
}\r
}\r
\r
internal class SQLiteEnlistment : IEnlistmentNotification\r
{\r
- internal SQLiteTransaction _transaction;\r
+ internal SqliteTransaction _transaction;\r
internal Transaction _scope;\r
internal bool _disposeConnection;\r
\r
- internal SQLiteEnlistment(SQLiteConnection cnn, Transaction scope)\r
+ internal SQLiteEnlistment(SqliteConnection cnn, Transaction scope)\r
{\r
_transaction = cnn.BeginTransaction();\r
_scope = scope;\r
_scope.EnlistVolatile(this, System.Transactions.EnlistmentOptions.None);\r
}\r
\r
- private void Cleanup(SQLiteConnection cnn)\r
+ private void Cleanup(SqliteConnection cnn)\r
{\r
if (_disposeConnection)\r
cnn.Dispose();\r
\r
public void Commit(Enlistment enlistment)\r
{\r
- SQLiteConnection cnn = _transaction.Connection;\r
+ SqliteConnection cnn = _transaction.Connection;\r
cnn._enlistment = null;\r
\r
try\r
\r
public void Rollback(Enlistment enlistment)\r
{\r
- SQLiteConnection cnn = _transaction.Connection;\r
+ SqliteConnection cnn = _transaction.Connection;\r
cnn._enlistment = null;\r
\r
try\r
/// </summary>\r
#if !PLATFORM_COMPACTFRAMEWORK\r
[Serializable]\r
- public sealed class SQLiteException : DbException\r
+ public sealed class SqliteException : DbException\r
#else\r
- public sealed class SQLiteException : Exception\r
+ public sealed class SqliteException : Exception\r
#endif\r
{\r
private SQLiteErrorCode _errorCode;\r
\r
#if !PLATFORM_COMPACTFRAMEWORK\r
- private SQLiteException(SerializationInfo info, StreamingContext context)\r
+ private SqliteException(SerializationInfo info, StreamingContext context)\r
: base(info, context)\r
{\r
}\r
/// </summary>\r
/// <param name="errorCode">The SQLite error code to report</param>\r
/// <param name="extendedInformation">Extra text to go along with the error message text</param>\r
- public SQLiteException(int errorCode, string extendedInformation)\r
+ public SqliteException(int errorCode, string extendedInformation)\r
: base(GetStockErrorMessage(errorCode, extendedInformation))\r
{\r
_errorCode = (SQLiteErrorCode)errorCode;\r
/// Various public constructors that just pass along to the base Exception\r
/// </summary>\r
/// <param name="message">Passed verbatim to Exception</param>\r
- public SQLiteException(string message)\r
+ public SqliteException(string message)\r
: base(message)\r
{\r
}\r
/// <summary>\r
/// Various public constructors that just pass along to the base Exception\r
/// </summary>\r
- public SQLiteException()\r
+ public SqliteException()\r
{\r
}\r
\r
/// <param name="message">Passed to Exception</param>\r
/// <param name="innerException">Passed to Exception</param>\r
/// </summary>\r
- public SQLiteException(string message, Exception innerException)\r
+ public SqliteException(string message, Exception innerException)\r
: base(message, innerException)\r
{\r
}\r
/// <summary>\r
/// SQLite implementation of DbProviderFactory.\r
/// </summary>\r
- public sealed partial class SQLiteFactory : DbProviderFactory\r
+ public sealed partial class SqliteFactory : DbProviderFactory\r
{\r
/// <summary>\r
- /// Static instance member which returns an instanced SQLiteFactory class.\r
+ /// Static instance member which returns an instanced SqliteFactory class.\r
/// </summary>\r
- public static readonly SQLiteFactory Instance = new SQLiteFactory();\r
+ public static readonly SqliteFactory Instance = new SqliteFactory();\r
\r
/// <summary>\r
- /// Returns a new SQLiteCommand object.\r
+ /// Returns a new SqliteCommand object.\r
/// </summary>\r
- /// <returns>A SQLiteCommand object.</returns>\r
+ /// <returns>A SqliteCommand object.</returns>\r
public override DbCommand CreateCommand()\r
{\r
- return new SQLiteCommand();\r
+ return new SqliteCommand();\r
}\r
\r
/// <summary>\r
- /// Returns a new SQLiteCommandBuilder object.\r
+ /// Returns a new SqliteCommandBuilder object.\r
/// </summary>\r
- /// <returns>A SQLiteCommandBuilder object.</returns>\r
+ /// <returns>A SqliteCommandBuilder object.</returns>\r
public override DbCommandBuilder CreateCommandBuilder()\r
{\r
- return new SQLiteCommandBuilder();\r
+ return new SqliteCommandBuilder();\r
}\r
\r
/// <summary>\r
- /// Creates a new SQLiteConnection.\r
+ /// Creates a new SqliteConnection.\r
/// </summary>\r
- /// <returns>A SQLiteConnection object.</returns>\r
+ /// <returns>A SqliteConnection object.</returns>\r
public override DbConnection CreateConnection()\r
{\r
- return new SQLiteConnection();\r
+ return new SqliteConnection();\r
}\r
\r
/// <summary>\r
- /// Creates a new SQLiteConnectionStringBuilder.\r
+ /// Creates a new SqliteConnectionStringBuilder.\r
/// </summary>\r
- /// <returns>A SQLiteConnectionStringBuilder object.</returns>\r
+ /// <returns>A SqliteConnectionStringBuilder object.</returns>\r
public override DbConnectionStringBuilder CreateConnectionStringBuilder()\r
{\r
- return new SQLiteConnectionStringBuilder();\r
+ return new SqliteConnectionStringBuilder();\r
}\r
\r
/// <summary>\r
- /// Creates a new SQLiteDataAdapter.\r
+ /// Creates a new SqliteDataAdapter.\r
/// </summary>\r
- /// <returns>A SQLiteDataAdapter object.</returns>\r
+ /// <returns>A SqliteDataAdapter object.</returns>\r
public override DbDataAdapter CreateDataAdapter()\r
{\r
- return new SQLiteDataAdapter();\r
+ return new SqliteDataAdapter();\r
}\r
\r
/// <summary>\r
- /// Creates a new SQLiteParameter.\r
+ /// Creates a new SqliteParameter.\r
/// </summary>\r
- /// <returns>A SQLiteParameter object.</returns>\r
+ /// <returns>A SqliteParameter object.</returns>\r
public override DbParameter CreateParameter()\r
{\r
- return new SQLiteParameter();\r
+ return new SqliteParameter();\r
}\r
}\r
#endif\r
/// connection to the database.\r
/// </summary>\r
/// <remarks>\r
- /// Although there is one instance of a class derived from SQLiteFunction per database connection, the derived class has no access\r
+ /// Although there is one instance of a class derived from SqliteFunction per database connection, the derived class has no access\r
/// to the underlying connection. This is necessary to deter implementers from thinking it would be a good idea to make database\r
/// calls during processing.\r
/// \r
/// For aggregate functions, always create and store your per-statement data in the contextData object on the 1st step. This data will\r
/// be automatically freed for you (and Dispose() called if the item supports IDisposable) when the statement completes.\r
/// </remarks>\r
- public abstract class SQLiteFunction : IDisposable\r
+ public abstract class SqliteFunction : IDisposable\r
{\r
private class AggregateData\r
{\r
/// <summary>\r
/// This static list contains all the user-defined functions declared using the proper attributes.\r
/// </summary>\r
- private static List<SQLiteFunctionAttribute> _registeredFunctions = new List<SQLiteFunctionAttribute>();\r
+ private static List<SqliteFunctionAttribute> _registeredFunctions = new List<SqliteFunctionAttribute>();\r
\r
/// <summary>\r
/// Internal constructor, initializes the function's internal variables.\r
/// </summary>\r
- protected SQLiteFunction()\r
+ protected SqliteFunction()\r
{\r
_contextDataList = new Dictionary<long, AggregateData>();\r
}\r
\r
/// <summary>\r
- /// Returns a reference to the underlying connection's SQLiteConvert class, which can be used to convert\r
+ /// Returns a reference to the underlying connection's SqliteConvert class, which can be used to convert\r
/// strings and DateTime's into the current connection's encoding schema.\r
/// </summary>\r
- public SQLiteConvert SQLiteConvert\r
+ public SqliteConvert SqliteConvert\r
{\r
get\r
{\r
}\r
}\r
\r
- switch (SQLiteConvert.TypeToAffinity(t))\r
+ switch (SqliteConvert.TypeToAffinity(t))\r
{\r
case TypeAffinity.Null:\r
_base.ReturnNull(context);\r
/// than the second.</returns>\r
internal int CompareCallback(IntPtr ptr, int len1, IntPtr ptr1, int len2, IntPtr ptr2)\r
{\r
- return Compare(SQLiteConvert.UTF8ToString(ptr1, len1), SQLiteConvert.UTF8ToString(ptr2, len2));\r
+ return Compare(SqliteConvert.UTF8ToString(ptr1, len1), SqliteConvert.UTF8ToString(ptr2, len2));\r
}\r
\r
internal int CompareCallback16(IntPtr ptr, int len1, IntPtr ptr1, int len2, IntPtr ptr2)\r
\r
/// <summary>\r
/// Using reflection, enumerate all assemblies in the current appdomain looking for classes that\r
- /// have a SQLiteFunctionAttribute attribute, and registering them accordingly.\r
+ /// have a SqliteFunctionAttribute attribute, and registering them accordingly.\r
/// </summary>\r
#if !PLATFORM_COMPACTFRAMEWORK\r
[global::System.Security.Permissions.FileIOPermission(global::System.Security.Permissions.SecurityAction.Assert, AllFiles = global::System.Security.Permissions.FileIOPermissionAccess.PathDiscovery)]\r
#endif\r
- static SQLiteFunction()\r
+ static SqliteFunction()\r
{\r
try\r
{\r
#if !PLATFORM_COMPACTFRAMEWORK\r
- SQLiteFunctionAttribute at;\r
+ SqliteFunctionAttribute at;\r
System.Reflection.Assembly[] arAssemblies = System.AppDomain.CurrentDomain.GetAssemblies();\r
int w = arAssemblies.Length;\r
System.Reflection.AssemblyName sqlite = System.Reflection.Assembly.GetCallingAssembly().GetName();\r
{\r
if (arTypes[x] == null) continue;\r
\r
- object[] arAtt = arTypes[x].GetCustomAttributes(typeof(SQLiteFunctionAttribute), false);\r
+ object[] arAtt = arTypes[x].GetCustomAttributes(typeof(SqliteFunctionAttribute), false);\r
int u = arAtt.Length;\r
for (int y = 0; y < u; y++)\r
{\r
- at = arAtt[y] as SQLiteFunctionAttribute;\r
+ at = arAtt[y] as SqliteFunctionAttribute;\r
if (at != null)\r
{\r
at._instanceType = arTypes[x];\r
}\r
}\r
/// <summary>\r
- /// Manual method of registering a function. The type must still have the SQLiteFunctionAttributes in order to work\r
+ /// Manual method of registering a function. The type must still have the SqliteFunctionAttributes in order to work\r
/// properly, but this is a workaround for the Compact Framework where enumerating assemblies is not currently supported.\r
/// </summary>\r
/// <param name="typ">The type of the function to register</param>\r
public static void RegisterFunction(Type typ)\r
{\r
- object[] arAtt = typ.GetCustomAttributes(typeof(SQLiteFunctionAttribute), false);\r
+ object[] arAtt = typ.GetCustomAttributes(typeof(SqliteFunctionAttribute), false);\r
int u = arAtt.Length;\r
- SQLiteFunctionAttribute at;\r
+ SqliteFunctionAttribute at;\r
\r
for (int y = 0; y < u; y++)\r
{\r
- at = arAtt[y] as SQLiteFunctionAttribute;\r
+ at = arAtt[y] as SqliteFunctionAttribute;\r
if (at != null)\r
{\r
at._instanceType = typ;\r
/// </remarks>\r
/// <param name="sqlbase">The base object on which the functions are to bind</param>\r
/// <returns>Returns an array of functions which the connection object should retain until the connection is closed.</returns>\r
- internal static SQLiteFunction[] BindFunctions(SQLiteBase sqlbase)\r
+ internal static SqliteFunction[] BindFunctions(SQLiteBase sqlbase)\r
{\r
- SQLiteFunction f;\r
- List<SQLiteFunction> lFunctions = new List<SQLiteFunction>();\r
+ SqliteFunction f;\r
+ List<SqliteFunction> lFunctions = new List<SqliteFunction>();\r
\r
- foreach (SQLiteFunctionAttribute pr in _registeredFunctions)\r
+ foreach (SqliteFunctionAttribute pr in _registeredFunctions)\r
{\r
- f = (SQLiteFunction)Activator.CreateInstance(pr._instanceType);\r
+ f = (SqliteFunction)Activator.CreateInstance(pr._instanceType);\r
f._base = sqlbase;\r
f._InvokeFunc = (pr.FuncType == FunctionType.Scalar) ? new SQLiteCallback(f.ScalarCallback) : null;\r
f._StepFunc = (pr.FuncType == FunctionType.Aggregate) ? new SQLiteCallback(f.StepCallback) : null;\r
f._CompareFunc16 = (pr.FuncType == FunctionType.Collation) ? new SQLiteCollation(f.CompareCallback16) : null;\r
\r
if (pr.FuncType != FunctionType.Collation)\r
- sqlbase.CreateFunction(pr.Name, pr.Arguments, (f is SQLiteFunctionEx), f._InvokeFunc, f._StepFunc, f._FinalFunc);\r
+ sqlbase.CreateFunction(pr.Name, pr.Arguments, (f is SqliteFunctionEx), f._InvokeFunc, f._StepFunc, f._FinalFunc);\r
else\r
sqlbase.CreateCollation(pr.Name, f._CompareFunc, f._CompareFunc16);\r
\r
lFunctions.Add(f);\r
}\r
\r
- SQLiteFunction[] arFunctions = new SQLiteFunction[lFunctions.Count];\r
+ SqliteFunction[] arFunctions = new SqliteFunction[lFunctions.Count];\r
lFunctions.CopyTo(arFunctions, 0);\r
\r
return arFunctions;\r
}\r
\r
/// <summary>\r
- /// Extends SQLiteFunction and allows an inherited class to obtain the collating sequence associated with a function call.\r
+ /// Extends SqliteFunction and allows an inherited class to obtain the collating sequence associated with a function call.\r
/// </summary>\r
/// <remarks>\r
/// User-defined functions can call the GetCollationSequence() method in this class and use it to compare strings and char arrays.\r
/// </remarks>\r
- public class SQLiteFunctionEx : SQLiteFunction\r
+ public class SqliteFunctionEx : SqliteFunction\r
{\r
/// <summary>\r
/// Obtains the collating sequence in effect for the given function.\r
/// <summary>\r
/// Context of the function that requested the collating sequence\r
/// </summary>\r
- internal SQLiteFunction _func;\r
+ internal SqliteFunction _func;\r
\r
/// <summary>\r
/// Calls the base collating sequence to compare two strings\r
/// the loaded assemblies and initialize them in SQLite as connections are made.\r
/// </summary>\r
[AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = true)]\r
- public sealed class SQLiteFunctionAttribute : Attribute\r
+ public sealed class SqliteFunctionAttribute : Attribute\r
{\r
private string _name;\r
private int _arguments;\r
/// <summary>\r
/// Default constructor, initializes the internal variables for the function.\r
/// </summary>\r
- public SQLiteFunctionAttribute()\r
+ public SqliteFunctionAttribute()\r
{\r
Name = "";\r
Arguments = -1;\r
/// Providing key information for a given statement is non-trivial :(\r
/// </remarks>\r
/// </summary>\r
- internal sealed class SQLiteKeyReader : IDisposable\r
+ internal sealed class SqliteKeyReader : IDisposable\r
{\r
private KeyInfo[] _keyInfo;\r
- private SQLiteStatement _stmt;\r
+ private SqliteStatement _stmt;\r
private bool _isValid;\r
\r
/// <summary>\r
/// </summary>\r
private sealed class KeyQuery : IDisposable\r
{\r
- private SQLiteCommand _command;\r
- internal SQLiteDataReader _reader;\r
+ private SqliteCommand _command;\r
+ internal SqliteDataReader _reader;\r
\r
- internal KeyQuery(SQLiteConnection cnn, string database, string table, params string[] columns)\r
+ internal KeyQuery(SqliteConnection cnn, string database, string table, params string[] columns)\r
{\r
- using (SQLiteCommandBuilder builder = new SQLiteCommandBuilder())\r
+ using (SqliteCommandBuilder builder = new SqliteCommandBuilder())\r
{\r
_command = cnn.CreateCommand();\r
for (int n = 0; n < columns.Length; n++)\r
/// <param name="cnn"></param>\r
/// <param name="reader"></param>\r
/// <param name="stmt"></param>\r
- internal SQLiteKeyReader(SQLiteConnection cnn, SQLiteDataReader reader, SQLiteStatement stmt)\r
+ internal SqliteKeyReader(SqliteConnection cnn, SqliteDataReader reader, SqliteStatement stmt)\r
{\r
Dictionary<string, int> catalogs = new Dictionary<string, int>();\r
Dictionary<string, List<string>> tables = new Dictionary<string, List<string>>();\r
/// <summary>\r
/// MetaDataCollections specific to SQLite\r
/// </summary>\r
- public static class SQLiteMetaDataCollectionNames\r
+ public static class SqliteMetaDataCollectionNames\r
{\r
/// <summary>\r
/// Returns a list of databases attached to the connection\r
/// <summary>\r
/// SQLite implementation of DbParameter.\r
/// </summary>\r
- public sealed class SQLiteParameter : DbParameter, ICloneable\r
+ public sealed class SqliteParameter : DbParameter, ICloneable\r
{\r
/// <summary>\r
/// The data type of the parameter\r
/// <summary>\r
/// Default constructor\r
/// </summary>\r
- public SQLiteParameter() \r
+ public SqliteParameter() \r
: this(null, (DbType)(-1), 0, null, DataRowVersion.Current)\r
{\r
}\r
/// Constructs a named parameter given the specified parameter name\r
/// </summary>\r
/// <param name="parameterName">The parameter name</param>\r
- public SQLiteParameter(string parameterName)\r
+ public SqliteParameter(string parameterName)\r
: this(parameterName, (DbType)(-1), 0, null, DataRowVersion.Current)\r
{\r
}\r
/// </summary>\r
/// <param name="parameterName">The parameter name</param>\r
/// <param name="value">The initial value of the parameter</param>\r
- public SQLiteParameter(string parameterName, object value)\r
+ public SqliteParameter(string parameterName, object value)\r
: this(parameterName, (DbType)(-1), 0, null, DataRowVersion.Current)\r
{\r
Value = value;\r
/// </summary>\r
/// <param name="parameterName">The parameter name</param>\r
/// <param name="dbType">The datatype of the parameter</param>\r
- public SQLiteParameter(string parameterName, DbType dbType)\r
+ public SqliteParameter(string parameterName, DbType dbType)\r
: this(parameterName, dbType, 0, null, DataRowVersion.Current)\r
{\r
}\r
/// <param name="parameterName">The parameter name</param>\r
/// <param name="dbType">The data type</param>\r
/// <param name="sourceColumn">The source column</param>\r
- public SQLiteParameter(string parameterName, DbType dbType, string sourceColumn)\r
+ public SqliteParameter(string parameterName, DbType dbType, string sourceColumn)\r
: this(parameterName, dbType, 0, sourceColumn, DataRowVersion.Current)\r
{\r
}\r
/// <param name="dbType">The data type</param>\r
/// <param name="sourceColumn">The source column</param>\r
/// <param name="rowVersion">The row version information</param>\r
- public SQLiteParameter(string parameterName, DbType dbType, string sourceColumn, DataRowVersion rowVersion)\r
+ public SqliteParameter(string parameterName, DbType dbType, string sourceColumn, DataRowVersion rowVersion)\r
: this(parameterName, dbType, 0, sourceColumn, rowVersion)\r
{\r
}\r
/// Constructs an unnamed parameter of the specified data type\r
/// </summary>\r
/// <param name="dbType">The datatype of the parameter</param>\r
- public SQLiteParameter(DbType dbType)\r
+ public SqliteParameter(DbType dbType)\r
: this(null, dbType, 0, null, DataRowVersion.Current)\r
{\r
}\r
/// </summary>\r
/// <param name="dbType">The datatype of the parameter</param>\r
/// <param name="value">The initial value of the parameter</param>\r
- public SQLiteParameter(DbType dbType, object value)\r
+ public SqliteParameter(DbType dbType, object value)\r
: this(null, dbType, 0, null, DataRowVersion.Current)\r
{\r
Value = value;\r
/// </summary>\r
/// <param name="dbType">The datatype of the parameter</param>\r
/// <param name="sourceColumn">The source column</param>\r
- public SQLiteParameter(DbType dbType, string sourceColumn)\r
+ public SqliteParameter(DbType dbType, string sourceColumn)\r
: this(null, dbType, 0, sourceColumn, DataRowVersion.Current)\r
{\r
}\r
/// <param name="dbType">The data type</param>\r
/// <param name="sourceColumn">The source column</param>\r
/// <param name="rowVersion">The row version information</param>\r
- public SQLiteParameter(DbType dbType, string sourceColumn, DataRowVersion rowVersion)\r
+ public SqliteParameter(DbType dbType, string sourceColumn, DataRowVersion rowVersion)\r
: this(null, dbType, 0, sourceColumn, rowVersion)\r
{\r
}\r
/// <param name="parameterName">The parameter name</param>\r
/// <param name="parameterType">The data type</param>\r
/// <param name="parameterSize">The size of the parameter</param>\r
- public SQLiteParameter(string parameterName, DbType parameterType, int parameterSize)\r
+ public SqliteParameter(string parameterName, DbType parameterType, int parameterSize)\r
: this(parameterName, parameterType, parameterSize, null, DataRowVersion.Current)\r
{\r
}\r
/// <param name="parameterType">The data type</param>\r
/// <param name="parameterSize">The size of the parameter</param>\r
/// <param name="sourceColumn">The source column</param>\r
- public SQLiteParameter(string parameterName, DbType parameterType, int parameterSize, string sourceColumn)\r
+ public SqliteParameter(string parameterName, DbType parameterType, int parameterSize, string sourceColumn)\r
: this(parameterName, parameterType, parameterSize, sourceColumn, DataRowVersion.Current)\r
{\r
}\r
/// <param name="parameterSize">The size of the parameter</param>\r
/// <param name="sourceColumn">The source column</param>\r
/// <param name="rowVersion">The row version information</param>\r
- public SQLiteParameter(string parameterName, DbType parameterType, int parameterSize, string sourceColumn, DataRowVersion rowVersion) \r
+ public SqliteParameter(string parameterName, DbType parameterType, int parameterSize, string sourceColumn, DataRowVersion rowVersion) \r
{\r
_parameterName = parameterName;\r
_dbType = (int)parameterType;\r
_nullable = true;\r
}\r
\r
- private SQLiteParameter(SQLiteParameter source)\r
+ private SqliteParameter(SqliteParameter source)\r
: this(source.ParameterName, (DbType)source._dbType, 0, source.Direction, source.IsNullable, 0, 0, source.SourceColumn, source.SourceVersion, source.Value)\r
{\r
_nullMapping = source._nullMapping;\r
#if !PLATFORM_COMPACTFRAMEWORK\r
[EditorBrowsable(EditorBrowsableState.Advanced)]\r
#endif\r
- public SQLiteParameter(string parameterName, DbType parameterType, int parameterSize, ParameterDirection direction, bool isNullable, byte precision, byte scale, string sourceColumn, DataRowVersion rowVersion, object value)\r
+ public SqliteParameter(string parameterName, DbType parameterType, int parameterSize, ParameterDirection direction, bool isNullable, byte precision, byte scale, string sourceColumn, DataRowVersion rowVersion, object value)\r
: this(parameterName, parameterType, parameterSize, sourceColumn, rowVersion)\r
{\r
Direction = direction;\r
#if !PLATFORM_COMPACTFRAMEWORK\r
[EditorBrowsable(EditorBrowsableState.Advanced)]\r
#endif\r
- public SQLiteParameter(string parameterName, DbType parameterType, int parameterSize, ParameterDirection direction, byte precision, byte scale, string sourceColumn, DataRowVersion rowVersion, bool sourceColumnNullMapping, object value)\r
+ public SqliteParameter(string parameterName, DbType parameterType, int parameterSize, ParameterDirection direction, byte precision, byte scale, string sourceColumn, DataRowVersion rowVersion, bool sourceColumnNullMapping, object value)\r
: this(parameterName, parameterType, parameterSize, sourceColumn, rowVersion)\r
{\r
Direction = direction;\r
/// </summary>\r
/// <param name="parameterType">The data type</param>\r
/// <param name="parameterSize">The size of the parameter</param>\r
- public SQLiteParameter(DbType parameterType, int parameterSize)\r
+ public SqliteParameter(DbType parameterType, int parameterSize)\r
: this(null, parameterType, parameterSize, null, DataRowVersion.Current)\r
{\r
}\r
/// <param name="parameterType">The data type</param>\r
/// <param name="parameterSize">The size of the parameter</param>\r
/// <param name="sourceColumn">The source column</param>\r
- public SQLiteParameter(DbType parameterType, int parameterSize, string sourceColumn)\r
+ public SqliteParameter(DbType parameterType, int parameterSize, string sourceColumn)\r
: this(null, parameterType, parameterSize, sourceColumn, DataRowVersion.Current)\r
{\r
}\r
/// <param name="parameterSize">The size of the parameter</param>\r
/// <param name="sourceColumn">The source column</param>\r
/// <param name="rowVersion">The row version information</param>\r
- public SQLiteParameter(DbType parameterType, int parameterSize, string sourceColumn, DataRowVersion rowVersion)\r
+ public SqliteParameter(DbType parameterType, int parameterSize, string sourceColumn, DataRowVersion rowVersion)\r
: this(null, parameterType, parameterSize, sourceColumn, rowVersion)\r
{\r
}\r
{\r
if (_objValue != null && _objValue != DBNull.Value)\r
{\r
- return SQLiteConvert.TypeToDbType(_objValue.GetType());\r
+ return SqliteConvert.TypeToDbType(_objValue.GetType());\r
}\r
return DbType.String; // Unassigned default value is String\r
}\r
{\r
_objValue = value;\r
if (_dbType == -1 && _objValue != null && _objValue != DBNull.Value) // If the DbType has never been assigned, try to glean one from the value's datatype \r
- _dbType = (int)SQLiteConvert.TypeToDbType(_objValue.GetType());\r
+ _dbType = (int)SqliteConvert.TypeToDbType(_objValue.GetType());\r
}\r
}\r
\r
/// <summary>\r
/// Clones a parameter\r
/// </summary>\r
- /// <returns>A new, unassociated SQLiteParameter</returns>\r
+ /// <returns>A new, unassociated SqliteParameter</returns>\r
public object Clone()\r
{\r
- SQLiteParameter newparam = new SQLiteParameter(this);\r
+ SqliteParameter newparam = new SqliteParameter(this);\r
\r
return newparam;\r
}\r
#if !PLATFORM_COMPACTFRAMEWORK\r
[Editor("Microsoft.VSDesigner.Data.Design.DBParametersEditor, 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"), ListBindable(false)]\r
#endif\r
- public sealed class SQLiteParameterCollection : DbParameterCollection\r
+ public sealed class SqliteParameterCollection : DbParameterCollection\r
{\r
/// <summary>\r
/// The underlying command to which this collection belongs\r
/// </summary>\r
- private SQLiteCommand _command;\r
+ private SqliteCommand _command;\r
/// <summary>\r
/// The internal array of parameters in this collection\r
/// </summary>\r
- private List<SQLiteParameter> _parameterList;\r
+ private List<SqliteParameter> _parameterList;\r
/// <summary>\r
/// Determines whether or not all parameters have been bound to their statement(s)\r
/// </summary>\r
/// Initializes the collection\r
/// </summary>\r
/// <param name="cmd">The command to which the collection belongs</param>\r
- internal SQLiteParameterCollection(SQLiteCommand cmd)\r
+ internal SqliteParameterCollection(SqliteCommand cmd)\r
{\r
_command = cmd;\r
- _parameterList = new List<SQLiteParameter>();\r
+ _parameterList = new List<SqliteParameter>();\r
_unboundFlag = true;\r
}\r
\r
/// <param name="parameterType">The data type</param>\r
/// <param name="parameterSize">The size of the value</param>\r
/// <param name="sourceColumn">The source column</param>\r
- /// <returns>A SQLiteParameter object</returns>\r
- public SQLiteParameter Add(string parameterName, DbType parameterType, int parameterSize, string sourceColumn)\r
+ /// <returns>A SqliteParameter object</returns>\r
+ public SqliteParameter Add(string parameterName, DbType parameterType, int parameterSize, string sourceColumn)\r
{\r
- SQLiteParameter param = new SQLiteParameter(parameterName, parameterType, parameterSize, sourceColumn);\r
+ SqliteParameter param = new SqliteParameter(parameterName, parameterType, parameterSize, sourceColumn);\r
Add(param);\r
\r
return param;\r
/// <param name="parameterName">The parameter name</param>\r
/// <param name="parameterType">The data type</param>\r
/// <param name="parameterSize">The size of the value</param>\r
- /// <returns>A SQLiteParameter object</returns>\r
- public SQLiteParameter Add(string parameterName, DbType parameterType, int parameterSize)\r
+ /// <returns>A SqliteParameter object</returns>\r
+ public SqliteParameter Add(string parameterName, DbType parameterType, int parameterSize)\r
{\r
- SQLiteParameter param = new SQLiteParameter(parameterName, parameterType, parameterSize);\r
+ SqliteParameter param = new SqliteParameter(parameterName, parameterType, parameterSize);\r
Add(param);\r
\r
return param;\r
/// </summary>\r
/// <param name="parameterName">The parameter name</param>\r
/// <param name="parameterType">The data type</param>\r
- /// <returns>A SQLiteParameter object</returns>\r
- public SQLiteParameter Add(string parameterName, DbType parameterType)\r
+ /// <returns>A SqliteParameter object</returns>\r
+ public SqliteParameter Add(string parameterName, DbType parameterType)\r
{\r
- SQLiteParameter param = new SQLiteParameter(parameterName, parameterType);\r
+ SqliteParameter param = new SqliteParameter(parameterName, parameterType);\r
Add(param);\r
\r
return param;\r
/// </summary>\r
/// <param name="parameter">The parameter to add</param>\r
/// <returns>A zero-based index of where the parameter is located in the array</returns>\r
- public int Add(SQLiteParameter parameter)\r
+ public int Add(SqliteParameter parameter)\r
{\r
int n = -1;\r
\r
if (n == -1)\r
{\r
n = _parameterList.Count;\r
- _parameterList.Add((SQLiteParameter)parameter);\r
+ _parameterList.Add((SqliteParameter)parameter);\r
}\r
\r
SetParameter(n, parameter);\r
#endif\r
public override int Add(object value)\r
{\r
- return Add((SQLiteParameter)value);\r
+ return Add((SqliteParameter)value);\r
}\r
\r
/// <summary>\r
/// </summary>\r
/// <param name="parameterName">Name of the parameter, or null to indicate an unnamed parameter</param>\r
/// <param name="value">The initial value of the parameter</param>\r
- /// <returns>Returns the SQLiteParameter object created during the call.</returns>\r
- public SQLiteParameter AddWithValue(string parameterName, object value)\r
+ /// <returns>Returns the SqliteParameter object created during the call.</returns>\r
+ public SqliteParameter AddWithValue(string parameterName, object value)\r
{\r
- SQLiteParameter param = new SQLiteParameter(parameterName, value);\r
+ SqliteParameter param = new SqliteParameter(parameterName, value);\r
Add(param);\r
\r
return param;\r
/// Adds an array of parameters to the collection\r
/// </summary>\r
/// <param name="values">The array of parameters to add</param>\r
- public void AddRange(SQLiteParameter[] values)\r
+ public void AddRange(SqliteParameter[] values)\r
{\r
int x = values.Length;\r
for (int n = 0; n < x; n++)\r
{\r
int x = values.Length;\r
for (int n = 0; n < x; n++)\r
- Add((SQLiteParameter)(values.GetValue(n)));\r
+ Add((SqliteParameter)(values.GetValue(n)));\r
}\r
\r
/// <summary>\r
/// <summary>\r
/// Determines if the parameter exists in the collection\r
/// </summary>\r
- /// <param name="value">The SQLiteParameter to check</param>\r
+ /// <param name="value">The SqliteParameter to check</param>\r
/// <returns>True if the parameter is in the collection</returns>\r
public override bool Contains(object value)\r
{\r
- return _parameterList.Contains((SQLiteParameter)value);\r
+ return _parameterList.Contains((SqliteParameter)value);\r
}\r
\r
/// <summary>\r
/// </summary>\r
/// <param name="parameterName">Name of the parameter to get/set</param>\r
/// <returns>The specified named SQLite parameter</returns>\r
- public new SQLiteParameter this[string parameterName]\r
+ public new SqliteParameter this[string parameterName]\r
{\r
get\r
{\r
- return (SQLiteParameter)GetParameter(parameterName);\r
+ return (SqliteParameter)GetParameter(parameterName);\r
}\r
set\r
{\r
/// </summary>\r
/// <param name="index">The index of the parameter to get/set</param>\r
/// <returns>The specified SQLite parameter</returns>\r
- public new SQLiteParameter this[int index]\r
+ public new SqliteParameter this[int index]\r
{\r
get\r
{\r
- return (SQLiteParameter)GetParameter(index);\r
+ return (SqliteParameter)GetParameter(index);\r
}\r
set\r
{\r
/// <returns>-1 if not found, otherwise a zero-based index of the parameter</returns>\r
public override int IndexOf(object value)\r
{\r
- return _parameterList.IndexOf((SQLiteParameter)value);\r
+ return _parameterList.IndexOf((SqliteParameter)value);\r
}\r
\r
/// <summary>\r
public override void Insert(int index, object value)\r
{\r
_unboundFlag = true;\r
- _parameterList.Insert(index, (SQLiteParameter)value);\r
+ _parameterList.Insert(index, (SqliteParameter)value);\r
}\r
\r
/// <summary>\r
public override void Remove(object value)\r
{\r
_unboundFlag = true;\r
- _parameterList.Remove((SQLiteParameter)value);\r
+ _parameterList.Remove((SqliteParameter)value);\r
}\r
\r
/// <summary>\r
protected override void SetParameter(int index, DbParameter value)\r
{\r
_unboundFlag = true;\r
- _parameterList[index] = (SQLiteParameter)value;\r
+ _parameterList[index] = (SqliteParameter)value;\r
}\r
\r
/// <summary>\r
/// Since named parameters may span multiple statements, this function makes sure all statements are bound\r
/// to the same named parameter. Unnamed parameters are bound in sequence.\r
/// </summary>\r
- internal void MapParameters(SQLiteStatement activeStatement)\r
+ internal void MapParameters(SqliteStatement activeStatement)\r
{\r
if (_unboundFlag == false || _parameterList.Count == 0 || _command._statementList == null) return;\r
\r
string s;\r
int n;\r
int y = -1;\r
- SQLiteStatement stmt;\r
+ SqliteStatement stmt;\r
\r
- foreach(SQLiteParameter p in _parameterList)\r
+ foreach(SqliteParameter p in _parameterList)\r
{\r
y ++;\r
s = p.ParameterName;\r
/// <summary>\r
/// Represents a single SQL statement in SQLite.\r
/// </summary>\r
- internal sealed class SQLiteStatement : IDisposable\r
+ internal sealed class SqliteStatement : IDisposable\r
{\r
/// <summary>\r
/// The underlying SQLite object this statement is bound to\r
/// <summary>\r
/// The actual statement pointer\r
/// </summary>\r
- internal SQLiteStatementHandle _sqlite_stmt;\r
+ internal SqliteStatementHandle _sqlite_stmt;\r
/// <summary>\r
/// An index from which unnamed parameters begin\r
/// </summary>\r
/// <summary>\r
/// Parameters for this statement\r
/// </summary>\r
- internal SQLiteParameter[] _paramValues;\r
+ internal SqliteParameter[] _paramValues;\r
/// <summary>\r
/// Command this statement belongs to (if any)\r
/// </summary>\r
- internal SQLiteCommand _command;\r
+ internal SqliteCommand _command;\r
\r
private string[] _types;\r
\r
/// <param name="stmt">The statement</param>\r
/// <param name="strCommand">The command text for this statement</param>\r
/// <param name="previous">The previous command in a multi-statement command</param>\r
- internal SQLiteStatement(SQLiteBase sqlbase, SQLiteStatementHandle stmt, string strCommand, SQLiteStatement previous)\r
+ internal SqliteStatement(SQLiteBase sqlbase, SqliteStatementHandle stmt, string strCommand, SqliteStatement previous)\r
{\r
_sql = sqlbase;\r
_sqlite_stmt = stmt;\r
nCmdStart = previous._unnamedParameters;\r
\r
_paramNames = new string[n];\r
- _paramValues = new SQLiteParameter[n];\r
+ _paramValues = new SqliteParameter[n];\r
\r
for (x = 0; x < n; x++)\r
{\r
}\r
\r
/// <summary>\r
- /// Called by SQLiteParameterCollection, this function determines if the specified parameter name belongs to\r
+ /// Called by SqliteParameterCollection, this function determines if the specified parameter name belongs to\r
/// this statement, and if so, keeps a reference to the parameter so it can be bound later.\r
/// </summary>\r
/// <param name="s">The parameter name to map</param>\r
/// <param name="p">The parameter to assign it</param>\r
- internal bool MapParameter(string s, SQLiteParameter p)\r
+ internal bool MapParameter(string s, SqliteParameter p)\r
{\r
if (_paramNames == null) return false;\r
\r
/// </summary>\r
/// <param name="index">The index of the parameter to bind</param>\r
/// <param name="param">The parameter we're binding</param>\r
- private void BindParameter(int index, SQLiteParameter param)\r
+ private void BindParameter(int index, SqliteParameter param)\r
{\r
if (param == null)\r
- throw new SQLiteException((int)SQLiteErrorCode.Error, "Insufficient parameters supplied to the command");\r
+ throw new SqliteException((int)SQLiteErrorCode.Error, "Insufficient parameters supplied to the command");\r
\r
object obj = param.Value;\r
DbType objType = param.DbType;\r
}\r
\r
if (objType == DbType.Object)\r
- objType = SQLiteConvert.TypeToDbType(obj.GetType());\r
+ objType = SqliteConvert.TypeToDbType(obj.GetType());\r
\r
switch (objType)\r
{\r
/// <summary>\r
/// SQLite implementation of DbTransaction.\r
/// </summary>\r
- public sealed class SQLiteTransaction : DbTransaction\r
+ public sealed class SqliteTransaction : DbTransaction\r
{\r
/// <summary>\r
/// The connection to which this transaction is bound\r
/// </summary>\r
- internal SQLiteConnection _cnn;\r
+ internal SqliteConnection _cnn;\r
internal long _version; // Matches the version of the connection\r
private IsolationLevel _level;\r
\r
/// </summary>\r
/// <param name="connection">The connection to open a transaction on</param>\r
/// <param name="deferredLock">TRUE to defer the writelock, or FALSE to lock immediately</param>\r
- internal SQLiteTransaction(SQLiteConnection connection, bool deferredLock)\r
+ internal SqliteTransaction(SqliteConnection connection, bool deferredLock)\r
{\r
_cnn = connection;\r
_version = _cnn._version;\r
{\r
try\r
{\r
- using (SQLiteCommand cmd = _cnn.CreateCommand())\r
+ using (SqliteCommand cmd = _cnn.CreateCommand())\r
{\r
if (!deferredLock)\r
cmd.CommandText = "BEGIN IMMEDIATE";\r
cmd.ExecuteNonQuery();\r
}\r
}\r
- catch (SQLiteException)\r
+ catch (SqliteException)\r
{\r
_cnn._transactionLevel--;\r
_cnn = null;\r
\r
if (_cnn._transactionLevel - 1 == 0)\r
{\r
- using (SQLiteCommand cmd = _cnn.CreateCommand())\r
+ using (SqliteCommand cmd = _cnn.CreateCommand())\r
{\r
cmd.CommandText = "COMMIT";\r
cmd.ExecuteNonQuery();\r
/// <summary>\r
/// Returns the underlying connection to which this transaction applies.\r
/// </summary>\r
- public new SQLiteConnection Connection\r
+ public new SqliteConnection Connection\r
{\r
get { return _cnn; }\r
}\r
_cnn = null;\r
}\r
\r
- internal static void IssueRollback(SQLiteConnection cnn)\r
+ internal static void IssueRollback(SqliteConnection cnn)\r
{\r
- using (SQLiteCommand cmd = cnn.CreateCommand())\r
+ using (SqliteCommand cmd = cnn.CreateCommand())\r
{\r
cmd.CommandText = "ROLLBACK";\r
cmd.ExecuteNonQuery();\r
\r
if (_cnn._transactionLevel == 0)\r
{\r
- if (throwError == true) throw new SQLiteException((int)SQLiteErrorCode.Misuse, "No transaction is active on this connection");\r
+ if (throwError == true) throw new SqliteException((int)SQLiteErrorCode.Misuse, "No transaction is active on this connection");\r
else return false;\r
}\r
if (_cnn._version != _version)\r
{\r
- if (throwError == true) throw new SQLiteException((int)SQLiteErrorCode.Misuse, "The connection was closed and re-opened, changes were rolled back");\r
+ if (throwError == true) throw new SqliteException((int)SQLiteErrorCode.Misuse, "The connection was closed and re-opened, changes were rolled back");\r
else return false;\r
}\r
if (_cnn.State != ConnectionState.Open)\r
{\r
- if (throwError == true) throw new SQLiteException((int)SQLiteErrorCode.Misuse, "Connection was closed");\r
+ if (throwError == true) throw new SqliteException((int)SQLiteErrorCode.Misuse, "Connection was closed");\r
else return false;\r
}\r
\r
internal static global::System.Resources.ResourceManager ResourceManager {\r
get {\r
if (object.ReferenceEquals(resourceMan, null)) {\r
- global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Mono.Data.Sqlite.SR", typeof(SR).Assembly);\r
+ global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("SR", typeof(SR).Assembly);\r
resourceMan = temp;\r
}\r
return resourceMan;\r
#endif\r
\r
// Handles the unmanaged database pointer, and provides finalization support for it.\r
- internal class SQLiteConnectionHandle : CriticalHandle\r
+ internal class SqliteConnectionHandle : CriticalHandle\r
{\r
- public static implicit operator IntPtr(SQLiteConnectionHandle db)\r
+ public static implicit operator IntPtr(SqliteConnectionHandle db)\r
{\r
return db.handle;\r
}\r
\r
- public static implicit operator SQLiteConnectionHandle(IntPtr db)\r
+ public static implicit operator SqliteConnectionHandle(IntPtr db)\r
{\r
- return new SQLiteConnectionHandle(db);\r
+ return new SqliteConnectionHandle(db);\r
}\r
\r
- private SQLiteConnectionHandle(IntPtr db)\r
+ private SqliteConnectionHandle(IntPtr db)\r
: this()\r
{\r
SetHandle(db);\r
}\r
\r
- internal SQLiteConnectionHandle()\r
+ internal SqliteConnectionHandle()\r
: base(IntPtr.Zero)\r
{\r
}\r
{\r
SQLiteBase.CloseConnection(this);\r
}\r
- catch (SQLiteException)\r
+ catch (SqliteException)\r
{\r
}\r
return true;\r
}\r
\r
// Provides finalization support for unmanaged SQLite statements.\r
- internal class SQLiteStatementHandle : CriticalHandle\r
+ internal class SqliteStatementHandle : CriticalHandle\r
{\r
- public static implicit operator IntPtr(SQLiteStatementHandle stmt)\r
+ public static implicit operator IntPtr(SqliteStatementHandle stmt)\r
{\r
return stmt.handle;\r
}\r
\r
- public static implicit operator SQLiteStatementHandle(IntPtr stmt)\r
+ public static implicit operator SqliteStatementHandle(IntPtr stmt)\r
{\r
- return new SQLiteStatementHandle(stmt);\r
+ return new SqliteStatementHandle(stmt);\r
}\r
\r
- private SQLiteStatementHandle(IntPtr stmt)\r
+ private SqliteStatementHandle(IntPtr stmt)\r
: this()\r
{\r
SetHandle(stmt);\r
}\r
\r
- internal SQLiteStatementHandle()\r
+ internal SqliteStatementHandle()\r
: base(IntPtr.Zero)\r
{\r
}\r
{\r
SQLiteBase.FinalizeStatement(this);\r
}\r
- catch (SQLiteException)\r
+ catch (SqliteException)\r
{\r
}\r
return true;\r
}
catch(Exception e)
{
+ Console.WriteLine (e);
throw new AssertionException("Create table failed",e);
}
finally