System.Data.SQLite
Check-in [36669ce629]
Not logged in

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

Overview
Comment:Add VerifyOnly method to the SQLiteCommand class.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 36669ce6295798d319316c3bbffe324a0dd4654c
User & Date: mistachkin 2016-06-02 19:35:33
Context
2016-06-03
17:40
Update list of SQLite core library return codes. check-in: 3f4f0cf495 user: mistachkin tags: trunk
2016-06-02
19:35
Add VerifyOnly method to the SQLiteCommand class. check-in: 36669ce629 user: mistachkin tags: trunk
2016-05-26
18:19
Handle parameter binding for boolean values using a new internal method. Consistently enable LogBind flag support for the .NET Compact Framework. check-in: d38c8328d0 user: mistachkin tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

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

43
44
45
46
47
48
49

50
51
52
53
54
55
56
    <div id="mainSection">
    <div id="mainBody">
    <h1 class="heading">Version History</h1>
    <p><b>1.0.102.0 - June XX, 2016 <font color="red">(release scheduled)</font></b></p>
    <ul>
      <li>Updated to <a href="https://www.sqlite.org/releaselog/3_13_0.html">SQLite 3.13.0</a>.</li>
      <li>Update the SQLiteConnection.EnableExtensions method to make use of the new SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION option, when available.&nbsp;<b>** Potentially Incompatible Change **</b></li>

    </ul>
    <p><b>1.0.101.0 - April 19, 2016</b></p>
    <ul>
      <li>Updated to <a href="https://www.sqlite.org/releaselog/3_12_2.html">SQLite 3.12.2</a>.</li>
      <li>Add binary package release for Mono on POSIX.</li>
    </ul>
    <p><b>1.0.100.0 - April 15, 2016</b></p>







>







43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
    <div id="mainSection">
    <div id="mainBody">
    <h1 class="heading">Version History</h1>
    <p><b>1.0.102.0 - June XX, 2016 <font color="red">(release scheduled)</font></b></p>
    <ul>
      <li>Updated to <a href="https://www.sqlite.org/releaselog/3_13_0.html">SQLite 3.13.0</a>.</li>
      <li>Update the SQLiteConnection.EnableExtensions method to make use of the new SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION option, when available.&nbsp;<b>** Potentially Incompatible Change **</b></li>
      <li>Add VerifyOnly method to the SQLiteCommand class.</li>
    </ul>
    <p><b>1.0.101.0 - April 19, 2016</b></p>
    <ul>
      <li>Updated to <a href="https://www.sqlite.org/releaselog/3_12_2.html">SQLite 3.12.2</a>.</li>
      <li>Add binary package release for Mono on POSIX.</li>
    </ul>
    <p><b>1.0.100.0 - April 15, 2016</b></p>

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

629
630
631
632
633
634
635






































































636
637
638
639
640
641
642
        return Transaction;
      }
      set
      {
        Transaction = (SQLiteTransaction)value;
      }
    }







































































    /// <summary>
    /// This function ensures there are no active readers, that we have a valid connection,
    /// that the connection is open, that all statements are prepared and all parameters are assigned
    /// in preparation for allocating a data reader.
    /// </summary>
    private void InitializeForReader()







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







629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
        return Transaction;
      }
      set
      {
        Transaction = (SQLiteTransaction)value;
      }
    }

    /// <summary>
    /// Verifies that all SQL queries associated with the current command text
    /// can be successfully compiled.  A <see cref="SQLiteException" /> will be
    /// raised if any errors occur.
    /// </summary>
    public void VerifyOnly()
    {
        CheckDisposed();

        SQLiteConnection connection = _cnn;
        SQLiteConnection.Check(connection); /* throw */
        SQLiteBase sqlBase = connection._sql;

        if ((connection == null) || (sqlBase == null))
            throw new SQLiteException("invalid or unusable connection");

        List<SQLiteStatement> statements = null;
        SQLiteStatement currentStatement = null;

        try
        {
            string text = _commandText;
            uint timeout = (uint)(_commandTimeout * 1000);
            SQLiteStatement previousStatement = null;

            while ((text != null) && (text.Length > 0))
            {
                currentStatement = sqlBase.Prepare(
                    connection, text, previousStatement, timeout,
                    ref text); /* throw */

                previousStatement = currentStatement;

                if (currentStatement != null)
                {
                    if (statements == null)
                        statements = new List<SQLiteStatement>();

                    statements.Add(currentStatement);
                    currentStatement = null;
                }

                if (text == null) continue;
                text = text.Trim();
            }
        }
        finally
        {
            if (currentStatement != null)
            {
                currentStatement.Dispose();
                currentStatement = null;
            }

            if (statements != null)
            {
                foreach (SQLiteStatement statement in statements)
                {
                    if (statement == null)
                        continue;

                    statement.Dispose();
                }

                statements.Clear();
                statements = null;
            }
        }
    }

    /// <summary>
    /// This function ensures there are no active readers, that we have a valid connection,
    /// that the connection is open, that all statements are prepared and all parameters are assigned
    /// in preparation for allocating a data reader.
    /// </summary>
    private void InitializeForReader()

