System.Data.SQLite

Check-in [e82be4000d]
Login

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

Overview
Comment:Some fixes. Add tests. Update version history docs.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | limits
Files: files | file ages | folders
SHA1: e82be4000d14150a79f6918abd11b12086fef5db
User & Date: mistachkin 2019-10-26 23:06:14.032
Context
2019-10-26
23:06
Fix test name. Closed-Leaf check-in: 08dc03fa55 user: mistachkin tags: limits
23:06
Some fixes. Add tests. Update version history docs. check-in: e82be4000d user: mistachkin tags: limits
2019-10-24
22:37
Initial work on being able to change limits via sqlite3_limit(). check-in: d279011853 user: mistachkin tags: limits
Changes
Unified Diff 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.112.0 - October XX, 2019 <font color="red">(release scheduled)</font></b></p>
    <ul>
      <li>Updated to <a href="https://www.sqlite.org/releaselog/3_30_0.html">SQLite 3.30.0</a>.</li>
      <li>Add support for new DBCONFIG options from the SQLite core library. Pursuant to <a href="https://system.data.sqlite.org/index.html/info/03b6b0edd7">[03b6b0edd7]</a>.</li>

    </ul>
    <p><b>1.0.111.0 - June 10, 2019</b></p>
    <ul>
      <li>Updated to <a href="https://www.sqlite.org/releaselog/3_28_0.html">SQLite 3.28.0</a>.</li>
      <li>Add No_SQLiteLog environment variable.</li>
    </ul>
    <p><b>1.0.110.0 - March 4, 2019</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.112.0 - October XX, 2019 <font color="red">(release scheduled)</font></b></p>
    <ul>
      <li>Updated to <a href="https://www.sqlite.org/releaselog/3_30_0.html">SQLite 3.30.0</a>.</li>
      <li>Add support for new DBCONFIG options from the SQLite core library. Pursuant to <a href="https://system.data.sqlite.org/index.html/info/03b6b0edd7">[03b6b0edd7]</a>.</li>
      <li>Add SetLimitOption method to the SQLiteConnection class.</li>
    </ul>
    <p><b>1.0.111.0 - June 10, 2019</b></p>
    <ul>
      <li>Updated to <a href="https://www.sqlite.org/releaselog/3_28_0.html">SQLite 3.28.0</a>.</li>
      <li>Add No_SQLiteLog environment variable.</li>
    </ul>
    <p><b>1.0.110.0 - March 4, 2019</b></p>
Changes to System.Data.SQLite/SQLite3.cs.
3006
3007
3008
3009
3010
3011
3012

