System.Data.SQLite
Check-in [785601b768]
Not logged in

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

Overview
Comment:Fix typos in the data reader class that could lead to them returning the wrong value for GetDatabaseName / GetTableName methods.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:785601b7684b1a0472c95f8df9bf118863ad337e
User & Date: mistachkin 2018-03-09 21:47:57
Context
2018-04-05
03:39
Add some comments to a test file. check-in: 72990f698b user: mistachkin tags: trunk
2018-03-09
21:47
Fix typos in the data reader class that could lead to them returning the wrong value for GetDatabaseName / GetTableName methods. check-in: 785601b768 user: mistachkin tags: trunk
17:45
The GetSchemaTable method must verify the base table name (for a column) actually refers to a base table before attempting to query its metadata. Pursuant to [baf42ee135]. check-in: 63ae5401bf user: mistachkin tags: trunk
Changes
Hide Diffs Unified Diffs Show Whitespace Changes Patch

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

1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
....
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
    /// <param name="i">The index of the column.</param>
    /// <returns>string</returns>
    public string GetDatabaseName(int i)
    {
        CheckDisposed();

        if (i >= PrivateVisibleFieldCount && _keyInfo != null)
            return _keyInfo.GetName(i - PrivateVisibleFieldCount);

        return _activeStatement._sql.ColumnDatabaseName(_activeStatement, i);
    }

    /// <summary>
    /// Returns the name of the table associated with the specified column.
    /// </summary>
................................................................................
    /// <param name="i">The index of the column.</param>
    /// <returns>string</returns>
    public string GetTableName(int i)
    {
        CheckDisposed();

        if (i >= PrivateVisibleFieldCount && _keyInfo != null)
            return _keyInfo.GetName(i - PrivateVisibleFieldCount);

        return _activeStatement._sql.ColumnTableName(_activeStatement, i);
    }

    /// <summary>
    /// Returns the original name of the specified column.
    /// </summary>







|







 







|







1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
....
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
    /// <param name="i">The index of the column.</param>
    /// <returns>string</returns>
    public string GetDatabaseName(int i)
    {
        CheckDisposed();

        if (i >= PrivateVisibleFieldCount && _keyInfo != null)
            return _keyInfo.GetDatabaseName(i - PrivateVisibleFieldCount);

        return _activeStatement._sql.ColumnDatabaseName(_activeStatement, i);
    }

    /// <summary>
    /// Returns the name of the table associated with the specified column.
    /// </summary>
................................................................................
    /// <param name="i">The index of the column.</param>
    /// <returns>string</returns>
    public string GetTableName(int i)
    {
        CheckDisposed();

        if (i >= PrivateVisibleFieldCount && _keyInfo != null)
            return _keyInfo.GetTableName(i - PrivateVisibleFieldCount);

        return _activeStatement._sql.ColumnTableName(_activeStatement, i);
    }

    /// <summary>
    /// Returns the original name of the specified column.
    /// </summary>

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

525
526
527
528
529
530
531










532
533
534
535
536
537
538

    internal Type GetFieldType(int i)
    {
      Sync();
      if (_keyInfo[i].query != null) return _keyInfo[i].query._reader.GetFieldType(_keyInfo[i].column);
      else return typeof(Int64);
    }











    internal string GetName(int i)
    {
      return _keyInfo[i].columnName;
    }

    internal int GetOrdinal(string name)







>
>
>
>
>
>
>
>
>
>







525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548

    internal Type GetFieldType(int i)
    {
      Sync();
      if (_keyInfo[i].query != null) return _keyInfo[i].query._reader.GetFieldType(_keyInfo[i].column);
      else return typeof(Int64);
    }

    internal string GetDatabaseName(int i)
    {
        return _keyInfo[i].databaseName;
    }

    internal string GetTableName(int i)
    {
        return _keyInfo[i].tableName;
    }

    internal string GetName(int i)
    {
      return _keyInfo[i].columnName;
    }

    internal int GetOrdinal(string name)