System.Data.SQLite

Check-in [154d609bbe]
Login

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

Overview
Comment:When counting the number of tables in the GetSchemaTable method, do not include those that have a null or empty name. Fix for [92dbf1229a].
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | nextRelease
Files: files | file ages | folders
SHA1: 154d609bbeb1ae4bac12b7aa0080afbc09b0b937
User & Date: mistachkin 2015-03-02 23:11:51.970
Context
2015-03-03
00:08
Update mailing list addresses. check-in: 789558b44e user: mistachkin tags: nextRelease
2015-03-02
23:11
When counting the number of tables in the GetSchemaTable method, do not include those that have a null or empty name. Fix for [92dbf1229a]. check-in: 154d609bbe user: mistachkin tags: nextRelease
19:07
Add tests for ticket [c28d7fe915]. check-in: 2166864f27 user: mistachkin tags: nextRelease
Changes
Unified Diff Ignore Whitespace Patch
Changes to Doc/Extra/Provider/version.html.
42
43
44
45
46
47
48

49
50
51
52
53
54
55
    </div>
    <div id="mainSection">
    <div id="mainBody">
    <h1 class="heading">Version History</h1>
    <p><b>1.0.96.0 - May XX, 2015</b></p>
    <ul>
      <li>Prevent the IDataReader.GetOrdinal method from throwing &quot;No current row&quot; exceptions. Fix for <a href="https://system.data.sqlite.org/index.html/info/2be4298631">[2be4298631]</a>, <a href="https://system.data.sqlite.org/index.html/info/abad7c577d">[abad7c577d]</a>, and <a href="https://system.data.sqlite.org/index.html/info/c28d7fe915">[c28d7fe915]</a>.</li>

    </ul>
    <p><b>1.0.95.0 - March 2, 2015</b></p>
    <ul>
      <li>Updated to <a href="https://www.sqlite.org/releaselog/3_8_8_3.html">SQLite 3.8.8.3</a>.</li>
      <li>Updated to <a href="https://www.nuget.org/packages/EntityFramework/6.1.2">Entity Framework 6.1.2</a>.</li>
      <li>Modify configuration file transforms performed by the NuGet packages to allow Entity Framework 6 design-time integration to work automatically. Fix for <a href="https://system.data.sqlite.org/index.html/info/2be4298631">[2be4298631]</a>, <a href="https://system.data.sqlite.org/index.html/info/abad7c577d">[abad7c577d]</a>, and <a href="https://system.data.sqlite.org/index.html/info/417d669435">[417d669435]</a>.</li>
      <li>The &quot;System.Data.SQLite.EF6*&quot; and &quot;System.Data.SQLite.Linq*&quot; NuGet packages no longer depend on the &quot;System.Data.SQLite.Core*&quot; packages.&nbsp;<b>** Potentially Incompatible Change **</b></li>







>







42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
    </div>
    <div id="mainSection">
    <div id="mainBody">
    <h1 class="heading">Version History</h1>
    <p><b>1.0.96.0 - May XX, 2015</b></p>
    <ul>
      <li>Prevent the IDataReader.GetOrdinal method from throwing &quot;No current row&quot; exceptions. Fix for <a href="https://system.data.sqlite.org/index.html/info/2be4298631">[2be4298631]</a>, <a href="https://system.data.sqlite.org/index.html/info/abad7c577d">[abad7c577d]</a>, and <a href="https://system.data.sqlite.org/index.html/info/c28d7fe915">[c28d7fe915]</a>.</li>
      <li>When counting the number of tables in the GetSchemaTable method, do not include those that have a null or empty name. Fix for <a href="https://system.data.sqlite.org/index.html/info/92dbf1229a">[92dbf1229a]</a>.</li>
    </ul>
    <p><b>1.0.95.0 - March 2, 2015</b></p>
    <ul>
      <li>Updated to <a href="https://www.sqlite.org/releaselog/3_8_8_3.html">SQLite 3.8.8.3</a>.</li>
      <li>Updated to <a href="https://www.nuget.org/packages/EntityFramework/6.1.2">Entity Framework 6.1.2</a>.</li>
      <li>Modify configuration file transforms performed by the NuGet packages to allow Entity Framework 6 design-time integration to work automatically. Fix for <a href="https://system.data.sqlite.org/index.html/info/2be4298631">[2be4298631]</a>, <a href="https://system.data.sqlite.org/index.html/info/abad7c577d">[abad7c577d]</a>, and <a href="https://system.data.sqlite.org/index.html/info/417d669435">[417d669435]</a>.</li>
      <li>The &quot;System.Data.SQLite.EF6*&quot; and &quot;System.Data.SQLite.Linq*&quot; NuGet packages no longer depend on the &quot;System.Data.SQLite.Core*&quot; packages.&nbsp;<b>** Potentially Incompatible Change **</b></li>
Changes to Setup/data/verify.lst.
745
746
747
748
749
750
751

