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;
     });
 }
示例#2
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;
     });
 }
示例#4
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);
        }
示例#5
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
         {
         }
     }
 }
示例#6
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);
        }
示例#8
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
         {
         }
     }
 }