System.Data.SQLite

Check-in [995978db06]
Login

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

Overview
Comment:Add BindDecimalAsText connection flag to force Decimal typed parameters to be bound as text. Pursuant to [b167206ad3].
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 995978db06cc8e086121d9abe84aed9fe7c348d2
User & Date: mistachkin 2017-09-16 05:49:05.089
Context
2017-09-16
06:20
Add the 'DECIMALTEXT' and 'NUMERICTEXT' type mappings. check-in: 354e4df35c user: mistachkin tags: trunk
05:49
Add BindDecimalAsText connection flag to force Decimal typed parameters to be bound as text. Pursuant to [b167206ad3]. check-in: 995978db06 user: mistachkin tags: trunk
2017-09-07
20:21
Update SQLite core library to the 3.20.1 release. check-in: 6ba379107f user: mistachkin tags: trunk
Changes
Unified Diff Ignore Whitespace Patch
Changes to Doc/Extra/Provider/version.html.
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
    </div>
    <div id="mainSection">
    <div id="mainBody">
    <h1 class="heading">Version History</h1>
    <p><b>1.0.106.0 - September XX, 2017 <font color="red">(release scheduled)</font></b></p>
    <ul>
      <li>Updated to <a href="https://www.sqlite.org/releaselog/3_20_1.html">SQLite 3.20.1</a>.</li>
      <li>Add GetDecimalAsText connection flag to force Decimal typed columns to be returned as text. Pursuant to <a href="https://system.data.sqlite.org/index.html/info/b167206ad3">[b167206ad3]</a>.</li>
    </ul>
    <p><b>1.0.105.2 - June 12, 2017</b></p>
    <ul>
      <li>Updated to <a href="https://www.sqlite.org/releaselog/3_19_3.html">SQLite 3.19.3</a>.</li>
      <li>Fix issues that prevented SQLiteBlob creation from succeeding for tables that did not have an integer primary key.</li>
    </ul>
    <p><b>1.0.105.1 - May 15, 2017</b></p>







|







42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
    </div>
    <div id="mainSection">
    <div id="mainBody">
    <h1 class="heading">Version History</h1>
    <p><b>1.0.106.0 - September XX, 2017 <font color="red">(release scheduled)</font></b></p>
    <ul>
      <li>Updated to <a href="https://www.sqlite.org/releaselog/3_20_1.html">SQLite 3.20.1</a>.</li>
      <li>Add BindDecimalAsText and GetDecimalAsText connection flags to force binding and returning of decimal values as text. Pursuant to <a href="https://system.data.sqlite.org/index.html/info/b167206ad3">[b167206ad3]</a>.</li>
    </ul>
    <p><b>1.0.105.2 - June 12, 2017</b></p>
    <ul>
      <li>Updated to <a href="https://www.sqlite.org/releaselog/3_19_3.html">SQLite 3.19.3</a>.</li>
      <li>Fix issues that prevented SQLiteBlob creation from succeeding for tables that did not have an integer primary key.</li>
    </ul>
    <p><b>1.0.105.1 - May 15, 2017</b></p>
Changes to System.Data.SQLite/SQLiteBase.cs.
1241
1242
1243
1244
1245
1246
1247







1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
      /// Allow transactions to be nested.  The outermost transaction still
      /// controls whether or not any changes are ultimately committed or
      /// rolled back.  All non-outermost transactions are implemented using
      /// the SAVEPOINT construct.
      /// </summary>
      AllowNestedTransactions = 0x8000000000,








      /// <summary>
      /// When returning column values, always return <see cref="Decimal" />
      /// values as though they were plain text (i.e. not <see cref="Double" />,
      /// which is the legacy behavior).
      /// </summary>
      GetDecimalAsText = 0x10000000000,

      /// <summary>
      /// When binding parameter values or returning column values, always
      /// treat them as though they were plain text (i.e. no numeric,
      /// date/time, or other conversions should be attempted).
      /// </summary>
      BindAndGetAllAsText = BindAllAsText | GetAllAsText,







>
>
>
>
>
>
>





|







