コード例 #1
0
        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// See the <see cref="ISQLiteManagedModule.Column" /> method.
        /// </summary>
        /// <param name="cursor">
        /// See the <see cref="ISQLiteManagedModule.Column" /> method.
        /// </param>
        /// <param name="context">
        /// See the <see cref="ISQLiteManagedModule.Column" /> method.
        /// </param>
        /// <param name="index">
        /// See the <see cref="ISQLiteManagedModule.Column" /> method.
        /// </param>
        /// <returns>
        /// See the <see cref="ISQLiteManagedModule.Column" /> method.
        /// </returns>
        public override SQLiteErrorCode Column(
            SQLiteVirtualTableCursor cursor,
            SQLiteContext context,
            int index
            )
        {
            CheckDisposed();

            SQLiteVirtualTableCursorEnumerator <T> enumeratorCursor =
                cursor as SQLiteVirtualTableCursorEnumerator <T>;

            if (enumeratorCursor == null)
            {
                return(CursorTypeMismatchError(cursor,
                                               typeof(SQLiteVirtualTableCursorEnumerator)));
            }

            if (enumeratorCursor.EndOfEnumerator)
            {
                return(CursorEndOfEnumeratorError(cursor));
            }

            T current = ((IEnumerator <T>)enumeratorCursor).Current;

            if (current != null)
            {
                context.SetString(GetStringFromObject(cursor, current));
            }
            else
            {
                context.SetNull();
            }

            return(SQLiteErrorCode.Ok);
        }
コード例 #2
0
        ///////////////////////////////////////////////////////////////////////

        #region ISQLiteManagedModule Members
        /// <summary>
        /// See the <see cref="ISQLiteManagedModule.Open" /> method.
        /// </summary>
        /// <param name="table">
        /// See the <see cref="ISQLiteManagedModule.Open" /> method.
        /// </param>
        /// <param name="cursor">
        /// See the <see cref="ISQLiteManagedModule.Open" /> method.
        /// </param>
        /// <returns>
        /// See the <see cref="ISQLiteManagedModule.Open" /> method.
        /// </returns>
        public override SQLiteErrorCode Open(
            SQLiteVirtualTable table,
            ref SQLiteVirtualTableCursor cursor
            )
        {
            CheckDisposed();

            cursor = new SQLiteVirtualTableCursorEnumerator <T>(
                table, enumerable.GetEnumerator());

            return(SQLiteErrorCode.Ok);
        }