/// <summary> /// Converts a SQLiteType to a .NET Type object /// </summary> /// <param name="t">The SQLiteType to convert</param> /// <returns>Returns a .NET Type object</returns> internal static Type SqliteTypeToType(SqliteType t) { if (t.Type == DbType.Object) { return(_affinitytotype[(int)t.Affinity]); } else { return(SqliteConvert.DbTypeToType(t.Type)); } }
/// <summary> /// Determines the data type of a column in a statement /// </summary> /// <param name="stmt">The statement to retrieve information for</param> /// <param name="i">The column to retrieve type information on</param> /// <param name="typ">The SQLiteType to receive the affinity for the given column</param> internal static void ColumnToType(SqliteStatement stmt, int i, SqliteType typ) { typ.Type = TypeNameToDbType(stmt._sql.ColumnType(stmt, i, out typ.Affinity)); }
internal abstract object GetValue(SqliteStatement stmt, int index, SqliteType typ);
internal override object GetValue(SqliteStatement stmt, int index, SqliteType typ) { lock (dbLock) { object result = null; if (stmt != null && stmt._sqlite_stmt != null && stmt._sqlite_stmt.DataType(index) != SQLitePCL.SQLiteType.NULL) { // result = Convert.ChangeType(stmt._sqlite_stmt.GetText(index), // SqliteConvert.DbTypeToType(SqliteConvert.TypeNameToDbType(stmt._sqlite_stmt.DataType(index).ToString()))); switch (stmt._sqlite_stmt.DataType(index)) { case SQLitePCL.SQLiteType.BLOB: result = stmt._sqlite_stmt.GetBlob(index); break; case SQLitePCL.SQLiteType.FLOAT: result = stmt._sqlite_stmt.GetFloat(index); break; case SQLitePCL.SQLiteType.INTEGER: result = stmt._sqlite_stmt.GetInteger(index); break; default: result = stmt._sqlite_stmt.GetText(index); break; } } return result; } }
/// <summary> /// Converts a SQLiteType to a .NET Type object /// </summary> /// <param name="t">The SQLiteType to convert</param> /// <returns>Returns a .NET Type object</returns> internal static Type SqliteTypeToType(SqliteType t) { if (t.Type == DbType.Object) return _affinitytotype[(int)t.Affinity]; else return SqliteConvert.DbTypeToType(t.Type); }