protected override string GetParameterName(int parameterOrdinal)
        {
            CultureInfo invariantCulture = CultureInfo.InvariantCulture;

            object[] objArray = new object[] { parameterOrdinal };
            return(HelperMethods.StringFormat(invariantCulture, "@param{0}", objArray));
        }
示例#2
0
        private System.Data.IsolationLevel GetSystemDataIsolationLevel(SQLiteConnection connection, System.Transactions.Transaction transaction, System.Data.IsolationLevel defaultIsolationLevel, bool throwOnUnavailable, bool throwOnUnsupported)
        {
            if (transaction == null)
            {
                if (connection != null)
                {
                    return(connection.GetDefaultIsolationLevel());
                }
                if (throwOnUnavailable)
                {
                    throw new InvalidOperationException("isolation level is unavailable");
                }
                return(defaultIsolationLevel);
            }
            System.Transactions.IsolationLevel isolationLevel = transaction.IsolationLevel;
            switch (isolationLevel)
            {
            case System.Transactions.IsolationLevel.Serializable:
            {
                return(System.Data.IsolationLevel.Serializable);
            }

            case System.Transactions.IsolationLevel.RepeatableRead:
            {
                return(System.Data.IsolationLevel.RepeatableRead);
            }

            case System.Transactions.IsolationLevel.ReadCommitted:
            {
                return(System.Data.IsolationLevel.ReadCommitted);
            }

            case System.Transactions.IsolationLevel.ReadUncommitted:
            {
                return(System.Data.IsolationLevel.ReadUncommitted);
            }

            case System.Transactions.IsolationLevel.Snapshot:
            {
                return(System.Data.IsolationLevel.Snapshot);
            }

            case System.Transactions.IsolationLevel.Chaos:
            {
                return(System.Data.IsolationLevel.Chaos);
            }

            case System.Transactions.IsolationLevel.Unspecified:
            {
                return(System.Data.IsolationLevel.Unspecified);
            }
            }
            if (throwOnUnsupported)
            {
                CultureInfo currentCulture = CultureInfo.CurrentCulture;
                object[]    objArray       = new object[] { isolationLevel };
                throw new InvalidOperationException(HelperMethods.StringFormat(currentCulture, "unsupported isolation level {0}", objArray));
            }
            return(defaultIsolationLevel);
        }
示例#3
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;
                }
            }
        }
        private static string GetStockErrorMessage(SQLiteErrorCode errorCode, string message)
        {
            CultureInfo currentCulture = CultureInfo.CurrentCulture;

            object[] errorString = new object[] { SQLiteException.GetErrorString(errorCode), Environment.NewLine, message };
            return(HelperMethods.StringFormat(currentCulture, "{0}{1}{2}", errorString).Trim());
        }
        private static void LogEventHandler(object sender, LogEventArgs e)
        {
            if (e == null)
            {
                return;
            }
            string message = e.Message;

            if (message != null)
            {
                message = message.Trim();
                if (message.Length == 0)
                {
                    message = "<empty>";
                }
            }
            else
            {
                message = "<null>";
            }
            object errorCode = e.ErrorCode;
            string str       = "error";

            if (errorCode as SQLiteErrorCode? != SQLiteErrorCode.Ok || errorCode is int)
            {
                SQLiteErrorCode sQLiteErrorCode = (SQLiteErrorCode)((int)(errorCode ?? -1));
                sQLiteErrorCode &= SQLiteErrorCode.NonExtendedMask;
                if (sQLiteErrorCode == SQLiteErrorCode.Ok)
                {
                    str = "message";
                }
                else if (sQLiteErrorCode == SQLiteErrorCode.Notice)
                {
                    str = "notice";
                }
                else if (sQLiteErrorCode == SQLiteErrorCode.Warning)
                {
                    str = "warning";
                }
                else if (sQLiteErrorCode == SQLiteErrorCode.Row || sQLiteErrorCode == SQLiteErrorCode.Done)
                {
                    str = "data";
                }
            }
            else if (errorCode == null)
            {
                str = "trace";
            }
            if (errorCode == null || object.ReferenceEquals(errorCode, string.Empty))
            {
                CultureInfo currentCulture = CultureInfo.CurrentCulture;
                object[]    objArray       = new object[] { str, message };
                Trace.WriteLine(HelperMethods.StringFormat(currentCulture, "SQLite {0}: {1}", objArray));
                return;
            }
            CultureInfo cultureInfo = CultureInfo.CurrentCulture;

            object[] objArray1 = new object[] { str, errorCode, message };
            Trace.WriteLine(HelperMethods.StringFormat(cultureInfo, "SQLite {0} ({1}): {2}", objArray1));
        }
 protected virtual void Dispose(bool disposing)
 {
     try
     {
         if (!this.disposed && this.statement != IntPtr.Zero)
         {
             try
             {
                 if (HelperMethods.LogPrepare(this.GetFlags()))
                 {
                     CultureInfo currentCulture = CultureInfo.CurrentCulture;
                     object[]    objArray       = new object[] { (disposing ? "disposed" : "finalized"), this.statement };
                     SQLiteLog.LogMessage(SQLiteErrorCode.Misuse, HelperMethods.StringFormat(currentCulture, "Connection lock object was {0} with statement {1}", objArray));
                 }
             }
             catch
             {
             }
         }
     }
     finally
     {
         this.disposed = true;
     }
 }
