System.Data.SQLite
Check-in [59bbbbfcdb]
Not logged in

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

Overview
Comment:Add StickyHasRows connection flag to cause the SQLiteDataReader.HasRows property to return non-zero if there were ever any rows in the associated result sets.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | stickyHasRows
Files: files | file ages | folders
SHA1: 59bbbbfcdb6304f3c9388f4013f178a73176b9bd
User & Date: mistachkin 2014-03-14 20:20:47
Context
2014-03-18
23:12
Add StickyHasRows connection flag to cause the SQLiteDataReader.HasRows property to return non-zero if there were ever any rows in the associated result sets. check-in: baf17cba3c user: mistachkin tags: trunk
2014-03-14
20:20
Add StickyHasRows connection flag to cause the SQLiteDataReader.HasRows property to return non-zero if there were ever any rows in the associated result sets. Closed-Leaf check-in: 59bbbbfcdb user: mistachkin tags: stickyHasRows
2014-03-12
22:56
Add the SQLiteDataReader.StepCount property to return the number of rows seen so far. check-in: a31cac5d59 user: mistachkin tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to Doc/Extra/Provider/version.html.

    45     45       <h1 class="heading">Version History</h1>
    46     46       <p><b>1.0.92.0 - March XX, 2014 <font color="red">(release scheduled)</font></b></p>
    47     47       <ul>
    48     48         <li>Updated to <a href="http://www.sqlite.org/releaselog/3_8_4_1.html">SQLite 3.8.4.1</a>.</li>
    49     49         <li>Update the list of keywords returned by SQLiteConnection.GetSchema(&quot;ReservedWords&quot;).&nbsp;<b>** Potentially Incompatible Change **</b></li>
    50     50         <li>Raise the static SQLiteConnection.Changed event when any SQLiteCommand or SQLiteDataReader object is closed or disposed.</li>
    51     51         <li>Add the SQLiteDataReader.StepCount property to return the number of rows seen so far.</li>
           52  +      <li>Add StickyHasRows connection flag to cause the SQLiteDataReader.HasRows property to return non-zero if there were ever any rows in the associated result sets.</li>
    52     53         <li>When the TraceWarning connection flag is set, issue warnings about possibly malformed UNC paths. Pursuant to <a href="http://system.data.sqlite.org/index.html/info/283344397b">[283344397b]</a>.</li>
    53     54         <li>Convert the primary NuGet package, &quot;System.Data.SQLite&quot;, into a meta-package.</li>
    54     55         <li>Enhancements to the NuGet packages, including the new &quot;modular&quot; packages.</li>
    55     56       </ul>
    56     57       <p><b>1.0.91.0 - February 12, 2014</b></p>
    57     58       <ul>
    58     59         <li>Updated to <a href="http://www.sqlite.org/releaselog/3_8_3_1.html">SQLite 3.8.3.1</a>.</li>

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

  1030   1030         /// cases; however, if there are no per-connection type mappings, the
  1031   1031         /// fallback defaults will be used for both type names and their
  1032   1032         /// associated <see cref="DbType" /> values.  Therefore, use of this flag
  1033   1033         /// is not recommended.
  1034   1034         /// </summary>
  1035   1035         NoGlobalTypes = 0x200000,
  1036   1036   
         1037  +      /// <summary>
         1038  +      /// When the <see cref="SQLiteDataReader.HasRows" /> property is used, it
         1039  +      /// should return non-zero if there were ever any rows in the associated
         1040  +      /// result sets.
         1041  +      /// </summary>
         1042  +      StickyHasRows = 0x400000,
         1043  +
  1037   1044         /// <summary>
  1038   1045         /// When binding parameter values or returning column values, always
  1039   1046         /// treat them as though they were plain text (i.e. no numeric,
  1040   1047         /// date/time, or other conversions should be attempted).
  1041   1048         /// </summary>
  1042   1049         BindAndGetAllAsText = BindAllAsText | GetAllAsText,
  1043   1050   

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

  1195   1195       /// </summary>
  1196   1196       public override bool HasRows
  1197   1197       {
  1198   1198         get
  1199   1199         {
  1200   1200           CheckDisposed();
  1201   1201           CheckClosed();
         1202  +
         1203  +        //
         1204  +        // NOTE: If the "sticky" flag has been set, use the new behavior,
         1205  +        //       which returns non-zero if there were ever any rows in
         1206  +        //       the associated result sets.  Generally, this flag is only
         1207  +        //       useful when it is necessary to retain compatibility with
         1208  +        //       other ADO.NET providers that use these same semantics for
         1209  +        //       the HasRows property.
         1210  +        //
         1211  +        if ((GetFlags(this) & SQLiteConnectionFlags.StickyHasRows) == SQLiteConnectionFlags.StickyHasRows)
         1212  +          return ((_readingState != 1) || (_stepCount > 0));
         1213  +
         1214  +        //
         1215  +        // NOTE: This is the default behavior.  It returns non-zero only if
         1216  +        //       more rows are available (i.e. a call to the Read method is
         1217  +        //       expected to succeed).  Prior to the introduction of the
         1218  +        //       "sticky" flag, this is how this property has always worked.
         1219  +        //
  1202   1220           return (_readingState != 1);
  1203   1221         }
  1204   1222       }
  1205   1223   
  1206   1224       /// <summary>
  1207   1225       /// Returns True if the data reader is closed
  1208   1226       /// </summary>

