System.Data.SQLite
Check-in [8d0c39afd2]
Not logged in

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

Overview
Comment:Modify the index introspection code so that it does not treat PRAGMA table_info 'pk' column values as boolean. Fix for [f2c47a01eb].
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 8d0c39afd29b2c864e062ab43bd1682e0beac35a
User & Date: mistachkin 2013-06-26 23:50:27
References
2013-06-26
23:53 Closed ticket [f2c47a01eb]: PK indexes of compount keys are not tagged as PK. plus 5 other changes artifact: 0363d640b3 user: mistachkin
Context
2013-06-26
23:52
Fix typo. check-in: 814c7ebe55 user: mistachkin tags: trunk
23:50
Modify the index introspection code so that it does not treat PRAGMA table_info 'pk' column values as boolean. Fix for [f2c47a01eb]. check-in: 8d0c39afd2 user: mistachkin tags: trunk
18:17
Add an example to the SQLiteModuleEnumerable class doc comments. check-in: e539f17af4 user: mistachkin tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to Doc/Extra/version.html.

    44     44       <div id="mainBody">
    45     45       <h1 class="heading">Version History</h1>
    46     46       <p><b>1.0.87.0 - June XX, 2013 <font color="red">(release scheduled)</font></b></p>
    47     47       <ul>
    48     48         <li>Add all the necessary infrastructure to allow virtual tables to be implemented in managed code. Fix for <a href="http://system.data.sqlite.org/index.html/info/9a544991be">[9a544991be]</a>.</li>
    49     49         <li>The DbType to type name translation needs to prioritize the Entity Framework type names. Fix for <a href="http://system.data.sqlite.org/index.html/info/47f4bac575">[47f4bac575]</a>.</li>
    50     50         <li>Add DateTimeFormatString connection string property to allow the DateTime format string used for all parsing and formatting to be overridden.</li>
           51  +      <li>Modify the index introspection code so that it does not treat PRAGMA table_info &quot;pk&quot; column values as boolean. Fix for <a href="http://system.data.sqlite.org/index.html/info/f2c47a01eb">[f2c47a01eb]</a>.</li>
    51     52         <li>Disable use of the new connection string parsing algorithm when the No_SQLiteConnectionNewParser environment variable is set. Pursuant to <a href="http://system.data.sqlite.org/index.html/info/bbdda6eae2">[bbdda6eae2]</a>.</li>
    52     53         <li>Rename the ReturnCode property of the SQLiteException class to ResultCode.&nbsp;<b>** Potentially Incompatible Change **</b></li>
    53     54       </ul>
    54     55       <p><b>1.0.86.0 - May 23, 2013</b></p>
    55     56       <ul>
    56     57         <li>Updated to <a href="http://www.sqlite.org/releaselog/3_7_17.html">SQLite 3.7.17</a>.</li>
    57     58         <li>Disable use of the AllowPartiallyTrustedCallers attribute when compiled for the .NET Framework 4.0/4.5.&nbsp;<b>** Potentially Incompatible Change **</b></li>

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

  3044   3044               try
  3045   3045               {
  3046   3046                 using (SQLiteCommand cmdTable = new SQLiteCommand(String.Format(CultureInfo.InvariantCulture, "PRAGMA [{0}].table_info([{1}])", strCatalog, rdTables.GetString(2)), this))
  3047   3047                 using (SQLiteDataReader rdTable = cmdTable.ExecuteReader())
  3048   3048                 {
  3049   3049                   while (rdTable.Read())
  3050   3050                   {
  3051         -                  if (rdTable.GetInt32(5) == 1)
         3051  +                  if (rdTable.GetInt32(5) != 0)
  3052   3052                     {
  3053   3053                       primaryKeys.Add(rdTable.GetInt32(0));
  3054   3054   
  3055   3055                       // If the primary key is of type INTEGER, then its a rowid and we need to make a fake index entry for it.
  3056   3056                       if (String.Compare(rdTable.GetString(2), "INTEGER", StringComparison.OrdinalIgnoreCase) == 0)
  3057   3057                         maybeRowId = true;
  3058   3058                     }

Added Tests/tkt-f2c47a01eb.eagle.

            1  +###############################################################################
            2  +#
            3  +# tkt-f2c47a01eb.eagle --
            4  +#
            5  +# Written by Joe Mistachkin.
            6  +# Released to the public domain, use at your own risk!
            7  +#
            8  +###############################################################################
            9  +
           10  +package require Eagle
           11  +package require Eagle.Library
           12  +package require Eagle.Test
           13  +
           14  +runTestPrologue
           15  +
           16  +###############################################################################
           17  +
           18  +package require System.Data.SQLite.Test
           19  +runSQLiteTestPrologue
           20  +
           21  +###############################################################################
           22  +
           23  +runTest {test tkt-f2c47a01eb-1.1 {GetSchema w/INDEXES, PK} -setup {
           24  +  setupDb [set fileName tkt-f2c47a01eb-1.1.db]
           25  +} -body {
           26  +  set connection [getDbConnection]
           27  +
           28  +  sql execute $db "CREATE TABLE t1(x TEXT PRIMARY KEY, y TEXT);"
           29  +  sql execute $db "CREATE INDEX t1_1 ON t1(x, y);"
           30  +  sql execute $db "CREATE UNIQUE INDEX t1_2 ON t1(x, y);"
           31  +
           32  +  set dataTable [$connection -alias GetSchema INDEXES]
           33  +  set results [list]
           34  +
           35  +  object foreach -alias dataRow [set dataRows [$dataTable -alias Rows]] {
           36  +    lappend results [list [$dataRow Item TABLE_NAME] \
           37  +        [$dataRow Item INDEX_NAME] [$dataRow Item PRIMARY_KEY]]
           38  +  }
           39  +
           40  +  set results
           41  +} -cleanup {
           42  +  cleanupDb $fileName
           43  +
           44  +  freeDbConnection
           45  +
           46  +  unset -nocomplain dataRow dataRows dataTable results connection db fileName
           47  +} -constraints \
           48  +{eagle monoBug28 command.sql compile.DATA SQLite System.Data.SQLite} \
           49  +-result {{t1 t1_2 False} {t1 t1_1 False} {t1 sqlite_autoindex_t1_1 True}}}
           50  +
           51  +###############################################################################
           52  +
           53  +runTest {test tkt-f2c47a01eb-1.2 {GetSchema w/INDEXES, composite PK} -setup {
           54  +  setupDb [set fileName tkt-f2c47a01eb-1.2.db]
           55  +} -body {
           56  +  set connection [getDbConnection]
           57  +
           58  +  sql execute $db "CREATE TABLE t1(x TEXT, y TEXT, PRIMARY KEY(x, y));"
           59  +  sql execute $db "CREATE INDEX t1_1 ON t1(x, y);"
           60  +  sql execute $db "CREATE UNIQUE INDEX t1_2 ON t1(x, y);"
           61  +
           62  +  set dataTable [$connection -alias GetSchema INDEXES]
           63  +  set results [list]
           64  +
           65  +  object foreach -alias dataRow [set dataRows [$dataTable -alias Rows]] {
           66  +    lappend results [list [$dataRow Item TABLE_NAME] \
           67  +        [$dataRow Item INDEX_NAME] [$dataRow Item PRIMARY_KEY]]
           68  +  }
           69  +
           70  +  set results
           71  +} -cleanup {
           72  +  cleanupDb $fileName
           73  +
           74  +  freeDbConnection
           75  +
           76  +  unset -nocomplain dataRow dataRows dataTable results connection db fileName
           77  +} -constraints \
           78  +{eagle monoBug28 command.sql compile.DATA SQLite System.Data.SQLite} \
           79  +-result {{t1 t1_2 False} {t1 t1_1 False} {t1 sqlite_autoindex_t1_1 True}}}
           80  +
           81  +###############################################################################
           82  +
           83  +runSQLiteTestEpilogue
           84  +runTestEpilogue

Changes to readme.htm.

   189    189   <p>
   190    190       <b>1.0.87.0 - June XX, 2013 <font color="red">(release scheduled)</font></b>
   191    191   </p>
   192    192   <ul>
   193    193       <li>Add all the necessary infrastructure to allow virtual tables to be implemented in managed code. Fix for [9a544991be].</li>
   194    194       <li>The DbType to type name translation needs to prioritize the Entity Framework type names. Fix for [47f4bac575].</li>
   195    195       <li>Add DateTimeFormatString connection string property to allow the DateTime format string used for all parsing and formatting to be overridden.</li>
          196  +    <li>Modify the index introspection code so that it does not treat PRAGMA table_info &quot;pk&quot; column values as boolean. Fix for [f2c47a01eb].</li>
   196    197       <li>Disable use of the new connection string parsing algorithm when the No_SQLiteConnectionNewParser environment variable is set. Pursuant to [bbdda6eae2].</li>
   197    198       <li>Rename the ReturnCode property of the SQLiteException class to ResultCode.&nbsp;<b>** Potentially Incompatible Change **</b></li>
   198    199   </ul>
   199    200   <p>
   200    201       <b>1.0.86.0 - May 23, 2013</b>
   201    202   </p>
   202    203   <ul>

Changes to www/news.wiki.

     5      5   <p>
     6      6       <b>1.0.87.0 - June XX, 2013 <font color="red">(release scheduled)</font></b>
     7      7   </p>
     8      8   <ul>
     9      9       <li>Add all the necessary infrastructure to allow virtual tables to be implemented in managed code. Fix for [9a544991be].</li>
    10     10       <li>The DbType to type name translation needs to prioritize the Entity Framework type names. Fix for [47f4bac575].</li>
    11     11       <li>Add DateTimeFormatString connection string property to allow the DateTime format string used for all parsing and formatting to be overridden.</li>
           12  +    <li>Modify the index introspection code so that it does not treat PRAGMA table_info 'pk' column values as boolean. Fix for [f2c47a01eb].</li>
    12     13       <li>Disable use of the new connection string parsing algorithm when the No_SQLiteConnectionNewParser environment variable is set. Pursuant to [bbdda6eae2].</li>
    13     14       <li>Rename the ReturnCode property of the SQLiteException class to ResultCode.&nbsp;<b>** Potentially Incompatible Change **</b></li>
    14     15   </ul>
    15     16   <p>
    16     17       <b>1.0.86.0 - May 23, 2013</b>
    17     18   </p>
    18     19   <ul>