예제 #1
0
        internal SQLiteStatement(SQLiteBase sqlbase, SQLiteConnectionFlags flags, SQLiteStatementHandle stmt, string strCommand, SQLiteStatement previous)
        {
            this._sql          = sqlbase;
            this._sqlite_stmt  = stmt;
            this._sqlStatement = strCommand;
            this._flags        = flags;
            int num  = 0;
            int num1 = this._sql.Bind_ParamCount(this, this._flags);

            if (num1 > 0)
            {
                if (previous != null)
                {
                    num = previous._unnamedParameters;
                }
                this._paramNames  = new string[num1];
                this._paramValues = new SQLiteParameter[num1];
                for (int i = 0; i < num1; i++)
                {
                    string str = this._sql.Bind_ParamName(this, this._flags, i + 1);
                    if (string.IsNullOrEmpty(str))
                    {
                        CultureInfo invariantCulture = CultureInfo.InvariantCulture;
                        object[]    objArray         = new object[] { num };
                        str = HelperMethods.StringFormat(invariantCulture, ";{0}", objArray);
                        num++;
                        this._unnamedParameters++;
                    }
                    this._paramNames[i]  = str;
                    this._paramValues[i] = null;
                }
            }
        }
예제 #2
0
        public void VerifyOnly()
        {
            this.CheckDisposed();
            SQLiteConnection sQLiteConnection = this._cnn;
            SQLiteBase       sQLiteBase       = sQLiteConnection._sql;

            if (sQLiteConnection == null || sQLiteBase == null)
            {
                throw new SQLiteException("invalid or unusable connection");
            }
            List <SQLiteStatement> sQLiteStatements = null;
            SQLiteStatement        sQLiteStatement  = null;

            try
            {
                string          str = this._commandText;
                uint            num = (uint)(this._commandTimeout * 1000);
                SQLiteStatement sQLiteStatement1 = null;
                while (str != null && str.Length > 0)
                {
                    sQLiteStatement  = sQLiteBase.Prepare(sQLiteConnection, str, sQLiteStatement1, num, ref str);
                    sQLiteStatement1 = sQLiteStatement;
                    if (sQLiteStatement != null)
                    {
                        if (sQLiteStatements == null)
                        {
                            sQLiteStatements = new List <SQLiteStatement>();
                        }
                        sQLiteStatements.Add(sQLiteStatement);
                        sQLiteStatement = null;
                    }
                    if (str == null)
                    {
                        continue;
                    }
                    str = str.Trim();
                }
            }
            finally
            {
                if (sQLiteStatement != null)
                {
                    sQLiteStatement.Dispose();
                    sQLiteStatement = null;
                }
                if (sQLiteStatements != null)
                {
                    foreach (SQLiteStatement sQLiteStatement2 in sQLiteStatements)
                    {
                        if (sQLiteStatement2 == null)
                        {
                            continue;
                        }
                        sQLiteStatement2.Dispose();
                    }
                    sQLiteStatements.Clear();
                    sQLiteStatements = null;
                }
            }
        }
예제 #3
0
 protected virtual void Dispose(bool disposing)
 {
     if (!this.disposed)
     {
         if (disposing)
         {
             foreach (KeyValuePair <IntPtr, SQLiteFunction.AggregateData> keyValuePair in this._contextDataList)
             {
                 IDisposable value = keyValuePair.Value._data as IDisposable;
                 if (value == null)
                 {
                     continue;
                 }
                 value.Dispose();
             }
             this._contextDataList.Clear();
             this._contextDataList = null;
             this._flags           = SQLiteConnectionFlags.None;
             this._InvokeFunc      = null;
             this._StepFunc        = null;
             this._FinalFunc       = null;
             this._CompareFunc     = null;
             this._base            = null;
         }
         this.disposed = true;
     }
 }
