Artifact
d437e32b54d06a0b73c126c37c618ee1eb1d8d47:
Wiki page
[The infamous DQS misfeature] by
sandro
2019-08-01 12:01:02.
0000: 44 20 32 30 31 39 2d 30 38 2d 30 31 54 31 32 3a D 2019-08-01T12:
0010: 30 31 3a 30 32 2e 34 37 31 0a 4c 20 54 68 65 5c 01:02.471.L The\
0020: 73 69 6e 66 61 6d 6f 75 73 5c 73 44 51 53 5c 73 sinfamous\sDQS\s
0030: 6d 69 73 66 65 61 74 75 72 65 0a 50 20 30 30 30 misfeature.P 000
0040: 38 65 35 39 65 65 63 65 64 66 33 63 37 32 33 31 8e59eecedf3c7231
0050: 39 31 64 31 61 34 39 39 64 64 35 38 31 30 38 31 91d1a499dd581081
0060: 35 33 65 64 66 0a 55 20 73 61 6e 64 72 6f 0a 57 53edf.U sandro.W
0070: 20 35 35 30 35 0a 3c 61 20 68 72 65 66 3d 22 68 5505.<a href="h
0080: 74 74 70 73 3a 2f 2f 77 77 77 2e 67 61 69 61 2d ttps://www.gaia-
0090: 67 69 73 2e 69 74 2f 66 6f 73 73 69 6c 2f 6c 69 gis.it/fossil/li
00a0: 62 73 70 61 74 69 61 6c 69 74 65 2f 77 69 6b 69 bspatialite/wiki
00b0: 3f 6e 61 6d 65 3d 34 2e 33 2e 30 2d 64 6f 63 22 ?name=4.3.0-doc"
00c0: 3e 62 61 63 6b 3c 2f 61 3e 3c 68 72 3e 3c 62 72 >back</a><hr><br
00d0: 3e 0d 0a 3c 68 31 3e 49 6e 74 72 6f 64 75 63 74 >..<h1>Introduct
00e0: 69 6f 6e 3c 2f 68 31 3e 0d 0a 3c 62 3e 44 51 53 ion</h1>..<b>DQS
00f0: 3c 2f 62 3e 20 73 69 6d 70 6c 79 20 69 73 20 74 </b> simply is t
0100: 68 65 20 61 63 72 6f 6e 79 6d 20 66 6f 72 20 3c he acronym for <
0110: 62 3e 44 6f 75 62 6c 65 2d 51 75 6f 74 65 64 20 b>Double-Quoted
0120: 53 74 72 69 6e 67 73 3c 2f 62 3e 2e 3c 62 72 3e Strings</b>.<br>
0130: 0d 0a 41 6c 6c 20 70 72 65 76 69 6f 75 73 20 76 ..All previous v
0140: 65 72 73 69 6f 6e 73 20 6f 66 20 3c 62 3e 53 51 ersions of <b>SQ
0150: 4c 69 74 65 33 3c 2f 62 3e 20 77 65 72 65 20 61 Lite3</b> were a
0160: 66 66 65 63 74 65 64 20 62 79 20 61 6e 20 6f 62 ffected by an ob
0170: 6e 6f 78 69 6f 75 73 20 3c 69 3e 3c 62 3e 44 51 noxious <i><b>DQ
0180: 53 20 6d 69 73 66 65 61 74 75 72 65 3c 2f 62 3e S misfeature</b>
0190: 3c 2f 69 3e 20 74 68 61 74 20 68 61 73 20 62 65 </i> that has be
01a0: 65 6e 20 66 69 6e 61 6c 6c 79 20 72 65 73 6f 6c en finally resol
01b0: 76 65 64 20 73 74 61 72 74 69 6e 67 20 66 72 6f ved starting fro
01c0: 6d 20 76 65 72 73 69 6f 6e 20 3c 62 3e 33 2e 32 m version <b>3.2
01d0: 39 2e 30 3c 2f 62 3e 20 28 72 65 6c 65 61 73 65 9.0</b> (release
01e0: 64 20 6f 6e 20 3c 62 3e 32 30 31 39 2d 30 37 2d d on <b>2019-07-
01f0: 31 30 3c 2f 62 3e 29 2e 0d 0a 3c 68 33 3e 57 68 10</b>)...<h3>Wh
0200: 61 74 20 74 68 65 20 49 53 4f 20 53 51 4c 20 73 at the ISO SQL s
0210: 74 61 6e 64 61 72 64 73 20 64 69 63 74 61 74 65 tandards dictate
0220: 73 3c 2f 68 33 3e 0d 0a 54 68 65 20 49 53 4f 20 s</h3>..The ISO
0230: 53 51 4c 20 73 74 61 6e 64 61 72 64 20 68 61 73 SQL standard has
0240: 20 74 77 6f 20 64 69 66 66 65 72 65 6e 74 20 6b two different k
0250: 69 6e 64 73 20 6f 66 20 74 65 78 74 20 73 74 72 inds of text str
0260: 69 6e 67 73 3a 0d 0a 3c 6f 6c 3e 0d 0a 3c 6c 69 ings:..<ol>..<li
0270: 3e 3c 62 3e 53 74 72 69 6e 67 20 4c 69 74 65 72 ><b>String Liter
0280: 61 6c 73 3c 2f 62 3e 20 28 61 6b 61 20 3c 69 3e als</b> (aka <i>
0290: 3c 62 3e 54 65 78 74 20 43 6f 6e 73 74 61 6e 74 <b>Text Constant
02a0: 73 3c 2f 62 3e 3c 2f 69 3e 29 3c 62 72 3e 0d 0a s</b></i>)<br>..
02b0: 20 20 20 20 54 68 65 79 20 61 72 65 20 61 6c 77 They are alw
02c0: 61 79 73 20 69 6e 74 65 72 70 72 65 74 65 64 20 ays interpreted
02d0: 61 73 20 3c 62 3e 76 61 6c 75 65 73 3c 2f 62 3e as <b>values</b>
02e0: 2c 20 61 6e 64 20 3c 62 3e 6d 75 73 74 3c 2f 62 , and <b>must</b
02f0: 3e 0d 0a 20 20 20 20 6e 65 63 65 73 73 61 72 69 >.. necessari
0300: 6c 79 20 62 65 20 65 6e 63 6c 6f 73 65 64 20 77 ly be enclosed w
0310: 69 74 68 69 6e 20 61 20 70 61 69 72 20 6f 66 20 ithin a pair of
0320: 3c 62 3e 53 69 6e 67 6c 65 20 51 75 6f 74 65 73 <b>Single Quotes
0330: 3c 62 3e 2e 3c 62 72 3e 0d 0a 20 20 20 20 3c 62 <b>.<br>.. <b
0340: 3e 45 78 61 6d 70 6c 65 3c 2f 62 3e 3a 20 3c 69 >Example</b>: <i
0350: 3e 3c 62 3e 53 45 4c 45 43 54 20 2a 20 46 52 4f ><b>SELECT * FRO
0360: 4d 20 78 20 57 48 45 52 45 20 6e 61 6d 65 20 3d M x WHERE name =
0370: 20 27 73 6f 6d 65 74 68 69 6e 67 27 3b 3c 2f 62 'something';</b
0380: 3e 3c 2f 69 3e 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e ></i></li>..<li>
0390: 3c 62 3e 53 51 4c 20 6e 61 6d 65 73 3c 2f 62 3e <b>SQL names</b>
03a0: 20 28 61 6b 61 20 3c 69 3e 3c 62 3e 53 51 4c 20 (aka <i><b>SQL
03b0: 69 64 65 6e 74 69 66 69 65 72 73 3c 2f 62 3e 3c identifiers</b><
03c0: 2f 69 3e 29 3c 62 72 3e 0d 0a 20 20 20 20 54 68 /i>)<br>.. Th
03d0: 65 79 20 61 72 65 20 69 6e 74 65 6e 64 65 64 20 ey are intended
03e0: 74 6f 20 69 64 65 6e 74 69 66 79 20 3c 62 3e 54 to identify <b>T
03f0: 61 62 6c 65 73 3c 2f 62 3e 2c 20 3c 62 3e 43 6f ables</b>, <b>Co
0400: 6c 75 6d 6e 73 3c 2f 62 3e 2c 20 20 20 3c 62 3e lumns</b>, <b>
0410: 54 72 69 67 67 65 72 73 3c 2f 62 3e 20 61 6e 64 Triggers</b> and
0420: 20 61 6c 69 6b 65 2c 20 61 6e 64 20 3c 62 3e 6d alike, and <b>m
0430: 75 73 74 3c 2f 62 3e 20 6f 70 74 69 6f 6e 61 6c ust</b> optional
0440: 6c 79 20 65 6e 63 6c 6f 73 65 64 20 77 69 74 68 ly enclosed with
0450: 69 6e 20 61 20 70 61 69 72 20 6f 72 20 3c 62 3e in a pair or <b>
0460: 44 6f 75 62 6c 65 20 51 75 6f 74 65 73 3c 2f 62 Double Quotes</b
0470: 3e 2e 3c 62 72 3e 0d 0a 20 20 20 20 4d 6f 72 65 >.<br>.. More
0480: 20 70 72 65 63 69 73 65 6c 79 3a 3c 75 6c 3e 0d precisely:<ul>.
0490: 0a 20 20 20 20 3c 6c 69 3e 53 51 4c 20 6e 61 6d . <li>SQL nam
04a0: 65 73 20 63 6f 6e 74 61 69 6e 69 6e 67 20 61 6e es containing an
04b0: 79 20 3c 62 3e 3c 69 3e 66 6f 72 62 69 64 64 65 y <b><i>forbidde
04c0: 6e 20 63 68 61 72 61 63 74 65 72 3c 2f 69 3e 3c n character</i><
04d0: 2f 62 3e 20 6d 75 73 74 20 62 65 20 61 6c 77 61 /b> must be alwa
04e0: 79 73 20 6d 61 73 6b 65 64 20 62 79 20 65 6e 63 ys masked by enc
04f0: 6c 6f 73 69 6e 67 20 74 68 65 20 69 6e 74 65 6e losing the inten
0500: 64 65 64 20 6e 61 6d 65 20 77 69 74 68 69 6e 20 ded name within
0510: 44 6f 75 62 6c 65 20 51 75 6f 74 65 73 2e 3c 2f Double Quotes.</
0520: 6c 69 3e 0d 0a 20 20 20 20 3c 6c 69 3e 61 6e 79 li>.. <li>any
0530: 20 6f 74 68 65 72 20 53 51 4c 20 6e 61 6d 65 20 other SQL name
0540: 28 6e 6f 74 20 63 6f 6e 74 61 69 6e 69 6e 67 20 (not containing
0550: 66 6f 72 62 69 64 64 65 6e 20 63 68 61 72 61 63 forbidden charac
0560: 74 65 72 73 29 20 64 6f 65 73 20 6e 6f 74 20 73 ters) does not s
0570: 74 72 69 63 74 6c 79 20 72 65 71 75 69 72 65 73 trictly requires
0580: 20 44 6f 75 62 6c 65 2d 71 75 6f 74 69 6e 67 2c Double-quoting,
0590: 20 62 75 74 20 63 61 6e 20 62 65 20 6f 70 74 69 but can be opti
05a0: 6f 6e 61 6c 6c 79 20 44 6f 75 62 6c 65 2d 71 75 onally Double-qu
05b0: 6f 74 65 64 2e 3c 2f 6c 69 3e 3c 2f 75 6c 3e 0d oted.</li></ul>.
05c0: 0a 20 20 20 20 3c 62 3e 45 78 61 6d 70 6c 65 3c . <b>Example<
05d0: 2f 62 3e 3a 20 3c 69 3e 3c 62 3e 53 45 4c 45 43 /b>: <i><b>SELEC
05e0: 54 20 22 61 22 2c 20 22 62 22 2c 20 22 63 22 20 T "a", "b", "c"
05f0: 46 52 4f 4d 20 22 78 22 3b 3c 2f 62 3e 3c 2f 69 FROM "x";</b></i
0600: 3e 3c 2f 6c 69 3e 0d 0a 20 20 20 20 3c 2f 6c 69 ></li>.. </li
0610: 3e 0d 0a 3c 2f 6f 6c 3e 0d 0a 3c 68 33 3e 57 68 >..</ol>..<h3>Wh
0620: 61 74 20 77 61 73 20 65 66 66 65 63 74 69 76 65 at was effective
0630: 6c 79 20 73 75 70 70 6f 72 74 65 64 20 62 79 20 ly supported by
0640: 53 51 4c 69 74 65 3c 2f 68 33 3e 0d 0a 49 6e 20 SQLite</h3>..In
0650: 61 6e 20 61 74 74 65 6d 70 74 20 74 6f 20 6d 69 an attempt to mi
0660: 6d 69 63 20 74 68 65 20 6e 6f 6e 2d 73 74 61 6e mic the non-stan
0670: 64 61 72 64 20 62 65 68 61 76 69 6f 72 20 6f 66 dard behavior of
0680: 20 3c 62 3e 4d 79 53 51 4c 20 33 2e 78 3c 2f 62 <b>MySQL 3.x</b
0690: 3e 20 53 51 4c 69 74 65 20 77 61 73 20 61 6c 77 > SQLite was alw
06a0: 61 79 73 20 76 65 72 79 20 74 6f 6c 65 72 61 6e ays very toleran
06b0: 74 20 61 62 6f 75 74 20 53 69 6e 67 6c 65 2d 20 t about Single-
06c0: 61 6e 64 20 44 6f 75 62 6c 65 2d 51 75 6f 74 69 and Double-Quoti
06d0: 6e 67 2e 3c 62 72 3e 0d 0a 45 76 65 6e 20 69 6e ng.<br>..Even in
06e0: 20 74 68 65 20 63 61 73 65 20 6f 66 20 69 6e 63 the case of inc
06f0: 6f 72 72 65 63 74 20 71 75 6f 74 69 6e 67 20 53 orrect quoting S
0700: 51 4c 69 74 65 20 77 61 73 20 6f 66 74 65 6e 20 QLite was often
0710: 61 62 6c 65 20 74 6f 20 67 75 65 73 73 20 74 68 able to guess th
0720: 65 20 69 6e 74 65 6e 64 65 64 20 73 63 6f 70 65 e intended scope
0730: 20 6f 66 20 61 6e 79 20 73 74 72 69 6e 67 20 62 of any string b
0740: 79 20 61 6e 61 6c 79 7a 69 6e 67 20 69 74 73 20 y analyzing its
0750: 63 6f 6e 74 65 78 74 2e 3c 62 72 3e 0d 0a 49 74 context.<br>..It
0760: 20 63 6c 65 61 72 6c 79 20 77 61 73 20 61 20 70 clearly was a p
0770: 6f 74 65 6e 74 69 61 6c 6c 79 20 65 72 72 6f 72 otentially error
0780: 20 70 72 6f 6e 65 20 61 70 70 72 6f 61 63 68 2c prone approach,
0790: 20 62 75 74 20 69 74 20 68 65 6c 70 65 64 20 6d but it helped m
07a0: 61 6e 79 20 73 6c 6f 70 70 79 20 6f 72 20 6d 65 any sloppy or me
07b0: 73 73 79 20 75 73 65 72 73 20 74 6f 20 77 72 69 ssy users to wri
07c0: 74 65 20 74 68 65 69 72 20 53 51 4c 20 71 75 65 te their SQL que
07d0: 72 69 65 73 20 77 69 74 68 20 66 65 77 20 63 6f ries with few co
07e0: 6d 70 6c 69 63 61 74 69 6f 6e 73 2e 3c 62 72 3e mplications.<br>
07f0: 0d 0a 56 65 72 79 20 73 69 6d 70 6c 79 20 73 61 ..Very simply sa
0800: 69 64 2c 20 69 74 20 77 61 73 20 61 20 3c 62 3e id, it was a <b>
0810: 6d 69 73 66 65 61 74 75 72 65 3c 2f 62 3e 20 62 misfeature</b> b
0820: 61 64 6c 79 20 65 6e 63 6f 75 72 61 67 69 6e 67 adly encouraging
0830: 20 6d 61 6e 79 20 64 65 76 65 6c 6f 70 65 72 73 many developers
0840: 20 69 6e 74 6f 20 74 68 65 20 62 61 64 20 68 61 into the bad ha
0850: 62 69 74 20 6f 66 20 6d 69 73 75 73 69 6e 67 20 bit of misusing
0860: 64 6f 75 62 6c 65 2d 20 61 6e 64 20 73 69 6e 67 double- and sing
0870: 6c 65 2d 71 75 6f 74 69 6e 67 2e 3c 62 72 3e 0d le-quoting.<br>.
0880: 0a 3c 68 33 3e 54 68 65 20 6d 6f 73 74 20 72 65 .<h3>The most re
0890: 63 65 6e 74 20 61 70 70 72 6f 61 63 68 20 6f 66 cent approach of
08a0: 20 53 51 4c 69 74 65 20 74 6f 20 49 53 4f 20 53 SQLite to ISO S
08b0: 51 4c 20 71 75 6f 74 69 6e 67 3c 2f 68 33 3e 20 QL quoting</h3>
08c0: 0d 0a 49 6e 20 72 65 63 65 6e 74 20 74 69 6d 65 ..In recent time
08d0: 73 20 74 68 65 20 64 65 76 65 6c 6f 70 65 72 73 s the developers
08e0: 20 6f 66 20 53 51 4c 69 74 65 20 66 69 6e 61 6c of SQLite final
08f0: 6c 79 20 72 65 63 6f 67 6e 69 7a 65 64 20 74 68 ly recognized th
0900: 61 74 20 64 65 70 61 72 74 69 6e 67 20 66 72 6f at departing fro
0910: 6d 20 74 68 65 20 49 53 4f 20 53 51 4c 20 73 74 m the ISO SQL st
0920: 61 6e 64 61 72 64 20 77 61 73 6e 27 74 20 67 6f andard wasn't go
0930: 6f 64 20 61 74 20 61 6c 6c 2e 3c 62 72 3e 0d 0a od at all.<br>..
0940: 41 6e 64 20 63 6f 6e 73 65 71 75 65 6e 74 6c 79 And consequently
0950: 20 74 68 65 79 20 64 65 63 69 64 65 64 20 74 68 they decided th
0960: 61 74 20 73 74 61 72 74 69 6e 67 20 66 72 6f 6d at starting from
0970: 20 76 65 72 73 69 6f 6e 20 3c 62 3e 33 2e 32 39 version <b>3.29
0980: 2e 30 3c 2f 62 3e 20 53 51 4c 69 74 65 20 73 68 .0</b> SQLite sh
0990: 6f 75 6c 64 20 66 69 6e 61 6c 6c 79 20 62 65 20 ould finally be
09a0: 61 62 6c 65 20 74 6f 20 63 6f 72 72 65 63 74 6c able to correctl
09b0: 79 20 65 6e 66 6f 72 63 65 20 73 74 72 69 63 74 y enforce strict
09c0: 20 49 53 4f 20 53 51 4c 20 71 75 6f 74 69 6e 67 ISO SQL quoting
09d0: 2e 3c 62 72 3e 0d 0a 55 6e 68 61 70 70 69 6c 79 .<br>..Unhappily
09e0: 20 73 75 63 68 20 61 20 72 61 64 69 63 61 6c 20 such a radical
09f0: 63 68 61 6e 67 65 20 63 61 6e 20 68 61 76 65 20 change can have
0a00: 61 20 76 65 72 79 20 68 65 61 76 79 20 69 6d 70 a very heavy imp
0a10: 61 63 74 20 6f 6e 20 61 6c 72 65 61 64 79 20 65 act on already e
0a20: 78 69 73 74 69 6e 67 20 61 70 70 6c 69 63 61 74 xisting applicat
0a30: 69 6f 6e 73 2c 20 73 6f 20 61 20 6d 6f 64 65 72 ions, so a moder
0a40: 61 74 65 20 61 70 70 72 6f 61 63 68 20 77 61 73 ate approach was
0a50: 20 61 64 6f 70 74 65 64 3a 0d 0a 3c 75 6c 3e 0d adopted:..<ul>.
0a60: 0a 3c 6c 69 3e 61 20 6e 65 77 20 62 75 69 6c 64 .<li>a new build
0a70: 2d 74 69 6d 65 20 6f 70 74 69 6f 6e 20 68 61 73 -time option has
0a80: 20 62 65 65 6e 20 69 6e 74 72 6f 64 75 63 65 2c been introduce,
0a90: 20 3c 62 3e 2d 44 53 51 4c 49 54 45 5f 44 51 53 <b>-DSQLITE_DQS
0aa0: 3d 3c 69 3e 6e 3c 2f 69 3e 3c 2f 62 3e 3c 2f 6c =<i>n</i></b></l
0ab0: 69 3e 0d 0a 3c 6c 69 3e 54 68 65 20 64 65 66 61 i>..<li>The defa
0ac0: 75 6c 74 20 61 73 73 75 6d 70 74 69 6f 6e 20 69 ult assumption i
0ad0: 73 20 3c 62 3e 2d 44 53 51 4c 49 54 45 5f 44 51 s <b>-DSQLITE_DQ
0ae0: 53 3d 33 3c 2f 62 3e 3c 62 72 3e 0d 0a 20 20 20 S=3</b><br>..
0af0: 20 74 68 69 73 20 70 72 61 63 74 69 63 61 6c 6c this practicall
0b00: 79 20 63 6f 72 72 65 73 70 6f 6e 64 73 20 74 6f y corresponds to
0b10: 20 74 68 65 20 6f 6c 64 20 74 72 61 64 69 74 69 the old traditi
0b20: 6f 6e 61 6c 20 62 65 68 61 76 69 6f 72 20 28 69 onal behavior (i
0b30: 2e 65 2e 20 73 75 70 70 6f 72 74 69 6e 67 20 61 .e. supporting a
0b40: 20 76 65 72 79 20 70 65 72 6d 69 73 73 69 76 65 very permissive
0b50: 20 61 6e 64 20 74 6f 6c 65 72 61 6e 74 20 71 75 and tolerant qu
0b60: 6f 74 69 6e 67 20 69 6e 74 65 72 70 72 65 74 61 oting interpreta
0b70: 74 69 6f 6e 29 2e 3c 2f 6c 69 3e 0d 0a 3c 6c 69 tion).</li>..<li
0b80: 3e 42 75 74 20 74 68 65 20 64 65 76 65 6c 6f 70 >But the develop
0b90: 65 72 73 20 6f 66 20 53 51 4c 69 74 65 20 73 74 ers of SQLite st
0ba0: 72 6f 6e 67 6c 79 20 72 65 63 6f 6d 6d 65 6e 64 rongly recommend
0bb0: 20 74 6f 20 61 6c 77 61 79 73 20 65 78 70 6c 69 to always expli
0bc0: 63 69 74 6c 79 20 73 65 74 20 3c 62 3e 2d 44 53 citly set <b>-DS
0bd0: 51 4c 49 54 45 5f 44 51 53 3d 33 3c 2f 62 3e 3c QLITE_DQS=3</b><
0be0: 62 72 3e 0d 0a 20 20 20 20 74 68 69 73 20 77 69 br>.. this wi
0bf0: 6c 6c 20 65 6e 66 6f 72 63 65 20 73 74 72 69 63 ll enforce stric
0c00: 74 20 49 53 4f 20 53 51 4c 20 71 75 6f 74 69 6e t ISO SQL quotin
0c10: 67 2c 20 61 6e 64 20 77 69 6c 6c 20 64 65 66 69 g, and will defi
0c20: 6e 69 74 65 6c 79 20 65 72 61 64 69 63 61 74 65 nitely eradicate
0c30: 20 74 68 65 20 65 78 74 72 61 76 61 67 61 6e 74 the extravagant
0c40: 20 3c 62 3e 44 51 53 20 6d 69 73 66 65 61 74 75 <b>DQS misfeatu
0c50: 72 65 3c 2f 62 3e 2e 3c 2f 6c 69 3e 0d 0a 3c 2f re</b>.</li>..</
0c60: 75 6c 3e 0d 0a 3c 68 33 3e 41 20 70 72 61 63 74 ul>..<h3>A pract
0c70: 69 63 61 6c 20 63 6f 6d 70 61 72 61 74 69 76 65 ical comparative
0c80: 20 74 65 73 74 3c 2f 68 33 3e 0d 0a 3c 74 61 62 test</h3>..<tab
0c90: 6c 65 20 62 67 63 6f 6c 6f 72 3d 22 23 65 30 66 le bgcolor="#e0f
0ca0: 66 65 30 22 20 62 6f 72 64 65 72 3d 22 31 22 20 fe0" border="1"
0cb0: 63 65 6c 6c 73 70 61 63 69 6e 67 3d 22 36 22 20 cellspacing="6"
0cc0: 63 65 6c 6c 70 61 64 64 69 6e 67 3d 22 36 22 20 cellpadding="6"
0cd0: 77 69 64 74 68 3d 22 31 30 30 25 22 3e 0d 0a 3c width="100%">..<
0ce0: 74 72 3e 3c 74 68 3e 54 65 73 74 65 64 20 6f 6e tr><th>Tested on
0cf0: 20 53 51 4c 69 74 65 20 33 2e 32 35 2e 33 3c 2f SQLite 3.25.3</
0d00: 74 68 3e 3c 74 68 3e 54 65 73 74 65 64 20 6f 6e th><th>Tested on
0d10: 20 53 51 4c 69 74 65 20 33 2e 32 39 2e 30 20 2d SQLite 3.29.0 -
0d20: 20 63 6f 6d 70 69 6c 65 64 20 77 69 74 68 20 2d compiled with -
0d30: 44 53 51 4c 49 54 45 5f 44 51 53 3d 30 3c 2f 74 DSQLITE_DQS=0</t
0d40: 68 3e 3c 2f 74 72 3e 0d 0a 3c 74 72 3e 0d 0a 3c h></tr>..<tr>..<
0d50: 74 64 3e 3c 76 65 72 62 61 74 69 6d 3e 0d 0a 43 td><verbatim>..C
0d60: 52 45 41 54 45 20 54 41 42 4c 45 20 22 74 65 73 REATE TABLE "tes
0d70: 74 22 20 28 0d 0a 20 20 20 20 22 69 64 22 20 49 t" (.. "id" I
0d80: 4e 54 45 47 45 52 20 50 52 49 4d 41 52 59 20 4b NTEGER PRIMARY K
0d90: 45 59 2c 0d 0a 20 20 20 20 22 6e 61 6d 65 22 20 EY,.. "name"
0da0: 54 45 58 54 20 4e 4f 54 20 4e 55 4c 4c 29 3b 0d TEXT NOT NULL);.
0db0: 0a 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d .---------------
0dc0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0d 0a --------------..
0dd0: 6f 6b 0d 0a 0d 0a 49 4e 53 45 52 54 20 49 4e 54 ok....INSERT INT
0de0: 4f 20 22 74 65 73 74 22 20 28 22 69 64 22 2c 20 O "test" ("id",
0df0: 22 6e 61 6d 65 22 29 20 56 41 4c 55 45 53 20 28 "name") VALUES (
0e00: 31 32 33 2c 20 22 6f 6e 65 22 29 3b 0d 0a 2d 2d 123, "one");..--
0e10: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
0e20: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0d 0a 6f 6b 0d -----------..ok.
0e30: 0a 0d 0a 53 45 4c 45 43 54 20 22 69 64 22 20 46 ...SELECT "id" F
0e40: 52 4f 4d 20 22 74 65 73 74 22 20 57 48 45 52 45 ROM "test" WHERE
0e50: 20 22 6e 61 6d 65 22 20 3d 20 22 6f 6e 65 22 3b "name" = "one";
0e60: 0d 0a 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ..--------------
0e70: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0d ---------------.
0e80: 0a 31 32 33 0d 0a 0d 0a 49 4e 53 45 52 54 20 49 .123....INSERT I
0e90: 4e 54 4f 20 74 65 73 74 20 28 69 64 2c 20 6e 61 NTO test (id, na
0ea0: 6d 65 29 20 56 41 4c 55 45 53 20 28 31 32 33 34 me) VALUES (1234
0eb0: 35 36 2c 20 27 74 77 6f 27 29 3b 0d 0a 2d 2d 2d 56, 'two');..---
0ec0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
0ed0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0d 0a 6f 6b 0d 0a ----------..ok..
0ee0: 0d 0a 53 45 4c 45 43 54 20 69 64 20 46 52 4f 4d ..SELECT id FROM
0ef0: 20 74 65 73 74 20 57 48 45 52 45 20 6e 61 6d 65 test WHERE name
0f00: 20 3d 20 27 74 77 6f 27 3b 0d 0a 2d 2d 2d 2d 2d = 'two';..-----
0f10: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
0f20: 2d 2d 2d 2d 2d 2d 2d 2d 0d 0a 31 32 33 34 35 36 --------..123456
0f30: 0d 0a 3c 2f 76 65 72 62 61 74 69 6d 3e 3c 2f 74 ..</verbatim></t
0f40: 64 3e 0d 0a 3c 74 64 3e 3c 76 65 72 62 61 74 69 d>..<td><verbati
0f50: 6d 3e 0d 0a 43 52 45 41 54 45 20 54 41 42 4c 45 m>..CREATE TABLE
0f60: 20 22 74 65 73 74 22 20 28 0d 0a 20 20 20 20 22 "test" (.. "
0f70: 69 64 22 20 49 4e 54 45 47 45 52 20 50 52 49 4d id" INTEGER PRIM
0f80: 41 52 59 20 4b 45 59 2c 0d 0a 20 20 20 20 22 6e ARY KEY,.. "n
0f90: 61 6d 65 22 20 54 45 58 54 20 4e 4f 54 20 4e 55 ame" TEXT NOT NU
0fa0: 4c 4c 29 3b 0d 0a 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d LL);..----------
0fb0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
0fc0: 2d 2d 2d 0d 0a 6f 6b 0d 0a 0d 0a 49 4e 53 45 52 ---..ok....INSER
0fd0: 54 20 49 4e 54 4f 20 22 74 65 73 74 22 20 28 22 T INTO "test" ("
0fe0: 69 64 22 2c 20 22 6e 61 6d 65 22 29 20 56 41 4c id", "name") VAL
0ff0: 55 45 53 20 28 31 32 33 2c 20 22 6f 6e 65 22 29 UES (123, "one")
1000: 3b 0d 0a 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ;..-------------
1010: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
1020: 0d 0a 6e 6f 20 73 75 63 68 20 63 6f 6c 75 6d 6e ..no such column
1030: 3a 20 6f 6e 65 0d 0a 0d 0a 53 45 4c 45 43 54 20 : one....SELECT
1040: 22 69 64 22 20 46 52 4f 4d 20 22 74 65 73 74 22 "id" FROM "test"
1050: 20 57 48 45 52 45 20 22 6e 61 6d 65 22 20 3d 20 WHERE "name" =
1060: 22 6f 6e 65 22 3b 0d 0a 2d 2d 2d 2d 2d 2d 2d 2d "one";..--------
1070: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
1080: 2d 2d 2d 2d 2d 0d 0a 6e 6f 20 73 75 63 68 20 63 -----..no such c
1090: 6f 6c 75 6d 6e 3a 20 6f 6e 65 0d 0a 0d 0a 49 4e olumn: one....IN
10a0: 53 45 52 54 20 49 4e 54 4f 20 74 65 73 74 20 28 SERT INTO test (
10b0: 69 64 2c 20 6e 61 6d 65 29 20 56 41 4c 55 45 53 id, name) VALUES
10c0: 20 28 31 32 33 34 35 36 2c 20 27 74 77 6f 27 29 (123456, 'two')
10d0: 3b 0d 0a 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ;..-------------
10e0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
10f0: 0d 0a 6f 6b 0d 0a 0d 0a 53 45 4c 45 43 54 20 69 ..ok....SELECT i
1100: 64 20 46 52 4f 4d 20 74 65 73 74 20 57 48 45 52 d FROM test WHER
1110: 45 20 6e 61 6d 65 20 3d 20 27 74 77 6f 27 3b 0d E name = 'two';.
1120: 0a 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d .---------------
1130: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0d 0a --------------..
1140: 31 32 33 34 35 36 0d 0a 3c 2f 76 65 72 62 61 74 123456..</verbat
1150: 69 6d 3e 3c 2f 74 64 3e 0d 0a 3c 2f 74 72 3e 20 im></td>..</tr>
1160: 0d 0a 3c 2f 74 61 62 6c 65 3e 0d 0a 3c 68 33 3e ..</table>..<h3>
1170: 41 6e 65 63 64 6f 74 61 6c 20 65 76 69 64 65 6e Anecdotal eviden
1180: 63 65 3c 2f 68 33 3e 0d 0a 54 68 65 20 63 6f 64 ce</h3>..The cod
1190: 65 20 6f 66 20 3c 62 3e 6c 69 62 73 70 61 74 69 e of <b>libspati
11a0: 61 6c 69 74 65 3c 2f 62 3e 20 69 74 73 65 6c 66 alite</b> itself
11b0: 20 68 61 64 20 76 65 72 79 20 6c 69 74 74 6c 65 had very little
11c0: 20 70 72 6f 62 6c 65 6d 73 20 69 6e 20 6e 69 63 problems in nic
11d0: 65 6c 79 20 61 64 61 70 74 69 6e 67 20 74 6f 20 ely adapting to
11e0: 68 65 20 6d 6f 73 74 20 72 65 63 65 6e 74 20 3c he most recent <
11f0: 62 3e 2d 44 53 51 4c 49 54 45 5f 44 51 53 3d 30 b>-DSQLITE_DQS=0
1200: 3c 2f 62 3e 20 72 65 71 75 69 72 65 6d 65 6e 74 </b> requirement
1210: 73 20 6f 66 20 53 51 4c 69 74 65 20 3c 62 3e 33 s of SQLite <b>3
1220: 2e 32 39 2e 30 3c 2f 62 3e 2e 3c 62 72 3e 0d 0a .29.0</b>.<br>..
1230: 54 68 65 72 65 20 77 65 72 65 20 6a 75 73 74 20 There were just
1240: 61 20 63 6f 75 70 6c 65 20 6f 66 20 62 61 64 6c a couple of badl
1250: 79 20 71 75 6f 74 65 64 20 53 51 4c 20 53 74 61 y quoted SQL Sta
1260: 74 65 6d 65 6e 74 73 20 72 65 71 75 69 72 69 6e tements requirin
1270: 67 20 74 6f 20 62 65 20 66 69 78 65 64 2e 3c 62 g to be fixed.<b
1280: 72 3e 3c 62 72 3e 0d 0a 42 75 74 20 70 72 6f 70 r><br>..But prop
1290: 65 72 6c 79 20 72 65 73 74 6f 72 69 6e 67 20 74 erly restoring t
12a0: 68 65 20 74 65 73 74 20 63 6f 76 65 72 61 67 65 he test coverage
12b0: 20 77 61 73 20 61 20 6e 61 73 74 79 20 73 75 72 was a nasty sur
12c0: 70 72 69 73 65 2e 3c 62 72 3e 0d 0a 54 68 65 72 prise.<br>..Ther
12d0: 65 20 77 65 72 65 20 70 6c 65 6e 74 79 20 6f 66 e were plenty of
12e0: 20 6d 69 73 71 75 6f 74 65 64 20 53 51 4c 20 53 misquoted SQL S
12f0: 74 61 74 65 6d 65 6e 74 73 20 28 61 62 6f 75 74 tatements (about
1300: 20 73 6f 6d 65 20 74 68 6f 75 73 61 6e 64 73 29 some thousands)
1310: 2c 20 61 6e 64 20 70 61 74 69 65 6e 74 6c 79 20 , and patiently
1320: 6e 75 72 73 69 6e 67 20 61 6c 6c 20 74 68 65 6d nursing all them
1330: 20 77 61 73 20 61 20 6c 65 6e 67 74 68 79 20 61 was a lengthy a
1340: 6e 64 20 62 6f 72 69 6e 67 20 74 61 73 6b 2e 3c nd boring task.<
1350: 62 72 3e 3c 62 72 3e 0d 0a 3c 66 6f 6e 74 20 73 br><br>..<font s
1360: 69 7a 65 3d 22 35 22 20 63 6f 6c 6f 72 3d 22 72 ize="5" color="r
1370: 65 64 22 3e 0d 0a 42 65 20 77 61 72 6e 65 64 3a ed">..Be warned:
1380: 20 73 77 69 74 63 68 69 6e 67 20 74 6f 20 74 68 switching to th
1390: 65 20 6d 6f 72 65 20 73 74 72 69 6e 67 65 6e 74 e more stringent
13a0: 20 72 65 71 75 69 72 65 6d 65 6e 74 73 20 6f 66 requirements of
13b0: 20 74 68 65 20 6d 6f 73 74 20 72 65 63 65 6e 74 the most recent
13c0: 20 76 65 72 73 69 6f 6e 73 20 6f 66 20 53 51 4c versions of SQL
13d0: 69 74 65 3c 62 72 3e 0d 0a 63 61 6e 20 65 61 73 ite<br>..can eas
13e0: 69 6c 79 20 62 65 63 6f 6d 65 20 61 20 72 65 61 ily become a rea
13f0: 6c 20 6e 69 67 68 74 6d 61 72 65 2c 20 6d 6f 73 l nightmare, mos
1400: 74 20 6e 6f 74 61 62 6c 79 20 69 66 20 79 6f 75 t notably if you
1410: 20 75 73 75 61 6c 6c 79 20 61 64 6f 70 74 65 64 usually adopted
1420: 20 61 20 73 6c 6f 70 70 79 20 53 51 4c 20 71 75 a sloppy SQL qu
1430: 6f 74 69 6e 67 20 73 74 79 6c 65 2e 0d 0a 3c 2f oting style...</
1440: 66 6f 6e 74 3e 3c 62 72 3e 3c 62 72 3e 0d 0a 3c font><br><br>..<
1450: 74 61 62 6c 65 20 62 67 63 6f 6c 6f 72 3d 22 23 table bgcolor="#
1460: 66 66 66 30 65 30 22 20 62 6f 72 64 65 72 3d 22 fff0e0" border="
1470: 31 22 20 63 65 6c 6c 73 70 61 63 69 6e 67 3d 22 1" cellspacing="
1480: 36 22 20 63 65 6c 6c 70 61 64 64 69 6e 67 3d 22 6" cellpadding="
1490: 31 36 22 3e 0d 0a 3c 74 72 3e 3c 74 64 3e 0d 0a 16">..<tr><td>..
14a0: 3c 68 31 3e 49 6d 70 6f 72 74 61 6e 74 20 6e 6f <h1>Important no
14b0: 74 69 63 65 20 66 6f 72 20 57 69 6e 64 6f 77 73 tice for Windows
14c0: 20 75 73 65 72 73 3c 2f 68 31 3e 0d 0a 41 6c 6c users</h1>..All
14d0: 20 66 75 74 75 72 65 20 62 69 6e 61 72 79 20 70 future binary p
14e0: 61 63 6b 61 67 65 73 20 66 6f 72 20 57 69 6e 64 ackages for Wind
14f0: 6f 77 73 20 64 69 73 74 72 69 62 75 74 65 64 20 ows distributed
1500: 62 79 20 53 70 61 74 69 61 4c 69 74 65 20 69 74 by SpatiaLite it
1510: 73 65 6c 66 20 77 69 6c 6c 20 62 65 20 61 6c 77 self will be alw
1520: 61 79 73 20 62 75 69 6c 74 20 62 79 20 73 70 65 ays built by spe
1530: 63 69 66 79 69 6e 67 20 74 68 65 20 3c 62 3e 2d cifying the <b>-
1540: 44 53 51 4c 49 54 45 5f 44 51 53 3d 30 3c 2f 62 DSQLITE_DQS=0</b
1550: 3e 20 6f 70 74 69 6f 6e 2e 3c 62 72 3e 3c 62 72 > option.<br><br
1560: 3e 0d 0a 3c 68 31 3e 42 65 20 70 72 65 70 61 72 >..<h1>Be prepar
1570: 65 64 2e 3c 2f 68 31 3e 0d 0a 3c 2f 74 64 3e 3c ed.</h1>..</td><
1580: 2f 74 72 3e 0d 0a 3c 2f 74 61 62 6c 65 3e 0d 0a /tr>..</table>..
1590: 3c 62 72 3e 3c 62 72 3e 0d 0a 3c 68 72 3e 3c 62 <br><br>..<hr><b
15a0: 72 3e 0d 0a 3c 61 20 68 72 65 66 3d 22 68 74 74 r>..<a href="htt
15b0: 70 73 3a 2f 2f 77 77 77 2e 67 61 69 61 2d 67 69 ps://www.gaia-gi
15c0: 73 2e 69 74 2f 66 6f 73 73 69 6c 2f 6c 69 62 73 s.it/fossil/libs
15d0: 70 61 74 69 61 6c 69 74 65 2f 77 69 6b 69 3f 6e patialite/wiki?n
15e0: 61 6d 65 3d 34 2e 33 2e 30 2d 64 6f 63 22 3e 62 ame=4.3.0-doc">b
15f0: 61 63 6b 3c 2f 61 3e 0a 5a 20 38 38 35 37 64 63 ack</a>.Z 8857dc
1600: 38 35 63 39 37 31 65 61 35 31 38 66 62 33 65 63 85c971ea518fb3ec
1610: 65 34 37 65 64 65 64 38 33 65 0a e47eded83e.