CursorMove() public static method

public static CursorMove ( IntPtr handle, int flags ) : int
handle System.IntPtr
flags int
return int
示例#1
0
        /// <summary>
        /// Moves the Cursor to the direction specified in the flags
        /// </summary>
        /// <remarks>
        /// This method wraps the native ups_cursor_move function.
        ///
        /// Moves the Cursor. Use the flags to specify the direction.
        /// After the move, use Cursor.GetKey and Cursor.GetRecord to
        /// retrieve key and record of the item.
        ///
        /// If the direction is not specified, the Cursor will not move.
        /// </remarks>
        /// <param name="flags">The direction for the move. If no direction
        /// is specified, the Cursor will remain on the current position.
        /// Possible flags are:
        ///   <list type="bullet">
        ///   <item><see cref="UpsConst.UPS_CURSOR_FIRST" /> positions
        ///     the Cursor to the first item in the Database</item>
        ///   <item><see cref="UpsConst.UPS_CURSOR_LAST" /> positions
        ///     the Cursor to the last item in the Database</item>
        ///   <item><see cref="UpsConst.UPS_CURSOR_NEXT" /> positions
        ///     the Cursor to the next item in the Database; if the Cursor
        ///     does not point to any item, the function behaves as if
        ///     direction was <see cref="UpsConst.UPS_CURSOR_FIRST"/>.</item>
        ///   <item><see cref="UpsConst.UPS_CURSOR_PREVIOUS" /> positions
        ///     the Cursor to the previous item in the Database; if the Cursor
        ///     does not point to any item, the function behaves as if
        ///     direction was <see cref="UpsConst.UPS_CURSOR_LAST"/>.</item>
        ///   <item><see cref="UpsConst.UPS_SKIP_DUPLICATES" /> skips
        ///     duplicate keys of the current key. Not allowed in combination
        ///     with <see cref="UpsConst.UPS_ONLY_DUPLICATES" />.</item>
        ///   <item><see cref="UpsConst.UPS_ONLY_DUPLICATES" /> only
        ///     moves through duplicate keys of the current key. Not allowed
        ///     in combination with
        ///     <see cref="UpsConst.UPS_SKIP_DUPLICATES" />.</item>
        ///   </list>
        /// </param>
        /// <exception cref="DatabaseException">
        ///   <list type="bullet">
        ///   <item><see cref="UpsConst.UPS_KEY_NOT_FOUND"/>
        ///     if the Cursor points to the first (or last) item, and a
        ///     move to the previous (or next) item was requested</item>
        ///   </list>
        /// </exception>
        public void Move(int flags)
        {
            int st;

            lock (db) {
                st = NativeMethods.CursorMove(handle, flags);
            }
            if (st != 0)
            {
                throw new DatabaseException(st);
            }
        }