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 Side-by-Side Diffs Ignore Whitespace Patch

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

   176    176       /// <returns>
   177    177       /// This function throws an InvalidTypeCast() exception if the requested type doesn't match the column's definition or affinity.
   178    178       /// </returns>
   179    179       /// <param name="i">The index of the column to type-check</param>
   180    180       /// <param name="typ">The type we want to get out of the column</param>
   181    181       private void VerifyType(int i, DbType typ)
   182    182       {
          183  +      CheckClosed();
   183    184         CheckValidRow();
   184    185         SQLiteType t = GetSQLiteType(i);
   185    186   
   186    187         if (t.Type == typ) return;
   187    188   
   188    189           // Coercable type, usually a literal of some kind
   189    190         switch (_fieldTypeArray[i].Affinity)
................................................................................
   336    337       /// <summary>
   337    338       /// Returns the .NET type of a given column
   338    339       /// </summary>
   339    340       /// <param name="i">The index of the column to retrieve</param>
   340    341       /// <returns>Type</returns>
   341    342       public override Type GetFieldType(int i)
   342    343       {
          344  +      CheckClosed();
   343    345         return SQLiteConvert.SQLiteTypeToType(GetSQLiteType(i));
   344    346       }
   345    347   
   346    348       /// <summary>
   347    349       /// Returns a column as a float value
   348    350       /// </summary>
   349    351       /// <param name="i">The index of the column to retrieve</param>
................................................................................
   636    638       /// <summary>
   637    639       /// Retrieves the column as an object corresponding to the underlying datatype of the column
   638    640       /// </summary>
   639    641       /// <param name="i">The index of the column to retrieve</param>
   640    642       /// <returns>object</returns>
   641    643       public override object GetValue(int i)
   642    644       {
          645  +      CheckClosed();
          646  +
   643    647         SQLiteType typ = GetSQLiteType(i);
   644    648   
   645    649         return _activeStatement._sql.GetValue(_activeStatement, i, ref typ);
   646    650       }
   647    651   
   648    652       /// <summary>
   649    653       /// Retreives the values of multiple columns, up to the size of the supplied array
   650    654       /// </summary>
   651    655       /// <param name="values">The array to fill with values from the columns in the current resultset</param>
   652    656       /// <returns>The number of columns retrieved</returns>
   653    657       public override int GetValues(object[] values)
   654    658       {
          659  +      CheckClosed();
          660  +
          661  +      SQLiteType typ;
   655    662         int nMax = _fieldCount;
   656    663         if (values.Length < nMax) nMax = values.Length;
          664  +
   657    665   
   658    666         for (int n = 0; n < nMax; n++)
   659    667         {
   660         -        values.SetValue(GetValue(n), n);
          668  +        typ = GetSQLiteType(n);
          669  +        values[n] = _activeStatement._sql.GetValue(_activeStatement, n, ref typ);
   661    670         }
   662    671   
   663    672         return nMax;
   664    673       }
   665    674   
   666    675       /// <summary>
   667    676       /// Returns True if the resultset has rows that can be fetched
................................................................................
   781    790       /// <summary>
   782    791       /// Retrieves the SQLiteType for a given column, and caches it to avoid repetetive interop calls.
   783    792       /// </summary>
   784    793       /// <param name="i">The index of the column to retrieve</param>
   785    794       /// <returns>A SQLiteType structure</returns>
   786    795       private SQLiteType GetSQLiteType(int i)
   787    796       {
   788         -      CheckClosed();
   789    797         if (_fieldTypeArray == null) _fieldTypeArray = new SQLiteType[_fieldCount];
   790    798   
   791    799         if (_fieldTypeArray[i].Affinity == TypeAffinity.Uninitialized || _fieldTypeArray[i].Affinity == TypeAffinity.Null)
   792    800           _fieldTypeArray[i].Type = SQLiteConvert.TypeNameToDbType(_activeStatement._sql.ColumnType(_activeStatement, i, out _fieldTypeArray[i].Affinity));
   793    801         return _fieldTypeArray[i];
   794    802       }
   795    803