示例#7
0
        private int Filter(IntPtr context, IntPtr pTblName)
        {
            int num;

            try
            {
                num = (this.tableFilterCallback(this.tableFilterClientData, SQLiteString.StringFromUtf8IntPtr(pTblName)) ? 1 : 0);
            }
            catch (Exception exception1)
            {
                Exception exception = exception1;
                try
                {
                    if (HelperMethods.LogCallbackExceptions(base.GetFlags()))
                    {
                        CultureInfo currentCulture = CultureInfo.CurrentCulture;
                        object[]    objArray       = new object[] { "xSessionFilter", exception };
                        SQLiteLog.LogMessage(-2146233088, HelperMethods.StringFormat(currentCulture, "Caught exception in \"{0}\" method: {1}", objArray));
                    }
                }
                catch
                {
                }
                return(0);
            }
            return(num);
        }
 //[ReflectionPermission(SecurityAction.Assert, MemberAccess=true)]
 private object GetSQLiteProviderServicesInstance()
 {
     if (SQLiteFactory._sqliteServices == null)
     {
         string  settingValue = UnsafeNativeMethods.GetSettingValue("TypeName_SQLiteProviderServices", null);
         Version version      = base.GetType().Assembly.GetName().Version;
         if (settingValue == null)
         {
             CultureInfo invariantCulture = CultureInfo.InvariantCulture;
             string      defaultTypeName  = SQLiteFactory.DefaultTypeName;
             object[]    objArray         = new object[] { version };
             settingValue = HelperMethods.StringFormat(invariantCulture, defaultTypeName, objArray);
         }
         else
         {
             CultureInfo cultureInfo = CultureInfo.InvariantCulture;
             object[]    objArray1   = new object[] { version };
             settingValue = HelperMethods.StringFormat(cultureInfo, settingValue, objArray1);
         }
         Type type = Type.GetType(settingValue, false);
         if (type != null)
         {
             FieldInfo field = type.GetField("Instance", SQLiteFactory.DefaultBindingFlags);
             if (field != null)
             {
                 SQLiteFactory._sqliteServices = field.GetValue(null);
             }
         }
     }
     return(SQLiteFactory._sqliteServices);
 }
