/// <summary>
        /// Reads the next row from the resultset
        /// </summary>
        /// <returns>True if a new row was successfully loaded and is ready for processing</returns>
        public override bool Read()
        {
            CheckClosed();

            if (_readingState == -1) // First step was already done at the NextResult() level, so don't step again, just return true.
            {
                _readingState = 0;
                return(true);
            }
            else if (_readingState == 0) // Actively reading rows
            {
                // Don't read a new row if the command behavior dictates SingleRow.  We've already read the first row.
                if ((_commandBehavior & CommandBehavior.SingleRow) == 0)
                {
                    if (_activeStatement._sql.Step(_activeStatement) == true)
                    {
                        if (_keyInfo != null)
                        {
                            _keyInfo.Reset();
                        }

                        return(true);
                    }
                }

                _readingState = 1; // Finished reading rows
            }

            return(false);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Reads the next row from the resultset
        /// </summary>
        /// <returns>True if a new row was successfully loaded and is ready for processing</returns>
        public override bool Read()
        {
            CheckClosed();

            if (_readingState == -1) // First step was already done at the NextResult() level, so don't step again, just return true.
            {
                _readingState = 0;
                return(true);
            }
            else if (_readingState == 0) // Actively reading rows
            {
                if (_activeStatement._sql.Step(_activeStatement) == true)
                {
#if MONO_SUPPORT_KEYREADER
                    if (_keyInfo != null)
                    {
                        _keyInfo.Reset();
                    }
#endif

                    return(true);
                }

                _readingState = 1; // Finished reading rows
            }

            return(false);
        }