示例#1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Cursor"/> class.
        /// </summary>
        /// <param name="isamSession">The session.</param>
        /// <param name="database">The database.</param>
        /// <param name="tableName">Name of the table.</param>
        /// <param name="tableid">The tableid.</param>
        /// <param name="inInsertMode">if set to <c>true</c> [in insert mode].</param>
        internal Cursor(
            IsamSession isamSession,
            TemporaryDatabase database,
            string tableName,
            JET_TABLEID tableid,
            bool inInsertMode)
        {
            lock (isamSession)
            {
                this.isamSession = isamSession;
                this.database = database;
                this.tableName = tableName;
                this.tableid = tableid;
                this.cleanup = true;
                this.record = new ColumnAccessor(this, isamSession, tableid, RetrieveColumnGrbit.None);
                this.editRecord = new ColumnAccessor(this, isamSession, tableid, RetrieveColumnGrbit.RetrieveCopy);
                this.indexRecord = new ColumnAccessor(this, isamSession, tableid, RetrieveColumnGrbit.RetrieveFromIndex);
                this.isSort = database.Tables[tableName].Type == TableType.Sort;
                this.isSortOrPreSort = database.Tables[tableName].Type == TableType.Sort
                                       || database.Tables[tableName].Type == TableType.PreSortTemporary;
                this.isTempTable = database.Tables[tableName].Type == TableType.Sort
                                   || database.Tables[tableName].Type == TableType.PreSortTemporary
                                   || database.Tables[tableName].Type == TableType.Temporary;
                this.inInsertMode = this.isSortOrPreSort && inInsertMode;
                this.inRetrieveMode = this.isSort && !inInsertMode;
                this.onBeforeFirst = this.isSort && !inInsertMode;

                if (!(this.isSort || (this.isSortOrPreSort && inInsertMode)))
                {
                    this.MoveBeforeFirst();
                }
            }
        }
示例#2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Cursor"/> class.
        /// </summary>
        /// <param name="isamSession">The session.</param>
        /// <param name="database">The database.</param>
        /// <param name="tableName">Name of the table.</param>
        /// <param name="grbit">The grbit.</param>
        internal Cursor(IsamSession isamSession, IsamDatabase database, string tableName, OpenTableGrbit grbit)
        {
            lock (isamSession)
            {
                this.isamSession = isamSession;
                this.database = database;
                this.tableName = tableName;
                Api.JetOpenTable(isamSession.Sesid, database.Dbid, tableName, null, 0, grbit, out this.tableid);
                this.cleanup = true;
                this.record = new ColumnAccessor(this, isamSession, this.tableid, RetrieveColumnGrbit.None);
                this.editRecord = new ColumnAccessor(this, isamSession, this.tableid, RetrieveColumnGrbit.RetrieveCopy);
                this.indexRecord = new ColumnAccessor(this, isamSession, this.tableid, RetrieveColumnGrbit.RetrieveFromIndex);

                this.MoveBeforeFirst();
            }
        }