752
753
754
755
756
757
758
  Tests/tkt-7e3fa93744.eagle
  Tests/tkt-84718e79fa.eagle
  Tests/tkt-8554170e09.eagle
  Tests/tkt-85b824b736.eagle
  Tests/tkt-8b7d179c3c.eagle
  Tests/tkt-8c3bee31c8.eagle
  Tests/tkt-8d928c3e88.eagle

  Tests/tkt-996d13cd87.eagle
  Tests/tkt-9ba9346f75.eagle
  Tests/tkt-a7d04fb111.eagle
  Tests/tkt-aba4549801.eagle
  Tests/tkt-ac47dd230a.eagle
  Tests/tkt-ae5267b863.eagle
  Tests/tkt-b4a7ddc83f.eagle







>







745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
  Tests/tkt-7e3fa93744.eagle
  Tests/tkt-84718e79fa.eagle
  Tests/tkt-8554170e09.eagle
  Tests/tkt-85b824b736.eagle
  Tests/tkt-8b7d179c3c.eagle
  Tests/tkt-8c3bee31c8.eagle
  Tests/tkt-8d928c3e88.eagle
  Tests/tkt-92dbf1229a.eagle
  Tests/tkt-996d13cd87.eagle
  Tests/tkt-9ba9346f75.eagle
  Tests/tkt-a7d04fb111.eagle
  Tests/tkt-aba4549801.eagle
  Tests/tkt-ac47dd230a.eagle
  Tests/tkt-ae5267b863.eagle
  Tests/tkt-b4a7ddc83f.eagle
Changes to System.Data.SQLite/SQLiteDataReader.cs.
888
889
890
891
892
893
894


895
896


897
898
899
900
901
902



























