/////////////////////////////////////////////////////////////////////// /// <summary> /// Arranges for the specified error message to be placed into the /// zErrMsg field of a sqlite3_vtab derived structure, freeing the /// existing error message, if any. /// </summary> /// <param name="module"> /// The <see cref="SQLiteModule" /> object instance to be used. /// </param> /// <param name="table"> /// The <see cref="SQLiteVirtualTable" /> object instance used to /// lookup the native pointer to the sqlite3_vtab derived structure. /// </param> /// <param name="logErrors"> /// Non-zero if this error message should also be logged using the /// <see cref="SQLiteLog" /> class. /// </param> /// <param name="logExceptions"> /// Non-zero if caught exceptions should be logged using the /// <see cref="SQLiteLog" /> class. /// </param> /// <param name="error"> /// The error message. /// </param> /// <returns> /// Non-zero upon success. /// </returns> private static bool SetTableError( SQLiteModule module, SQLiteVirtualTable table, bool logErrors, bool logExceptions, string error ) { if (table == null) return false; IntPtr pVtab = table.NativeHandle; if (pVtab == IntPtr.Zero) return false; return SetTableError( module, pVtab, logErrors, logExceptions, error); }
/////////////////////////////////////////////////////////////////////// /// <summary> /// See the <see cref="ISQLiteManagedModule.Rollback" /> method. /// </summary> /// <param name="table"> /// See the <see cref="ISQLiteManagedModule.Rollback" /> method. /// </param> /// <returns> /// See the <see cref="ISQLiteManagedModule.Rollback" /> method. /// </returns> public override SQLiteErrorCode Rollback( SQLiteVirtualTable table ) { CheckDisposed(); return GetMethodResultCode("Rollback"); }
/////////////////////////////////////////////////////////////////////// /// <summary> /// See the <see cref="ISQLiteManagedModule.Rename" /> method. /// </summary> /// <param name="table"> /// See the <see cref="ISQLiteManagedModule.Rename" /> method. /// </param> /// <param name="newName"> /// See the <see cref="ISQLiteManagedModule.Rename" /> method. /// </param> /// <returns> /// See the <see cref="ISQLiteManagedModule.Rename" /> method. /// </returns> public override SQLiteErrorCode Rename( SQLiteVirtualTable table, string newName ) { CheckDisposed(); return GetMethodResultCode("Rename"); }
/////////////////////////////////////////////////////////////////////// /// <summary> /// See the <see cref="ISQLiteManagedModule.Open" /> method. /// </summary> /// <param name="table"> /// See the <see cref="ISQLiteManagedModule.Open" /> method. /// </param> /// <param name="cursor"> /// See the <see cref="ISQLiteManagedModule.Open" /> method. /// </param> /// <returns> /// See the <see cref="ISQLiteManagedModule.Open" /> method. /// </returns> public override SQLiteErrorCode Open( SQLiteVirtualTable table, ref SQLiteVirtualTableCursor cursor ) { CheckDisposed(); return GetMethodResultCode("Open"); }
/////////////////////////////////////////////////////////////////////// /// <summary> /// See the <see cref="ISQLiteManagedModule.Begin" /> method. /// </summary> /// <param name="table"> /// See the <see cref="ISQLiteManagedModule.Begin" /> method. /// </param> /// <returns> /// See the <see cref="ISQLiteManagedModule.Begin" /> method. /// </returns> public override SQLiteErrorCode Begin( SQLiteVirtualTable table ) { CheckDisposed(); return GetMethodResultCode("Begin"); }
/////////////////////////////////////////////////////////////////////// /// <summary> /// See the <see cref="ISQLiteManagedModule.Connect" /> method. /// </summary> /// <param name="connection"> /// See the <see cref="ISQLiteManagedModule.Connect" /> method. /// </param> /// <param name="pClientData"> /// See the <see cref="ISQLiteManagedModule.Connect" /> method. /// </param> /// <param name="arguments"> /// See the <see cref="ISQLiteManagedModule.Connect" /> method. /// </param> /// <param name="table"> /// See the <see cref="ISQLiteManagedModule.Connect" /> method. /// </param> /// <param name="error"> /// See the <see cref="ISQLiteManagedModule.Connect" /> method. /// </param> /// <returns> /// See the <see cref="ISQLiteManagedModule.Connect" /> method. /// </returns> public override SQLiteErrorCode Connect( SQLiteConnection connection, IntPtr pClientData, string[] arguments, ref SQLiteVirtualTable table, ref string error ) { CheckDisposed(); return GetMethodResultCode("Connect"); }
/////////////////////////////////////////////////////////////////////// /// <summary> /// See the <see cref="ISQLiteManagedModule.Disconnect" /> method. /// </summary> /// <param name="table"> /// See the <see cref="ISQLiteManagedModule.Disconnect" /> method. /// </param> /// <returns> /// See the <see cref="ISQLiteManagedModule.Disconnect" /> method. /// </returns> public override SQLiteErrorCode Disconnect( SQLiteVirtualTable table ) { CheckDisposed(); return GetMethodResultCode("Disconnect"); }
/////////////////////////////////////////////////////////////////////// /// <summary> /// This method is called in response to the /// <see cref="ISQLiteNativeModule.xDestroy" /> method. /// </summary> /// <param name="table"> /// The <see cref="SQLiteVirtualTable" /> object instance associated /// with this virtual table. /// </param> /// <returns> /// A standard SQLite return code. /// </returns> public abstract SQLiteErrorCode Destroy( SQLiteVirtualTable table );
/////////////////////////////////////////////////////////////////////// /// <summary> /// This method is called in response to the /// <see cref="ISQLiteNativeModule.xOpen" /> method. /// </summary> /// <param name="table"> /// The <see cref="SQLiteVirtualTable" /> object instance associated /// with this virtual table. /// </param> /// <param name="cursor"> /// Upon success, this parameter must be modified to contain the /// <see cref="SQLiteVirtualTableCursor" /> object instance associated /// with the newly opened virtual table cursor. /// </param> /// <returns> /// A standard SQLite return code. /// </returns> public abstract SQLiteErrorCode Open( SQLiteVirtualTable table, ref SQLiteVirtualTableCursor cursor );
/////////////////////////////////////////////////////////////////////// /// <summary> /// This method is called in response to the /// <see cref="ISQLiteNativeModule.xBestIndex" /> method. /// </summary> /// <param name="table"> /// The <see cref="SQLiteVirtualTable" /> object instance associated /// with this virtual table. /// </param> /// <param name="index"> /// The <see cref="SQLiteIndex" /> object instance containing all the /// data for the inputs and outputs relating to index selection. /// </param> /// <returns> /// A standard SQLite return code. /// </returns> public abstract SQLiteErrorCode BestIndex( SQLiteVirtualTable table, SQLiteIndex index );
/////////////////////////////////////////////////////////////////////// /// <summary> /// This method is called in response to the /// <see cref="ISQLiteNativeModule.xDisconnect" /> method. /// </summary> /// <param name="table"> /// The <see cref="SQLiteVirtualTable" /> object instance associated /// with this virtual table. /// </param> /// <returns> /// A standard SQLite return code. /// </returns> public abstract SQLiteErrorCode Disconnect( SQLiteVirtualTable table );
/////////////////////////////////////////////////////////////////////// /// <summary> /// This method is called in response to the /// <see cref="ISQLiteNativeModule.xConnect" /> method. /// </summary> /// <param name="connection"> /// The <see cref="SQLiteConnection" /> object instance associated with /// the virtual table. /// </param> /// <param name="pClientData"> /// The native user-data pointer associated with this module, as it was /// provided to the SQLite core library when the native module instance /// was created. /// </param> /// <param name="arguments"> /// The module name, database name, virtual table name, and all other /// arguments passed to the CREATE VIRTUAL TABLE statement. /// </param> /// <param name="table"> /// Upon success, this parameter must be modified to contain the /// <see cref="SQLiteVirtualTable" /> object instance associated with /// the virtual table. /// </param> /// <param name="error"> /// Upon failure, this parameter must be modified to contain an error /// message. /// </param> /// <returns> /// A standard SQLite return code. /// </returns> public abstract SQLiteErrorCode Connect( SQLiteConnection connection, IntPtr pClientData, string[] arguments, ref SQLiteVirtualTable table, ref string error );
/////////////////////////////////////////////////////////////////////// /// <summary> /// Arranges for the specified error message to be placed into the /// zErrMsg field of a sqlite3_vtab derived structure, freeing the /// existing error message, if any. /// </summary> /// <param name="table"> /// The <see cref="SQLiteVirtualTable" /> object instance used to /// lookup the native pointer to the sqlite3_vtab derived structure. /// </param> /// <param name="error"> /// The error message. /// </param> /// <returns> /// Non-zero upon success. /// </returns> protected virtual bool SetTableError( SQLiteVirtualTable table, string error ) { return SetTableError( this, table, LogErrorsNoThrow, LogExceptionsNoThrow, error); }
/////////////////////////////////////////////////////////////////////// /// <summary> /// Allocates and returns a native pointer to a sqlite3_vtab derived /// structure and creates an association between it and the specified /// <see cref="SQLiteVirtualTable" /> object instance. /// </summary> /// <param name="table"> /// The <see cref="SQLiteVirtualTable" /> object instance to be used /// when creating the association. /// </param> /// <returns> /// The native pointer to a sqlite3_vtab derived structure or /// <see cref="IntPtr.Zero" /> if the method fails for any reason. /// </returns> protected virtual IntPtr TableToIntPtr( SQLiteVirtualTable table ) { if ((table == null) || (tables == null)) return IntPtr.Zero; IntPtr pVtab = IntPtr.Zero; bool success = false; try { pVtab = AllocateTable(); if (pVtab != IntPtr.Zero) { ZeroTable(pVtab); table.NativeHandle = pVtab; tables.Add(pVtab, table); success = true; } } finally { if (!success && (pVtab != IntPtr.Zero)) { FreeTable(pVtab); pVtab = IntPtr.Zero; } } return pVtab; }
/////////////////////////////////////////////////////////////////////// /// <summary> /// This method is called in response to the /// <see cref="ISQLiteNativeModule.xRelease" /> method. /// </summary> /// <param name="table"> /// The <see cref="SQLiteVirtualTable" /> object instance associated /// with this virtual table. /// </param> /// <param name="savepoint"> /// This is an integer used to indicate that any saved states with an /// identifier greater than or equal to this should be deleted by the /// virtual table. /// </param> /// <returns> /// A standard SQLite return code. /// </returns> public abstract SQLiteErrorCode Release( SQLiteVirtualTable table, int savepoint );
/////////////////////////////////////////////////////////////////////// /// <summary> /// This method is called in response to the /// <see cref="ISQLiteNativeModule.xUpdate" /> method. /// </summary> /// <param name="table"> /// The <see cref="SQLiteVirtualTable" /> object instance associated /// with this virtual table. /// </param> /// <param name="values"> /// The array of <see cref="SQLiteValue" /> object instances containing /// the new or modified column values, if any. /// </param> /// <param name="rowId"> /// Upon success, this parameter must be modified to contain the unique /// integer row identifier for the row that was inserted, if any. /// </param> /// <returns> /// A standard SQLite return code. /// </returns> public abstract SQLiteErrorCode Update( SQLiteVirtualTable table, SQLiteValue[] values, ref long rowId );
/////////////////////////////////////////////////////////////////////// /// <summary> /// This method is called in response to the /// <see cref="ISQLiteNativeModule.xRollbackTo" /> method. /// </summary> /// <param name="table"> /// The <see cref="SQLiteVirtualTable" /> object instance associated /// with this virtual table. /// </param> /// <param name="savepoint"> /// This is an integer identifier used to specify a specific saved /// state for the virtual table for it to restore itself back to, which /// should also have the effect of deleting all saved states with an /// integer identifier greater than this one. /// </param> /// <returns> /// A standard SQLite return code. /// </returns> public abstract SQLiteErrorCode RollbackTo( SQLiteVirtualTable table, int savepoint );
/////////////////////////////////////////////////////////////////////// /// <summary> /// This method is called in response to the /// <see cref="ISQLiteNativeModule.xBegin" /> method. /// </summary> /// <param name="table"> /// The <see cref="SQLiteVirtualTable" /> object instance associated /// with this virtual table. /// </param> /// <returns> /// A standard SQLite return code. /// </returns> public abstract SQLiteErrorCode Begin( SQLiteVirtualTable table );
/////////////////////////////////////////////////////////////////////// /// <summary> /// See the <see cref="ISQLiteManagedModule.BestIndex" /> method. /// </summary> /// <param name="table"> /// See the <see cref="ISQLiteManagedModule.BestIndex" /> method. /// </param> /// <param name="index"> /// See the <see cref="ISQLiteManagedModule.BestIndex" /> method. /// </param> /// <returns> /// See the <see cref="ISQLiteManagedModule.BestIndex" /> method. /// </returns> public override SQLiteErrorCode BestIndex( SQLiteVirtualTable table, SQLiteIndex index ) { CheckDisposed(); return GetMethodResultCode("BestIndex"); }
/////////////////////////////////////////////////////////////////////// /// <summary> /// This method is called in response to the /// <see cref="ISQLiteNativeModule.xSync" /> method. /// </summary> /// <param name="table"> /// The <see cref="SQLiteVirtualTable" /> object instance associated /// with this virtual table. /// </param> /// <returns> /// A standard SQLite return code. /// </returns> public abstract SQLiteErrorCode Sync( SQLiteVirtualTable table );
/////////////////////////////////////////////////////////////////////// /// <summary> /// See the <see cref="ISQLiteManagedModule.Destroy" /> method. /// </summary> /// <param name="table"> /// See the <see cref="ISQLiteManagedModule.Destroy" /> method. /// </param> /// <returns> /// See the <see cref="ISQLiteManagedModule.Destroy" /> method. /// </returns> public override SQLiteErrorCode Destroy( SQLiteVirtualTable table ) { CheckDisposed(); return GetMethodResultCode("Destroy"); }
/////////////////////////////////////////////////////////////////////// /// <summary> /// This method is called in response to the /// <see cref="ISQLiteNativeModule.xCommit" /> method. /// </summary> /// <param name="table"> /// The <see cref="SQLiteVirtualTable" /> object instance associated /// with this virtual table. /// </param> /// <returns> /// A standard SQLite return code. /// </returns> public abstract SQLiteErrorCode Commit( SQLiteVirtualTable table );
/////////////////////////////////////////////////////////////////////// /// <summary> /// See the <see cref="ISQLiteManagedModule.Update" /> method. /// </summary> /// <param name="table"> /// See the <see cref="ISQLiteManagedModule.Update" /> method. /// </param> /// <param name="values"> /// See the <see cref="ISQLiteManagedModule.Update" /> method. /// </param> /// <param name="rowId"> /// See the <see cref="ISQLiteManagedModule.Update" /> method. /// </param> /// <returns> /// See the <see cref="ISQLiteManagedModule.Update" /> method. /// </returns> public override SQLiteErrorCode Update( SQLiteVirtualTable table, SQLiteValue[] values, ref long rowId ) { CheckDisposed(); return GetMethodResultCode("Update"); }
/////////////////////////////////////////////////////////////////////// /// <summary> /// This method is called in response to the /// <see cref="ISQLiteNativeModule.xRollback" /> method. /// </summary> /// <param name="table"> /// The <see cref="SQLiteVirtualTable" /> object instance associated /// with this virtual table. /// </param> /// <returns> /// A standard SQLite return code. /// </returns> public abstract SQLiteErrorCode Rollback( SQLiteVirtualTable table );
/////////////////////////////////////////////////////////////////////// /// <summary> /// See the <see cref="ISQLiteManagedModule.Commit" /> method. /// </summary> /// <param name="table"> /// See the <see cref="ISQLiteManagedModule.Commit" /> method. /// </param> /// <returns> /// See the <see cref="ISQLiteManagedModule.Commit" /> method. /// </returns> public override SQLiteErrorCode Commit( SQLiteVirtualTable table ) { CheckDisposed(); return GetMethodResultCode("Commit"); }
/////////////////////////////////////////////////////////////////////// /// <summary> /// This method is called in response to the /// <see cref="ISQLiteNativeModule.xFindFunction" /> method. /// </summary> /// <param name="table"> /// The <see cref="SQLiteVirtualTable" /> object instance associated /// with this virtual table. /// </param> /// <param name="argumentCount"> /// The number of arguments to the function being sought. /// </param> /// <param name="name"> /// The name of the function being sought. /// </param> /// <param name="function"> /// Upon success, this parameter must be modified to contain the /// <see cref="SQLiteFunction" /> object instance responsible for /// implementing the specified function. /// </param> /// <param name="pClientData"> /// Upon success, this parameter must be modified to contain the /// native user-data pointer associated with /// <paramref name="function" />. /// </param> /// <returns> /// Non-zero if the specified function was found; zero otherwise. /// </returns> public abstract bool FindFunction( SQLiteVirtualTable table, int argumentCount, string name, ref SQLiteFunction function, ref IntPtr pClientData );
/////////////////////////////////////////////////////////////////////// /// <summary> /// See the <see cref="ISQLiteManagedModule.FindFunction" /> method. /// </summary> /// <param name="table"> /// See the <see cref="ISQLiteManagedModule.FindFunction" /> method. /// </param> /// <param name="argumentCount"> /// See the <see cref="ISQLiteManagedModule.FindFunction" /> method. /// </param> /// <param name="name"> /// See the <see cref="ISQLiteManagedModule.FindFunction" /> method. /// </param> /// <param name="function"> /// See the <see cref="ISQLiteManagedModule.FindFunction" /> method. /// </param> /// <param name="pClientData"> /// See the <see cref="ISQLiteManagedModule.FindFunction" /> method. /// </param> /// <returns> /// See the <see cref="ISQLiteManagedModule.FindFunction" /> method. /// </returns> public override bool FindFunction( SQLiteVirtualTable table, int argumentCount, string name, ref SQLiteFunction function, ref IntPtr pClientData ) { CheckDisposed(); return ResultCodeToFindFunctionResult(GetMethodResultCode( "FindFunction")); }
/////////////////////////////////////////////////////////////////////// /// <summary> /// This method is called in response to the /// <see cref="ISQLiteNativeModule.xRename" /> method. /// </summary> /// <param name="table"> /// The <see cref="SQLiteVirtualTable" /> object instance associated /// with this virtual table. /// </param> /// <param name="newName"> /// The new name for the virtual table. /// </param> /// <returns> /// A standard SQLite return code. /// </returns> public abstract SQLiteErrorCode Rename( SQLiteVirtualTable table, string newName );
/////////////////////////////////////////////////////////////////////// /// <summary> /// See the <see cref="ISQLiteManagedModule.RollbackTo" /> method. /// </summary> /// <param name="table"> /// See the <see cref="ISQLiteManagedModule.RollbackTo" /> method. /// </param> /// <param name="savepoint"> /// See the <see cref="ISQLiteManagedModule.RollbackTo" /> method. /// </param> /// <returns> /// See the <see cref="ISQLiteManagedModule.RollbackTo" /> method. /// </returns> public override SQLiteErrorCode RollbackTo( SQLiteVirtualTable table, int savepoint ) { CheckDisposed(); return GetMethodResultCode("RollbackTo"); }
/////////////////////////////////////////////////////////////////////// #region Public Constructors /// <summary> /// Constructs an instance of this class. /// </summary> /// <param name="table"> /// The <see cref="SQLiteVirtualTable" /> object instance associated /// with this object instance. /// </param> public SQLiteVirtualTableCursor( SQLiteVirtualTable table ) : this() { this.table = table; }