System.Data.SQLite
Check-in [6975b34fa4]
Not logged in

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Minor performance enhancements
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | sourceforge
Files: files | file ages | folders
SHA1: 6975b34fa43cde6aae059b0fc45866f68c9b7bab
User & Date: rmsimpson 2006-05-23 13:59:19
Context
2006-06-08
04:19
3.3.6 check-in: 99df6fe847 user: rmsimpson tags: sourceforge
2006-05-23
13:59
Minor performance enhancements check-in: 6975b34fa4 user: rmsimpson tags: sourceforge
2006-05-19
13:57
Tentative DataDirectory support check-in: f011ea6e60 user: rmsimpson tags: sourceforge
Changes
Hide Diffs Unified Diffs Show Whitespace Changes Patch

Changes to System.Data.SQLite/SQLiteDataReader.cs.

176
177
178
179
180
181
182

183
184
185
186
187
188
189
...
336
337
338
339
340
341
342

343
344
345
346
347
348
349
...
636
637
638
639
640
641
642


643
644
645
646
647
648
649
650
651
652
653
654



655
656

657
658
659
660

661
662
663
664
665
666
667
...
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
    /// <returns>
    /// This function throws an InvalidTypeCast() exception if the requested type doesn't match the column's definition or affinity.
    /// </returns>
    /// <param name="i">The index of the column to type-check</param>
    /// <param name="typ">The type we want to get out of the column</param>
    private void VerifyType(int i, DbType typ)
    {

      CheckValidRow();
      SQLiteType t = GetSQLiteType(i);

      if (t.Type == typ) return;

        // Coercable type, usually a literal of some kind
      switch (_fieldTypeArray[i].Affinity)
................................................................................
    /// <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)
    {

      return SQLiteConvert.SQLiteTypeToType(GetSQLiteType(i));
    }

    /// <summary>
    /// Returns a column as a float value
    /// </summary>
    /// <param name="i">The index of the column to retrieve</param>
................................................................................
    /// <summary>
    /// Retrieves the column as an object corresponding to the underlying datatype of the column
    /// </summary>
    /// <param name="i">The index of the column to retrieve</param>
    /// <returns>object</returns>
    public override object GetValue(int i)
    {


      SQLiteType typ = GetSQLiteType(i);

      return _activeStatement._sql.GetValue(_activeStatement, i, ref typ);
    }

    /// <summary>
    /// Retreives the values of multiple columns, up to the size of the supplied array
    /// </summary>
    /// <param name="values">The array to fill with values from the columns in the current resultset</param>
    /// <returns>The number of columns retrieved</returns>
    public override int GetValues(object[] values)
    {



      int nMax = _fieldCount;
      if (values.Length < nMax) nMax = values.Length;


      for (int n = 0; n < nMax; n++)
      {
        values.SetValue(GetValue(n), n);

      }

      return nMax;
    }

    /// <summary>
    /// Returns True if the resultset has rows that can be fetched
................................................................................
    /// <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)
    {
      CheckClosed();
      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];
    }








>







 







>







 







>
>












>
>
>


>



|
>







 







<







176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
...
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
...
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
...
790
791
792
793
794
795
796

797
798
799
800
801
802
803
    /// <returns>
    /// This function throws an InvalidTypeCast() exception if the requested type doesn't match the column's definition or affinity.
    /// </returns>
    /// <param name="i">The index of the column to type-check</param>
    /// <param name="typ">The type we want to get out of the column</param>
    private void VerifyType(int i, DbType typ)
    {
      CheckClosed();
      CheckValidRow();
      SQLiteType t = GetSQLiteType(i);

      if (t.Type == typ) return;

        // Coercable type, usually a literal of some kind
      switch (_fieldTypeArray[i].Affinity)
................................................................................
    /// <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();
      return SQLiteConvert.SQLiteTypeToType(GetSQLiteType(i));
    }

    /// <summary>
    /// Returns a column as a float value
    /// </summary>
    /// <param name="i">The index of the column to retrieve</param>
................................................................................
    /// <summary>
    /// Retrieves the column as an object corresponding to the underlying datatype of the column
    /// </summary>
    /// <param name="i">The index of the column to retrieve</param>
    /// <returns>object</returns>
    public override object GetValue(int i)
    {
      CheckClosed();

      SQLiteType typ = GetSQLiteType(i);

      return _activeStatement._sql.GetValue(_activeStatement, i, ref typ);
    }

    /// <summary>
    /// Retreives the values of multiple columns, up to the size of the supplied array
    /// </summary>
    /// <param name="values">The array to fill with values from the columns in the current resultset</param>
    /// <returns>The number of columns retrieved</returns>
    public override int GetValues(object[] values)
    {
      CheckClosed();

      SQLiteType typ;
      int nMax = _fieldCount;
      if (values.Length < nMax) nMax = values.Length;


      for (int n = 0; n < nMax; n++)
      {
        typ = GetSQLiteType(n);
        values[n] = _activeStatement._sql.GetValue(_activeStatement, n, ref typ);
      }

      return nMax;
    }

    /// <summary>
    /// Returns True if the resultset has rows that can be fetched
................................................................................
    /// <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];
    }