示例#1
0
        public void FindNearest(IRow key, out CursorGetFlags flags)
        {
            Exception exception    = null;
            int       nestingLevel = _plan.ServerProcess.BeginTransactionalCall();

            try
            {
                long startTicks = TimingUtility.CurrentTicks;
                try
                {
                    _sourceTable.FindNearest(key);
                    flags = InternalGetFlags();
                }
                finally
                {
                    _program.Statistics.ExecuteTime += TimingUtility.TimeSpanFromTicks(startTicks);
                }
            }
            catch (Exception E)
            {
                exception = E;
                throw WrapException(E);
            }
            finally
            {
                _plan.ServerProcess.EndTransactionalCall(nestingLevel, exception);
            }
        }
示例#2
0
        public bool Refresh(IRow row, out CursorGetFlags flags)
        {
            Exception exception    = null;
            int       nestingLevel = _plan.ServerProcess.BeginTransactionalCall();

            try
            {
                long startTicks = TimingUtility.CurrentTicks;
                try
                {
                    bool success = _sourceTable.Refresh(row);
                    flags = InternalGetFlags();
                    return(success);
                }
                finally
                {
                    _program.Statistics.ExecuteTime += TimingUtility.TimeSpanFromTicks(startTicks);
                }
            }
            catch (Exception E)
            {
                exception = E;
                throw WrapException(E);
            }
            finally
            {
                _plan.ServerProcess.EndTransactionalCall(nestingLevel, exception);
            }
        }
示例#3
0
        public bool GotoBookmark(Guid bookmark, bool forward, out CursorGetFlags flags)
        {
            Exception exception    = null;
            int       nestingLevel = _plan.ServerProcess.BeginTransactionalCall();

            try
            {
                long startTicks = TimingUtility.CurrentTicks;
                try
                {
                    bool success = InternalGotoBookmark(bookmark, forward);
                    flags = InternalGetFlags();
                    return(success);
                }
                finally
                {
                    _program.Statistics.ExecuteTime += TimingUtility.TimeSpanFromTicks(startTicks);
                }
            }
            catch (Exception E)
            {
                exception = E;
                throw WrapException(E);
            }
            finally
            {
                _plan.ServerProcess.EndTransactionalCall(nestingLevel, exception);
            }
        }
示例#4
0
        private CursorGetFlags InternalGetFlags()
        {
            CursorGetFlags getFlags = CursorGetFlags.None;

            if (_sourceTable.BOF())
            {
                getFlags = getFlags | CursorGetFlags.BOF;
            }
            if (_sourceTable.EOF())
            {
                getFlags = getFlags | CursorGetFlags.EOF;
            }
            return(getFlags);
        }
示例#5
0
        // MoveBy
        public int MoveBy(int delta, out CursorGetFlags flags)
        {
            Exception exception    = null;
            int       nestingLevel = _plan.ServerProcess.BeginTransactionalCall();

            try
            {
                long startTicks = TimingUtility.CurrentTicks;
                try
                {
                    int localDelta = 0;
                    while (delta != 0)
                    {
                        if (delta > 0)
                        {
                            if (!_sourceTable.Next())
                            {
                                break;
                            }
                            delta--;
                        }
                        else
                        {
                            if (!_sourceTable.Prior())
                            {
                                break;
                            }
                            delta++;
                        }
                        localDelta++;
                    }
                    flags = InternalGetFlags();
                    return(localDelta);
                }
                finally
                {
                    _program.Statistics.ExecuteTime += TimingUtility.TimeSpanFromTicks(startTicks);
                }
            }
            catch (Exception E)
            {
                exception = E;
                throw WrapException(E);
            }
            finally
            {
                _plan.ServerProcess.EndTransactionalCall(nestingLevel, exception);
            }
        }
示例#6
0
        // Fetch
        public int Fetch(IRow[] rows, Guid[] bookmarks, int count, bool skipCurrent, out CursorGetFlags flags)
        {
            Exception exception    = null;
            int       nestingLevel = _plan.ServerProcess.BeginTransactionalCall();

            try
            {
                long startTicks = TimingUtility.CurrentTicks;
                try
                {
                    int localCount = 0;
                    while (count != 0)
                    {
                        if (count > 0)
                        {
                            if ((localCount == 0) && skipCurrent && !_sourceTable.Next())
                            {
                                break;
                            }

                            if ((localCount > 0) && (!_sourceTable.Next()))
                            {
                                break;
                            }

                            _sourceTable.Select(rows[localCount]);
                            bookmarks[localCount] = Supports(CursorCapability.Bookmarkable) ? InternalGetBookmark() : Guid.Empty;
                            count--;
                        }
                        else
                        {
                            if ((localCount == 0) && skipCurrent && !_sourceTable.Prior())
                            {
                                break;
                            }

                            if ((localCount > 0) && (!_sourceTable.Prior()))
                            {
                                break;
                            }

                            _sourceTable.Select(rows[localCount]);
                            bookmarks[localCount] = Supports(CursorCapability.Bookmarkable) ? InternalGetBookmark() : Guid.Empty;
                            count++;
                        }
                        localCount++;
                    }
                    flags = InternalGetFlags();
                    return(localCount);
                }
                finally
                {
                    _program.Statistics.ExecuteTime += TimingUtility.TimeSpanFromTicks(startTicks);
                }
            }
            catch (Exception E)
            {
                exception = E;
                throw WrapException(E);
            }
            finally
            {
                _plan.ServerProcess.EndTransactionalCall(nestingLevel, exception);
            }
        }
示例#7
0
        // TrivialEOF unneccesary because Last returns flags

        protected void SetFlags(CursorGetFlags flags)
        {
            _flags       = flags;
            _flagsCached = true;
            _trivialBOF  = false;
        }