static private SqliteTypeToType ( |
||
t | The SqliteType to convert | |
Résultat |
/// <summary> /// Returns the .NET type of a given column /// </summary> /// <param name="i">The index of the column to retrieve</param> /// <returns>Type</returns> public override Type GetFieldType(int i) { CheckClosed(); #if MONO_SUPPORT_KEYREADER if (i >= VisibleFieldCount && _keyInfo != null) { return(_keyInfo.GetFieldType(i - VisibleFieldCount)); } #endif return(SqliteConvert.SqliteTypeToType(GetSqliteType(i))); }
/// <summary> /// Helper function to retrieve a column of data from an active statement. /// </summary> /// <param name="stmt">The statement being step()'d through</param> /// <param name="index">The column index to retrieve</param> /// <param name="typ">The type of data contained in the column. If Uninitialized, this function will retrieve the datatype information.</param> /// <returns>Returns the data in the column</returns> internal override object GetValue(SqliteStatement stmt, int index, SqliteType typ) { if (typ.Affinity == 0) { typ = SqliteConvert.ColumnToType(stmt, index); } if (IsNull(stmt, index)) { return(DBNull.Value); } Type t = SqliteConvert.SqliteTypeToType(typ); switch (TypeToAffinity(t)) { case TypeAffinity.Blob: if (typ.Type == DbType.Guid && typ.Affinity == TypeAffinity.Text) { return(new Guid(GetText(stmt, index))); } int n = (int)GetBytes(stmt, index, 0, null, 0, 0); byte[] b = new byte[n]; GetBytes(stmt, index, 0, b, 0, n); if (typ.Type == DbType.Guid && n == 16) { return(new Guid(b)); } return(b); case TypeAffinity.DateTime: return(GetDateTime(stmt, index)); case TypeAffinity.Double: return(Convert.ChangeType(GetDouble(stmt, index), t, null)); case TypeAffinity.Int64: return(Convert.ChangeType(GetInt64(stmt, index), t, null)); default: return(GetText(stmt, index)); } }
/// <summary> /// Retrieves the name of the back-end datatype of the column /// </summary> /// <param name="i">The index of the column to retrieve</param> /// <returns>string</returns> public override string GetDataTypeName(int i) { CheckClosed(); #if MONO_SUPPORT_KEYREADER if (i >= VisibleFieldCount && _keyInfo != null) { return(_keyInfo.GetDataTypeName(i - VisibleFieldCount)); } #endif SqliteType typ = GetSqliteType(i); if (typ.Type == DbType.Object) { return(SqliteConvert.SqliteTypeToType(typ).Name); } return(_activeStatement._sql.ColumnType(_activeStatement, i, out typ.Affinity)); }