Changes to Tests/basic.eagle.

4079
4080
4081
4082
4083
4084
4085
4086
4087
4088

























































































4089
4090
4091
4092
4093
4094
4095
} -cleanup {
  cleanupDb $fileName

  unset -nocomplain result db fileName
} -constraints \
{eagle monoBug28 command.sql compile.DATA SQLite System.Data.SQLite} -result \
[list [getDbDefaultPageSize] -1 1 8192]}

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


























































































reportSQLiteResources $test_channel

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

runSQLiteTestFilesEpilogue
runSQLiteTestEpilogue
runTestEpilogue










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







4079
4080
4081
4082
4083
4084
4085
4086
4087
4088
4089
4090
4091
4092
4093
4094
4095
4096
4097
4098
4099
4100
4101
4102
4103
4104
4105
4106
4107
4108
4109
4110
4111
4112
4113
4114
4115
4116
4117
4118
4119
4120
4121
4122
4123
4124
4125
4126
4127
4128
4129
4130
4131
4132
4133
4134
4135
4136
4137
4138
4139
4140
4141
4142
4143
4144
4145
4146
4147
4148
4149
4150
4151
4152
4153
4154
4155
4156
4157
4158
4159
4160
4161
4162
4163
4164
4165
4166
4167
4168
4169
4170
4171
4172
4173
4174
4175
4176
4177
4178
4179
4180
4181
4182
4183
4184
} -cleanup {
  cleanupDb $fileName

  unset -nocomplain result db fileName
} -constraints \
{eagle monoBug28 command.sql compile.DATA SQLite System.Data.SQLite} -result \
[list [getDbDefaultPageSize] -1 1 8192]}

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

runTest {test data-1.81 {SQLiteCommand.VerifyOnly method} -setup {
  setupDb [set fileName data-1.81.db]
} -body {
  set connection [getDbConnection]

  sql execute $db {
    CREATE TABLE t1(x);
    INSERT INTO t1 (x) VALUES(1);
    INSERT INTO t1 (x) VALUES(2);
    INSERT INTO t1 (x) VALUES(3);
  }

  set command [$connection -alias CreateCommand]

  set code(1) [catch {
    $command CommandText null
    $command VerifyOnly
  } result(1)]

  set code(2) [catch {
    $command CommandText ""
    $command VerifyOnly
  } result(2)]

  set code(3) [catch {
    $command CommandText "SELECT * FROM t1;"
    $command VerifyOnly
  } result(3)]

  set code(4) [catch {
    $command CommandText "SELECT * FROM t2;"
    $command VerifyOnly; # throw
  } result(4)]

  set code(5) [catch {
    $command CommandText "BAD COMMAND;"
    $command VerifyOnly; # throw
  } result(5)]

  set code(6) [catch {
    $command CommandText "INSERT INTO t1 (x) VALUES(4); SELECT * FROM t1;"
    $command VerifyOnly
  } result(6)]

  set code(7) [catch {
    $command CommandText "INSERT INTO t1 (x) VALUES(5); SELECT * FROM t2;"
    $command VerifyOnly; # throw
  } result(7)]

  set code(8) [catch {
    $command CommandText "BAD COMMAND; INSERT INTO t1 (x) VALUES(6);"
    $command VerifyOnly; # throw
  } result(8)]

  set code(9) [catch {
    $command CommandText "SELECT * FROM t2; INSERT INTO t1 (x) VALUES(7);"
    $command VerifyOnly; # throw
  } result(9)]

  set result(10) [sql execute -execute reader -format list $db {
    SELECT * FROM t1 ORDER BY x;
  }]

  list $code(1) [extractSystemDataSQLiteExceptionMessage $result(1)] \
      $code(2) [extractSystemDataSQLiteExceptionMessage $result(2)] \
      $code(3) [extractSystemDataSQLiteExceptionMessage $result(3)] \
      $code(4) [extractSystemDataSQLiteExceptionMessage $result(4)] \
      $code(5) [extractSystemDataSQLiteExceptionMessage $result(5)] \
      $code(6) [extractSystemDataSQLiteExceptionMessage $result(6)] \
      $code(7) [extractSystemDataSQLiteExceptionMessage $result(7)] \
      $code(8) [extractSystemDataSQLiteExceptionMessage $result(8)] \
      $code(9) [extractSystemDataSQLiteExceptionMessage $result(9)] \
      $result(10)
} -cleanup {
  cleanupDb $fileName

  freeDbConnection

  unset -nocomplain result code command connection db fileName
} -constraints \
{eagle monoBug28 command.sql compile.DATA SQLite System.Data.SQLite} -result \
{0 {} 0 {} 0 {} 1 {SQL logic error or missing database -- no such table: t2} 1\
{SQL logic error or missing database -- near "BAD": syntax error} 0 {} 1 {SQL\
logic error or missing database -- no such table: t2} 1 {SQL logic error or\
missing database -- near "BAD": syntax error} 1 {SQL logic error or missing\
database -- no such table: t2} {1 2 3}}}

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