示例#9
0
        internal int CompareCallback16(IntPtr ptr, int len1, IntPtr ptr1, int len2, IntPtr ptr2)
        {
            int num;

            try
            {
                num = this.Compare(SQLite3_UTF16.UTF16ToString(ptr1, len1), SQLite3_UTF16.UTF16ToString(ptr2, len2));
            }
            catch (Exception exception1)
            {
                Exception exception = exception1;
                try
                {
                    if (HelperMethods.LogCallbackExceptions(this._flags))
                    {
                        CultureInfo currentCulture = CultureInfo.CurrentCulture;
                        object[]    objArray       = new object[] { "Compare (UTF16)", exception };
                        SQLiteLog.LogMessage(-2146233088, HelperMethods.StringFormat(currentCulture, "Caught exception in \"{0}\" method: {1}", objArray));
                    }
                }
                catch
                {
                }
                if (this._base != null && this._base.IsOpen())
                {
                    this._base.Cancel();
                }
                return(0);
            }
            return(num);
        }
 protected UnsafeNativeMethods.xSessionFilter GetDelegate(SessionTableFilterCallback tableFilterCallback, object clientData)
 {
     if (tableFilterCallback == null)
     {
         return(null);
     }
     return((IntPtr context, IntPtr pTblName) => {
         int num;
         try
         {
             string str = SQLiteString.StringFromUtf8IntPtr(pTblName);
             num = (tableFilterCallback(clientData, str) ? 1 : 0);
         }
         catch (Exception exception1)
         {
             Exception exception = exception1;
             try
             {
                 if (HelperMethods.LogCallbackExceptions(base.GetFlags()))
                 {
                     SQLiteLog.LogMessage(-2146233088, HelperMethods.StringFormat(CultureInfo.CurrentCulture, "Caught exception in \"{0}\" method: {1}", new object[] { "xSessionFilter", exception }));
                 }
             }
             catch
             {
             }
             return 0;
         }
         return num;
     });
 }
 protected UnsafeNativeMethods.xSessionConflict GetDelegate(SessionConflictCallback conflictCallback, object clientData)
 {
     if (conflictCallback == null)
     {
         return(null);
     }
     return((IntPtr context, SQLiteChangeSetConflictType type, IntPtr iterator) => {
         SQLiteChangeSetConflictResult sQLiteChangeSetConflictResult;
         try
         {
             ISQLiteChangeSetMetadataItem sQLiteChangeSetMetadataItem = this.CreateMetadataItem(iterator);
             if (sQLiteChangeSetMetadataItem == null)
             {
                 throw new SQLiteException("could not create metadata item");
             }
             sQLiteChangeSetConflictResult = conflictCallback(clientData, type, sQLiteChangeSetMetadataItem);
         }
         catch (Exception exception1)
         {
             Exception exception = exception1;
             try
             {
                 if (HelperMethods.LogCallbackExceptions(base.GetFlags()))
                 {
                     SQLiteLog.LogMessage(-2146233088, HelperMethods.StringFormat(CultureInfo.CurrentCulture, "Caught exception in \"{0}\" method: {1}", new object[] { "xSessionConflict", exception }));
                 }
             }
             catch
             {
             }
             return SQLiteChangeSetConflictResult.Abort;
         }
         return sQLiteChangeSetConflictResult;
     });
 }
        static SQLiteModuleCommon()
        {
            CultureInfo invariantCulture = CultureInfo.InvariantCulture;

            object[] name = new object[] { typeof(SQLiteModuleCommon).Name };
            SQLiteModuleCommon.declareSql = HelperMethods.StringFormat(invariantCulture, "CREATE TABLE {0}(x);", name);
        }
 private static void DefaultTypeNameWarning(DbType dbType, SQLiteConnectionFlags flags, string typeName)
 {
     if ((flags & SQLiteConnectionFlags.TraceWarning) == SQLiteConnectionFlags.TraceWarning)
     {
         CultureInfo currentCulture = CultureInfo.CurrentCulture;
         object[]    objArray       = new object[] { typeName, dbType };
         Trace.WriteLine(HelperMethods.StringFormat(currentCulture, "WARNING: Type mapping failed, returning default name \"{0}\" for type {1}.", objArray));
     }
 }
        public override SQLiteErrorCode Update(SQLiteVirtualTable table, SQLiteValue[] values, ref long rowId)
        {
            this.CheckDisposed();
            CultureInfo currentCulture = CultureInfo.CurrentCulture;

            object[] tableName = new object[] { table.TableName };
            this.SetTableError(table, HelperMethods.StringFormat(currentCulture, "virtual table \"{0}\" is read-only", tableName));
            return(SQLiteErrorCode.Error);
        }
 private static void DefaultDbTypeWarning(string typeName, SQLiteConnectionFlags flags, DbType?dbType)
 {
     if (!string.IsNullOrEmpty(typeName) && (flags & SQLiteConnectionFlags.TraceWarning) == SQLiteConnectionFlags.TraceWarning)
     {
         CultureInfo currentCulture = CultureInfo.CurrentCulture;
         object[]    objArray       = new object[] { dbType, typeName };
         Trace.WriteLine(HelperMethods.StringFormat(currentCulture, "WARNING: Type mapping failed, returning default type {0} for name \"{1}\".", objArray));
     }
 }
        public override SQLiteErrorCode Rename(SQLiteVirtualTable table, string newName)
        {
            this.CheckDisposed();
            if (table.Rename(newName))
            {
                return(SQLiteErrorCode.Ok);
            }
            CultureInfo currentCulture = CultureInfo.CurrentCulture;

            object[] tableName = new object[] { table.TableName, newName };
            this.SetTableError(table, HelperMethods.StringFormat(currentCulture, "failed to rename virtual table from \"{0}\" to \"{1}\"", tableName));
            return(SQLiteErrorCode.Error);
        }
        public override SQLiteErrorCode BestIndex(SQLiteVirtualTable table, SQLiteIndex index)
        {
            this.CheckDisposed();
            if (table.BestIndex(index))
            {
                return(SQLiteErrorCode.Ok);
            }
            CultureInfo currentCulture = CultureInfo.CurrentCulture;

            object[] tableName = new object[] { table.TableName };
            this.SetTableError(table, HelperMethods.StringFormat(currentCulture, "failed to select best index for virtual table \"{0}\"", tableName));
            return(SQLiteErrorCode.Error);
        }
        static SQLiteFactory()
        {
            SQLiteFactory.Instance            = new SQLiteFactory();
            SQLiteFactory.DefaultTypeName     = "EntityWorker.SQLite.Linq.SQLiteProviderServices, EntityWorker.SQLite.Linq, Version={0}, Culture=neutral, PublicKeyToken=db937bc2d44ff139";
            SQLiteFactory.DefaultBindingFlags = BindingFlags.Instance | BindingFlags.Static | BindingFlags.NonPublic;
            UnsafeNativeMethods.Initialize();
            SQLiteLog.Initialize();
            string      str = "3.5.0.0";
            CultureInfo invariantCulture = CultureInfo.InvariantCulture;

            object[] objArray = new object[] { str };
            SQLiteFactory._dbProviderServicesType = Type.GetType(HelperMethods.StringFormat(invariantCulture, "System.Data.Common.DbProviderServices, System.Data.Entity, Version={0}, Culture=neutral, PublicKeyToken=b77a5c561934e089", objArray), false);
        }
 protected virtual SQLiteErrorCode CursorTypeMismatchError(SQLiteVirtualTableCursor cursor, Type type)
 {
     if (type == null)
     {
         this.SetCursorError(cursor, "cursor type mismatch");
     }
     else
     {
         CultureInfo currentCulture = CultureInfo.CurrentCulture;
         object[]    objArray       = new object[] { type };
         this.SetCursorError(cursor, HelperMethods.StringFormat(currentCulture, "not a \"{0}\" cursor", objArray));
     }
     return(SQLiteErrorCode.Error);
 }
 internal static void MaybeBreakIntoDebugger()
 {
     lock (HelperMethods.staticSyncRoot)
     {
         if (HelperMethods.debuggerBreak.HasValue)
         {
             return;
         }
     }
     if (UnsafeNativeMethods.GetSettingValue("PreLoadSQLite_BreakIntoDebugger", null) != null)
     {
         try
         {
             CultureInfo currentCulture = CultureInfo.CurrentCulture;
             object[]    processId      = new object[] { HelperMethods.GetProcessId() };
             Console.WriteLine(HelperMethods.StringFormat(currentCulture, "Attach a debugger to process {0} and press any key to continue.", processId));
             Console.ReadKey();
         }
         catch (Exception exception1)
         {
             Exception exception = exception1;
             try
             {
                 CultureInfo cultureInfo = CultureInfo.CurrentCulture;
                 object[]    objArray    = new object[] { typeof(Console), exception };
                 Trace.WriteLine(HelperMethods.StringFormat(cultureInfo, "Failed to issue debugger prompt, {0} may be unusable: {1}", objArray));
             }
             catch
             {
             }
         }
         try
         {
             Debugger.Break();
             lock (HelperMethods.staticSyncRoot)
             {
                 HelperMethods.debuggerBreak = new bool?(true);
             }
         }
         catch
         {
             lock (HelperMethods.staticSyncRoot)
             {
                 HelperMethods.debuggerBreak = new bool?(false);
             }
             throw;
         }
     }
 }
        public override object Invoke(object[] args)
        {
            if (this.callback1 == null)
            {
                CultureInfo currentCulture = CultureInfo.CurrentCulture;
                object[]    objArray       = new object[] { "Invoke" };
                throw new InvalidOperationException(HelperMethods.StringFormat(currentCulture, "No \"{0}\" callback is set.", objArray));
            }
            SQLiteInvokeDelegate sQLiteInvokeDelegate = this.callback1 as SQLiteInvokeDelegate;

            if (sQLiteInvokeDelegate != null)
            {
                return(sQLiteInvokeDelegate("Invoke", args));
            }
            return(this.callback1.DynamicInvoke(this.GetInvokeArgs(args, false)));
        }
        public override object Final(object contextData)
        {
            if (this.callback2 == null)
            {
                CultureInfo currentCulture = CultureInfo.CurrentCulture;
                object[]    objArray       = new object[] { "Final" };
                throw new InvalidOperationException(HelperMethods.StringFormat(currentCulture, "No \"{0}\" callback is set.", objArray));
            }
            SQLiteFinalDelegate sQLiteFinalDelegate = this.callback2 as SQLiteFinalDelegate;

            if (sQLiteFinalDelegate != null)
            {
                return(sQLiteFinalDelegate("Final", contextData));
            }
            return(this.callback1.DynamicInvoke(this.GetFinalArgs(contextData, false)));
        }