예제 #4
0
 public static void Initialize()
 {
     if (SQLite3.StaticIsInitialized())
     {
         return;
     }
     if (!AppDomain.CurrentDomain.IsDefaultAppDomain() && UnsafeNativeMethods.GetSettingValue("Force_SQLiteLog", null) == null)
     {
         return;
     }
     lock (SQLiteLog.syncRoot)
     {
         if (SQLiteLog._domainUnload == null)
         {
             SQLiteLog._domainUnload = new EventHandler(SQLiteLog.DomainUnload);
             AppDomain.CurrentDomain.DomainUnload += SQLiteLog._domainUnload;
         }
         if (SQLiteLog._sql == null)
         {
             SQLiteLog._sql = new SQLite3(SQLiteDateFormats.ISO8601, DateTimeKind.Unspecified, null, IntPtr.Zero, null, false);
         }
         if (SQLiteLog._callback == null)
         {
             SQLiteLog._callback = new SQLiteLogCallback(SQLiteLog.LogCallback);
             SQLiteErrorCode sQLiteErrorCode = SQLiteLog._sql.SetLogCallback(SQLiteLog._callback);
             if (sQLiteErrorCode != SQLiteErrorCode.Ok)
             {
                 throw new SQLiteException(sQLiteErrorCode, "Failed to initialize logging.");
             }
         }
         SQLiteLog._enabled = true;
         SQLiteLog.AddDefaultHandler();
     }
 }
예제 #5
0
        internal static bool UnbindFunction(SQLiteBase sqliteBase, SQLiteFunctionAttribute functionAttribute, SQLiteFunction function, SQLiteConnectionFlags flags)
        {
            if (sqliteBase == null)
            {
                throw new ArgumentNullException("sqliteBase");
            }
            if (functionAttribute == null)
            {
                throw new ArgumentNullException("functionAttribute");
            }
            if (function == null)
            {
                throw new ArgumentNullException("function");
            }
            FunctionType funcType = functionAttribute.FuncType;
            string       name     = functionAttribute.Name;

            if (funcType == FunctionType.Collation)
            {
                return(sqliteBase.CreateCollation(name, null, null, false) == SQLiteErrorCode.Ok);
            }
            bool flag = function is SQLiteFunctionEx;

            return(sqliteBase.CreateFunction(name, functionAttribute.Arguments, flag, null, null, null, false) == SQLiteErrorCode.Ok);
        }
예제 #6
0
 protected override bool ReleaseHandle()
 {
     if (!this.ownHandle)
     {
         return(true);
     }
     try
     {
         try
         {
             IntPtr intPtr = Interlocked.Exchange(ref this.handle, IntPtr.Zero);
             if (intPtr != IntPtr.Zero)
             {
                 SQLiteBase.CloseConnection(this, intPtr);
             }
         }
         catch (SQLiteException sQLiteException)
         {
         }
     }
     finally
     {
         base.SetHandleAsInvalid();
     }
     return(true);
 }
예제 #7
0
        internal static bool ResetConnection(SQLiteConnectionHandle hdl, IntPtr db, bool canThrow)
        {
            SQLiteErrorCode sQLiteErrorCode;

            if (hdl == null || db == IntPtr.Zero)
            {
                return(false);
            }
            bool flag = false;

            try
            {
            }
            finally
            {
                lock (hdl)
                {
                    if (canThrow && hdl.IsInvalid)
                    {
                        throw new InvalidOperationException("The connection handle is invalid.");
                    }
                    if (canThrow && hdl.IsClosed)
                    {
                        throw new InvalidOperationException("The connection handle is closed.");
                    }
                    if (!hdl.IsInvalid && !hdl.IsClosed)
                    {
                        IntPtr zero = IntPtr.Zero;
                        do
                        {
                            zero = UnsafeNativeMethods.sqlite3_next_stmt(db, zero);
                            if (zero == IntPtr.Zero)
                            {
                                continue;
                            }
                            sQLiteErrorCode = UnsafeNativeMethods.sqlite3_reset_interop(zero);
                        }while (zero != IntPtr.Zero);
                        if (!SQLiteBase.IsAutocommit(hdl, db))
                        {
                            sQLiteErrorCode = UnsafeNativeMethods.sqlite3_exec(db, SQLiteConvert.ToUTF8("ROLLBACK"), IntPtr.Zero, IntPtr.Zero, ref zero);
                            if (sQLiteErrorCode == SQLiteErrorCode.Ok)
                            {
                                flag = true;
                            }
                            else if (canThrow)
                            {
                                throw new SQLiteException(sQLiteErrorCode, SQLiteBase.GetLastError(hdl, db));
                            }
                        }
                        else
                        {
                            flag = true;
                        }
                    }
                }
            }
            GC.KeepAlive(hdl);
            return(flag);
        }
