Beispiel #1
0
        /// <summary>
        /// Positions the cursor on a record specified by a bookmark.
        /// </summary>
        /// <param name="bookmark">The bookmarkto go to.</param>
        public virtual void GotoBookmark(Bookmark bookmark)
        {
            this.Tracer.TraceVerbose("GotoBookmark");
            this.CheckNotDisposed();
            this.CancelUpdate();

            Api.JetGotoBookmark(this.session, this.table, bookmark.BookmarkData, bookmark.BookmarkLength);
            this.hasCurrency = true;
            this.CheckNotDisposed();
        }
Beispiel #2
0
        /// <summary>
        /// Update the current record.
        /// </summary>
        /// <returns>The bookmark of the updated record.</returns>
        public virtual Bookmark Update()
        {
            this.Tracer.TraceVerbose("Update");
            this.CheckNotDisposed();

            var updateBookmark = new byte[SystemParameters.BookmarkMost];
            int bookmarkSize;

            Api.JetUpdate(this.session, this.table, updateBookmark, updateBookmark.Length, out bookmarkSize);
            this.inUpdate = false;

            var bookmark = new Bookmark
            {
                BookmarkData = updateBookmark,
                BookmarkLength = bookmarkSize
            };
            this.GotoBookmark(bookmark);

            return bookmark;
        }
Beispiel #3
0
 /// <summary>
 /// Initializes a new instance of the RecordBase class. This constructor
 /// is used for a record which already exists in the table.
 /// </summary>
 /// <param name="table">The table containing the record.</param>
 /// <param name="bookmark">The bookmark of the record.</param>
 protected RecordBase(TableBase table, Bookmark bookmark)
     : this()
 {
     this.table = table;
     this.Bookmark = bookmark;
 }
Beispiel #4
0
        /// <summary>
        /// Get the bookmark of the current record.
        /// </summary>
        /// <returns>The bookmark of the current record.</returns>
        public virtual Bookmark GetBookmark()
        {
            this.Tracer.TraceVerbose("GetBookmark");
            this.CheckNotDisposed();
            this.CheckHasCurrency();

            byte[] bookmarkData = new byte[SystemParameters.BookmarkMost];
            int bookmarkLength;
            Api.JetGetBookmark(this.session, this.table, bookmarkData, bookmarkData.Length, out bookmarkLength);
            Debug.Assert(bookmarkLength <= bookmarkData.Length, "Bookmark is too long");
            var bookmark = new Bookmark
            {
                BookmarkData = bookmarkData,
                BookmarkLength = bookmarkLength
            };

            return bookmark;
        }
Beispiel #5
0
 /// <summary>
 /// Initializes a new instance of the ReadWriteRecord class. This constructor
 /// is used for a record which already exists in the table.
 /// </summary>
 /// <param name="table">The table containing the record.</param>
 /// <param name="bookmark">The bookmark of the record.</param>
 public ReadWriteRecord(TableBase table, Bookmark bookmark) :
     base(table, bookmark)
 {
 }
Beispiel #6
0
 /// <summary>
 /// Create a Record object for the record with the specified bookmark.
 /// </summary>
 /// <param name="bookmark">The bookmark of the record.</param>
 /// <returns>A new ReadOnlyRecord.</returns>
 protected override Record CreateRecord(Bookmark bookmark)
 {
     return new ReadOnlyRecord(this, bookmark);
 }
Beispiel #7
0
 /// <summary>
 /// Initializes a new instance of the ReadOnlyRecord class. This constructor
 /// is used for a record which already exists in the table.
 /// </summary>
 /// <param name="table">The table containing the record.</param>
 /// <param name="bookmark">The bookmark of the record.</param>
 public ReadOnlyRecord(TableBase table, Bookmark bookmark)
     : base(table, bookmark)
 {
 }
Beispiel #8
0
 /// <summary>
 /// Create a Record object for the record with the specified bookmark.
 /// </summary>
 /// <remarks>
 /// Implemented by ReadOnlyTable and ReadWriteTable.
 /// </remarks>
 /// <param name="bookmark">The bookmark of the record.</param>
 /// <returns>A new record object.</returns>
 protected abstract Record CreateRecord(Bookmark bookmark);
Beispiel #9
0
 /// <summary>
 /// Initializes a new instance of the ReadOnlyRecord class. This constructor
 /// is used for a record which already exists in the table.
 /// </summary>
 /// <param name="table">The table containing the record.</param>
 /// <param name="bookmark">The bookmark of the record.</param>
 public ReadOnlyRecord(TableBase table, Bookmark bookmark) :
     base(table, bookmark)
 {
 }