Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Added more internal-use utility type conversion helpers |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | sourceforge |
Files: | files | file ages | folders |
SHA1: |
1f38aec2e8a8ed7f148571d284e80dfa |
User & Date: | rmsimpson 2005-03-04 21:30:11.000 |
Context
2005-03-04
| ||
21:30 | Increased performance ExecuteScalar() and ExecuteNonQuery() resulting in a nice boost in the insert 100k rows tests and user-function tests check-in: 5f06409677 user: rmsimpson tags: sourceforge | |
21:30 | Added more internal-use utility type conversion helpers check-in: 1f38aec2e8 user: rmsimpson tags: sourceforge | |
21:29 | More performance enhancements to SQLiteCommand check-in: 8502a3ae6d user: rmsimpson tags: sourceforge | |
Changes
Changes to System.Data.SQLite/SQLiteBase.cs.
︙ | ︙ | |||
130 131 132 133 134 135 136 137 138 139 140 141 142 143 | internal abstract Int32 GetInt32(SQLiteStatement stmt, int index); internal abstract Int64 GetInt64(SQLiteStatement stmt, int index); internal abstract string GetText(SQLiteStatement stmt, int index); internal abstract long GetBytes(SQLiteStatement stmt, int index, int nDataoffset, byte[] bDest, int nStart, int nLength); internal abstract long GetChars(SQLiteStatement stmt, int index, int nDataoffset, char[] bDest, int nStart, int nLength); internal abstract DateTime GetDateTime(SQLiteStatement stmt, int index); internal abstract bool IsNull(SQLiteStatement stmt, int index); internal abstract int CreateCollation(string strCollation, SQLiteCollation func); internal abstract int CreateFunction(string strFunction, int nArgs, SQLiteCallback func, SQLiteCallback funcstep, SQLiteCallback funcfinal); internal abstract void FreeFunction(int nCookie); internal abstract int AggregateCount(int context); internal abstract int AggregateContext(int context); | > > > > > > > > > > > > > > > > > > > | 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 | internal abstract Int32 GetInt32(SQLiteStatement stmt, int index); internal abstract Int64 GetInt64(SQLiteStatement stmt, int index); internal abstract string GetText(SQLiteStatement stmt, int index); internal abstract long GetBytes(SQLiteStatement stmt, int index, int nDataoffset, byte[] bDest, int nStart, int nLength); internal abstract long GetChars(SQLiteStatement stmt, int index, int nDataoffset, char[] bDest, int nStart, int nLength); internal abstract DateTime GetDateTime(SQLiteStatement stmt, int index); internal abstract bool IsNull(SQLiteStatement stmt, int index); internal virtual object GetValue(SQLiteStatement stmt, int index, ref SQLiteType typ) { if (typ.Affinity == 0) typ = SQLiteConvert.ColumnToType(stmt, index); if (IsNull(stmt, index)) return DBNull.Value; Type t = SQLiteConvert.SQLiteTypeToType(typ); if (t == typeof(byte[])) { int n = (int)GetBytes(stmt, index, 0, null, 0, 0); byte[] b = new byte[n]; GetBytes(stmt, index, 0, b, 0, n); return b; } return Convert.ChangeType(GetText(stmt, index), t, null); } internal abstract int CreateCollation(string strCollation, SQLiteCollation func); internal abstract int CreateFunction(string strFunction, int nArgs, SQLiteCallback func, SQLiteCallback funcstep, SQLiteCallback funcfinal); internal abstract void FreeFunction(int nCookie); internal abstract int AggregateCount(int context); internal abstract int AggregateContext(int context); |
︙ | ︙ |
Changes to System.Data.SQLite/SQLiteConvert.cs.
︙ | ︙ | |||
61 62 63 64 65 66 67 68 69 70 71 72 73 74 | Ticks = 0, /// <summary> /// The default format for this provider. More compatible with SQLite's intended usage of datetimes, but overall less accurate than Ticks as it doesn't /// natively support times down to fractions of a second. /// </summary> ISO8601 = 1, } /// <summary> /// This base class provides datatype conversion services for the SQLite provider. /// </summary> public abstract class SQLiteConvert { /// <summary> | > > > > > > | 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 | Ticks = 0, /// <summary> /// The default format for this provider. More compatible with SQLite's intended usage of datetimes, but overall less accurate than Ticks as it doesn't /// natively support times down to fractions of a second. /// </summary> ISO8601 = 1, } internal struct SQLiteType { internal DbType Type; internal TypeAffinity Affinity; } /// <summary> /// This base class provides datatype conversion services for the SQLite provider. /// </summary> public abstract class SQLiteConvert { /// <summary> |
︙ | ︙ | |||
307 308 309 310 311 312 313 314 315 316 317 318 319 320 | string[] ar = new string[ls.Count]; ls.CopyTo(ar, 0); return ar; } #region Type Conversions /// <summary> /// For a given intrinsic type, return a DbType /// </summary> /// <param name="typ">The native type to convert</param> /// <returns>The corresponding (closest match) DbType</returns> internal static DbType TypeToDbType(Type typ) { | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 | string[] ar = new string[ls.Count]; ls.CopyTo(ar, 0); return ar; } #region Type Conversions internal static SQLiteType ColumnToType(SQLiteStatement stmt, int ordinal) { SQLiteType typ; typ.Type = TypeNameToDbType(stmt._sql.ColumnType(stmt, ordinal, out typ.Affinity)); return typ; } internal static Type SQLiteTypeToType(SQLiteType t) { if (t.Type != DbType.Object) return SQLiteConvert.DbTypeToType(t.Type); switch (t.Affinity) { case TypeAffinity.Null: return typeof(DBNull); case TypeAffinity.Int64: return typeof(Int64); case TypeAffinity.Double: return typeof(Double); case TypeAffinity.Blob: return typeof(byte[]); default: return typeof(string); } } /// <summary> /// For a given intrinsic type, return a DbType /// </summary> /// <param name="typ">The native type to convert</param> /// <returns>The corresponding (closest match) DbType</returns> internal static DbType TypeToDbType(Type typ) { |
︙ | ︙ |