예제 #8
0
 protected SQLiteFunction(SQLiteDateFormats format, DateTimeKind kind, string formatString, bool utf16) : this()
 {
     if (utf16)
     {
         this._base = new SQLite3_UTF16(format, kind, formatString, IntPtr.Zero, null, false);
         return;
     }
     this._base = new SQLite3(format, kind, formatString, IntPtr.Zero, null, false);
 }
예제 #9
0
 internal SQLiteBackup(SQLiteBase sqlbase, SQLiteBackupHandle backup, IntPtr destDb, byte[] zDestName, IntPtr sourceDb, byte[] zSourceName)
 {
     this._sql           = sqlbase;
     this._sqlite_backup = backup;
     this._destDb        = destDb;
     this._zDestName     = zDestName;
     this._sourceDb      = sourceDb;
     this._zSourceName   = zSourceName;
 }
예제 #10
0
        internal SQLiteStatement BuildNextCommand()
        {
            SQLiteStatement sQLiteStatement;
            SQLiteStatement item;
            SQLiteStatement sQLiteStatement1 = null;

            try
            {
                if (this._cnn != null && this._cnn._sql != null)
                {
                    if (this._statementList == null)
                    {
                        this._remainingText = this._commandText;
                    }
                    SQLiteBase       sQLiteBase       = this._cnn._sql;
                    SQLiteConnection sQLiteConnection = this._cnn;
                    string           str = this._remainingText;
                    if (this._statementList == null)
                    {
                        item = null;
                    }
                    else
                    {
                        item = this._statementList[this._statementList.Count - 1];
                    }
                    sQLiteStatement1 = sQLiteBase.Prepare(sQLiteConnection, str, item, (uint)(this._commandTimeout * 1000), ref this._remainingText);
                    if (sQLiteStatement1 != null)
                    {
                        sQLiteStatement1._command = this;
                        if (this._statementList == null)
                        {
                            this._statementList = new List <SQLiteStatement>();
                        }
                        this._statementList.Add(sQLiteStatement1);
                        this._parameterCollection.MapParameters(sQLiteStatement1);
                        sQLiteStatement1.BindParameters();
                    }
                }
                sQLiteStatement = sQLiteStatement1;
            }
            catch (Exception exception)
            {
                if (sQLiteStatement1 != null)
                {
                    if (this._statementList != null && this._statementList.Contains(sQLiteStatement1))
                    {
                        this._statementList.Remove(sQLiteStatement1);
                    }
                    sQLiteStatement1.Dispose();
                }
                this._remainingText = null;
                throw;
            }
            return(sQLiteStatement);
        }
