Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Modified to use the new utility type conversion helper(s) in SQLiteBase and SQLiteConvert |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | sourceforge |
Files: | files | file ages | folders |
SHA1: |
6886e6f4fb169be9aa68071fedb70ed7 |
User & Date: | rmsimpson 2005-03-04 21:31:58 |
Context
2005-03-04
| ||
21:32 | Latest build check-in: 972b7cde17 user: rmsimpson tags: sourceforge | |
21:31 | Modified to use the new utility type conversion helper(s) in SQLiteBase and SQLiteConvert check-in: 6886e6f4fb user: rmsimpson tags: sourceforge | |
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 | |
Changes
Changes to System.Data.SQLite/SQLiteDataReader.cs.
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 .. 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 ... 311 312 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 ... 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 |
namespace System.Data.SQLite { using System; using System.Data; using System.Data.Common; using System.Collections.Generic; internal struct SQLiteType { internal DbType Type; internal TypeAffinity Affinity; } /// <summary> /// SQLite implementation of DbDataReader. /// </summary> public sealed class SQLiteDataReader : DbDataReader { /// <summary> /// Underlying command this reader is attached to ................................................................................ private CommandBehavior _commandBehavior; internal SQLiteDataReader(SQLiteCommand cmd, CommandBehavior behave) { _command = cmd; _commandBehavior = behave; Initialize(); } internal void Initialize() { _activeStatementIndex = -1; _activeStatement = null; _rowsAffected = -1; _fieldCount = -1; NextResult(); } /// <summary> /// Closes the datareader, potentially closing the connection as well if CommandBehavior.CloseConnection was specified. /// </summary> public override void Close() { if (_command != null) { while (NextResult()) ; _command.ClearDataReader(); } // If the datareader's behavior includes closing the connection, then do so here. if ((_commandBehavior & CommandBehavior.CloseConnection) != 0) _command.Connection.Close(); ................................................................................ /// <summary> /// /// </summary> /// <param name="ordinal"></param> /// <returns></returns> public override Type GetFieldType(int ordinal) { SQLiteType t = GetSQLiteType(ordinal); 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> /// /// </summary> /// <param name="ordinal"></param> /// <returns></returns> ................................................................................ /// <summary> /// /// </summary> /// <param name="ordinal"></param> /// <returns></returns> public override object GetValue(int ordinal) { if (IsDBNull(ordinal)) return DBNull.Value; if (GetFieldType(ordinal) == typeof(byte[])) { int n = (int)GetBytes(ordinal, 0, null, 0, 0); byte[] b = new byte[n]; GetBytes(ordinal, 0, b, 0, n); return b; } return Convert.ChangeType(_activeStatement._sql.GetText(_activeStatement, ordinal), GetFieldType(ordinal), null); } /// <summary> /// /// </summary> /// <param name="values"></param> /// <returns></returns> |
< < < < < < > > > < < | > > | < < < < < < < < < < < < < < < < < | | < < < < < < < < < |
8 9 10 11 12 13 14 15 16 17 18 19 20 21 .. 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 ... 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 ... 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 |
namespace System.Data.SQLite { using System; using System.Data; using System.Data.Common; using System.Collections.Generic; /// <summary> /// SQLite implementation of DbDataReader. /// </summary> public sealed class SQLiteDataReader : DbDataReader { /// <summary> /// Underlying command this reader is attached to ................................................................................ private CommandBehavior _commandBehavior; internal SQLiteDataReader(SQLiteCommand cmd, CommandBehavior behave) { _command = cmd; _commandBehavior = behave; Initialize(); if (_command != null) NextResult(); } internal void Initialize() { _activeStatementIndex = -1; _activeStatement = null; _rowsAffected = -1; _fieldCount = -1; } /// <summary> /// Closes the datareader, potentially closing the connection as well if CommandBehavior.CloseConnection was specified. /// </summary> public override void Close() { if (_command != null) { while (NextResult()) { } _command.ClearDataReader(); } // If the datareader's behavior includes closing the connection, then do so here. if ((_commandBehavior & CommandBehavior.CloseConnection) != 0) _command.Connection.Close(); ................................................................................ /// <summary> /// /// </summary> /// <param name="ordinal"></param> /// <returns></returns> public override Type GetFieldType(int ordinal) { return SQLiteConvert.SQLiteTypeToType(GetSQLiteType(ordinal)); } /// <summary> /// /// </summary> /// <param name="ordinal"></param> /// <returns></returns> ................................................................................ /// <summary> /// /// </summary> /// <param name="ordinal"></param> /// <returns></returns> public override object GetValue(int ordinal) { SQLiteType typ = GetSQLiteType(ordinal); return _activeStatement._sql.GetValue(_activeStatement, ordinal, ref typ); } /// <summary> /// /// </summary> /// <param name="values"></param> /// <returns></returns> |