Exemple #1
0
        private void ExecuteFirstStep()
        {
            _Done      = true;
            _FirstRead = true;

            // Exec first step and get column info.
            _Statement = _Command.Statements[_StatementIndex];
            _Statement.Compile();
            _NativeMethods.busy_timeout(_Command.CommandTimeout);

            SQLiteCode res = _Statement.Step();

            if (res == SQLiteCode.RowReady || res == SQLiteCode.Done)
            {
                _FieldNames             = new String[_Statement.GetColumnCount()];
                _FieldTypes             = new Type[_Statement.GetColumnCount()];
                _ColumnNameStartIndexes = new int[_Statement.GetColumnCount()];

                // Get column info.
                for (int i = 0; i < _Statement.GetColumnCount(); i++)
                {
                    _FieldNames[i]             = _Statement.GetColumnName(i);
                    _FieldTypes[i]             = SQLType2Type(_Statement.GetColumnType(i));
                    _ColumnNameStartIndexes[i] = _FieldNames[i].IndexOf('.') + 1;
                }

                _Done = res == SQLiteCode.Done;
            }
            else if (res == SQLiteCode.Error)
            {
                _Statement.Dispose();
            }
            else
            {
                throw new SQLiteException(string.Format("Unknown SQLite error code {0}.", res));
            }
        }
        private void ExecuteFirstStep()
        {
            _Done = true;
            _FirstRead = true;

            // Exec first step and get column info.
            _Statement = _Command.Statements[_StatementIndex];
            _Statement.Compile();
            _NativeMethods.busy_timeout(_Command.CommandTimeout);

            SQLiteCode res = _Statement.Step();
            if (res == SQLiteCode.RowReady || res == SQLiteCode.Done)
            {
                _FieldNames = new String[_Statement.GetColumnCount()];
                _FieldTypes = new Type[_Statement.GetColumnCount()];
                _ColumnNameStartIndexes = new int[_Statement.GetColumnCount()];

                // Get column info.
                for (int i = 0; i < _Statement.GetColumnCount(); i++)
                {
                    _FieldNames[i] = _Statement.GetColumnName(i);
                    _FieldTypes[i] = SQLType2Type(_Statement.GetColumnType(i));
                    _ColumnNameStartIndexes[i] = _FieldNames[i].IndexOf('.') + 1;
                }

                _Done = res == SQLiteCode.Done;
            }
            else if (res == SQLiteCode.Error) _Statement.Dispose();
            else throw new SQLiteException(string.Format("Unknown SQLite error code {0}.", res));
        }