System.Data.SQLite
Check-in [146cb55f1e]
Not logged in

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

Overview
Comment:Add SetChunkSize method to the SQLiteConnection class. Pursuant to [d1c008fa0a].
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 146cb55f1e9c892953f5db7f5112793b8088fc85
User & Date: mistachkin 2014-04-21 20:11:11
References
2014-04-21
20:12 Closed ticket [d1c008fa0a]: Provide API to manipulate SQLITE_FCNTL_CHUNK_SIZE. plus 7 other changes artifact: e836f4f160 user: mistachkin
Context
2014-04-22
06:48
Adjust the vendor-specific setup script (for Eagle) to allow it to be successfully evaluated using a 'safe' interpreter. check-in: a4a1d80b10 user: mistachkin tags: trunk
2014-04-21
20:11
Add SetChunkSize method to the SQLiteConnection class. Pursuant to [d1c008fa0a]. check-in: 146cb55f1e user: mistachkin tags: trunk
2014-04-15
04:54
Update Eagle in externals to the beta 30 release. check-in: f9cacf60ea 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.93.0 - April XX, 2014 <font color="red">(release scheduled)</font></b></p>
    <ul>
      <li>Updated to <a href="http://www.sqlite.org/releaselog/3_8_4_3.html">SQLite 3.8.4.3</a>.</li>
      <li>Add support for mapping transaction isolation levels to their legacy default values. Pursuant to <a href="http://system.data.sqlite.org/index.html/info/56b42d99c1">[56b42d99c1]</a>.</li>

    </ul>
    <p><b>1.0.92.0 - March 19, 2014</p>
    <ul>
      <li>Updated to <a href="http://www.sqlite.org/releaselog/3_8_4_1.html">SQLite 3.8.4.1</a>.</li>
      <li>Update the list of keywords returned by SQLiteConnection.GetSchema(&quot;ReservedWords&quot;).&nbsp;<b>** Potentially Incompatible Change **</b></li>
      <li>Raise the static SQLiteConnection.Changed event when any SQLiteCommand or SQLiteDataReader object is closed or disposed.</li>
      <li>Add the SQLiteDataReader.StepCount property to return the number of rows seen so far.</li>







>







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.93.0 - April XX, 2014 <font color="red">(release scheduled)</font></b></p>
    <ul>
      <li>Updated to <a href="http://www.sqlite.org/releaselog/3_8_4_3.html">SQLite 3.8.4.3</a>.</li>
      <li>Add support for mapping transaction isolation levels to their legacy default values. Pursuant to <a href="http://system.data.sqlite.org/index.html/info/56b42d99c1">[56b42d99c1]</a>.</li>
      <li>Add SetChunkSize method to the SQLiteConnection class. Pursuant to [d1c008fa0a].</li>
    </ul>
    <p><b>1.0.92.0 - March 19, 2014</p>
    <ul>
      <li>Updated to <a href="http://www.sqlite.org/releaselog/3_8_4_1.html">SQLite 3.8.4.1</a>.</li>
      <li>Update the list of keywords returned by SQLiteConnection.GetSchema(&quot;ReservedWords&quot;).&nbsp;<b>** Potentially Incompatible Change **</b></li>
      <li>Raise the static SQLiteConnection.Changed event when any SQLiteCommand or SQLiteDataReader object is closed or disposed.</li>
      <li>Add the SQLiteDataReader.StepCount property to return the number of rows seen so far.</li>

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

366
367
368
369
370
371
372

373
374
375
376
377
378
379
....
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182



































3183
3184
3185
3186
3187
3188
3189
    private const bool DefaultToFullPath = true;
    private const bool DefaultPooling = false; // TODO: Maybe promote this to static property?
    private const bool DefaultLegacyFormat = false;
    private const bool DefaultForeignKeys = false;
    private const bool DefaultEnlist = true;
    private const bool DefaultSetDefaults = true;


    private const int SQLITE_FCNTL_WIN32_AV_RETRY = 9;

    private const string _dataDirectory = "|DataDirectory|";
    private const string _masterdb = "sqlite_master";
    private const string _tempmasterdb = "sqlite_temp_master";
    #endregion