3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
    /// <param name="option">
    /// The database limit to change.
    /// </param>
    /// <param name="value">
    /// The new value for the specified limit.
    /// </param>
    /// <returns>

    /// A standard SQLite return code.
    /// </returns>
    internal override SQLiteErrorCode SetLimitOption(
        SQLiteLimitOpsEnum option,
        int value
        )
    {
        if (!Enum.IsDefined(typeof(SQLiteLimitOpsEnum), option))
        {
            throw new SQLiteException(HelperMethods.StringFormat(







>
|

|







3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
    /// <param name="option">
    /// The database limit to change.
    /// </param>
    /// <param name="value">
    /// The new value for the specified limit.
    /// </param>
    /// <returns>
    /// The old value for the specified limit -OR- negative one if an error
    /// occurs.
    /// </returns>
    internal override int SetLimitOption(
        SQLiteLimitOpsEnum option,
        int value
        )
    {
        if (!Enum.IsDefined(typeof(SQLiteLimitOpsEnum), option))
        {
            throw new SQLiteException(HelperMethods.StringFormat(
Changes to System.Data.SQLite/SQLiteBase.cs.
399
400
401
402
403
404
405

406
407
408
409
410
411
412
413
414
415
    /// <param name="option">
    /// The database limit to change.
    /// </param>
    /// <param name="value">
    /// The new value for the specified limit.
    /// </param>
    /// <returns>

    /// A standard SQLite return code.
    /// </returns>
    internal abstract SQLiteErrorCode SetLimitOption(SQLiteLimitOpsEnum option, int value);
    /// <summary>
    /// Change a configuration option value for the database.
    /// </summary>
    /// <param name="option">
    /// The database configuration option to change.
    /// </param>
    /// <param name="value">







>
|

|







399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
    /// <param name="option">
    /// The database limit to change.
    /// </param>
    /// <param name="value">
    /// The new value for the specified limit.
    /// </param>
    /// <returns>
    /// The old value for the specified limit -OR- negative one if an error
    /// occurs.
    /// </returns>
    internal abstract int SetLimitOption(SQLiteLimitOpsEnum option, int value);
    /// <summary>
    /// Change a configuration option value for the database.
    /// </summary>
    /// <param name="option">
    /// The database configuration option to change.
    /// </param>
    /// <param name="value">
1722
1723
1724
1725
1726
1727
1728





1729
1730
1731
1732
1733
1734
1735
  }

  /// <summary>
  /// These constants are used with the sqlite3_limit() API.
  /// </summary>
  public enum SQLiteLimitOpsEnum
  {





      /// <summary>
      /// The maximum size of any string or BLOB or table row, in bytes.
      /// </summary>
      SQLITE_LIMIT_LENGTH = 0,

      /// <summary>
      /// The maximum length of an SQL statement, in bytes.







>
>
>
>
>







1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
  }

  /// <summary>
  /// These constants are used with the sqlite3_limit() API.
  /// </summary>
  public enum SQLiteLimitOpsEnum
  {
      /// <summary>
      /// This value represents an unknown (or invalid) limit, do not use it.
      /// </summary>
      SQLITE_LIMIT_NONE = -1,

      /// <summary>
      /// The maximum size of any string or BLOB or table row, in bytes.
      /// </summary>
      SQLITE_LIMIT_LENGTH = 0,

      /// <summary>
      /// The maximum length of an SQL statement, in bytes.
Changes to System.Data.SQLite/SQLiteConnection.cs.
3937
3938
3939
3940
3941
3942
3943




3944
3945
3946
3947
3948
3949
3950
3951
3952
3953
3954
3955
3956
3957
3958
3959
3960
3961
3962
3963
3964
3965
3966
3967
    /// </summary>
    /// <param name="option">
    /// The database limit to change.
    /// </param>
    /// <param name="value">
    /// The new value for the specified limit.
    /// </param>




    public void SetLimitOption(
        SQLiteLimitOpsEnum option,
        int value
        )
    {
        CheckDisposed();

        if (_sql == null)
        {
            throw new InvalidOperationException(
                "Database connection not valid for changing a limit option.");
        }

        SQLiteErrorCode rc = _sql.SetLimitOption(option, value);

        if (rc != SQLiteErrorCode.Ok)
            throw new SQLiteException(rc, null);
    }

    /// <summary>
    /// Change a configuration option value for the database.
    /// </summary>
    /// <param name="option">
    /// The database configuration option to change.







>
>
>
>
|












|
<
<
<







3937
3938
3939
3940
3941
3942
3943
3944
3945
3946
3947
3948
3949
3950
3951
3952
3953
3954
3955
3956
3957
3958
3959
3960
3961



3962
3963
3964
3965
3966
3967
3968
    /// </summary>
    /// <param name="option">
    /// The database limit to change.
    /// </param>
    /// <param name="value">
    /// The new value for the specified limit.
    /// </param>
    /// <returns>
    /// The old value for the specified limit -OR- negative one if an error
    /// occurs.
    /// </returns>
    public int SetLimitOption(
        SQLiteLimitOpsEnum option,
        int value
        )
    {
        CheckDisposed();

        if (_sql == null)
        {
            throw new InvalidOperationException(
                "Database connection not valid for changing a limit option.");
        }

        return _sql.SetLimitOption(option, value);



    }

    /// <summary>
    /// Change a configuration option value for the database.
    /// </summary>
    /// <param name="option">
    /// The database configuration option to change.
Changes to System.Data.SQLite/UnsafeNativeMethods.cs.
4308
4309
4310
4311
4312
4313
4314
4315
4316
4317
4318
4319
4320
4321
4322
    internal static extern IntPtr sqlite3_trace_v2(IntPtr db, SQLiteTraceFlags mask, SQLiteTraceCallback2 func, IntPtr pvUser);

#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
#else
    [DllImport(SQLITE_DLL)]
#endif
    internal static extern SQLiteErrorCode sqlite3_limit(IntPtr db, SQLiteLimitOpsEnum op, int value);

    // Since sqlite3_config() takes a variable argument list, we have to overload declarations
    // for all possible calls that we want to use.
#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, EntryPoint = "sqlite3_config", CallingConvention = CallingConvention.Cdecl)]
#else
    [DllImport(SQLITE_DLL, EntryPoint = "sqlite3_config")]







|







4308
4309
4310
4311
4312
4313
4314
4315
4316
4317
4318
4319
4320
4321
4322
    internal static extern IntPtr sqlite3_trace_v2(IntPtr db, SQLiteTraceFlags mask, SQLiteTraceCallback2 func, IntPtr pvUser);

#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
#else
    [DllImport(SQLITE_DLL)]
#endif
    internal static extern int sqlite3_limit(IntPtr db, SQLiteLimitOpsEnum op, int value);

    // Since sqlite3_config() takes a variable argument list, we have to overload declarations
    // for all possible calls that we want to use.
#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, EntryPoint = "sqlite3_config", CallingConvention = CallingConvention.Cdecl)]
#else
    [DllImport(SQLITE_DLL, EntryPoint = "sqlite3_config")]
Changes to Tests/basic.eagle.
5498
5499
5500
5501
5502
5503
5504








































5505
5506
5507
5508
5509
5510
5511
(net471)
(net472)
(net48)
(netXX)
(netstandard2.0)
(netstandard2.1)
(.NETStandard,Version=vX.X)}}









































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

reportSQLiteResources $test_channel

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








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







5498
5499
5500
5501
5502
5503
5504
5505
5506
5507
5508
5509
5510
5511
5512
5513
5514
5515
5516
5517
5518
5519
5520
5521
5522
5523
5524
5525
5526
5527
5528
5529
5530
5531
5532
5533
5534
5535
5536
5537
5538
5539
5540
5541
5542
5543
5544
5545
5546
5547
5548
5549
5550
5551
(net471)
(net472)
(net48)
(netXX)
(netstandard2.0)
(netstandard2.1)
(.NETStandard,Version=vX.X)}}

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

runTest {test data-1.103 { method} -setup {
  setupDb [set fileName data-1.103.db]
} -body {
  set limits [list]

  lappend limits SQLITE_LIMIT_NONE
  lappend limits SQLITE_LIMIT_LENGTH
  lappend limits SQLITE_LIMIT_SQL_LENGTH
  lappend limits SQLITE_LIMIT_COLUMN
  lappend limits SQLITE_LIMIT_EXPR_DEPTH
  lappend limits SQLITE_LIMIT_COMPOUND_SELECT
  lappend limits SQLITE_LIMIT_VDBE_OP
  lappend limits SQLITE_LIMIT_FUNCTION_ARG
  lappend limits SQLITE_LIMIT_ATTACHED
  lappend limits SQLITE_LIMIT_LIKE_PATTERN_LENGTH
  lappend limits SQLITE_LIMIT_VARIABLE_NUMBER
  lappend limits SQLITE_LIMIT_TRIGGER_DEPTH
  lappend limits SQLITE_LIMIT_WORKER_THREADS

  set connection [getDbConnection]

  foreach limit $limits {
    lappend result [$connection SetLimitOption $limit 1]
    lappend result [$connection SetLimitOption $limit 2]
  }

  set result
} -cleanup {
  cleanupDb $fileName

  freeDbConnection

  unset -nocomplain value result limit limits
  unset -nocomplain connection db fileName
} -constraints {eagle monoBug28 command.sql compile.DATA SQLite\
System.Data.SQLite} -result {-1 -1 1000000000 1 1000000000 1 2000 1 1000 1 500\
1 250000000 1 127 1 10 1 50000 1 999 1 1000 1 0 1}}

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

reportSQLiteResources $test_channel

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

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

216
217
218
219
220
221
222

<p>
    <b>1.0.112.0 - October XX, 2019 <font color="red">(release scheduled)</font></b>
</p>
<ul>
    <li>Updated to <a href="https://www.sqlite.org/releaselog/3_30_0.html">SQLite 3.30.0</a>.</li>
    <li>Add support for new DBCONFIG options from the SQLite core library. Pursuant to [03b6b0edd7].</li>

</ul>
<p>
    <b>1.0.111.0 - June 10, 2019</b>
</p>
<ul>
    <li>Updated to <a href="https://www.sqlite.org/releaselog/3_28_0.html">SQLite 3.28.0</a>.</li>
    <li>Add No_SQLiteLog environment variable.</li>







>







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

<p>
    <b>1.0.112.0 - October XX, 2019 <font color="red">(release scheduled)</font></b>
</p>
<ul>
    <li>Updated to <a href="https://www.sqlite.org/releaselog/3_30_0.html">SQLite 3.30.0</a>.</li>
    <li>Add support for new DBCONFIG options from the SQLite core library. Pursuant to [03b6b0edd7].</li>
    <li>Add SetLimitOption method to the SQLiteConnection class.</li>
</ul>
<p>
    <b>1.0.111.0 - June 10, 2019</b>
</p>
<ul>
    <li>Updated to <a href="https://www.sqlite.org/releaselog/3_28_0.html">SQLite 3.28.0</a>.</li>
    <li>Add No_SQLiteLog environment variable.</li>
Changes to www/news.wiki.
46
47
48
49
50
51
52

53
54
55
56
57
58
59

<p>
    <b>1.0.112.0 - October XX, 2019 <font color="red">(release scheduled)</font></b>
</p>
<ul>
    <li>Updated to [https://www.sqlite.org/releaselog/3_30_0.html|SQLite 3.30.0].</li>
    <li>Add support for new DBCONFIG options from the SQLite core library. Pursuant to [03b6b0edd7].</li>

</ul>
<p>
    <b>1.0.111.0 - June 10, 2019</b>
</p>
<ul>
    <li>Updated to [https://www.sqlite.org/releaselog/3_28_0.html|SQLite 3.28.0].</li>
    <li>Add No_SQLiteLog environment variable.</li>







>







46
47
48
49
50
51
52
53
54
55
56
57
58
59
60

<p>
    <b>1.0.112.0 - October XX, 2019 <font color="red">(release scheduled)</font></b>
</p>
<ul>
    <li>Updated to [https://www.sqlite.org/releaselog/3_30_0.html|SQLite 3.30.0].</li>
    <li>Add support for new DBCONFIG options from the SQLite core library. Pursuant to [03b6b0edd7].</li>
    <li>Add SetLimitOption method to the SQLiteConnection class.</li>
</ul>
<p>
    <b>1.0.111.0 - June 10, 2019</b>
</p>
<ul>
    <li>Updated to [https://www.sqlite.org/releaselog/3_28_0.html|SQLite 3.28.0].</li>
    <li>Add No_SQLiteLog environment variable.</li>