Artifact
10f2bbd56c7b1b846445bf505ee54d221dc48437:
Wiki page
[The infamous DQS misfeature] by
sandro
2019-12-26 15:55:59.
0000: 44 20 32 30 31 39 2d 31 32 2d 32 36 54 31 35 3a D 2019-12-26T15:
0010: 35 35 3a 35 39 2e 38 33 36 0a 4c 20 54 68 65 5c 55:59.836.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 64 34 33 misfeature.P d43
0040: 37 65 33 32 62 35 34 64 30 36 61 30 62 37 33 63 7e32b54d06a0b73c
0050: 31 32 36 63 33 37 63 36 31 38 65 65 31 65 62 31 126c37c618ee1eb1
0060: 64 38 64 34 37 0a 55 20 73 61 6e 64 72 6f 0a 57 d8d47.U sandro.W
0070: 20 35 35 35 31 0a 42 61 63 6b 20 74 6f 20 3c 61 5551.Back to <a
0080: 20 68 72 65 66 3d 22 68 74 74 70 73 3a 2f 2f 77 href="https://w
0090: 77 77 2e 67 61 69 61 2d 67 69 73 2e 69 74 2f 66 ww.gaia-gis.it/f
00a0: 6f 73 73 69 6c 2f 6c 69 62 73 70 61 74 69 61 6c ossil/libspatial
00b0: 69 74 65 2f 77 69 6b 69 3f 6e 61 6d 65 3d 35 2e ite/wiki?name=5.
00c0: 30 2e 30 2d 64 6f 63 22 3e 35 2e 30 2e 30 2d 64 0.0-doc">5.0.0-d
00d0: 6f 63 20 6d 61 69 6e 20 70 61 67 65 3c 2f 61 3e oc main page</a>
00e0: 3c 68 72 3e 3c 62 72 3e 0d 0a 3c 68 31 3e 49 6e <hr><br>..<h1>In
00f0: 74 72 6f 64 75 63 74 69 6f 6e 3c 2f 68 31 3e 0d troduction</h1>.
0100: 0a 3c 62 3e 44 51 53 3c 2f 62 3e 20 73 69 6d 70 .<b>DQS</b> simp
0110: 6c 79 20 69 73 20 74 68 65 20 61 63 72 6f 6e 79 ly is the acrony
0120: 6d 20 66 6f 72 20 3c 62 3e 44 6f 75 62 6c 65 2d m for <b>Double-
0130: 51 75 6f 74 65 64 20 53 74 72 69 6e 67 73 3c 2f Quoted Strings</
0140: 62 3e 2e 3c 62 72 3e 0d 0a 41 6c 6c 20 70 72 65 b>.<br>..All pre
0150: 76 69 6f 75 73 20 76 65 72 73 69 6f 6e 73 20 6f vious versions o
0160: 66 20 3c 62 3e 53 51 4c 69 74 65 33 3c 2f 62 3e f <b>SQLite3</b>
0170: 20 77 65 72 65 20 61 66 66 65 63 74 65 64 20 62 were affected b
0180: 79 20 61 6e 20 6f 62 6e 6f 78 69 6f 75 73 20 3c y an obnoxious <
0190: 69 3e 3c 62 3e 44 51 53 20 6d 69 73 66 65 61 74 i><b>DQS misfeat
01a0: 75 72 65 3c 2f 62 3e 3c 2f 69 3e 20 74 68 61 74 ure</b></i> that
01b0: 20 68 61 73 20 62 65 65 6e 20 66 69 6e 61 6c 6c has been finall
01c0: 79 20 72 65 73 6f 6c 76 65 64 20 73 74 61 72 74 y resolved start
01d0: 69 6e 67 20 66 72 6f 6d 20 76 65 72 73 69 6f 6e ing from version
01e0: 20 3c 62 3e 33 2e 32 39 2e 30 3c 2f 62 3e 20 28 <b>3.29.0</b> (
01f0: 72 65 6c 65 61 73 65 64 20 6f 6e 20 3c 62 3e 32 released on <b>2
0200: 30 31 39 2d 30 37 2d 31 30 3c 2f 62 3e 29 2e 0d 019-07-10</b>)..
0210: 0a 3c 68 33 3e 57 68 61 74 20 74 68 65 20 49 53 .<h3>What the IS
0220: 4f 20 53 51 4c 20 73 74 61 6e 64 61 72 64 73 20 O SQL standards
0230: 64 69 63 74 61 74 65 73 3c 2f 68 33 3e 0d 0a 54 dictates</h3>..T
0240: 68 65 20 49 53 4f 20 53 51 4c 20 73 74 61 6e 64 he ISO SQL stand
0250: 61 72 64 20 68 61 73 20 74 77 6f 20 64 69 66 66 ard has two diff
0260: 65 72 65 6e 74 20 6b 69 6e 64 73 20 6f 66 20 74 erent kinds of t
0270: 65 78 74 20 73 74 72 69 6e 67 73 3a 0d 0a 3c 6f ext strings:..<o
0280: 6c 3e 0d 0a 3c 6c 69 3e 3c 62 3e 53 74 72 69 6e l>..<li><b>Strin
0290: 67 20 4c 69 74 65 72 61 6c 73 3c 2f 62 3e 20 28 g Literals</b> (
02a0: 61 6b 61 20 3c 69 3e 3c 62 3e 54 65 78 74 20 43 aka <i><b>Text C
02b0: 6f 6e 73 74 61 6e 74 73 3c 2f 62 3e 3c 2f 69 3e onstants</b></i>
02c0: 29 3c 62 72 3e 0d 0a 20 20 20 20 54 68 65 79 20 )<br>.. They
02d0: 61 72 65 20 61 6c 77 61 79 73 20 69 6e 74 65 72 are always inter
02e0: 70 72 65 74 65 64 20 61 73 20 3c 62 3e 76 61 6c preted as <b>val
02f0: 75 65 73 3c 2f 62 3e 2c 20 61 6e 64 20 3c 62 3e ues</b>, and <b>
0300: 6d 75 73 74 3c 2f 62 3e 0d 0a 20 20 20 20 6e 65 must</b>.. ne
0310: 63 65 73 73 61 72 69 6c 79 20 62 65 20 65 6e 63 cessarily be enc
0320: 6c 6f 73 65 64 20 77 69 74 68 69 6e 20 61 20 70 losed within a p
0330: 61 69 72 20 6f 66 20 3c 62 3e 53 69 6e 67 6c 65 air of <b>Single
0340: 20 51 75 6f 74 65 73 3c 62 3e 2e 3c 62 72 3e 0d Quotes<b>.<br>.
0350: 0a 20 20 20 20 3c 62 3e 45 78 61 6d 70 6c 65 3c . <b>Example<
0360: 2f 62 3e 3a 20 3c 69 3e 3c 62 3e 53 45 4c 45 43 /b>: <i><b>SELEC
0370: 54 20 2a 20 46 52 4f 4d 20 78 20 57 48 45 52 45 T * FROM x WHERE
0380: 20 6e 61 6d 65 20 3d 20 27 73 6f 6d 65 74 68 69 name = 'somethi
0390: 6e 67 27 3b 3c 2f 62 3e 3c 2f 69 3e 3c 2f 6c 69 ng';</b></i></li
03a0: 3e 0d 0a 3c 6c 69 3e 3c 62 3e 53 51 4c 20 6e 61 >..<li><b>SQL na
03b0: 6d 65 73 3c 2f 62 3e 20 28 61 6b 61 20 3c 69 3e mes</b> (aka <i>
03c0: 3c 62 3e 53 51 4c 20 69 64 65 6e 74 69 66 69 65 <b>SQL identifie
03d0: 72 73 3c 2f 62 3e 3c 2f 69 3e 29 3c 62 72 3e 0d rs</b></i>)<br>.
03e0: 0a 20 20 20 20 54 68 65 79 20 61 72 65 20 69 6e . They are in
03f0: 74 65 6e 64 65 64 20 74 6f 20 69 64 65 6e 74 69 tended to identi
0400: 66 79 20 3c 62 3e 54 61 62 6c 65 73 3c 2f 62 3e fy <b>Tables</b>
0410: 2c 20 3c 62 3e 43 6f 6c 75 6d 6e 73 3c 2f 62 3e , <b>Columns</b>
0420: 2c 20 20 20 3c 62 3e 54 72 69 67 67 65 72 73 3c , <b>Triggers<
0430: 2f 62 3e 20 61 6e 64 20 61 6c 69 6b 65 2c 20 61 /b> and alike, a
0440: 6e 64 20 3c 62 3e 6d 75 73 74 3c 2f 62 3e 20 6f nd <b>must</b> o
0450: 70 74 69 6f 6e 61 6c 6c 79 20 65 6e 63 6c 6f 73 ptionally enclos
0460: 65 64 20 77 69 74 68 69 6e 20 61 20 70 61 69 72 ed within a pair
0470: 20 6f 72 20 3c 62 3e 44 6f 75 62 6c 65 20 51 75 or <b>Double Qu
0480: 6f 74 65 73 3c 2f 62 3e 2e 3c 62 72 3e 0d 0a 20 otes</b>.<br>..
0490: 20 20 20 4d 6f 72 65 20 70 72 65 63 69 73 65 6c More precisel
04a0: 79 3a 3c 75 6c 3e 0d 0a 20 20 20 20 3c 6c 69 3e y:<ul>.. <li>
04b0: 53 51 4c 20 6e 61 6d 65 73 20 63 6f 6e 74 61 69 SQL names contai
04c0: 6e 69 6e 67 20 61 6e 79 20 3c 62 3e 3c 69 3e 66 ning any <b><i>f
04d0: 6f 72 62 69 64 64 65 6e 20 63 68 61 72 61 63 74 orbidden charact
04e0: 65 72 3c 2f 69 3e 3c 2f 62 3e 20 6d 75 73 74 20 er</i></b> must
04f0: 62 65 20 61 6c 77 61 79 73 20 6d 61 73 6b 65 64 be always masked
0500: 20 62 79 20 65 6e 63 6c 6f 73 69 6e 67 20 74 68 by enclosing th
0510: 65 20 69 6e 74 65 6e 64 65 64 20 6e 61 6d 65 20 e intended name
0520: 77 69 74 68 69 6e 20 44 6f 75 62 6c 65 20 51 75 within Double Qu
0530: 6f 74 65 73 2e 3c 2f 6c 69 3e 0d 0a 20 20 20 20 otes.</li>..
0540: 3c 6c 69 3e 61 6e 79 20 6f 74 68 65 72 20 53 51 <li>any other SQ
0550: 4c 20 6e 61 6d 65 20 28 6e 6f 74 20 63 6f 6e 74 L name (not cont
0560: 61 69 6e 69 6e 67 20 66 6f 72 62 69 64 64 65 6e aining forbidden
0570: 20 63 68 61 72 61 63 74 65 72 73 29 20 64 6f 65 characters) doe
0580: 73 20 6e 6f 74 20 73 74 72 69 63 74 6c 79 20 72 s not strictly r
0590: 65 71 75 69 72 65 73 20 44 6f 75 62 6c 65 2d 71 equires Double-q
05a0: 75 6f 74 69 6e 67 2c 20 62 75 74 20 63 61 6e 20 uoting, but can
05b0: 62 65 20 6f 70 74 69 6f 6e 61 6c 6c 79 20 44 6f be optionally Do
05c0: 75 62 6c 65 2d 71 75 6f 74 65 64 2e 3c 2f 6c 69 uble-quoted.</li
05d0: 3e 3c 2f 75 6c 3e 0d 0a 20 20 20 20 3c 62 3e 45 ></ul>.. <b>E
05e0: 78 61 6d 70 6c 65 3c 2f 62 3e 3a 20 3c 69 3e 3c xample</b>: <i><
05f0: 62 3e 53 45 4c 45 43 54 20 22 61 22 2c 20 22 62 b>SELECT "a", "b
0600: 22 2c 20 22 63 22 20 46 52 4f 4d 20 22 78 22 3b ", "c" FROM "x";
0610: 3c 2f 62 3e 3c 2f 69 3e 3c 2f 6c 69 3e 0d 0a 20 </b></i></li>..
0620: 20 20 20 3c 2f 6c 69 3e 0d 0a 3c 2f 6f 6c 3e 0d </li>..</ol>.
0630: 0a 3c 68 33 3e 57 68 61 74 20 77 61 73 20 65 66 .<h3>What was ef
0640: 66 65 63 74 69 76 65 6c 79 20 73 75 70 70 6f 72 fectively suppor
0650: 74 65 64 20 62 79 20 53 51 4c 69 74 65 3c 2f 68 ted by SQLite</h
0660: 33 3e 0d 0a 49 6e 20 61 6e 20 61 74 74 65 6d 70 3>..In an attemp
0670: 74 20 74 6f 20 6d 69 6d 69 63 20 74 68 65 20 6e t to mimic the n
0680: 6f 6e 2d 73 74 61 6e 64 61 72 64 20 62 65 68 61 on-standard beha
0690: 76 69 6f 72 20 6f 66 20 3c 62 3e 4d 79 53 51 4c vior of <b>MySQL
06a0: 20 33 2e 78 3c 2f 62 3e 20 53 51 4c 69 74 65 20 3.x</b> SQLite
06b0: 77 61 73 20 61 6c 77 61 79 73 20 76 65 72 79 20 was always very
06c0: 74 6f 6c 65 72 61 6e 74 20 61 62 6f 75 74 20 53 tolerant about S
06d0: 69 6e 67 6c 65 2d 20 61 6e 64 20 44 6f 75 62 6c ingle- and Doubl
06e0: 65 2d 51 75 6f 74 69 6e 67 2e 3c 62 72 3e 0d 0a e-Quoting.<br>..
06f0: 45 76 65 6e 20 69 6e 20 74 68 65 20 63 61 73 65 Even in the case
0700: 20 6f 66 20 69 6e 63 6f 72 72 65 63 74 20 71 75 of incorrect qu
0710: 6f 74 69 6e 67 20 53 51 4c 69 74 65 20 77 61 73 oting SQLite was
0720: 20 6f 66 74 65 6e 20 61 62 6c 65 20 74 6f 20 67 often able to g
0730: 75 65 73 73 20 74 68 65 20 69 6e 74 65 6e 64 65 uess the intende
0740: 64 20 73 63 6f 70 65 20 6f 66 20 61 6e 79 20 73 d scope of any s
0750: 74 72 69 6e 67 20 62 79 20 61 6e 61 6c 79 7a 69 tring by analyzi
0760: 6e 67 20 69 74 73 20 63 6f 6e 74 65 78 74 2e 3c ng its context.<
0770: 62 72 3e 0d 0a 49 74 20 63 6c 65 61 72 6c 79 20 br>..It clearly
0780: 77 61 73 20 61 20 70 6f 74 65 6e 74 69 61 6c 6c was a potentiall
0790: 79 20 65 72 72 6f 72 20 70 72 6f 6e 65 20 61 70 y error prone ap
07a0: 70 72 6f 61 63 68 2c 20 62 75 74 20 69 74 20 68 proach, but it h
07b0: 65 6c 70 65 64 20 6d 61 6e 79 20 73 6c 6f 70 70 elped many slopp
07c0: 79 20 6f 72 20 6d 65 73 73 79 20 75 73 65 72 73 y or messy users
07d0: 20 74 6f 20 77 72 69 74 65 20 74 68 65 69 72 20 to write their
07e0: 53 51 4c 20 71 75 65 72 69 65 73 20 77 69 74 68 SQL queries with
07f0: 20 66 65 77 20 63 6f 6d 70 6c 69 63 61 74 69 6f few complicatio
0800: 6e 73 2e 3c 62 72 3e 0d 0a 56 65 72 79 20 73 69 ns.<br>..Very si
0810: 6d 70 6c 79 20 73 61 69 64 2c 20 69 74 20 77 61 mply said, it wa
0820: 73 20 61 20 3c 62 3e 6d 69 73 66 65 61 74 75 72 s a <b>misfeatur
0830: 65 3c 2f 62 3e 20 62 61 64 6c 79 20 65 6e 63 6f e</b> badly enco
0840: 75 72 61 67 69 6e 67 20 6d 61 6e 79 20 64 65 76 uraging many dev
0850: 65 6c 6f 70 65 72 73 20 69 6e 74 6f 20 74 68 65 elopers into the
0860: 20 62 61 64 20 68 61 62 69 74 20 6f 66 20 6d 69 bad habit of mi
0870: 73 75 73 69 6e 67 20 64 6f 75 62 6c 65 2d 20 61 susing double- a
0880: 6e 64 20 73 69 6e 67 6c 65 2d 71 75 6f 74 69 6e nd single-quotin
0890: 67 2e 3c 62 72 3e 0d 0a 3c 68 33 3e 54 68 65 20 g.<br>..<h3>The
08a0: 6d 6f 73 74 20 72 65 63 65 6e 74 20 61 70 70 72 most recent appr
08b0: 6f 61 63 68 20 6f 66 20 53 51 4c 69 74 65 20 74 oach of SQLite t
08c0: 6f 20 49 53 4f 20 53 51 4c 20 71 75 6f 74 69 6e o ISO SQL quotin
08d0: 67 3c 2f 68 33 3e 20 0d 0a 49 6e 20 72 65 63 65 g</h3> ..In rece
08e0: 6e 74 20 74 69 6d 65 73 20 74 68 65 20 64 65 76 nt times the dev
08f0: 65 6c 6f 70 65 72 73 20 6f 66 20 53 51 4c 69 74 elopers of SQLit
0900: 65 20 66 69 6e 61 6c 6c 79 20 72 65 63 6f 67 6e e finally recogn
0910: 69 7a 65 64 20 74 68 61 74 20 64 65 70 61 72 74 ized that depart
0920: 69 6e 67 20 66 72 6f 6d 20 74 68 65 20 49 53 4f ing from the ISO
0930: 20 53 51 4c 20 73 74 61 6e 64 61 72 64 20 77 61 SQL standard wa
0940: 73 6e 27 74 20 67 6f 6f 64 20 61 74 20 61 6c 6c sn't good at all
0950: 2e 3c 62 72 3e 0d 0a 41 6e 64 20 63 6f 6e 73 65 .<br>..And conse
0960: 71 75 65 6e 74 6c 79 20 74 68 65 79 20 64 65 63 quently they dec
0970: 69 64 65 64 20 74 68 61 74 20 73 74 61 72 74 69 ided that starti
0980: 6e 67 20 66 72 6f 6d 20 76 65 72 73 69 6f 6e 20 ng from version
0990: 3c 62 3e 33 2e 32 39 2e 30 3c 2f 62 3e 20 53 51 <b>3.29.0</b> SQ
09a0: 4c 69 74 65 20 73 68 6f 75 6c 64 20 66 69 6e 61 Lite should fina
09b0: 6c 6c 79 20 62 65 20 61 62 6c 65 20 74 6f 20 63 lly be able to c
09c0: 6f 72 72 65 63 74 6c 79 20 65 6e 66 6f 72 63 65 orrectly enforce
09d0: 20 73 74 72 69 63 74 20 49 53 4f 20 53 51 4c 20 strict ISO SQL
09e0: 71 75 6f 74 69 6e 67 2e 3c 62 72 3e 0d 0a 55 6e quoting.<br>..Un
09f0: 68 61 70 70 69 6c 79 20 73 75 63 68 20 61 20 72 happily such a r
0a00: 61 64 69 63 61 6c 20 63 68 61 6e 67 65 20 63 61 adical change ca
0a10: 6e 20 68 61 76 65 20 61 20 76 65 72 79 20 68 65 n have a very he
0a20: 61 76 79 20 69 6d 70 61 63 74 20 6f 6e 20 61 6c avy impact on al
0a30: 72 65 61 64 79 20 65 78 69 73 74 69 6e 67 20 61 ready existing a
0a40: 70 70 6c 69 63 61 74 69 6f 6e 73 2c 20 73 6f 20 pplications, so
0a50: 61 20 6d 6f 64 65 72 61 74 65 20 61 70 70 72 6f a moderate appro
0a60: 61 63 68 20 77 61 73 20 61 64 6f 70 74 65 64 3a ach was adopted:
0a70: 0d 0a 3c 75 6c 3e 0d 0a 3c 6c 69 3e 61 20 6e 65 ..<ul>..<li>a ne
0a80: 77 20 62 75 69 6c 64 2d 74 69 6d 65 20 6f 70 74 w build-time opt
0a90: 69 6f 6e 20 68 61 73 20 62 65 65 6e 20 69 6e 74 ion has been int
0aa0: 72 6f 64 75 63 65 2c 20 3c 62 3e 2d 44 53 51 4c roduce, <b>-DSQL
0ab0: 49 54 45 5f 44 51 53 3d 3c 69 3e 6e 3c 2f 69 3e ITE_DQS=<i>n</i>
0ac0: 3c 2f 62 3e 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e 54 </b></li>..<li>T
0ad0: 68 65 20 64 65 66 61 75 6c 74 20 61 73 73 75 6d he default assum
0ae0: 70 74 69 6f 6e 20 69 73 20 3c 62 3e 2d 44 53 51 ption is <b>-DSQ
0af0: 4c 49 54 45 5f 44 51 53 3d 33 3c 2f 62 3e 3c 62 LITE_DQS=3</b><b
0b00: 72 3e 0d 0a 20 20 20 20 74 68 69 73 20 70 72 61 r>.. this pra
0b10: 63 74 69 63 61 6c 6c 79 20 63 6f 72 72 65 73 70 ctically corresp
0b20: 6f 6e 64 73 20 74 6f 20 74 68 65 20 6f 6c 64 20 onds to the old
0b30: 74 72 61 64 69 74 69 6f 6e 61 6c 20 62 65 68 61 traditional beha
0b40: 76 69 6f 72 20 28 69 2e 65 2e 20 73 75 70 70 6f vior (i.e. suppo
0b50: 72 74 69 6e 67 20 61 20 76 65 72 79 20 70 65 72 rting a very per
0b60: 6d 69 73 73 69 76 65 20 61 6e 64 20 74 6f 6c 65 missive and tole
0b70: 72 61 6e 74 20 71 75 6f 74 69 6e 67 20 69 6e 74 rant quoting int
0b80: 65 72 70 72 65 74 61 74 69 6f 6e 29 2e 3c 2f 6c erpretation).</l
0b90: 69 3e 0d 0a 3c 6c 69 3e 42 75 74 20 74 68 65 20 i>..<li>But the
0ba0: 64 65 76 65 6c 6f 70 65 72 73 20 6f 66 20 53 51 developers of SQ
0bb0: 4c 69 74 65 20 73 74 72 6f 6e 67 6c 79 20 72 65 Lite strongly re
0bc0: 63 6f 6d 6d 65 6e 64 20 74 6f 20 61 6c 77 61 79 commend to alway
0bd0: 73 20 65 78 70 6c 69 63 69 74 6c 79 20 73 65 74 s explicitly set
0be0: 20 3c 62 3e 2d 44 53 51 4c 49 54 45 5f 44 51 53 <b>-DSQLITE_DQS
0bf0: 3d 33 3c 2f 62 3e 3c 62 72 3e 0d 0a 20 20 20 20 =3</b><br>..
0c00: 74 68 69 73 20 77 69 6c 6c 20 65 6e 66 6f 72 63 this will enforc
0c10: 65 20 73 74 72 69 63 74 20 49 53 4f 20 53 51 4c e strict ISO SQL
0c20: 20 71 75 6f 74 69 6e 67 2c 20 61 6e 64 20 77 69 quoting, and wi
0c30: 6c 6c 20 64 65 66 69 6e 69 74 65 6c 79 20 65 72 ll definitely er
0c40: 61 64 69 63 61 74 65 20 74 68 65 20 65 78 74 72 adicate the extr
0c50: 61 76 61 67 61 6e 74 20 3c 62 3e 44 51 53 20 6d avagant <b>DQS m
0c60: 69 73 66 65 61 74 75 72 65 3c 2f 62 3e 2e 3c 2f isfeature</b>.</
0c70: 6c 69 3e 0d 0a 3c 2f 75 6c 3e 0d 0a 3c 68 33 3e li>..</ul>..<h3>
0c80: 41 20 70 72 61 63 74 69 63 61 6c 20 63 6f 6d 70 A practical comp
0c90: 61 72 61 74 69 76 65 20 74 65 73 74 3c 2f 68 33 arative test</h3
0ca0: 3e 0d 0a 3c 74 61 62 6c 65 20 62 67 63 6f 6c 6f >..<table bgcolo
0cb0: 72 3d 22 23 65 30 66 66 65 30 22 20 62 6f 72 64 r="#e0ffe0" bord
0cc0: 65 72 3d 22 31 22 20 63 65 6c 6c 73 70 61 63 69 er="1" cellspaci
0cd0: 6e 67 3d 22 36 22 20 63 65 6c 6c 70 61 64 64 69 ng="6" cellpaddi
0ce0: 6e 67 3d 22 36 22 20 77 69 64 74 68 3d 22 31 30 ng="6" width="10
0cf0: 30 25 22 3e 0d 0a 3c 74 72 3e 3c 74 68 3e 54 65 0%">..<tr><th>Te
0d00: 73 74 65 64 20 6f 6e 20 53 51 4c 69 74 65 20 33 sted on SQLite 3
0d10: 2e 32 35 2e 33 3c 2f 74 68 3e 3c 74 68 3e 54 65 .25.3</th><th>Te
0d20: 73 74 65 64 20 6f 6e 20 53 51 4c 69 74 65 20 33 sted on SQLite 3
0d30: 2e 32 39 2e 30 20 2d 20 63 6f 6d 70 69 6c 65 64 .29.0 - compiled
0d40: 20 77 69 74 68 20 2d 44 53 51 4c 49 54 45 5f 44 with -DSQLITE_D
0d50: 51 53 3d 30 3c 2f 74 68 3e 3c 2f 74 72 3e 0d 0a QS=0</th></tr>..
0d60: 3c 74 72 3e 0d 0a 3c 74 64 3e 3c 76 65 72 62 61 <tr>..<td><verba
0d70: 74 69 6d 3e 0d 0a 43 52 45 41 54 45 20 54 41 42 tim>..CREATE TAB
0d80: 4c 45 20 22 74 65 73 74 22 20 28 0d 0a 20 20 20 LE "test" (..
0d90: 20 22 69 64 22 20 49 4e 54 45 47 45 52 20 50 52 "id" INTEGER PR
0da0: 49 4d 41 52 59 20 4b 45 59 2c 0d 0a 20 20 20 20 IMARY KEY,..
0db0: 22 6e 61 6d 65 22 20 54 45 58 54 20 4e 4f 54 20 "name" TEXT NOT
0dc0: 4e 55 4c 4c 29 3b 0d 0a 2d 2d 2d 2d 2d 2d 2d 2d NULL);..--------
0dd0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
0de0: 2d 2d 2d 2d 2d 0d 0a 6f 6b 0d 0a 0d 0a 49 4e 53 -----..ok....INS
0df0: 45 52 54 20 49 4e 54 4f 20 22 74 65 73 74 22 20 ERT INTO "test"
0e00: 28 22 69 64 22 2c 20 22 6e 61 6d 65 22 29 20 56 ("id", "name") V
0e10: 41 4c 55 45 53 20 28 31 32 33 2c 20 22 6f 6e 65 ALUES (123, "one
0e20: 22 29 3b 0d 0a 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ");..-----------
0e30: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
0e40: 2d 2d 0d 0a 6f 6b 0d 0a 0d 0a 53 45 4c 45 43 54 --..ok....SELECT
0e50: 20 22 69 64 22 20 46 52 4f 4d 20 22 74 65 73 74 "id" FROM "test
0e60: 22 20 57 48 45 52 45 20 22 6e 61 6d 65 22 20 3d " WHERE "name" =
0e70: 20 22 6f 6e 65 22 3b 0d 0a 2d 2d 2d 2d 2d 2d 2d "one";..-------
0e80: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
0e90: 2d 2d 2d 2d 2d 2d 0d 0a 31 32 33 0d 0a 0d 0a 49 ------..123....I
0ea0: 4e 53 45 52 54 20 49 4e 54 4f 20 74 65 73 74 20 NSERT INTO test
0eb0: 28 69 64 2c 20 6e 61 6d 65 29 20 56 41 4c 55 45 (id, name) VALUE
0ec0: 53 20 28 31 32 33 34 35 36 2c 20 27 74 77 6f 27 S (123456, 'two'
0ed0: 29 3b 0d 0a 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d );..------------
0ee0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
0ef0: 2d 0d 0a 6f 6b 0d 0a 0d 0a 53 45 4c 45 43 54 20 -..ok....SELECT
0f00: 69 64 20 46 52 4f 4d 20 74 65 73 74 20 57 48 45 id FROM test WHE
0f10: 52 45 20 6e 61 6d 65 20 3d 20 27 74 77 6f 27 3b RE name = 'two';
0f20: 0d 0a 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ..--------------
0f30: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0d ---------------.
0f40: 0a 31 32 33 34 35 36 0d 0a 3c 2f 76 65 72 62 61 .123456..</verba
0f50: 74 69 6d 3e 3c 2f 74 64 3e 0d 0a 3c 74 64 3e 3c tim></td>..<td><
0f60: 76 65 72 62 61 74 69 6d 3e 0d 0a 43 52 45 41 54 verbatim>..CREAT
0f70: 45 20 54 41 42 4c 45 20 22 74 65 73 74 22 20 28 E TABLE "test" (
0f80: 0d 0a 20 20 20 20 22 69 64 22 20 49 4e 54 45 47 .. "id" INTEG
0f90: 45 52 20 50 52 49 4d 41 52 59 20 4b 45 59 2c 0d ER PRIMARY KEY,.
0fa0: 0a 20 20 20 20 22 6e 61 6d 65 22 20 54 45 58 54 . "name" TEXT
0fb0: 20 4e 4f 54 20 4e 55 4c 4c 29 3b 0d 0a 2d 2d 2d NOT NULL);..---
0fc0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
0fd0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0d 0a 6f 6b 0d 0a ----------..ok..
0fe0: 0d 0a 49 4e 53 45 52 54 20 49 4e 54 4f 20 22 74 ..INSERT INTO "t
0ff0: 65 73 74 22 20 28 22 69 64 22 2c 20 22 6e 61 6d est" ("id", "nam
1000: 65 22 29 20 56 41 4c 55 45 53 20 28 31 32 33 2c e") VALUES (123,
1010: 20 22 6f 6e 65 22 29 3b 0d 0a 2d 2d 2d 2d 2d 2d "one");..------
1020: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
1030: 2d 2d 2d 2d 2d 2d 2d 0d 0a 6e 6f 20 73 75 63 68 -------..no such
1040: 20 63 6f 6c 75 6d 6e 3a 20 6f 6e 65 0d 0a 0d 0a column: one....
1050: 53 45 4c 45 43 54 20 22 69 64 22 20 46 52 4f 4d SELECT "id" FROM
1060: 20 22 74 65 73 74 22 20 57 48 45 52 45 20 22 6e "test" WHERE "n
1070: 61 6d 65 22 20 3d 20 22 6f 6e 65 22 3b 0d 0a 2d ame" = "one";..-
1080: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
1090: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0d 0a 6e 6f ------------..no
10a0: 20 73 75 63 68 20 63 6f 6c 75 6d 6e 3a 20 6f 6e such column: on
10b0: 65 0d 0a 0d 0a 49 4e 53 45 52 54 20 49 4e 54 4f e....INSERT INTO
10c0: 20 74 65 73 74 20 28 69 64 2c 20 6e 61 6d 65 29 test (id, name)
10d0: 20 56 41 4c 55 45 53 20 28 31 32 33 34 35 36 2c VALUES (123456,
10e0: 20 27 74 77 6f 27 29 3b 0d 0a 2d 2d 2d 2d 2d 2d 'two');..------
10f0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
1100: 2d 2d 2d 2d 2d 2d 2d 0d 0a 6f 6b 0d 0a 0d 0a 53 -------..ok....S
1110: 45 4c 45 43 54 20 69 64 20 46 52 4f 4d 20 74 65 ELECT id FROM te
1120: 73 74 20 57 48 45 52 45 20 6e 61 6d 65 20 3d 20 st WHERE name =
1130: 27 74 77 6f 27 3b 0d 0a 2d 2d 2d 2d 2d 2d 2d 2d 'two';..--------
1140: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
1150: 2d 2d 2d 2d 2d 0d 0a 31 32 33 34 35 36 0d 0a 3c -----..123456..<
1160: 2f 76 65 72 62 61 74 69 6d 3e 3c 2f 74 64 3e 0d /verbatim></td>.
1170: 0a 3c 2f 74 72 3e 20 0d 0a 3c 2f 74 61 62 6c 65 .</tr> ..</table
1180: 3e 0d 0a 3c 68 33 3e 41 6e 65 63 64 6f 74 61 6c >..<h3>Anecdotal
1190: 20 65 76 69 64 65 6e 63 65 3c 2f 68 33 3e 0d 0a evidence</h3>..
11a0: 54 68 65 20 63 6f 64 65 20 6f 66 20 3c 62 3e 6c The code of <b>l
11b0: 69 62 73 70 61 74 69 61 6c 69 74 65 3c 2f 62 3e ibspatialite</b>
11c0: 20 69 74 73 65 6c 66 20 68 61 64 20 76 65 72 79 itself had very
11d0: 20 6c 69 74 74 6c 65 20 70 72 6f 62 6c 65 6d 73 little problems
11e0: 20 69 6e 20 6e 69 63 65 6c 79 20 61 64 61 70 74 in nicely adapt
11f0: 69 6e 67 20 74 6f 20 68 65 20 6d 6f 73 74 20 72 ing to he most r
1200: 65 63 65 6e 74 20 3c 62 3e 2d 44 53 51 4c 49 54 ecent <b>-DSQLIT
1210: 45 5f 44 51 53 3d 30 3c 2f 62 3e 20 72 65 71 75 E_DQS=0</b> requ
1220: 69 72 65 6d 65 6e 74 73 20 6f 66 20 53 51 4c 69 irements of SQLi
1230: 74 65 20 3c 62 3e 33 2e 32 39 2e 30 3c 2f 62 3e te <b>3.29.0</b>
1240: 2e 3c 62 72 3e 0d 0a 54 68 65 72 65 20 77 65 72 .<br>..There wer
1250: 65 20 6a 75 73 74 20 61 20 63 6f 75 70 6c 65 20 e just a couple
1260: 6f 66 20 62 61 64 6c 79 20 71 75 6f 74 65 64 20 of badly quoted
1270: 53 51 4c 20 53 74 61 74 65 6d 65 6e 74 73 20 72 SQL Statements r
1280: 65 71 75 69 72 69 6e 67 20 74 6f 20 62 65 20 66 equiring to be f
1290: 69 78 65 64 2e 3c 62 72 3e 3c 62 72 3e 0d 0a 42 ixed.<br><br>..B
12a0: 75 74 20 70 72 6f 70 65 72 6c 79 20 72 65 73 74 ut properly rest
12b0: 6f 72 69 6e 67 20 74 68 65 20 74 65 73 74 20 63 oring the test c
12c0: 6f 76 65 72 61 67 65 20 77 61 73 20 61 20 6e 61 overage was a na
12d0: 73 74 79 20 73 75 72 70 72 69 73 65 2e 3c 62 72 sty surprise.<br
12e0: 3e 0d 0a 54 68 65 72 65 20 77 65 72 65 20 70 6c >..There were pl
12f0: 65 6e 74 79 20 6f 66 20 6d 69 73 71 75 6f 74 65 enty of misquote
1300: 64 20 53 51 4c 20 53 74 61 74 65 6d 65 6e 74 73 d SQL Statements
1310: 20 28 61 62 6f 75 74 20 73 6f 6d 65 20 74 68 6f (about some tho
1320: 75 73 61 6e 64 73 29 2c 20 61 6e 64 20 70 61 74 usands), and pat
1330: 69 65 6e 74 6c 79 20 6e 75 72 73 69 6e 67 20 61 iently nursing a
1340: 6c 6c 20 74 68 65 6d 20 77 61 73 20 61 20 6c 65 ll them was a le
1350: 6e 67 74 68 79 20 61 6e 64 20 62 6f 72 69 6e 67 ngthy and boring
1360: 20 74 61 73 6b 2e 3c 62 72 3e 3c 62 72 3e 0d 0a task.<br><br>..
1370: 3c 66 6f 6e 74 20 73 69 7a 65 3d 22 35 22 20 63 <font size="5" c
1380: 6f 6c 6f 72 3d 22 72 65 64 22 3e 0d 0a 42 65 20 olor="red">..Be
1390: 77 61 72 6e 65 64 3a 20 73 77 69 74 63 68 69 6e warned: switchin
13a0: 67 20 74 6f 20 74 68 65 20 6d 6f 72 65 20 73 74 g to the more st
13b0: 72 69 6e 67 65 6e 74 20 72 65 71 75 69 72 65 6d ringent requirem
13c0: 65 6e 74 73 20 6f 66 20 74 68 65 20 6d 6f 73 74 ents of the most
13d0: 20 72 65 63 65 6e 74 20 76 65 72 73 69 6f 6e 73 recent versions
13e0: 20 6f 66 20 53 51 4c 69 74 65 3c 62 72 3e 0d 0a of SQLite<br>..
13f0: 63 61 6e 20 65 61 73 69 6c 79 20 62 65 63 6f 6d can easily becom
1400: 65 20 61 20 72 65 61 6c 20 6e 69 67 68 74 6d 61 e a real nightma
1410: 72 65 2c 20 6d 6f 73 74 20 6e 6f 74 61 62 6c 79 re, most notably
1420: 20 69 66 20 79 6f 75 20 75 73 75 61 6c 6c 79 20 if you usually
1430: 61 64 6f 70 74 65 64 20 61 20 73 6c 6f 70 70 79 adopted a sloppy
1440: 20 53 51 4c 20 71 75 6f 74 69 6e 67 20 73 74 79 SQL quoting sty
1450: 6c 65 2e 0d 0a 3c 2f 66 6f 6e 74 3e 3c 62 72 3e le...</font><br>
1460: 3c 62 72 3e 0d 0a 3c 74 61 62 6c 65 20 62 67 63 <br>..<table bgc
1470: 6f 6c 6f 72 3d 22 23 66 66 66 30 65 30 22 20 62 olor="#fff0e0" b
1480: 6f 72 64 65 72 3d 22 31 22 20 63 65 6c 6c 73 70 order="1" cellsp
1490: 61 63 69 6e 67 3d 22 36 22 20 63 65 6c 6c 70 61 acing="6" cellpa
14a0: 64 64 69 6e 67 3d 22 31 36 22 3e 0d 0a 3c 74 72 dding="16">..<tr
14b0: 3e 3c 74 64 3e 0d 0a 3c 68 31 3e 49 6d 70 6f 72 ><td>..<h1>Impor
14c0: 74 61 6e 74 20 6e 6f 74 69 63 65 20 66 6f 72 20 tant notice for
14d0: 57 69 6e 64 6f 77 73 20 75 73 65 72 73 3c 2f 68 Windows users</h
14e0: 31 3e 0d 0a 41 6c 6c 20 66 75 74 75 72 65 20 62 1>..All future b
14f0: 69 6e 61 72 79 20 70 61 63 6b 61 67 65 73 20 66 inary packages f
1500: 6f 72 20 57 69 6e 64 6f 77 73 20 64 69 73 74 72 or Windows distr
1510: 69 62 75 74 65 64 20 62 79 20 53 70 61 74 69 61 ibuted by Spatia
1520: 4c 69 74 65 20 69 74 73 65 6c 66 20 77 69 6c 6c Lite itself will
1530: 20 62 65 20 61 6c 77 61 79 73 20 62 75 69 6c 74 be always built
1540: 20 62 79 20 73 70 65 63 69 66 79 69 6e 67 20 74 by specifying t
1550: 68 65 20 3c 62 3e 2d 44 53 51 4c 49 54 45 5f 44 he <b>-DSQLITE_D
1560: 51 53 3d 30 3c 2f 62 3e 20 6f 70 74 69 6f 6e 2e QS=0</b> option.
1570: 3c 62 72 3e 3c 62 72 3e 0d 0a 3c 68 31 3e 42 65 <br><br>..<h1>Be
1580: 20 70 72 65 70 61 72 65 64 2e 3c 2f 68 31 3e 0d prepared.</h1>.
1590: 0a 3c 2f 74 64 3e 3c 2f 74 72 3e 0d 0a 3c 2f 74 .</td></tr>..</t
15a0: 61 62 6c 65 3e 0d 0a 3c 62 72 3e 3c 62 72 3e 0d able>..<br><br>.
15b0: 0a 3c 68 72 3e 3c 62 72 3e 0d 0a 42 61 63 6b 20 .<hr><br>..Back
15c0: 74 6f 20 3c 61 20 68 72 65 66 3d 22 68 74 74 70 to <a href="http
15d0: 73 3a 2f 2f 77 77 77 2e 67 61 69 61 2d 67 69 73 s://www.gaia-gis
15e0: 2e 69 74 2f 66 6f 73 73 69 6c 2f 6c 69 62 73 70 .it/fossil/libsp
15f0: 61 74 69 61 6c 69 74 65 2f 77 69 6b 69 3f 6e 61 atialite/wiki?na
1600: 6d 65 3d 35 2e 30 2e 30 2d 64 6f 63 22 3e 35 2e me=5.0.0-doc">5.
1610: 30 2e 30 2d 64 6f 63 20 6d 61 69 6e 20 70 61 67 0.0-doc main pag
1620: 65 3c 2f 61 3e 0a 5a 20 30 39 30 36 62 32 62 33 e</a>.Z 0906b2b3
1630: 34 65 36 37 38 31 63 66 64 66 61 62 38 33 61 38 4e6781cfdfab83a8
1640: 65 35 38 63 36 38 65 33 0a e58c68e3.