コード例 #1
0
        /// <summary>
        /// Retrieves the SQLiteType for a given column, and caches it to avoid repetetive interop calls.
        /// </summary>
        /// <param name="i">The index of the column to retrieve</param>
        /// <returns>A SQLiteType structure</returns>
        private SQLiteType GetSQLiteType(int i)
        {
            SQLiteType typ;

            // Initialize the field types array if not already initialized
            if (_fieldTypeArray == null)
            {
                _fieldTypeArray = new SQLiteType[VisibleFieldCount];
            }

            // Initialize this column's field type instance
            if (_fieldTypeArray[i] == null)
            {
                _fieldTypeArray[i] = new SQLiteType();
            }

            typ = _fieldTypeArray[i];

            // If not initialized, then fetch the declared column datatype and attempt to convert it
            // to a known DbType.
            if (typ.Affinity == TypeAffinity.Uninitialized)
            {
                typ.Type = SQLiteConvert.TypeNameToDbType(_activeStatement._sql.ColumnType(_activeStatement, i, out typ.Affinity));
            }
            else
            {
                typ.Affinity = _activeStatement._sql.ColumnAffinity(_activeStatement, i);
            }

            return(typ);
        }
コード例 #2
0
        /// <summary>
        /// Retrieves the SQLiteType for a given column, and caches it to avoid repetetive interop calls.
        /// </summary>
        /// <param name="i">The index of the column to retrieve</param>
        /// <returns>A SQLiteType structure</returns>
        private SQLiteType GetSQLiteType(int i)
        {
            if (_fieldTypeArray == null)
            {
                _fieldTypeArray = new SQLiteType[_fieldCount];
            }

            if (_fieldTypeArray[i].Affinity == TypeAffinity.Uninitialized || _fieldTypeArray[i].Affinity == TypeAffinity.Null)
            {
                _fieldTypeArray[i].Type = SQLiteConvert.TypeNameToDbType(_activeStatement._sql.ColumnType(_activeStatement, i, out _fieldTypeArray[i].Affinity));
            }
            return(_fieldTypeArray[i]);
        }
コード例 #3
0
ファイル: SQLiteDataReader.cs プロジェクト: bdcliang/BD
        private SQLiteType GetSQLiteType(int i)
        {
            if (this._fieldTypeArray == null)
            {
                this._fieldTypeArray = new SQLiteType[this.VisibleFieldCount];
            }
            if (this._fieldTypeArray[i] == null)
            {
                this._fieldTypeArray[i] = new SQLiteType();
            }
            SQLiteType type = this._fieldTypeArray[i];

            if (type.Affinity == TypeAffinity.Uninitialized)
            {
                type.Type = SQLiteConvert.TypeNameToDbType(this._activeStatement._sql.ColumnType(this._activeStatement, i, out type.Affinity));
                return(type);
            }
            type.Affinity = this._activeStatement._sql.ColumnAffinity(this._activeStatement, i);
            return(type);
        }