예제 #11
0
        internal static bool UnbindAllFunctions(SQLiteBase sqlbase, SQLiteConnectionFlags flags, bool registered)
        {
            SQLiteFunction sQLiteFunction;

            if (sqlbase == null)
            {
                return(false);
            }
            IDictionary <SQLiteFunctionAttribute, SQLiteFunction> functions = sqlbase.Functions;

            if (functions == null)
            {
                return(false);
            }
            bool flag = true;

            if (!registered)
            {
                functions = new Dictionary <SQLiteFunctionAttribute, SQLiteFunction>(functions);
                foreach (KeyValuePair <SQLiteFunctionAttribute, SQLiteFunction> function in functions)
                {
                    SQLiteFunctionAttribute key = function.Key;
                    if (key == null)
                    {
                        continue;
                    }
                    SQLiteFunction value = function.Value;
                    if (value == null || !SQLiteFunction.UnbindFunction(sqlbase, key, value, flags))
                    {
                        flag = false;
                    }
                    else
                    {
                        sqlbase.Functions.Remove(key);
                    }
                }
            }
            else
            {
                foreach (KeyValuePair <SQLiteFunctionAttribute, object> _registeredFunction in SQLiteFunction._registeredFunctions)
                {
                    SQLiteFunctionAttribute sQLiteFunctionAttribute = _registeredFunction.Key;
                    if (sQLiteFunctionAttribute == null || functions.TryGetValue(sQLiteFunctionAttribute, out sQLiteFunction) && sQLiteFunction != null && SQLiteFunction.UnbindFunction(sqlbase, sQLiteFunctionAttribute, sQLiteFunction, flags))
                    {
                        continue;
                    }
                    flag = false;
                }
            }
            return(flag);
        }
예제 #12
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;
     }
 }
예제 #13
0
 private void Dispose(bool disposing)
 {
     if (!this.disposed)
     {
         if (disposing)
         {
             if (this._sqlite_stmt != null)
             {
                 this._sqlite_stmt.Dispose();
                 this._sqlite_stmt = null;
             }
             this._paramNames   = null;
             this._paramValues  = null;
             this._sql          = null;
             this._sqlStatement = null;
         }
         this.disposed = true;
     }
 }
예제 #14
0
 private void Dispose(bool disposing)
 {
     if (!this.disposed)
     {
         if (disposing)
         {
             if (this._sqlite_backup != null)
             {
                 this._sqlite_backup.Dispose();
                 this._sqlite_backup = null;
             }
             this._zSourceName = null;
             this._sourceDb    = IntPtr.Zero;
             this._zDestName   = null;
             this._destDb      = IntPtr.Zero;
             this._sql         = null;
         }
         this.disposed = true;
     }
 }
예제 #15
0
 internal static void CloseConnectionV2(SQLiteConnectionHandle hdl, IntPtr db)
 {
     if (hdl == null || db == IntPtr.Zero)
     {
         return;
     }
     try
     {
     }
     finally
     {
         lock (hdl)
         {
             SQLiteErrorCode sQLiteErrorCode = UnsafeNativeMethods.sqlite3_close_interop(db);
             if (sQLiteErrorCode != SQLiteErrorCode.Ok)
             {
                 throw new SQLiteException(sQLiteErrorCode, SQLiteBase.GetLastError(hdl, db));
             }
         }
     }
 }
 protected override bool ReleaseHandle()
 {
     try
     {
         try
         {
             IntPtr intPtr = Interlocked.Exchange(ref this.handle, IntPtr.Zero);
             if (intPtr != IntPtr.Zero)
             {
                 SQLiteBase.FinishBackup(this.cnn, intPtr);
             }
         }
         catch (SQLiteException sQLiteException)
         {
         }
     }
     finally
     {
         base.SetHandleAsInvalid();
     }
     return(true);
 }
예제 #17
0
        public void Reset(bool clearBindings, bool ignoreErrors)
        {
            this.CheckDisposed();
            if (clearBindings && this._parameterCollection != null)
            {
                this._parameterCollection.Unbind();
            }
            this.ClearDataReader();
            if (this._statementList == null)
            {
                return;
            }
            SQLiteBase sQLiteBase = this._cnn._sql;

            foreach (SQLiteStatement sQLiteStatement in this._statementList)
            {
                if (sQLiteStatement == null)
                {
                    continue;
                }
                SQLiteStatementHandle _sqliteStmt = sQLiteStatement._sqlite_stmt;
                if (_sqliteStmt == null)
                {
                    continue;
                }
                SQLiteErrorCode sQLiteErrorCode = sQLiteBase.Reset(sQLiteStatement);
                if (sQLiteErrorCode == SQLiteErrorCode.Ok && clearBindings && SQLite3.SQLiteVersionNumber >= 3003007)
                {
                    sQLiteErrorCode = UnsafeNativeMethods.sqlite3_clear_bindings(_sqliteStmt);
                }
                if (ignoreErrors || sQLiteErrorCode == SQLiteErrorCode.Ok)
                {
                    continue;
                }
                throw new SQLiteException(sQLiteErrorCode, sQLiteBase.GetLastError());
            }
        }