示例#23
0
 internal void FinalCallback(IntPtr context)
 {
     SQLiteFunction.AggregateData aggregateDatum;
     try
     {
         object obj = null;
         if (this._base != null)
         {
             IntPtr intPtr = this._base.AggregateContext(context);
             if (this._contextDataList != null && this._contextDataList.TryGetValue(intPtr, out aggregateDatum))
             {
                 obj = aggregateDatum._data;
                 this._contextDataList.Remove(intPtr);
             }
         }
         try
         {
             this._context = context;
             this.SetReturnValue(context, this.Final(obj));
         }
         finally
         {
             IDisposable disposable = obj as IDisposable;
             if (disposable != null)
             {
                 disposable.Dispose();
             }
         }
     }
     catch (Exception exception1)
     {
         Exception exception = exception1;
         try
         {
             if (HelperMethods.LogCallbackExceptions(this._flags))
             {
                 CultureInfo currentCulture = CultureInfo.CurrentCulture;
                 object[]    objArray       = new object[] { "Final", exception };
                 SQLiteLog.LogMessage(-2146233088, HelperMethods.StringFormat(currentCulture, "Caught exception in \"{0}\" method: {1}", objArray));
             }
         }
         catch
         {
         }
     }
 }
示例#24
0
            internal KeyQuery(SQLiteConnection cnn, string database, string table, params string[] columns)
            {
                using (SQLiteCommandBuilder sQLiteCommandBuilder = new SQLiteCommandBuilder())
                {
                    this._command = cnn.CreateCommand();
                    for (int i = 0; i < (int)columns.Length; i++)
                    {
                        columns[i] = sQLiteCommandBuilder.QuoteIdentifier(columns[i]);
                    }
                }
                SQLiteCommand sQLiteCommand    = this._command;
                CultureInfo   invariantCulture = CultureInfo.InvariantCulture;

                object[] objArray = new object[] { string.Join(",", columns), database, table };
                sQLiteCommand.CommandText = HelperMethods.StringFormat(invariantCulture, "SELECT {0} FROM [{1}].[{2}] WHERE ROWID = ?", objArray);
                this._command.Parameters.AddWithValue(null, (long)0);
            }
