Ejemplo n.º 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();
        }
Ejemplo n.º 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;
        }
Ejemplo n.º 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;
 }
Ejemplo n.º 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;
        }
Ejemplo n.º 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)
 {
 }
Ejemplo n.º 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);
 }
Ejemplo n.º 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)
 {
 }
Ejemplo n.º 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);
Ejemplo n.º 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)
 {
 }