1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
      /// Allow transactions to be nested.  The outermost transaction still
      /// controls whether or not any changes are ultimately committed or
      /// rolled back.  All non-outermost transactions are implemented using
      /// the SAVEPOINT construct.
      /// </summary>
      AllowNestedTransactions = 0x8000000000,

      /// <summary>
      /// When binding parameter values, always bind <see cref="Decimal" />
      /// values as though they were plain text (i.e. not <see cref="Decimal" />,
      /// which is the legacy behavior).
      /// </summary>
      BindDecimalAsText = 0x10000000000,

      /// <summary>
      /// When returning column values, always return <see cref="Decimal" />
      /// values as though they were plain text (i.e. not <see cref="Double" />,
      /// which is the legacy behavior).
      /// </summary>
      GetDecimalAsText = 0x20000000000,

      /// <summary>
      /// When binding parameter values or returning column values, always
      /// treat them as though they were plain text (i.e. no numeric,
      /// date/time, or other conversions should be attempted).
      /// </summary>
      BindAndGetAllAsText = BindAllAsText | GetAllAsText,
Changes to System.Data.SQLite/SQLiteStatement.cs.
430
431
432
433
434
435
436












437
438
439
440
441
442
443
              _sql.Bind_Text(this, _flags, index, invariantText ?
                  SQLiteConvert.ToStringWithProvider(obj, invariantCultureInfo) :
                  obj.ToString());
          }

          return;
      }













      CultureInfo cultureInfo = CultureInfo.CurrentCulture;

      if ((_flags & SQLiteConnectionFlags.ConvertInvariantText) == SQLiteConnectionFlags.ConvertInvariantText)
          cultureInfo = invariantCultureInfo;

      switch (objType)







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







430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
              _sql.Bind_Text(this, _flags, index, invariantText ?
                  SQLiteConvert.ToStringWithProvider(obj, invariantCultureInfo) :
                  obj.ToString());
          }

          return;
      }

      if ((_flags & SQLiteConnectionFlags.BindDecimalAsText) == SQLiteConnectionFlags.BindDecimalAsText)
      {
          if (obj is Decimal)
          {
              _sql.Bind_Text(this, _flags, index, invariantText ?
                  SQLiteConvert.ToStringWithProvider(obj, invariantCultureInfo) :
                  obj.ToString());

              return;
          }
      }

      CultureInfo cultureInfo = CultureInfo.CurrentCulture;

      if ((_flags & SQLiteConnectionFlags.ConvertInvariantText) == SQLiteConnectionFlags.ConvertInvariantText)
          cultureInfo = invariantCultureInfo;

      switch (objType)
Changes to Tests/tkt-b167206ad3.eagle.
25
26
27
28
29
30
31
32