reportSQLiteResources $test_channel

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

runSQLiteTestFilesEpilogue
runSQLiteTestEpilogue
runTestEpilogue

Changes to readme.htm.

210
211
212
213
214
215
216

217
218
219
220
221
222
223

<p>
    <b>1.0.102.0 - June XX, 2016 <font color="red">(release scheduled)</font></b>
</p>
<ul>
    <li>Updated to <a href="https://www.sqlite.org/releaselog/3_13_0.html">SQLite 3.13.0</a>.</li>
    <li>Update the SQLiteConnection.EnableExtensions method to make use of the new SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION option, when available.&nbsp;<b>** Potentially Incompatible Change **</b></li>

</ul>
<p>
    <b>1.0.101.0 - April 19, 2016</b>
</p>
<ul>
    <li>Updated to <a href="https://www.sqlite.org/releaselog/3_12_2.html">SQLite 3.12.2</a>.</li>
    <li>Add binary package release for Mono on POSIX.</li>







>







210
211
212
213
214
215
216
217
218
219
220
221
222
223
224

<p>
    <b>1.0.102.0 - June XX, 2016 <font color="red">(release scheduled)</font></b>
</p>
<ul>
    <li>Updated to <a href="https://www.sqlite.org/releaselog/3_13_0.html">SQLite 3.13.0</a>.</li>
    <li>Update the SQLiteConnection.EnableExtensions method to make use of the new SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION option, when available.&nbsp;<b>** Potentially Incompatible Change **</b></li>
    <li>Add VerifyOnly method to the SQLiteCommand class.</li>
</ul>
<p>
    <b>1.0.101.0 - April 19, 2016</b>
</p>
<ul>
    <li>Updated to <a href="https://www.sqlite.org/releaselog/3_12_2.html">SQLite 3.12.2</a>.</li>
    <li>Add binary package release for Mono on POSIX.</li>

Changes to www/news.wiki.

4
5
6
7
8
9
10

11
12
13
14
15
16
17

<p>
    <b>1.0.102.0 - June XX, 2016 <font color="red">(release scheduled)</font></b>
</p>
<ul>
    <li>Updated to [https://www.sqlite.org/releaselog/3_13_0.html|SQLite 3.13.0].</li>
    <li>Update the SQLiteConnection.EnableExtensions method to make use of the new SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION option, when available.&nbsp;<b>** Potentially Incompatible Change **</b></li>

</ul>
<p>
    <b>1.0.101.0 - April 19, 2016</b>
</p>
<ul>
    <li>Updated to [https://www.sqlite.org/releaselog/3_12_2.html|SQLite 3.12.2].</li>
    <li>Add binary package release for Mono on POSIX.</li>







>







4
5
6
7
8
9
10
11
12
13
14
15
16
17
18

<p>
    <b>1.0.102.0 - June XX, 2016 <font color="red">(release scheduled)</font></b>
</p>
<ul>
    <li>Updated to [https://www.sqlite.org/releaselog/3_13_0.html|SQLite 3.13.0].</li>
    <li>Update the SQLiteConnection.EnableExtensions method to make use of the new SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION option, when available.&nbsp;<b>** Potentially Incompatible Change **</b></li>
    <li>Add VerifyOnly method to the SQLiteCommand class.</li>
</ul>
<p>
    <b>1.0.101.0 - April 19, 2016</b>
</p>
<ul>
    <li>Updated to [https://www.sqlite.org/releaselog/3_12_2.html|SQLite 3.12.2].</li>
    <li>Add binary package release for Mono on POSIX.</li>