예제 #1
0
 private void Dispose(bool disposing)
 {
     if (!this.disposed)
     {
         if (disposing)
         {
             if (this._sqlite_blob != null)
             {
                 this._sqlite_blob.Dispose();
                 this._sqlite_blob = null;
             }
             this._sql = null;
         }
         this.disposed = true;
     }
 }
예제 #2
0
        public static SQLiteBlob Create(SQLiteDataReader dataReader, int i, bool readOnly)
        {
            SQLiteConnection connection = SQLiteDataReader.GetConnection(dataReader);

            if (connection == null)
            {
                throw new InvalidOperationException("Connection not available");
            }
            SQLite3 sQLite3 = connection._sql as SQLite3;

            if (sQLite3 == null)
            {
                throw new InvalidOperationException("Connection has no wrapper");
            }
            SQLiteConnectionHandle sQLiteConnectionHandle = sQLite3._sql;

            if (sQLiteConnectionHandle == null)
            {
                throw new InvalidOperationException("Connection has an invalid handle.");
            }
            long?rowId = dataReader.GetRowId(i);

            if (!rowId.HasValue)
            {
                throw new InvalidOperationException("No RowId is available");
            }
            SQLiteBlobHandle sQLiteBlobHandle = null;

            try
            {
            }
            finally
            {
                IntPtr          zero            = IntPtr.Zero;
                SQLiteErrorCode sQLiteErrorCode = UnsafeNativeMethods.sqlite3_blob_open(sQLiteConnectionHandle, SQLiteConvert.ToUTF8(dataReader.GetDatabaseName(i)), SQLiteConvert.ToUTF8(dataReader.GetTableName(i)), SQLiteConvert.ToUTF8(dataReader.GetName(i)), rowId.Value, (readOnly ? 0 : 1), ref zero);
                if (sQLiteErrorCode != SQLiteErrorCode.Ok)
                {
                    throw new SQLiteException(sQLiteErrorCode, null);
                }
                sQLiteBlobHandle = new SQLiteBlobHandle(sQLiteConnectionHandle, zero);
            }
            object[] objArray = new object[] { typeof(SQLiteBlob), dataReader, i, readOnly };
            SQLiteConnection.OnChanged(null, new ConnectionEventArgs(SQLiteConnectionEventType.NewCriticalHandle, null, null, null, dataReader, sQLiteBlobHandle, null, objArray));
            return(new SQLiteBlob(sQLite3, sQLiteBlobHandle));
        }
예제 #3
0
 private SQLiteBlob(SQLiteBase sqlbase, SQLiteBlobHandle blob)
 {
     this._sql         = sqlbase;
     this._sqlite_blob = blob;
 }