protected virtual long GetRowIdFromObject(SQLiteVirtualTableCursor cursor, object value)
        {
            int num      = (cursor != null ? cursor.GetRowIndex() : 0);
            int hashCode = SQLiteMarshal.GetHashCode(value, this.objectIdentity);

            return(this.MakeRowId(num, hashCode));
        }
        public override SQLiteErrorCode Column(SQLiteVirtualTableCursor cursor, SQLiteContext context, int index)
        {
            this.CheckDisposed();
            SQLiteVirtualTableCursorEnumerator sQLiteVirtualTableCursorEnumerator = cursor as SQLiteVirtualTableCursorEnumerator;

            if (sQLiteVirtualTableCursorEnumerator == null)
            {
                return(this.CursorTypeMismatchError(cursor, typeof(SQLiteVirtualTableCursorEnumerator)));
            }
            if (sQLiteVirtualTableCursorEnumerator.EndOfEnumerator)
            {
                return(this.CursorEndOfEnumeratorError(cursor));
            }
            object current = sQLiteVirtualTableCursorEnumerator.Current;

            if (current == null)
            {
                context.SetNull();
            }
            else
            {
                context.SetString(this.GetStringFromObject(cursor, current));
            }
            return(SQLiteErrorCode.Ok);
        }
        public override bool Eof(SQLiteVirtualTableCursor cursor)
        {
            this.CheckDisposed();
            SQLiteVirtualTableCursorEnumerator sQLiteVirtualTableCursorEnumerator = cursor as SQLiteVirtualTableCursorEnumerator;

            if (sQLiteVirtualTableCursorEnumerator != null)
            {
                return(sQLiteVirtualTableCursorEnumerator.EndOfEnumerator);
            }
            return(this.ResultCodeToEofResult(this.CursorTypeMismatchError(cursor, typeof(SQLiteVirtualTableCursorEnumerator))));
        }
 protected virtual string GetStringFromObject(SQLiteVirtualTableCursor cursor, object value)
 {
     if (value == null)
     {
         return(null);
     }
     if (value is string)
     {
         return((string)value);
     }
     return(value.ToString());
 }
        public override SQLiteErrorCode Close(SQLiteVirtualTableCursor cursor)
        {
            this.CheckDisposed();
            SQLiteVirtualTableCursorEnumerator sQLiteVirtualTableCursorEnumerator = cursor as SQLiteVirtualTableCursorEnumerator;

            if (sQLiteVirtualTableCursorEnumerator != null)
            {
                sQLiteVirtualTableCursorEnumerator.Close();
                return(SQLiteErrorCode.Ok);
            }
            return(this.CursorTypeMismatchError(cursor, typeof(SQLiteVirtualTableCursorEnumerator)));
        }
        public override SQLiteErrorCode Filter(SQLiteVirtualTableCursor cursor, int indexNumber, string indexString, SQLiteValue[] values)
        {
            this.CheckDisposed();
            SQLiteVirtualTableCursorEnumerator sQLiteVirtualTableCursorEnumerator = cursor as SQLiteVirtualTableCursorEnumerator;

            if (sQLiteVirtualTableCursorEnumerator == null)
            {
                return(this.CursorTypeMismatchError(cursor, typeof(SQLiteVirtualTableCursorEnumerator)));
            }
            sQLiteVirtualTableCursorEnumerator.Filter(indexNumber, indexString, values);
            sQLiteVirtualTableCursorEnumerator.Reset();
            sQLiteVirtualTableCursorEnumerator.MoveNext();
            return(SQLiteErrorCode.Ok);
        }
 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);
 }
        public override SQLiteErrorCode RowId(SQLiteVirtualTableCursor cursor, ref long rowId)
        {
            this.CheckDisposed();
            SQLiteVirtualTableCursorEnumerator sQLiteVirtualTableCursorEnumerator = cursor as SQLiteVirtualTableCursorEnumerator;

            if (sQLiteVirtualTableCursorEnumerator == null)
            {
                return(this.CursorTypeMismatchError(cursor, typeof(SQLiteVirtualTableCursorEnumerator)));
            }
            if (sQLiteVirtualTableCursorEnumerator.EndOfEnumerator)
            {
                return(this.CursorEndOfEnumeratorError(cursor));
            }
            rowId = this.GetRowIdFromObject(cursor, sQLiteVirtualTableCursorEnumerator.Current);
            return(SQLiteErrorCode.Ok);
        }
        public override SQLiteErrorCode Next(SQLiteVirtualTableCursor cursor)
        {
            this.CheckDisposed();
            SQLiteVirtualTableCursorEnumerator sQLiteVirtualTableCursorEnumerator = cursor as SQLiteVirtualTableCursorEnumerator;

            if (sQLiteVirtualTableCursorEnumerator == null)
            {
                return(this.CursorTypeMismatchError(cursor, typeof(SQLiteVirtualTableCursorEnumerator)));
            }
            if (sQLiteVirtualTableCursorEnumerator.EndOfEnumerator)
            {
                return(this.CursorEndOfEnumeratorError(cursor));
            }
            sQLiteVirtualTableCursorEnumerator.MoveNext();
            return(SQLiteErrorCode.Ok);
        }
 public override SQLiteErrorCode Column(SQLiteVirtualTableCursor cursor, SQLiteContext context, int index)
 {
     this.CheckDisposed();
     return(this.GetMethodResultCode("Column"));
 }
 public override SQLiteErrorCode Close(SQLiteVirtualTableCursor cursor)
 {
     this.CheckDisposed();
     return(this.GetMethodResultCode("Close"));
 }
 public override SQLiteErrorCode RowId(SQLiteVirtualTableCursor cursor, ref long rowId)
 {
     this.CheckDisposed();
     return(this.GetMethodResultCode("RowId"));
 }
 public override SQLiteErrorCode Open(SQLiteVirtualTable table, ref SQLiteVirtualTableCursor cursor)
 {
     this.CheckDisposed();
     return(this.GetMethodResultCode("Open"));
 }
 public override SQLiteErrorCode Open(SQLiteVirtualTable table, ref SQLiteVirtualTableCursor cursor)
 {
     this.CheckDisposed();
     cursor = new SQLiteVirtualTableCursorEnumerator(table, this.enumerable.GetEnumerator());
     return(SQLiteErrorCode.Ok);
 }
 public override bool Eof(SQLiteVirtualTableCursor cursor)
 {
     this.CheckDisposed();
     return(this.ResultCodeToEofResult(this.GetMethodResultCode("Eof")));
 }
 public override SQLiteErrorCode Filter(SQLiteVirtualTableCursor cursor, int indexNumber, string indexString, SQLiteValue[] values)
 {
     this.CheckDisposed();
     return(this.GetMethodResultCode("Filter"));
 }
 protected virtual SQLiteErrorCode CursorEndOfEnumeratorError(SQLiteVirtualTableCursor cursor)
 {
     this.SetCursorError(cursor, "already hit end of enumerator");
     return(SQLiteErrorCode.Error);
 }