예제 #18
0
        private void BindParameter(int index, SQLiteParameter param)
        {
            bool                  flag;
            SQLiteBase            sQLiteBase;
            SQLiteConnectionFlags sQLiteConnectionFlag;
            int    num;
            string str;

            if (param == null)
            {
                throw new SQLiteException("Insufficient parameters supplied to the command");
            }
            if ((this._flags & SQLiteConnectionFlags.UseConnectionBindValueCallbacks) == SQLiteConnectionFlags.UseConnectionBindValueCallbacks)
            {
                this.InvokeBindValueCallback(index, param, out flag);
                if (flag)
                {
                    return;
                }
            }
            object value  = param.Value;
            DbType dbType = param.DbType;

            if (value != null && dbType == DbType.Object)
            {
                dbType = SQLiteConvert.TypeToDbType(value.GetType());
            }
            if (HelperMethods.LogPreBind(this._flags))
            {
                IntPtr      _sqliteStmt    = this._sqlite_stmt;
                CultureInfo currentCulture = CultureInfo.CurrentCulture;
                object[]    objArray       = new object[] { _sqliteStmt, index, dbType, value };
                SQLiteLog.LogMessage(HelperMethods.StringFormat(currentCulture, "Binding statement {0} paramter #{1} with database type {2} and raw value {{{3}}}...", objArray));
            }
            if (value == null || Convert.IsDBNull(value))
            {
                this._sql.Bind_Null(this, this._flags, index);
                return;
            }
            CultureInfo invariantCulture = CultureInfo.InvariantCulture;
            bool        flag1            = (this._flags & SQLiteConnectionFlags.BindInvariantText) == SQLiteConnectionFlags.BindInvariantText;
            CultureInfo cultureInfo      = CultureInfo.CurrentCulture;

            if ((this._flags & SQLiteConnectionFlags.ConvertInvariantText) == SQLiteConnectionFlags.ConvertInvariantText)
            {
                cultureInfo = invariantCulture;
            }
            if ((this._flags & SQLiteConnectionFlags.BindAllAsText) == SQLiteConnectionFlags.BindAllAsText)
            {
                if (value is DateTime)
                {
                    this._sql.Bind_DateTime(this, this._flags, index, (DateTime)value);
                    return;
                }
                this._sql.Bind_Text(this, this._flags, index, (flag1 ? SQLiteConvert.ToStringWithProvider(value, invariantCulture) : SQLiteConvert.ToStringWithProvider(value, cultureInfo)));
                return;
            }
            bool flag2 = (this._flags & SQLiteConnectionFlags.BindInvariantDecimal) == SQLiteConnectionFlags.BindInvariantDecimal;

            if ((this._flags & SQLiteConnectionFlags.BindDecimalAsText) == SQLiteConnectionFlags.BindDecimalAsText && value is decimal)
            {
                this._sql.Bind_Text(this, this._flags, index, (flag1 || flag2 ? SQLiteConvert.ToStringWithProvider(value, invariantCulture) : SQLiteConvert.ToStringWithProvider(value, cultureInfo)));
                return;
            }
            switch (dbType)
            {
            case DbType.Binary:
            {
                this._sql.Bind_Blob(this, this._flags, index, (byte[])value);
                return;
            }

            case DbType.Byte:
            {
                this._sql.Bind_UInt32(this, this._flags, index, Convert.ToByte(value, cultureInfo));
                return;
            }

            case DbType.Boolean:
            {
                this._sql.Bind_Boolean(this, this._flags, index, SQLiteConvert.ToBoolean(value, cultureInfo, true));
                return;
            }

            case DbType.Currency:
            case DbType.Double:
            case DbType.Single:
            {
                this._sql.Bind_Double(this, this._flags, index, Convert.ToDouble(value, cultureInfo));
                return;
            }

            case DbType.Date:
            case DbType.DateTime:
            case DbType.Time:
            {
                this._sql.Bind_DateTime(this, this._flags, index, (value is string?this._sql.ToDateTime((string)value) : Convert.ToDateTime(value, cultureInfo)));
                return;
            }

            case DbType.Decimal:
            {
                this._sql.Bind_Text(this, this._flags, index, (flag1 || flag2 ? SQLiteConvert.ToStringWithProvider(Convert.ToDecimal(value, cultureInfo), invariantCulture) : SQLiteConvert.ToStringWithProvider(Convert.ToDecimal(value, cultureInfo), cultureInfo)));
                return;
            }

            case DbType.Guid:
            {
                if (this._command.Connection._binaryGuid)
                {
                    SQLiteBase            sQLiteBase1           = this._sql;
                    SQLiteConnectionFlags sQLiteConnectionFlag1 = this._flags;
                    Guid guid = (Guid)value;
                    sQLiteBase1.Bind_Blob(this, sQLiteConnectionFlag1, index, guid.ToByteArray());
                    return;
                }
                this._sql.Bind_Text(this, this._flags, index, (flag1 ? SQLiteConvert.ToStringWithProvider(value, invariantCulture) : SQLiteConvert.ToStringWithProvider(value, cultureInfo)));
                return;
            }

            case DbType.Int16:
            {
                this._sql.Bind_Int32(this, this._flags, index, Convert.ToInt16(value, cultureInfo));
                return;
            }

            case DbType.Int32:
            {
                this._sql.Bind_Int32(this, this._flags, index, Convert.ToInt32(value, cultureInfo));
                return;
            }

            case DbType.Int64:
            {
                this._sql.Bind_Int64(this, this._flags, index, Convert.ToInt64(value, cultureInfo));
                return;
            }

            case DbType.Object:
            case DbType.String:
            {
                sQLiteBase           = this._sql;
                sQLiteConnectionFlag = this._flags;
                num = index;
                str = (flag1 ? SQLiteConvert.ToStringWithProvider(value, invariantCulture) : SQLiteConvert.ToStringWithProvider(value, cultureInfo));
                sQLiteBase.Bind_Text(this, sQLiteConnectionFlag, num, str);
                return;
            }

            case DbType.SByte:
            {
                this._sql.Bind_Int32(this, this._flags, index, Convert.ToSByte(value, cultureInfo));
                return;
            }

            case DbType.UInt16:
            {
                this._sql.Bind_UInt32(this, this._flags, index, Convert.ToUInt16(value, cultureInfo));
                return;
            }

            case DbType.UInt32:
            {
                this._sql.Bind_UInt32(this, this._flags, index, Convert.ToUInt32(value, cultureInfo));
                return;
            }

            case DbType.UInt64:
            {
                this._sql.Bind_UInt64(this, this._flags, index, Convert.ToUInt64(value, cultureInfo));
                return;
            }

            default:
            {
                sQLiteBase           = this._sql;
                sQLiteConnectionFlag = this._flags;
                num = index;
                str = (flag1 ? SQLiteConvert.ToStringWithProvider(value, invariantCulture) : SQLiteConvert.ToStringWithProvider(value, cultureInfo));
                sQLiteBase.Bind_Text(this, sQLiteConnectionFlag, num, str);
                return;
            }
            }
        }