Changes to Tests/basic.eagle.

  3009   3009   {eagle monoBug28 command.sql compile.DATA SQLite System.Data.SQLite} -result \
  3010   3010   {False True True False True True False True True 1 True 0 False 0 False False\
  3011   3011   True True False False True False False True 1 True 1 True 0 False False False\
  3012   3012   True False False False False False False 1 True 1 True 1 True}}
  3013   3013   
  3014   3014   ###############################################################################
  3015   3015   
  3016         -runTest {test data-1.64 {SQLiteDataReader StepCount property} -setup {
  3017         -  setupDb [set fileName data-1.64.db]
         3016  +runTest {test data-1.64 {SQLiteDataReader sticky HasRows property} -setup {
         3017  +  setupDb [set fileName data-1.64.db] "" "" "" StickyHasRows
         3018  +} -body {
         3019  +  sql execute $db {
         3020  +    CREATE TABLE t1(x);
         3021  +    CREATE TABLE t2(x);
         3022  +    INSERT INTO t2 (x) VALUES(1);
         3023  +    CREATE TABLE t3(x);
         3024  +    INSERT INTO t3 (x) VALUES(1);
         3025  +    INSERT INTO t3 (x) VALUES(2);
         3026  +  }
         3027  +
         3028  +  set reader(1) [sql execute -execute reader -format datareader -alias \
         3029  +      $db "SELECT * FROM t1;"]
         3030  +
         3031  +  set reader(2) [sql execute -execute reader -format datareader -alias \
         3032  +      $db "SELECT * FROM t2;"]
         3033  +
         3034  +  set reader(3) [sql execute -execute reader -format datareader -alias \
         3035  +      $db "SELECT * FROM t3;"]
         3036  +
         3037  +  set noRow "*: No current row*"
         3038  +
         3039  +  list [$reader(1) HasRows] [$reader(2) HasRows] [$reader(3) HasRows] \
         3040  +      [$reader(1) Read] [$reader(2) Read] [$reader(3) Read] \
         3041  +      [$reader(1) HasRows] [$reader(2) HasRows] [$reader(3) HasRows] \
         3042  +      [catch {$reader(1) Item x} error] [string match $noRow $error] \
         3043  +      [catch {$reader(2) Item x} error] [string match $noRow $error] \
         3044  +      [catch {$reader(3) Item x} error] [string match $noRow $error] \
         3045  +      [$reader(1) HasRows] [$reader(2) HasRows] [$reader(3) HasRows] \
         3046  +      [$reader(1) Read] [$reader(2) Read] [$reader(3) Read] \
         3047  +      [$reader(1) HasRows] [$reader(2) HasRows] [$reader(3) HasRows] \
         3048  +      [catch {$reader(1) Item x} error] [string match $noRow $error] \
         3049  +      [catch {$reader(2) Item x} error] [string match $noRow $error] \
         3050  +      [catch {$reader(3) Item x} error] [string match $noRow $error] \
         3051  +      [$reader(1) HasRows] [$reader(2) HasRows] [$reader(3) HasRows] \
         3052  +      [$reader(1) Read] [$reader(2) Read] [$reader(3) Read] \
         3053  +      [$reader(1) HasRows] [$reader(2) HasRows] [$reader(3) HasRows] \
         3054  +      [catch {$reader(1) Item x} error] [string match $noRow $error] \
         3055  +      [catch {$reader(2) Item x} error] [string match $noRow $error] \
         3056  +      [catch {$reader(3) Item x} error] [string match $noRow $error]
         3057  +} -cleanup {
         3058  +  unset -nocomplain reader
         3059  +
         3060  +  cleanupDb $fileName
         3061  +
         3062  +  unset -nocomplain error noRow db fileName
         3063  +} -constraints \
         3064  +{eagle monoBug28 command.sql compile.DATA SQLite System.Data.SQLite} -result \
         3065  +{False True True False True True False True True 1 True 0 False 0 False False\
         3066  +True True False False True False True True 1 True 1 True 0 False False True\
         3067  +True False False False False True True 1 True 1 True 1 True}}
         3068  +
         3069  +###############################################################################
         3070  +
         3071  +runTest {test data-1.65 {SQLiteDataReader StepCount property} -setup {
         3072  +  setupDb [set fileName data-1.65.db]
  3018   3073   } -body {
  3019   3074     sql execute $db {
  3020   3075       CREATE TABLE t1(x);
  3021   3076       CREATE TABLE t2(x);
  3022   3077       INSERT INTO t2 (x) VALUES(1);
  3023   3078       CREATE TABLE t3(x);
  3024   3079       INSERT INTO t3 (x) VALUES(1);

Changes to readme.htm.

   212    212       <b>1.0.92.0 - March XX, 2014 <font color="red">(release scheduled)</font></b>
   213    213   </p>
   214    214   <ul>
   215    215       <li>Updated to <a href="http://www.sqlite.org/releaselog/3_8_4_1.html">SQLite 3.8.4.1</a>.</li>
   216    216       <li>Update the list of keywords returned by SQLiteConnection.GetSchema(&quot;ReservedWords&quot;).&nbsp;<b>** Potentially Incompatible Change **</b></li>
   217    217       <li>Raise the static SQLiteConnection.Changed event when any SQLiteCommand or SQLiteDataReader object is closed or disposed.</li>
   218    218       <li>Add the SQLiteDataReader.StepCount property to return the number of rows seen so far.</li>
          219  +    <li>Add StickyHasRows connection flag to cause the SQLiteDataReader.HasRows property to return non-zero if there were ever any rows in the associated result sets.</li>
   219    220       <li>When the TraceWarning connection flag is set, issue warnings about possibly malformed UNC paths. Pursuant to [283344397b].</li>
   220    221       <li>Convert the primary NuGet package, &quot;System.Data.SQLite&quot;, into a meta-package.</li>
   221    222       <li>Enhancements to the NuGet packages, including the new &quot;modular&quot; packages.</li>
   222    223   </ul>
   223    224   <p>
   224    225       <b>1.0.91.0 - February 12, 2014</b>
   225    226   </p>

Changes to www/news.wiki.

     6      6       <b>1.0.92.0 - March XX, 2014 <font color="red">(release scheduled)</font></b>
     7      7   </p>
     8      8   <ul>
     9      9       <li>Updated to <a href="http://www.sqlite.org/releaselog/3_8_4_1.html">SQLite 3.8.4.1</a>.</li>
    10     10       <li>Update the list of keywords returned by SQLiteConnection.GetSchema(&quot;ReservedWords&quot;).&nbsp;<b>** Potentially Incompatible Change **</b></li>
    11     11       <li>Raise the static SQLiteConnection.Changed event when any SQLiteCommand or SQLiteDataReader object is closed or disposed.</li>
    12     12       <li>Add the SQLiteDataReader.StepCount property to return the number of rows seen so far.</li>
           13  +    <li>Add StickyHasRows connection flag to cause the SQLiteDataReader.HasRows property to return non-zero if there were ever any rows in the associated result sets.</li>
    13     14       <li>When the TraceWarning connection flag is set, issue warnings about possibly malformed UNC paths. Pursuant to [283344397b].</li>
    14     15       <li>Convert the primary NuGet package, &quot;System.Data.SQLite&quot;, into a meta-package.</li>
    15     16       <li>Enhancements to the NuGet packages, including the new &quot;modular&quot; packages.</li>
    16     17   </ul>
    17     18   <p>
    18     19       <b>1.0.91.0 - February 12, 2014</b>
    19     20   </p>