................................................................................
            pArg = Marshal.AllocHGlobal(sizeof(int) * 2);

            Marshal.WriteInt32(pArg, 0, count);
            Marshal.WriteInt32(pArg, sizeof(int), interval);

            rc = _sql.FileControl(null, SQLITE_FCNTL_WIN32_AV_RETRY, pArg);

            if (rc == 0)
            {
                count = Marshal.ReadInt32(pArg, 0);
                interval = Marshal.ReadInt32(pArg, sizeof(int));
            }
        }
        finally
        {
            if (pArg != IntPtr.Zero)
                Marshal.FreeHGlobal(pArg);
        }

        return rc;
    }




































    /// <summary>
    /// Removes one set of surrounding single -OR- double quotes from the string
    /// value and returns the resulting string value.  If the string is null, empty,
    /// or contains quotes that are not balanced, nothing is done and the original
    /// string value will be returned.
    /// </summary>







>







 







|













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







366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
....
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
    private const bool DefaultToFullPath = true;
    private const bool DefaultPooling = false; // TODO: Maybe promote this to static property?
    private const bool DefaultLegacyFormat = false;
    private const bool DefaultForeignKeys = false;
    private const bool DefaultEnlist = true;
    private const bool DefaultSetDefaults = true;

    private const int SQLITE_FCNTL_CHUNK_SIZE = 6;
    private const int SQLITE_FCNTL_WIN32_AV_RETRY = 9;

    private const string _dataDirectory = "|DataDirectory|";
    private const string _masterdb = "sqlite_master";
    private const string _tempmasterdb = "sqlite_temp_master";
    #endregion

................................................................................
            pArg = Marshal.AllocHGlobal(sizeof(int) * 2);

            Marshal.WriteInt32(pArg, 0, count);
            Marshal.WriteInt32(pArg, sizeof(int), interval);

            rc = _sql.FileControl(null, SQLITE_FCNTL_WIN32_AV_RETRY, pArg);

            if (rc == SQLiteErrorCode.Ok)
            {
                count = Marshal.ReadInt32(pArg, 0);
                interval = Marshal.ReadInt32(pArg, sizeof(int));
            }
        }
        finally
        {
            if (pArg != IntPtr.Zero)
                Marshal.FreeHGlobal(pArg);
        }

        return rc;
    }

    /// <summary>
    /// Sets the chunk size for the primary file associated with this database
    /// connection.
    /// </summary>
    /// <param name="size">
    /// The new chunk size for the main database, in bytes.
    /// </param>
    /// <returns>
    /// Zero for success, non-zero for error.
    /// </returns>
    public SQLiteErrorCode SetChunkSize(int size)
    {
        CheckDisposed();

        if (_connectionState != ConnectionState.Open)
            throw new InvalidOperationException(
                "Database must be opened before changing the chunk size.");

        IntPtr pArg = IntPtr.Zero;

        try
        {
            pArg = Marshal.AllocHGlobal(sizeof(int) * 1);

            Marshal.WriteInt32(pArg, 0, size);

            return _sql.FileControl(null, SQLITE_FCNTL_CHUNK_SIZE, pArg);
        }
        finally
        {
            if (pArg != IntPtr.Zero)
                Marshal.FreeHGlobal(pArg);
        }
    }

    /// <summary>
    /// Removes one set of surrounding single -OR- double quotes from the string
    /// value and returns the resulting string value.  If the string is null, empty,
    /// or contains quotes that are not balanced, nothing is done and the original
    /// string value will be returned.
    /// </summary>

Changes to Tests/basic.eagle.

3115
3116
3117
3118
3119
3120
3121










































3122
3123
3124
3125
3126
3127
3128
  cleanupDb $fileName

  unset -nocomplain error noRow db fileName
} -constraints \
{eagle monoBug28 command.sql compile.DATA SQLite System.Data.SQLite} -result \
{0 1 1 False True True 0 1 1 1 True 0 False 0 False 0 1 1 False False True 0 1\
2 1 True 1 True 0 False 0 1 2 False False False 0 1 2 1 True 1 True 1 True}}











































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

reportSQLiteResources $test_channel

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








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







3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
  cleanupDb $fileName

  unset -nocomplain error noRow db fileName
} -constraints \
{eagle monoBug28 command.sql compile.DATA SQLite System.Data.SQLite} -result \
{0 1 1 False True True 0 1 1 1 True 0 False 0 False 0 1 1 False False True 0 1\
2 1 True 1 True 0 False 0 1 2 False False False 0 1 2 1 True 1 True 1 True}}

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

runTest {test data-1.66 {SQLiteConnection.SetChunkSize default} -setup {
  setupDb [set fileName data-1.66.db]
} -body {
  sql execute $db {
    CREATE TABLE t1(a, b);
  }

  file size [file join [getDatabaseDirectory] $fileName]
} -cleanup {
  cleanupDb $fileName

  unset -nocomplain db fileName
} -constraints \
{eagle monoBug28 command.sql compile.DATA SQLite System.Data.SQLite} -result \
{2048}}

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