示例#25
0
 internal void StepCallback(IntPtr context, int nArgs, IntPtr argsptr)
 {
     try
     {
         SQLiteFunction.AggregateData aggregateDatum = null;
         if (this._base != null)
         {
             IntPtr intPtr = this._base.AggregateContext(context);
             if (this._contextDataList != null && !this._contextDataList.TryGetValue(intPtr, out aggregateDatum))
             {
                 aggregateDatum = new SQLiteFunction.AggregateData();
                 this._contextDataList[intPtr] = aggregateDatum;
             }
         }
         if (aggregateDatum == null)
         {
             aggregateDatum = new SQLiteFunction.AggregateData();
         }
         try
         {
             this._context = context;
             this.Step(this.ConvertParams(nArgs, argsptr), aggregateDatum._count, ref aggregateDatum._data);
         }
         finally
         {
             aggregateDatum._count++;
         }
     }
     catch (Exception exception1)
     {
         Exception exception = exception1;
         try
         {
             if (HelperMethods.LogCallbackExceptions(this._flags))
             {
                 CultureInfo currentCulture = CultureInfo.CurrentCulture;
                 object[]    objArray       = new object[] { "Step", exception };
                 SQLiteLog.LogMessage(-2146233088, HelperMethods.StringFormat(currentCulture, "Caught exception in \"{0}\" method: {1}", objArray));
             }
         }
         catch
         {
         }
     }
 }
        private SQLiteErrorCode Input(IntPtr context, IntPtr pData, ref int nData)
        {
            SQLiteErrorCode sQLiteErrorCode;

            try
            {
                Stream stream = this.stream;
                if (stream != null)
                {
                    if (nData > 0)
                    {
                        byte[] numArray = new byte[nData];
                        int    num      = stream.Read(numArray, 0, nData);
                        if (num > 0 && pData != IntPtr.Zero)
                        {
                            Marshal.Copy(numArray, 0, pData, num);
                        }
                        nData = num;
                    }
                    sQLiteErrorCode = SQLiteErrorCode.Ok;
                }
                else
                {
                    sQLiteErrorCode = SQLiteErrorCode.Misuse;
                }
            }
            catch (Exception exception1)
            {
                Exception exception = exception1;
                try
                {
                    if (HelperMethods.LogCallbackExceptions(this.GetFlags()))
                    {
                        CultureInfo currentCulture = CultureInfo.CurrentCulture;
                        object[]    objArray       = new object[] { "xSessionInput", exception };
                        SQLiteLog.LogMessage(-2146233088, HelperMethods.StringFormat(currentCulture, "Caught exception in \"{0}\" method: {1}", objArray));
                    }
                }
                catch
                {
                }
                return(SQLiteErrorCode.IoErr_Read);
            }
            return(sQLiteErrorCode);
        }