33
34
35
36
37
38
39
} -body {
  sql execute $db {
    CREATE TABLE t1(x INTEGER, y DECIMAL(38,9));
    INSERT INTO t1 (x, y) VALUES(1, 123456789123456780);
    INSERT INTO t1 (x, y) VALUES(2, '123456789123456780');
  }

  set dataReader [sql execute -execute reader -format datareader \

      -alias $db "SELECT x, y FROM t1 ORDER BY x;"]

  set result [list]

  while {[$dataReader Read]} {
    set x [$dataReader -create -alias GetValue 0]
    set y1 [$dataReader -create -alias GetDecimal 1]







|
>







25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
} -body {
  sql execute $db {
    CREATE TABLE t1(x INTEGER, y DECIMAL(38,9));
    INSERT INTO t1 (x, y) VALUES(1, 123456789123456780);
    INSERT INTO t1 (x, y) VALUES(2, '123456789123456780');
  }

  set dataReader [sql execute \
      -execute reader -format datareader \
      -alias $db "SELECT x, y FROM t1 ORDER BY x;"]

  set result [list]

  while {[$dataReader Read]} {
    set x [$dataReader -create -alias GetValue 0]
    set y1 [$dataReader -create -alias GetDecimal 1]
60
61
62
63
64
65
66
67

68
69
70
71
72
73
74
} -body {
  sql execute $db {
    CREATE TABLE t1(x INTEGER, y DECIMAL(38,9));
    INSERT INTO t1 (x, y) VALUES(1, 123456789123456780);
    INSERT INTO t1 (x, y) VALUES(2, '123456789123456780');
  }

  set dataReader [sql execute -execute reader -format datareader \

      -alias $db "SELECT x, y FROM t1 ORDER BY x;"]

  set result [list]

  while {[$dataReader Read]} {
    set x [$dataReader -create -alias GetValue 0]
    set y1 [$dataReader -create -alias GetDecimal 1]







|
>







61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
} -body {
  sql execute $db {
    CREATE TABLE t1(x INTEGER, y DECIMAL(38,9));
    INSERT INTO t1 (x, y) VALUES(1, 123456789123456780);
    INSERT INTO t1 (x, y) VALUES(2, '123456789123456780');
  }

  set dataReader [sql execute \
      -execute reader -format datareader \
      -alias $db "SELECT x, y FROM t1 ORDER BY x;"]

  set result [list]

  while {[$dataReader Read]} {
    set x [$dataReader -create -alias GetValue 0]
    set y1 [$dataReader -create -alias GetDecimal 1]
95
96
97
98
99
100
101
102

103
104
105
106
107
108
109
} -body {
  sql execute $db {
    CREATE TABLE t1(x INTEGER, y NUMERIC);
    INSERT INTO t1 (x, y) VALUES(1, 123456789123456780);
    INSERT INTO t1 (x, y) VALUES(2, '123456789123456780');
  }

  set dataReader [sql execute -execute reader -format datareader \

      -alias $db "SELECT x, y FROM t1 ORDER BY x;"]

  set result [list]

  while {[$dataReader Read]} {
    set x [$dataReader -create -alias GetValue 0]
    set y1 [$dataReader -create -alias GetDecimal 1]







|
>







97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
} -body {
  sql execute $db {
    CREATE TABLE t1(x INTEGER, y NUMERIC);
    INSERT INTO t1 (x, y) VALUES(1, 123456789123456780);
    INSERT INTO t1 (x, y) VALUES(2, '123456789123456780');
  }

  set dataReader [sql execute \
      -execute reader -format datareader \
      -alias $db "SELECT x, y FROM t1 ORDER BY x;"]

  set result [list]

  while {[$dataReader Read]} {
    set x [$dataReader -create -alias GetValue 0]
    set y1 [$dataReader -create -alias GetDecimal 1]
130
131
132
133
134
135
136
137

138
139
140
141
142
143
144
} -body {
  sql execute $db {
    CREATE TABLE t1(x INTEGER, y NUMERIC);
    INSERT INTO t1 (x, y) VALUES(1, 123456789123456780);
    INSERT INTO t1 (x, y) VALUES(2, '123456789123456780');
  }

  set dataReader [sql execute -execute reader -format datareader \

      -alias $db "SELECT x, y FROM t1 ORDER BY x;"]

  set result [list]

  while {[$dataReader Read]} {
    set x [$dataReader -create -alias GetValue 0]
    set y1 [$dataReader -create -alias GetDecimal 1]







|
>







133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
} -body {
  sql execute $db {
    CREATE TABLE t1(x INTEGER, y NUMERIC);
    INSERT INTO t1 (x, y) VALUES(1, 123456789123456780);
    INSERT INTO t1 (x, y) VALUES(2, '123456789123456780');
  }

  set dataReader [sql execute \
      -execute reader -format datareader \
      -alias $db "SELECT x, y FROM t1 ORDER BY x;"]

  set result [list]

  while {[$dataReader Read]} {
    set x [$dataReader -create -alias GetValue 0]
    set y1 [$dataReader -create -alias GetDecimal 1]
153
154
155
156
157
158
159
160
161
162














































































































































































163
164

  cleanupDb $fileName

  unset -nocomplain y2 y1 x result db fileName
} -constraints {eagle command.object monoBug28 command.sql compile.DATA SQLite\
System.Data.SQLite} -result {{1 123456789123456780 123456789123456780} {2\
123456789123456780 123456789123456780}}}

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















































































































































































runSQLiteTestEpilogue
runTestEpilogue










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


157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342

  cleanupDb $fileName

  unset -nocomplain y2 y1 x result db fileName
} -constraints {eagle command.object monoBug28 command.sql compile.DATA SQLite\
System.Data.SQLite} -result {{1 123456789123456780 123456789123456780} {2\
123456789123456780 123456789123456780}}}

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

runTest {test tkt-b167206ad3-2.1 {bind type for DECIMAL} -setup {
  setupDb [set fileName tkt-b167206ad3-2.1.db]
} -body {
  sql execute $db {
    CREATE TABLE t1(x INTEGER, y DECIMAL(38,9));
  }

  set d(1) [object invoke -create Decimal Parse 123456789123456780]
  set d(2) [object invoke -create Decimal Parse 12345678912345.1556346]

  sql execute $db "INSERT INTO t1 (x, y) VALUES(1, ?);" \
      [list param1 Decimal $d(1)]

  sql execute $db "INSERT INTO t1 (x, y) VALUES(2, ?);" \
      [list param1 Decimal $d(2)]

  set dataReader [sql execute \
      -execute reader -format datareader \
      -alias $db "SELECT x, y FROM t1 ORDER BY x;"]

  set result [list]

  while {[$dataReader Read]} {
    set x [$dataReader -create -alias GetValue 0]
    set y1 [$dataReader -create -alias GetDecimal 1]
    set y2 [$dataReader -create -alias GetValue 1]

    lappend result [list [$x ToString] [$y1 ToString] [$y2 ToString]]
  }

  set result
} -cleanup {
  unset -nocomplain dataReader

  cleanupDb $fileName

  unset -nocomplain y2 y1 x d result db fileName
} -constraints {eagle command.object monoBug28 command.sql compile.DATA SQLite\
System.Data.SQLite} -result {{1 123456789123456780 123456789123457000} {2\
12345678912345.2 12345678912345.2}}}

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

runTest {test tkt-b167206ad3-2.2 {bind type for DECIMAL} -setup {
  setupDb [set fileName tkt-b167206ad3-2.2.db] "" "" "" \
      "BindDecimalAsText GetAllAsText"
} -body {
  sql execute $db {
    CREATE TABLE t1(x INTEGER, y DECIMAL(38,9));
  }

  set d(1) [object invoke -create Decimal Parse 123456789123456780]
  set d(2) [object invoke -create Decimal Parse 12345678912345.1556346]

  sql execute $db "INSERT INTO t1 (x, y) VALUES(1, ?);" \
      [list param1 Decimal $d(1)]

  sql execute $db "INSERT INTO t1 (x, y) VALUES(2, ?);" \
      [list param1 Decimal $d(2)]

  set dataReader [sql execute \
      -execute reader -format datareader \
      -alias $db "SELECT x, y FROM t1 ORDER BY x;"]

  set result [list]

  while {[$dataReader Read]} {
    set x [$dataReader -create -alias GetValue 0]
    set y1 [$dataReader -create -alias GetDecimal 1]
    set y2 [$dataReader -create -alias GetValue 1]

    lappend result [list [$x ToString] [$y1 ToString] [$y2 ToString]]
  }

  set result
} -cleanup {
  unset -nocomplain dataReader

  cleanupDb $fileName

  unset -nocomplain y2 y1 x d result db fileName
} -constraints {eagle command.object monoBug28 command.sql compile.DATA SQLite\
System.Data.SQLite} -result {{1 123456789123456780 123456789123456780} {2\
12345678912345.1556346 12345678912345.1556346}}}

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

runTest {test tkt-b167206ad3-2.3 {bind type for NUMERIC} -setup {
  setupDb [set fileName tkt-b167206ad3-2.3.db]
} -body {
  sql execute $db {
    CREATE TABLE t1(x INTEGER, y NUMERIC);
  }

  set d(1) [object invoke -create Decimal Parse 123456789123456780]
  set d(2) [object invoke -create Decimal Parse 12345678912345.1556346]

  sql execute $db "INSERT INTO t1 (x, y) VALUES(1, ?);" \
      [list param1 Decimal $d(1)]

  sql execute $db "INSERT INTO t1 (x, y) VALUES(2, ?);" \
      [list param1 Decimal $d(2)]

  set dataReader [sql execute \
      -execute reader -format datareader \
      -alias $db "SELECT x, y FROM t1 ORDER BY x;"]

  set result [list]

  while {[$dataReader Read]} {
    set x [$dataReader -create -alias GetValue 0]
    set y1 [$dataReader -create -alias GetDecimal 1]
    set y2 [$dataReader -create -alias GetValue 1]

    lappend result [list [$x ToString] [$y1 ToString] [$y2 ToString]]
  }

  set result
} -cleanup {
  unset -nocomplain dataReader

  cleanupDb $fileName

  unset -nocomplain y2 y1 x d result db fileName
} -constraints {eagle command.object monoBug28 command.sql compile.DATA SQLite\
System.Data.SQLite} -result {{1 123456789123456780 123456789123457000} {2\
12345678912345.2 12345678912345.2}}}

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

runTest {test tkt-b167206ad3-2.4 {bind type for NUMERIC} -setup {
  setupDb [set fileName tkt-b167206ad3-2.4.db] "" "" "" \
      "BindDecimalAsText GetAllAsText"
} -body {
  sql execute $db {
    CREATE TABLE t1(x INTEGER, y NUMERIC);
  }

  set d(1) [object invoke -create Decimal Parse 123456789123456780]
  set d(2) [object invoke -create Decimal Parse 12345678912345.1556346]

  sql execute $db "INSERT INTO t1 (x, y) VALUES(1, ?);" \
      [list param1 Decimal $d(1)]

  sql execute $db "INSERT INTO t1 (x, y) VALUES(2, ?);" \
      [list param1 Decimal $d(2)]

  set dataReader [sql execute \
      -execute reader -format datareader \
      -alias $db "SELECT x, y FROM t1 ORDER BY x;"]

  set result [list]

  while {[$dataReader Read]} {
    set x [$dataReader -create -alias GetValue 0]
    set y1 [$dataReader -create -alias GetDecimal 1]
    set y2 [$dataReader -create -alias GetValue 1]

    lappend result [list [$x ToString] [$y1 ToString] [$y2 ToString]]
  }

  set result
} -cleanup {
  unset -nocomplain dataReader

  cleanupDb $fileName

  unset -nocomplain y2 y1 x d result db fileName
} -constraints {eagle command.object monoBug28 command.sql compile.DATA SQLite\
System.Data.SQLite} -result {{1 123456789123456780 123456789123456780} {2\
12345678912345.1556346 12345678912345.1556346}}}

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

runSQLiteTestEpilogue
runTestEpilogue
Changes to readme.htm.
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
<h2><b>Version History</b></h2>

<p>
    <b>1.0.106.0 - September XX, 2017 <font color="red">(release scheduled)</font></b>
</p>
<ul>
    <li>Updated to <a href="https://www.sqlite.org/releaselog/3_20_1.html">SQLite 3.20.1</a>.</li>
    <li>Add GetDecimalAsText connection flag to force Decimal typed columns to be returned as text. Pursuant to [b167206ad3].</li>
</ul>
<p>
    <b>1.0.105.2 - June 12, 2017</b>
</p>
<ul>
    <li>Updated to <a href="https://www.sqlite.org/releaselog/3_19_3.html">SQLite 3.19.3</a>.</li>
    <li>Fix issues that prevented SQLiteBlob creation from succeeding for tables that did not have an integer primary key.</li>







|







208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
<h2><b>Version History</b></h2>

<p>
    <b>1.0.106.0 - September XX, 2017 <font color="red">(release scheduled)</font></b>
</p>
<ul>
    <li>Updated to <a href="https://www.sqlite.org/releaselog/3_20_1.html">SQLite 3.20.1</a>.</li>
    <li>Add BindDecimalAsText and GetDecimalAsText connection flags to force binding and returning of decimal values as text. Pursuant to [b167206ad3].</li>
</ul>
<p>
    <b>1.0.105.2 - June 12, 2017</b>
</p>
<ul>
    <li>Updated to <a href="https://www.sqlite.org/releaselog/3_19_3.html">SQLite 3.19.3</a>.</li>
    <li>Fix issues that prevented SQLiteBlob creation from succeeding for tables that did not have an integer primary key.</li>
Changes to www/news.wiki.
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
<div align="center"><h2><b>Version History</b></h2></div>

<p>
    <b>1.0.106.0 - September XX, 2017 <font color="red">(release scheduled)</font></b>
</p>
<ul>
    <li>Updated to [https://www.sqlite.org/releaselog/3_20_1.html|SQLite 3.20.1].</li>
    <li>Add GetDecimalAsText connection flag to force Decimal typed columns to be returned as text. Pursuant to [b167206ad3].</li>
</ul>
<p>
    <b>1.0.105.2 - June 12, 2017</b>
</p>
<ul>
    <li>Updated to [https://www.sqlite.org/releaselog/3_19_3.html|SQLite 3.19.3].</li>
    <li>Fix issues that prevented SQLiteBlob creation from succeeding for tables that did not have an integer primary key.</li>







|







45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
<div align="center"><h2><b>Version History</b></h2></div>

<p>
    <b>1.0.106.0 - September XX, 2017 <font color="red">(release scheduled)</font></b>
</p>
<ul>
    <li>Updated to [https://www.sqlite.org/releaselog/3_20_1.html|SQLite 3.20.1].</li>
    <li>Add BindDecimalAsText and GetDecimalAsText connection flags to force binding and returning of decimal values as text. Pursuant to [b167206ad3].</li>
</ul>
<p>
    <b>1.0.105.2 - June 12, 2017</b>
</p>
<ul>
    <li>Updated to [https://www.sqlite.org/releaselog/3_19_3.html|SQLite 3.19.3].</li>
    <li>Fix issues that prevented SQLiteBlob creation from succeeding for tables that did not have an integer primary key.</li>