runTest {test data-1.67 {SQLiteConnection.SetChunkSize method} -setup {
  setupDb [set fileName data-1.67.db]
} -body {
  set connection [getDbConnection]

  lappend result [$connection SetChunkSize [expr {32 * 1024}]]

  sql execute $db {
    CREATE TABLE t1(a, b);
  }

  lappend result [file size [file join [getDatabaseDirectory] $fileName]]
} -cleanup {
  cleanupDb $fileName

  freeDbConnection

  unset -nocomplain result connection db fileName
} -constraints \
{eagle monoBug28 command.sql compile.DATA SQLite System.Data.SQLite} -result \
{Ok 32768}}

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

reportSQLiteResources $test_channel

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

Changes to readme.htm.

210
211
212
213
214
215
216

217
218
219
220
221
222
223

<p>
    <b>1.0.93.0 - April XX, 2014 <font color="red">(release scheduled)</font></b>
</p>
<ul>
    <li>Updated to <a href="http://www.sqlite.org/releaselog/3_8_4_3.html">SQLite 3.8.4.3</a>.</li>
    <li>Add support for mapping transaction isolation levels to their legacy default values. Pursuant to [56b42d99c1].</li>

</ul>
<p>
    <b>1.0.92.0 - March 19, 2014</b>
</p>
<ul>
    <li>Updated to <a href="http://www.sqlite.org/releaselog/3_8_4_1.html">SQLite 3.8.4.1</a>.</li>
    <li>Update the list of keywords returned by SQLiteConnection.GetSchema(&quot;ReservedWords&quot;).&nbsp;<b>** Potentially Incompatible Change **</b></li>







>







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

<p>
    <b>1.0.93.0 - April XX, 2014 <font color="red">(release scheduled)</font></b>
</p>
<ul>
    <li>Updated to <a href="http://www.sqlite.org/releaselog/3_8_4_3.html">SQLite 3.8.4.3</a>.</li>
    <li>Add support for mapping transaction isolation levels to their legacy default values. Pursuant to [56b42d99c1].</li>
    <li>Add SetChunkSize method to the SQLiteConnection class. Pursuant to [d1c008fa0a].</li>
</ul>
<p>
    <b>1.0.92.0 - March 19, 2014</b>
</p>
<ul>
    <li>Updated to <a href="http://www.sqlite.org/releaselog/3_8_4_1.html">SQLite 3.8.4.1</a>.</li>
    <li>Update the list of keywords returned by SQLiteConnection.GetSchema(&quot;ReservedWords&quot;).&nbsp;<b>** Potentially Incompatible Change **</b></li>

Changes to www/news.wiki.

4
5
6
7
8
9
10

11
12
13
14
15
16
17

<p>
    <b>1.0.93.0 - April XX, 2014 <font color="red">(release scheduled)</font></b>
</p>
<ul>
    <li>Updated to <a href="http://www.sqlite.org/releaselog/3_8_4_3.html">SQLite 3.8.4.3</a>.</li>
    <li>Add support for mapping transaction isolation levels to their legacy default values. Pursuant to [56b42d99c1].</li>

</ul>
<p>
    <b>1.0.92.0 - March 19, 2014</b>
</p>
<ul>
    <li>Updated to <a href="http://www.sqlite.org/releaselog/3_8_4_1.html">SQLite 3.8.4.1</a>.</li>
    <li>Update the list of keywords returned by SQLiteConnection.GetSchema(&quot;ReservedWords&quot;).&nbsp;<b>** Potentially Incompatible Change **</b></li>







>







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

<p>
    <b>1.0.93.0 - April XX, 2014 <font color="red">(release scheduled)</font></b>
</p>
<ul>
    <li>Updated to <a href="http://www.sqlite.org/releaselog/3_8_4_3.html">SQLite 3.8.4.3</a>.</li>
    <li>Add support for mapping transaction isolation levels to their legacy default values. Pursuant to [56b42d99c1].</li>
    <li>Add SetChunkSize method to the SQLiteConnection class. Pursuant to [d1c008fa0a].</li>
</ul>
<p>
    <b>1.0.92.0 - March 19, 2014</b>
</p>
<ul>
    <li>Updated to <a href="http://www.sqlite.org/releaselog/3_8_4_1.html">SQLite 3.8.4.1</a>.</li>
    <li>Update the list of keywords returned by SQLiteConnection.GetSchema(&quot;ReservedWords&quot;).&nbsp;<b>** Potentially Incompatible Change **</b></li>