示例#27
0
        public void LoadDifferencesFromTable(string fromDatabaseName, string tableName)
        {
            this.CheckDisposed();
            this.CheckHandle();
            if (fromDatabaseName == null)
            {
                throw new ArgumentNullException("fromDatabaseName");
            }
            if (tableName == null)
            {
                throw new ArgumentNullException("tableName");
            }
            IntPtr zero = IntPtr.Zero;

            try
            {
                SQLiteErrorCode sQLiteErrorCode = UnsafeNativeMethods.sqlite3session_diff(this.session, SQLiteString.GetUtf8BytesFromString(fromDatabaseName), SQLiteString.GetUtf8BytesFromString(tableName), ref zero);
                if (sQLiteErrorCode != SQLiteErrorCode.Ok)
                {
                    string str = null;
                    if (zero != IntPtr.Zero)
                    {
                        str = SQLiteString.StringFromUtf8IntPtr(zero);
                        if (!string.IsNullOrEmpty(str))
                        {
                            CultureInfo currentCulture = CultureInfo.CurrentCulture;
                            object[]    objArray       = new object[] { str };
                            str = HelperMethods.StringFormat(currentCulture, ": {0}", objArray);
                        }
                    }
                    CultureInfo cultureInfo = CultureInfo.CurrentCulture;
                    object[]    objArray1   = new object[] { "sqlite3session_diff", str };
                    throw new SQLiteException(sQLiteErrorCode, HelperMethods.StringFormat(cultureInfo, "{0}{1}", objArray1));
                }
            }
            finally
            {
                if (zero != IntPtr.Zero)
                {
                    SQLiteMemory.Free(zero);
                    zero = IntPtr.Zero;
                }
            }
        }
        public override void Step(object[] args, int stepNumber, ref object contextData)
        {
            if (this.callback1 == null)
            {
                CultureInfo currentCulture = CultureInfo.CurrentCulture;
                object[]    objArray       = new object[] { "Step" };
                throw new InvalidOperationException(HelperMethods.StringFormat(currentCulture, "No \"{0}\" callback is set.", objArray));
            }
            SQLiteStepDelegate sQLiteStepDelegate = this.callback1 as SQLiteStepDelegate;

            if (sQLiteStepDelegate != null)
            {
                sQLiteStepDelegate("Step", args, stepNumber, ref contextData);
                return;
            }
            object[] stepArgs = this.GetStepArgs(args, stepNumber, contextData, false);
            this.callback1.DynamicInvoke(stepArgs);
            this.UpdateStepArgs(stepArgs, ref contextData, false);
        }
        public static string ToDisplayString(object value)
        {
            if (value == null)
            {
                return("<nullObject>");
            }
            string str = value.ToString();

            if (str.Length == 0)
            {
                return("<emptyString>");
            }
            if (str.IndexOfAny(HelperMethods.SpaceChars) < 0)
            {
                return(str);
            }
            CultureInfo invariantCulture = CultureInfo.InvariantCulture;

            object[] objArray = new object[] { str };
            return(HelperMethods.StringFormat(invariantCulture, "\"{0}\"", objArray));
        }
示例#30
0
 internal void ScalarCallback(IntPtr context, int nArgs, IntPtr argsptr)
 {
     try
     {
         this._context = context;
         this.SetReturnValue(context, this.Invoke(this.ConvertParams(nArgs, argsptr)));
     }
     catch (Exception exception1)
     {
         Exception exception = exception1;
         try
         {
             if (HelperMethods.LogCallbackExceptions(this._flags))
             {
                 CultureInfo currentCulture = CultureInfo.CurrentCulture;
                 object[]    objArray       = new object[] { "Invoke", exception };
                 SQLiteLog.LogMessage(-2146233088, HelperMethods.StringFormat(currentCulture, "Caught exception in \"{0}\" method: {1}", objArray));
             }
         }
         catch
         {
         }
     }
 }