903
904
905
906
907
908
909
            string databaseName = sql.ColumnDatabaseName(stmt, n);
            string tableName = sql.ColumnTableName(stmt, n);
            string columnName = sql.ColumnOriginalName(stmt, n);

            ColumnParent key = new ColumnParent(databaseName, tableName, null);
            ColumnParent value = new ColumnParent(databaseName, tableName, columnName);



            if (!parentToColumns.ContainsKey(key))
                parentToColumns.Add(key, new List<int>(new int[] { n }));


            else
                parentToColumns[key].Add(n);

            columnToParent.Add(n, value);
        }
    }




























    internal DataTable GetSchemaTable(bool wantUniqueInfo, bool wantDefaultValue)
    {
      CheckClosed();
      if (_throwOnDisposed) SQLiteCommand.Check(_command);

      //







>
>
|

>
>

|




>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
            string databaseName = sql.ColumnDatabaseName(stmt, n);
            string tableName = sql.ColumnTableName(stmt, n);
            string columnName = sql.ColumnOriginalName(stmt, n);

            ColumnParent key = new ColumnParent(databaseName, tableName, null);
            ColumnParent value = new ColumnParent(databaseName, tableName, columnName);

            List<int> indexList;

            if (!parentToColumns.TryGetValue(key, out indexList))
                parentToColumns.Add(key, new List<int>(new int[] { n }));
            else if (indexList != null)
                indexList.Add(n);
            else
                parentToColumns[key] = new List<int>(new int[] { n });

            columnToParent.Add(n, value);
        }
    }

    ///////////////////////////////////////////////////////////////////////////

    private static int CountParents(
        Dictionary<ColumnParent, List<int>> parentToColumns
        )
    {
        int result = 0;

        if (parentToColumns != null)
        {
            foreach (ColumnParent key in parentToColumns.Keys)
            {
                if (key == null)
                    continue;

                if (String.IsNullOrEmpty(key.TableName))
                    continue;

                result++;
            }
        }

        return result;
    }

    ///////////////////////////////////////////////////////////////////////////

    internal DataTable GetSchemaTable(bool wantUniqueInfo, bool wantDefaultValue)
    {
      CheckClosed();
      if (_throwOnDisposed) SQLiteCommand.Check(_command);

      //
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
            (string)row[SchemaTableOptionalColumn.BaseCatalogName],
            (string)row[SchemaTableColumn.BaseTableName],
            strColumn,
            ref dataType, ref collSeq, ref bNotNull, ref bPrimaryKey, ref bAutoIncrement);

          if (bNotNull || bPrimaryKey) row[SchemaTableColumn.AllowDBNull] = false;

          row[SchemaTableColumn.IsKey] = bPrimaryKey && parentToColumns.Count <= 1;
          row[SchemaTableOptionalColumn.IsAutoIncrement] = bAutoIncrement;
          row["CollationType"] = collSeq;

          // For types like varchar(50) and such, extract the size
          arSize = dataType.Split('(');
          if (arSize.Length > 1)
          {







|







1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
            (string)row[SchemaTableOptionalColumn.BaseCatalogName],
            (string)row[SchemaTableColumn.BaseTableName],
            strColumn,
            ref dataType, ref collSeq, ref bNotNull, ref bPrimaryKey, ref bAutoIncrement);

          if (bNotNull || bPrimaryKey) row[SchemaTableColumn.AllowDBNull] = false;

          row[SchemaTableColumn.IsKey] = bPrimaryKey && CountParents(parentToColumns) <= 1;
          row[SchemaTableOptionalColumn.IsAutoIncrement] = bAutoIncrement;
          row["CollationType"] = collSeq;

          // For types like varchar(50) and such, extract the size
          arSize = dataType.Split('(');
          if (arSize.Length > 1)
          {
Added Tests/tkt-92dbf1229a.eagle.






















































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
###############################################################################
#
# tkt-92dbf1229a.eagle --
#
# Written by Joe Mistachkin.
# Released to the public domain, use at your own risk!
#
###############################################################################

package require Eagle
package require Eagle.Library
package require Eagle.Test

runTestPrologue

###############################################################################

package require System.Data.SQLite.Test
runSQLiteTestPrologue

###############################################################################

runTest {test tkt-92dbf1229a-1.1 {GetSchemaTable w/non-table columns} -setup {
  setupDb [set fileName tkt-92dbf1229a-1.1.db]
} -body {
  sql execute $db {
    CREATE TABLE t1(x INTEGER, y INTEGER, z TEXT, PRIMARY KEY(x, y));
  }

  set dataReader [sql execute -execute reader -format datareader \
      -alias $db "SELECT x, y, NULL AS w, z FROM t1;"]

  set dataTable [$dataReader -alias GetSchemaTable]
  set result [list]

  foreach row [getRowsFromDataTable $dataTable] {
    foreach column $row {
      if {[lindex $column 0] in [list ColumnName IsKey]} then {
        lappend result $column
      }
    }
  }

  set result
} -cleanup {
  unset -nocomplain dataTable dataReader

  cleanupDb $fileName

  unset -nocomplain column row result dataReader db fileName
} -constraints \
{eagle monoBug28 command.sql compile.DATA SQLite System.Data.SQLite} -result \
{{ColumnName x} {IsKey True} {ColumnName y} {IsKey True} {ColumnName w} {IsKey\
False} {ColumnName z} {IsKey False}}}

###############################################################################

runSQLiteTestEpilogue
runTestEpilogue
Changes to readme.htm.
209
210
211
212
213
214
215

216
217
218
219
220
221
222
<h2><b>Version History</b></h2>

<p>
    <b>1.0.96.0 - May XX, 2015 <font color="red">(release scheduled)</font></b>
</p>
<ul>
    <li>Prevent the IDataReader.GetOrdinal method from throwing &quot;No current row&quot; exceptions. Fix for [c28d7fe915].</li>

</ul>
<p>
    <b>1.0.95.0 - March 2, 2015</b>
</p>
<ul>
    <li>Updated to <a href="https://www.sqlite.org/releaselog/3_8_8_3.html">SQLite 3.8.8.3</a>.</li>
    <li>Updated to <a href="https://www.nuget.org/packages/EntityFramework/6.1.2">Entity Framework 6.1.2</a>.</li>







>







209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
<h2><b>Version History</b></h2>

<p>
    <b>1.0.96.0 - May XX, 2015 <font color="red">(release scheduled)</font></b>
</p>
<ul>
    <li>Prevent the IDataReader.GetOrdinal method from throwing &quot;No current row&quot; exceptions. Fix for [c28d7fe915].</li>
    <li>When counting the number of tables in the GetSchemaTable method, do not include those that have a null or empty name. Fix for [92dbf1229a].</li>
</ul>
<p>
    <b>1.0.95.0 - March 2, 2015</b>
</p>
<ul>
    <li>Updated to <a href="https://www.sqlite.org/releaselog/3_8_8_3.html">SQLite 3.8.8.3</a>.</li>
    <li>Updated to <a href="https://www.nuget.org/packages/EntityFramework/6.1.2">Entity Framework 6.1.2</a>.</li>
Changes to www/news.wiki.
1
2
3
4
5
6
7
8
9

10
11
12
13
14
15
16
<title>News</title>

<b>Version History</b>

<p>
    <b>1.0.96.0 - May XX, 2015 <font color="red">(release scheduled)</font></b>
</p>
<ul>
    <li>Prevent the IDataReader.GetOrdinal method from throwing &quot;No current row&quot; exceptions. Fix for [c28d7fe915].</li>

</ul>
<p>
    <b>1.0.95.0 - March 2, 2015</b>
</p>
<ul>
    <li>Updated to [https://www.sqlite.org/releaselog/3_8_8_3.html|SQLite 3.8.8.3].</li>
    <li>Updated to [https://www.nuget.org/packages/EntityFramework/6.1.2|Entity Framework 6.1.2].</li>









>







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
<title>News</title>

<b>Version History</b>

<p>
    <b>1.0.96.0 - May XX, 2015 <font color="red">(release scheduled)</font></b>
</p>
<ul>
    <li>Prevent the IDataReader.GetOrdinal method from throwing &quot;No current row&quot; exceptions. Fix for [c28d7fe915].</li>
    <li>When counting the number of tables in the GetSchemaTable method, do not include those that have a null or empty name. Fix for [92dbf1229a].</li>
</ul>
<p>
    <b>1.0.95.0 - March 2, 2015</b>
</p>
<ul>
    <li>Updated to [https://www.sqlite.org/releaselog/3_8_8_3.html|SQLite 3.8.8.3].</li>
    <li>Updated to [https://www.nuget.org/packages/EntityFramework/6.1.2|Entity Framework 6.1.2].</li>