System.Data.SQLite
Check-in [a6a79f6c79]
Not logged in

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

Overview
Comment:Fixed a bug that failed to throw an exception if there wasn't a current row and a function was called to read data from the current row
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | sourceforge
Files: files | file ages | folders
SHA1: a6a79f6c790a4b835dd506198d8670fb55a768ee
User & Date: rmsimpson 2005-11-30 18:04:58
Context
2005-12-07
22:40
Fix over-aggressive preparation of statements before execution check-in: ba2464b7f6 user: rmsimpson tags: sourceforge
2005-11-30
18:04
Fixed a bug that failed to throw an exception if there wasn't a current row and a function was called to read data from the current row check-in: a6a79f6c79 user: rmsimpson tags: sourceforge
2005-11-22
14:54
Fixed the incomplete Catalogs schema check-in: 897a253ad0 user: rmsimpson tags: sourceforge
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

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

   118    118       /// Throw an error if the datareader is closed
   119    119       /// </summary>
   120    120       private void CheckClosed()
   121    121       {
   122    122         if (_command == null)
   123    123           throw new InvalidOperationException("DataReader has been closed");
   124    124       }
          125  +
          126  +    /// <summary>
          127  +    /// Throw an error if a row is not loaded
          128  +    /// </summary>
          129  +    private void CheckValidRow()
          130  +    {
          131  +      if (_readingState != 0)
          132  +        throw new InvalidOperationException("No current row");
          133  +    }
   125    134   
   126    135       /// <summary>
   127    136       /// Enumerator support
   128    137       /// </summary>
   129    138       /// <returns>Returns a DbEnumerator object.</returns>
   130    139       public override Collections.IEnumerator GetEnumerator()
   131    140       {
................................................................................
   167    176       /// <returns>
   168    177       /// This function throws an InvalidTypeCast() exception if the requested type doesn't match the column's definition or affinity.
   169    178       /// </returns>
   170    179       /// <param name="i">The index of the column to type-check</param>
   171    180       /// <param name="typ">The type we want to get out of the column</param>
   172    181       private void VerifyType(int i, DbType typ)
   173    182       {
          183  +      CheckValidRow();
   174    184         SQLiteType t = GetSQLiteType(i);
   175    185   
   176    186         if (t.Type == typ) return;
   177    187   
   178    188           // Coercable type, usually a literal of some kind
   179    189         switch (_fieldTypeArray[i].Affinity)
   180    190         {
................................................................................
   594    604       /// <summary>
   595    605       /// Retreives the values of multiple columns, up to the size of the supplied array
   596    606       /// </summary>
   597    607       /// <param name="values">The array to fill with values from the columns in the current resultset</param>
   598    608       /// <returns>The number of columns retrieved</returns>
   599    609       public override int GetValues(object[] values)
   600    610       {
   601         -      CheckClosed();
   602    611         int nMax = _fieldCount;
   603    612         if (values.Length < nMax) nMax = values.Length;
   604    613   
   605    614         for (int n = 0; n < nMax; n++)
   606    615         {
   607    616           values.SetValue(GetValue(n), n);
   608    617         }