예제 #19
0
        internal static IDictionary <SQLiteFunctionAttribute, SQLiteFunction> BindFunctions(SQLiteBase sqlbase, SQLiteConnectionFlags flags)
        {
            SQLiteFunction sQLiteFunction;
            IDictionary <SQLiteFunctionAttribute, SQLiteFunction> sQLiteFunctionAttributes = new Dictionary <SQLiteFunctionAttribute, SQLiteFunction>();

            foreach (KeyValuePair <SQLiteFunctionAttribute, object> _registeredFunction in SQLiteFunction._registeredFunctions)
            {
                SQLiteFunctionAttribute key = _registeredFunction.Key;
                if (key == null)
                {
                    continue;
                }
                if (!SQLiteFunction.CreateFunction(key, out sQLiteFunction))
                {
                    sQLiteFunctionAttributes[key] = null;
                }
                else
                {
                    SQLiteFunction.BindFunction(sqlbase, key, sQLiteFunction, flags);
                    sQLiteFunctionAttributes[key] = sQLiteFunction;
                }
            }
            return(sQLiteFunctionAttributes);
        }
예제 #20
0
        internal static void BindFunction(SQLiteBase sqliteBase, SQLiteFunctionAttribute functionAttribute, SQLiteFunction function, SQLiteConnectionFlags flags)
        {
            SQLiteCallback      sQLiteCallback;
            SQLiteCallback      sQLiteCallback1;
            SQLiteFinalCallback sQLiteFinalCallback;
            SQLiteCollation     sQLiteCollation;
            SQLiteCollation     sQLiteCollation1;

            if (sqliteBase == null)
            {
                throw new ArgumentNullException("sqliteBase");
            }
            if (functionAttribute == null)
            {
                throw new ArgumentNullException("functionAttribute");
            }
            if (function == null)
            {
                throw new ArgumentNullException("function");
            }
            FunctionType funcType = functionAttribute.FuncType;

            function._base  = sqliteBase;
            function._flags = flags;
            SQLiteFunction sQLiteFunction = function;

            if (funcType == FunctionType.Scalar)
            {
                sQLiteCallback = new SQLiteCallback(function.ScalarCallback);
            }
            else
            {
                sQLiteCallback = null;
            }
            sQLiteFunction._InvokeFunc = sQLiteCallback;
            SQLiteFunction sQLiteFunction1 = function;

            if (funcType == FunctionType.Aggregate)
            {
                sQLiteCallback1 = new SQLiteCallback(function.StepCallback);
            }
            else
            {
                sQLiteCallback1 = null;
            }
            sQLiteFunction1._StepFunc = sQLiteCallback1;
            SQLiteFunction sQLiteFunction2 = function;

            if (funcType == FunctionType.Aggregate)
            {
                sQLiteFinalCallback = new SQLiteFinalCallback(function.FinalCallback);
            }
            else
            {
                sQLiteFinalCallback = null;
            }
            sQLiteFunction2._FinalFunc = sQLiteFinalCallback;
            SQLiteFunction sQLiteFunction3 = function;

            if (funcType == FunctionType.Collation)
            {
                sQLiteCollation = new SQLiteCollation(function.CompareCallback);
            }
            else
            {
                sQLiteCollation = null;
            }
            sQLiteFunction3._CompareFunc = sQLiteCollation;
            SQLiteFunction sQLiteFunction4 = function;

            if (funcType == FunctionType.Collation)
            {
                sQLiteCollation1 = new SQLiteCollation(function.CompareCallback16);
            }
            else
            {
                sQLiteCollation1 = null;
            }
            sQLiteFunction4._CompareFunc16 = sQLiteCollation1;
            string name = functionAttribute.Name;

            if (funcType == FunctionType.Collation)
            {
                sqliteBase.CreateCollation(name, function._CompareFunc, function._CompareFunc16, true);
                return;
            }
            bool flag = function is SQLiteFunctionEx;

            sqliteBase.CreateFunction(name, functionAttribute.Arguments, flag, function._InvokeFunc, function._StepFunc, function._FinalFunc, true);
        }
예제 #21
0
 private SQLiteBlob(SQLiteBase sqlbase, SQLiteBlobHandle blob)
 {
     this._sql         = sqlbase;
     this._sqlite_blob = blob;
 }