Wiki page
[Stored Procedures] by
sandro
2017-11-02 18:42:52.
0000: 44 20 32 30 31 37 2d 31 31 2d 30 32 54 31 38 3a D 2017-11-02T18:
0010: 34 32 3a 35 32 2e 35 35 39 0a 4c 20 53 74 6f 72 42:52.559.L Stor
0020: 65 64 5c 73 50 72 6f 63 65 64 75 72 65 73 0a 50 ed\sProcedures.P
0030: 20 66 61 31 31 30 33 34 66 38 62 30 66 36 30 39 fa11034f8b0f609
0040: 33 38 38 62 30 36 35 38 66 63 63 30 64 64 31 38 388b0658fcc0dd18
0050: 35 63 65 30 36 61 36 38 64 0a 55 20 73 61 6e 64 5ce06a68d.U sand
0060: 72 6f 0a 57 20 31 33 31 33 30 0a 3c 74 61 62 6c ro.W 13130.<tabl
0070: 65 20 63 65 6c 6c 73 70 61 63 69 6e 67 3d 22 31 e cellspacing="1
0080: 32 22 20 77 69 64 74 68 3d 22 31 30 30 25 22 3e 2" width="100%">
0090: 0d 0a 3c 74 72 3e 3c 74 64 20 63 6f 6c 73 70 61 ..<tr><td colspa
00a0: 6e 3d 22 32 22 3e 0d 0a 3c 74 61 62 6c 65 20 77 n="2">..<table w
00b0: 69 64 74 68 3d 22 31 30 30 25 22 20 62 67 63 6f idth="100%" bgco
00c0: 6c 6f 72 3d 22 23 66 30 66 30 66 38 22 3e 0d 0a lor="#f0f0f8">..
00d0: 3c 74 72 3e 3c 74 64 20 61 6c 69 67 6e 3d 22 63 <tr><td align="c
00e0: 65 6e 74 65 72 22 3e 0d 0a 3c 2f 74 64 3e 3c 2f enter">..</td></
00f0: 74 72 3e 3c 2f 74 61 62 6c 65 3e 0d 0a 3c 74 61 tr></table>..<ta
0100: 62 6c 65 20 77 69 64 74 68 3d 22 31 30 30 25 22 ble width="100%"
0110: 3e 3c 74 72 3e 0d 0a 3c 74 64 20 77 69 64 74 68 ><tr>..<td width
0120: 3d 22 33 33 25 22 20 61 6c 69 67 6e 3d 22 6c 65 ="33%" align="le
0130: 66 74 22 3e 3c 2f 74 64 3e 0d 0a 3c 74 64 20 61 ft"></td>..<td a
0140: 6c 69 67 6e 3d 22 63 65 6e 74 65 72 22 3e 3c 61 lign="center"><a
0150: 20 68 72 65 66 3d 22 68 74 74 70 73 3a 2f 2f 77 href="https://w
0160: 77 77 2e 67 61 69 61 2d 67 69 73 2e 69 74 2f 66 ww.gaia-gis.it/f
0170: 6f 73 73 69 6c 2f 6c 69 62 73 70 61 74 69 61 6c ossil/libspatial
0180: 69 74 65 2f 77 69 6b 69 3f 6e 61 6d 65 3d 34 2e ite/wiki?name=4.
0190: 33 2e 30 2b 64 6f 63 22 3e 62 61 63 6b 20 74 6f 3.0+doc">back to
01a0: 20 69 6e 64 65 78 3c 2f 61 3e 3c 2f 74 64 3e 0d index</a></td>.
01b0: 0a 3c 74 64 20 77 69 64 74 68 3d 22 33 33 25 22 .<td width="33%"
01c0: 20 61 6c 69 67 6e 3d 22 72 69 67 68 74 22 3e 3c align="right"><
01d0: 2f 74 64 3e 0d 0a 3c 2f 74 72 3e 3c 2f 74 61 62 /td>..</tr></tab
01e0: 6c 65 3e 0d 0a 3c 68 31 3e 53 51 4c 20 50 72 6f le>..<h1>SQL Pro
01f0: 63 65 64 75 72 65 73 2c 20 53 74 6f 72 65 64 20 cedures, Stored
0200: 50 72 6f 63 65 64 75 72 65 73 20 61 6e 64 20 53 Procedures and S
0210: 74 6f 72 65 64 20 56 61 72 69 61 62 6c 65 73 3a tored Variables:
0220: 20 61 20 71 75 69 63 6b 20 69 6e 74 72 6f 3c 2f a quick intro</
0230: 68 31 3e 0d 0a 53 74 61 72 74 69 6e 67 20 73 69 h1>..Starting si
0240: 6e 63 65 20 76 65 72 73 69 6f 6e 20 3c 62 3e 34 nce version <b>4
0250: 2e 35 2e 30 3c 2f 62 3e 20 53 70 61 74 69 61 4c .5.0</b> SpatiaL
0260: 69 74 65 20 73 75 70 70 6f 72 74 73 20 61 6e 20 ite supports an
0270: 61 64 76 61 6e 63 65 64 20 6d 65 63 68 61 6e 69 advanced mechani
0280: 73 6d 20 69 6e 74 65 6e 64 65 64 20 74 6f 20 73 sm intended to s
0290: 69 67 6e 69 66 69 63 61 6e 74 6c 79 20 65 78 74 ignificantly ext
02a0: 65 6e 64 20 74 68 65 20 73 63 72 69 70 74 69 6e end the scriptin
02b0: 67 20 74 65 63 68 6e 69 71 75 65 73 20 61 6c 6c g techniques all
02c0: 6f 77 69 6e 67 20 66 6f 72 20 61 20 70 6f 77 65 owing for a powe
02d0: 72 66 75 6c 20 61 6e 64 20 66 6c 65 78 69 62 6c rful and flexibl
02e0: 65 20 61 75 74 6f 6d 61 74 69 6f 6e 20 6f 66 20 e automation of
02f0: 63 6f 6d 70 6c 65 78 20 77 6f 72 6b 66 6c 6f 77 complex workflow
0300: 73 2e 3c 62 72 3e 0d 0a 54 68 69 6e 6b 20 6f 66 s.<br>..Think of
0310: 20 74 68 65 20 6e 69 63 65 20 66 6c 65 78 69 62 the nice flexib
0320: 69 6c 69 74 79 20 61 6c 6c 6f 77 65 64 20 62 79 ility allowed by
0330: 20 6d 69 78 69 6e 67 20 73 74 61 6e 64 61 72 64 mixing standard
0340: 20 3c 62 3e 3c 69 3e 53 51 4c 20 73 63 72 69 70 <b><i>SQL scrip
0350: 74 73 3c 2f 69 3e 3c 2f 62 3e 20 61 6e 64 20 3c ts</i></b> and <
0360: 62 3e 3c 69 3e 56 61 72 69 61 62 6c 65 73 3c 2f b><i>Variables</
0370: 69 3e 3c 2f 62 3e 20 74 6f 20 62 65 20 72 65 70 i></b> to be rep
0380: 6c 61 63 65 64 20 6a 75 73 74 20 62 65 66 6f 72 laced just befor
0390: 65 20 61 63 74 75 61 6c 20 65 78 65 63 75 74 69 e actual executi
03a0: 6f 6e 2e 0d 0a 4e 6f 74 20 6f 6e 6c 79 3a 20 74 on...Not only: t
03b0: 68 69 6e 6b 20 6f 66 20 6d 61 6e 79 20 77 6f 6e hink of many won
03c0: 64 65 72 66 75 6c 20 6f 70 70 6f 72 74 75 6e 69 derful opportuni
03d0: 74 69 65 73 20 64 65 72 69 76 69 6e 67 20 66 72 ties deriving fr
03e0: 6f 6d 20 70 65 72 6d 61 6e 65 6e 74 6c 79 20 73 om permanently s
03f0: 74 6f 72 69 6e 67 20 77 69 74 68 69 6e 20 61 20 toring within a
0400: 64 61 74 61 62 61 73 65 20 73 75 63 68 20 3c 62 database such <b
0410: 3e 3c 69 3e 53 51 4c 20 53 63 72 69 70 74 73 20 ><i>SQL Scripts
0420: 77 69 74 68 20 56 61 72 69 61 62 6c 65 73 3c 2f with Variables</
0430: 69 3e 3c 2f 62 3e 20 73 6f 20 74 6f 20 6d 61 6b i></b> so to mak
0440: 65 20 61 73 20 73 69 6d 70 6c 65 20 61 73 20 70 e as simple as p
0450: 6f 73 73 69 62 6c 65 20 61 75 74 6f 6d 61 74 69 ossible automati
0460: 6e 67 20 63 6f 6d 6d 6f 6e 20 77 6f 72 6b 66 6c ng common workfl
0470: 6f 77 73 20 74 6f 20 62 65 20 72 65 70 65 61 74 ows to be repeat
0480: 65 64 6c 79 20 65 78 65 63 75 74 65 64 2e 0d 0a edly executed...
0490: 54 68 69 73 20 65 78 61 63 74 6c 79 20 69 73 20 This exactly is
04a0: 74 68 65 20 69 6e 74 65 6e 64 65 64 20 73 63 6f the intended sco
04b0: 70 65 20 6f 66 20 74 68 69 73 20 6e 65 77 20 6d pe of this new m
04c0: 6f 64 75 6c 65 2e 3c 62 72 3e 3c 62 72 3e 0d 0a odule.<br><br>..
04d0: 57 65 27 6c 6c 20 73 74 61 72 74 20 66 69 72 73 We'll start firs
04e0: 74 20 62 79 20 66 6f 72 6d 61 6c 6c 79 20 64 65 t by formally de
04f0: 66 69 6e 69 6e 67 20 66 65 77 20 62 61 73 69 63 fining few basic
0500: 20 63 6f 6e 63 65 70 74 73 20 61 6e 64 20 6f 62 concepts and ob
0510: 6a 65 63 74 73 20 73 6f 20 74 6f 20 61 76 6f 69 jects so to avoi
0520: 64 20 61 6e 79 20 70 6f 73 73 69 62 6c 65 20 63 d any possible c
0530: 6f 6e 66 75 73 69 6f 6e 2e 3c 62 72 3e 3c 62 72 onfusion.<br><br
0540: 3e 0d 0a 3c 68 72 3e 0d 0a 3c 68 32 3e 42 61 73 >..<hr>..<h2>Bas
0550: 69 63 20 44 65 66 69 6e 69 74 69 6f 6e 73 20 61 ic Definitions a
0560: 6e 64 20 43 6f 6e 63 65 70 74 73 3c 2f 68 32 3e nd Concepts</h2>
0570: 0d 0a 3c 6f 6c 3e 0d 0a 3c 6c 69 3e 0d 0a 3c 68 ..<ol>..<li>..<h
0580: 34 3e 53 51 4c 20 53 74 61 74 65 6d 65 6e 74 3c 4>SQL Statement<
0590: 2f 68 34 3e 0d 0a 54 68 65 20 6d 69 6e 69 6d 61 /h4>..The minima
05a0: 6c 20 65 78 65 63 75 74 69 6f 6e 20 75 6e 69 74 l execution unit
05b0: 20 61 6c 6c 6f 77 65 64 20 62 79 20 53 51 4c 20 allowed by SQL
05c0: 73 79 6e 74 61 78 3b 20 61 20 73 74 61 6e 64 2d syntax; a stand-
05d0: 61 6c 6f 6e 65 20 53 51 4c 20 64 69 72 65 63 74 alone SQL direct
05e0: 69 76 65 20 74 6f 20 62 65 20 61 74 6f 6d 69 63 ive to be atomic
05f0: 61 6c 6c 79 20 65 78 65 63 75 74 65 64 20 69 6e ally executed in
0600: 20 61 20 73 69 6e 67 6c 65 20 73 74 65 70 2e 20 a single step.
0610: 45 78 61 6d 70 6c 65 73 3a 0d 0a 3c 76 65 72 62 Examples:..<verb
0620: 61 74 69 6d 3e 0d 0a 53 45 4c 45 43 54 20 69 64 atim>..SELECT id
0630: 2c 20 6e 61 6d 65 2c 20 6d 65 61 73 75 72 65 20 , name, measure
0640: 46 52 4f 4d 20 73 6f 6d 65 5f 74 61 62 6c 65 3b FROM some_table;
0650: 0d 0a 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0d 0a ..------------..
0660: 44 45 4c 45 54 45 20 46 52 4f 4d 20 73 6f 6d 65 DELETE FROM some
0670: 5f 74 61 62 6c 65 20 57 48 45 52 45 20 6d 65 61 _table WHERE mea
0680: 73 75 72 65 20 3e 20 31 30 30 30 3b 0d 0a 2d 2d sure > 1000;..--
0690: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0d 0a 55 50 44 41 ----------..UPDA
06a0: 54 45 20 73 6f 6d 65 5f 74 61 62 6c 65 20 53 45 TE some_table SE
06b0: 54 20 6d 65 61 73 75 72 65 20 3d 20 6d 65 61 73 T measure = meas
06c0: 75 72 65 20 2f 20 31 30 2e 30 0d 0a 3c 2f 76 65 ure / 10.0..</ve
06d0: 72 62 61 74 69 6d 3e 0d 0a 3c 75 3e 4e 6f 74 65 rbatim>..<u>Note
06e0: 3c 2f 75 3e 3a 20 53 51 4c 20 53 74 61 74 65 6d </u>: SQL Statem
06f0: 65 6e 74 73 20 61 72 65 20 75 73 75 61 6c 6c 79 ents are usually
0700: 20 65 78 70 65 63 74 65 64 20 74 6f 20 62 65 20 expected to be
0710: 65 78 70 6c 69 63 69 74 6c 79 20 74 65 72 6d 69 explicitly termi
0720: 6e 61 74 65 64 20 62 79 20 61 20 3c 62 3e 3c 69 nated by a <b><i
0730: 3e 73 65 6d 69 63 6f 6c 6f 6e 3c 2f 69 3e 3c 2f >semicolon</i></
0740: 62 3e 20 28 3c 62 3e 3c 69 3e 3b 3c 2f 69 3e 3c b> (<b><i>;</i><
0750: 2f 62 3e 29 2e 3c 62 72 3e 0d 0a 54 68 65 20 73 /b>).<br>..The s
0760: 65 6d 69 63 6f 6c 6f 6e 20 74 65 72 6d 69 6e 61 emicolon termina
0770: 74 6f 72 20 63 61 6e 20 62 65 20 73 61 66 65 6c tor can be safel
0780: 79 20 73 75 70 70 72 65 73 73 65 64 20 6f 6e 6c y suppressed onl
0790: 79 20 77 68 65 6e 20 74 68 65 20 53 51 4c 20 53 y when the SQL S
07a0: 74 61 74 65 6d 65 6e 74 20 69 73 20 69 6d 6d 65 tatement is imme
07b0: 64 69 61 74 65 6c 79 20 66 6f 6c 6c 6f 77 65 64 diately followed
07c0: 20 62 79 20 61 20 73 74 72 69 6e 67 20 74 65 72 by a string ter
07d0: 6d 69 6e 61 74 6f 72 20 28 6c 65 61 64 69 6e 67 minator (leading
07e0: 20 61 6e 64 20 74 72 61 69 6c 69 6e 67 20 73 65 and trailing se
07f0: 71 75 65 6e 63 65 73 20 6f 66 20 61 6c 6c 20 3c quences of all <
0800: 62 3e 3c 69 3e 62 6c 61 6e 6b 73 3c 2f 69 3e 3c b><i>blanks</i><
0810: 2f 62 3e 20 77 69 6c 6c 20 62 65 20 61 6c 77 61 /b> will be alwa
0820: 79 73 20 69 67 6e 6f 72 65 64 29 2e 0d 0a 3c 2f ys ignored)...</
0830: 6c 69 3e 0d 0a 3c 6c 69 3e 0d 0a 3c 68 34 3e 53 li>..<li>..<h4>S
0840: 51 4c 20 53 63 72 69 70 74 3c 2f 68 34 3e 0d 0a QL Script</h4>..
0850: 41 20 6d 6f 72 65 20 6f 72 20 6c 65 73 73 20 63 A more or less c
0860: 6f 6d 70 6c 65 78 20 73 65 71 75 65 6e 63 65 20 omplex sequence
0870: 6f 66 20 3c 62 3e 3c 69 3e 53 51 4c 20 53 74 61 of <b><i>SQL Sta
0880: 74 65 6d 65 6e 74 73 3c 2f 69 3e 3c 2f 62 3e 2c tements</i></b>,
0890: 20 70 6f 73 73 69 62 6c 79 20 69 6e 63 6c 75 64 possibly includ
08a0: 69 6e 67 20 69 6e 74 65 72 6c 65 61 76 65 64 20 ing interleaved
08b0: 3c 62 3e 3c 69 3e 43 6f 6d 6d 65 6e 74 73 3c 2f <b><i>Comments</
08c0: 69 3e 3c 2f 62 3e 20 61 6e 64 2f 6f 72 20 3c 62 i></b> and/or <b
08d0: 3e 3c 69 3e 44 6f 74 20 4d 61 63 72 6f 73 3c 2f ><i>Dot Macros</
08e0: 69 3e 3c 2f 62 3e 2e 3c 62 72 3e 0d 0a 53 51 4c i></b>.<br>..SQL
08f0: 20 53 63 72 69 70 74 73 20 61 72 65 20 69 6e 74 Scripts are int
0900: 65 6e 64 65 64 20 74 6f 20 62 65 20 65 78 65 63 ended to be exec
0910: 75 74 65 64 20 69 6e 20 61 20 73 69 6e 67 6c 65 uted in a single
0920: 20 6d 6f 6e 6f 6c 69 74 68 69 63 20 70 61 73 73 monolithic pass
0930: 20 28 61 74 6f 6d 69 63 20 6f 72 20 6e 6f 74 2c (atomic or not,
0940: 20 64 65 70 65 6e 64 69 6e 67 20 6f 6e 20 69 6e depending on in
0950: 74 65 72 6e 61 6c 20 3c 62 3e 3c 69 3e 54 72 61 ternal <b><i>Tra
0960: 6e 73 61 63 74 69 6f 6e 3c 2f 69 3e 3c 2f 62 3e nsaction</i></b>
0970: 20 68 61 6e 64 6c 69 6e 67 29 2e 20 45 78 61 6d handling). Exam
0980: 70 6c 65 3a 0d 0a 3c 76 65 72 62 61 74 69 6d 3e ple:..<verbatim>
0990: 0d 0a 2e 65 63 68 6f 20 6f 6e 0d 0a 0d 0a 2d 2d ...echo on....--
09a0: 0d 0a 2d 2d 20 73 74 61 72 74 69 6e 67 20 61 20 ..-- starting a
09b0: 54 72 61 6e 73 61 63 74 69 6f 6e 0d 0a 2d 2d 0d Transaction..--.
09c0: 0a 42 45 47 49 4e 3b 0d 0a 0d 0a 2d 2d 0d 0a 2d .BEGIN;....--..-
09d0: 2d 20 63 72 65 61 74 69 6e 67 20 61 20 74 61 62 - creating a tab
09e0: 6c 65 0d 0a 2d 2d 0d 0a 43 52 45 41 54 45 20 54 le..--..CREATE T
09f0: 41 42 4c 45 20 65 78 61 6d 70 6c 65 20 28 0d 0a ABLE example (..
0a00: 20 20 69 64 20 49 4e 54 45 47 45 52 20 50 52 49 id INTEGER PRI
0a10: 4d 41 52 59 20 4b 45 59 20 41 55 54 4f 49 4e 43 MARY KEY AUTOINC
0a20: 52 45 4d 45 4e 54 2c 0d 0a 20 20 6e 61 6d 65 20 REMENT,.. name
0a30: 54 45 58 54 20 4e 4f 54 20 4e 55 4c 4c 2c 0d 0a TEXT NOT NULL,..
0a40: 20 20 76 61 6c 75 65 20 44 4f 55 42 4c 45 29 3b value DOUBLE);
0a50: 0d 0a 0d 0a 2d 2d 0d 0a 2d 2d 20 70 6f 70 75 6c ....--..-- popul
0a60: 61 74 69 6e 67 20 74 68 65 20 74 61 62 6c 65 0d ating the table.
0a70: 0a 2d 2d 0d 0a 49 4e 53 45 52 54 20 49 4e 54 4f .--..INSERT INTO
0a80: 20 65 78 61 6d 70 6c 65 20 28 69 64 2c 20 6e 61 example (id, na
0a90: 6d 65 2c 20 76 61 6c 75 65 29 20 56 41 4c 55 45 me, value) VALUE
0aa0: 53 20 28 4e 55 4c 4c 2c 20 27 66 69 72 73 74 27 S (NULL, 'first'
0ab0: 2c 20 31 32 2e 33 34 29 3b 0d 0a 49 4e 53 45 52 , 12.34);..INSER
0ac0: 54 20 49 4e 54 4f 20 65 78 61 6d 70 6c 65 20 28 T INTO example (
0ad0: 69 64 2c 20 6e 61 6d 65 2c 20 76 61 6c 75 65 29 id, name, value)
0ae0: 20 56 41 4c 55 45 53 20 28 4e 55 4c 4c 2c 20 27 VALUES (NULL, '
0af0: 73 65 63 6f 6e 64 27 2c 20 35 36 2e 37 38 29 3b second', 56.78);
0b00: 0d 0a 49 4e 53 45 52 54 20 49 4e 54 4f 20 65 78 ..INSERT INTO ex
0b10: 61 6d 70 6c 65 20 28 69 64 2c 20 6e 61 6d 65 2c ample (id, name,
0b20: 20 76 61 6c 75 65 29 20 56 41 4c 55 45 53 20 28 value) VALUES (
0b30: 4e 55 4c 4c 2c 20 27 74 68 69 72 64 22 2c 20 4e NULL, 'third", N
0b40: 55 4c 4c 29 3b 0d 0a 0d 0a 2d 2d 0d 0a 2d 2d 20 ULL);....--..--
0b50: 63 6f 6d 6d 69 74 74 69 6e 67 20 74 68 65 20 70 committing the p
0b60: 65 6e 64 69 6e 67 20 54 72 61 6e 73 61 63 74 69 ending Transacti
0b70: 6f 6e 0d 0a 2d 2d 0d 0a 43 4f 4d 4d 49 54 3b 0d on..--..COMMIT;.
0b80: 0a 0d 0a 2e 71 75 69 74 0d 0a 3c 2f 76 65 72 62 ....quit..</verb
0b90: 61 74 69 6d 3e 0d 0a 3c 2f 6c 69 3e 0d 0a 3c 6c atim>..</li>..<l
0ba0: 69 3e 0d 0a 3c 68 34 3e 53 51 4c 20 56 61 72 69 i>..<h4>SQL Vari
0bb0: 61 62 6c 65 3c 2f 68 34 3e 0d 0a 41 20 3c 62 3e able</h4>..A <b>
0bc0: 3c 69 3e 53 51 4c 20 56 61 72 69 61 62 6c 65 3c <i>SQL Variable<
0bd0: 2f 69 3e 3c 2f 62 3e 20 69 73 20 6a 75 73 74 20 /i></b> is just
0be0: 61 20 3c 69 3e 3c 75 3e 6d 6e 65 6d 6f 6e 69 63 a <i><u>mnemonic
0bf0: 20 73 79 6d 62 6f 6c 3c 2f 75 3e 3c 2f 69 3e 20 symbol</u></i>
0c00: 65 6e 63 6c 6f 73 65 64 20 62 65 74 77 65 65 6e enclosed between
0c10: 20 74 77 6f 20 3c 69 3e 3c 75 3e 73 70 65 63 69 two <i><u>speci
0c20: 61 6c 20 6d 61 72 6b 65 72 73 3c 2f 75 3e 3c 2f al markers</u></
0c30: 69 3e 20 28 3c 62 3e 3c 69 3e 40 3c 2f 69 3e 3c i> (<b><i>@</i><
0c40: 2f 62 3e 20 6f 72 20 3c 62 3e 3c 69 3e 24 3c 2f /b> or <b><i>$</
0c50: 69 3e 3c 2f 62 3e 29 2e 20 45 78 61 6d 70 6c 65 i></b>). Example
0c60: 73 3a 0d 0a 3c 76 65 72 62 61 74 69 6d 3e 0d 0a s:..<verbatim>..
0c70: 40 74 61 62 6c 65 5f 6e 61 6d 65 40 0d 0a 40 63 @table_name@..@c
0c80: 6f 6c 5f 6e 61 6d 65 40 0d 0a 24 76 61 6c 75 65 ol_name@..$value
0c90: 24 0d 0a 24 72 61 64 69 75 73 24 0d 0a 3c 2f 76 $..$radius$..</v
0ca0: 65 72 62 61 74 69 6d 3e 0d 0a 3c 75 3e 4e 6f 74 erbatim>..<u>Not
0cb0: 65 3c 2f 75 3e 3a 20 75 73 69 6e 67 20 74 68 65 e</u>: using the
0cc0: 20 3c 62 3e 3c 69 3e 40 3c 2f 69 3e 3c 2f 62 3e <b><i>@</i></b>
0cd0: 20 6f 72 20 74 68 65 20 3c 62 3e 3c 69 3e 24 3c or the <b><i>$<
0ce0: 2f 69 3e 3c 2f 62 3e 20 6d 61 72 6b 65 72 73 20 /i></b> markers
0cf0: 69 73 20 6a 75 73 74 20 61 6e 20 3c 69 3e 3c 75 is just an <i><u
0d00: 3e 61 65 73 74 68 65 74 69 63 20 63 68 6f 69 63 >aesthetic choic
0d10: 65 3c 2f 75 3e 3c 2f 69 3e 3b 20 62 6f 74 68 20 e</u></i>; both
0d20: 68 61 76 65 20 69 64 65 6e 74 69 63 61 6c 20 6d have identical m
0d30: 65 61 6e 69 6e 67 20 61 6e 64 20 70 72 61 63 74 eaning and pract
0d40: 69 63 61 6c 20 65 66 66 65 63 74 2e 0d 0a 3c 2f ical effect...</
0d50: 6c 69 3e 0d 0a 3c 6c 69 3e 0d 0a 3c 68 34 3e 53 li>..<li>..<h4>S
0d60: 51 4c 20 42 6f 64 79 3c 2f 68 34 3e 0d 0a 41 20 QL Body</h4>..A
0d70: 3c 62 3e 3c 69 3e 53 51 4c 20 53 63 72 69 70 74 <b><i>SQL Script
0d80: 3c 2f 69 3e 3c 2f 62 3e 20 69 6e 74 65 72 6e 61 </i></b> interna
0d90: 6c 6c 79 20 75 73 69 6e 67 20 3c 62 3e 3c 69 3e lly using <b><i>
0da0: 56 61 72 69 61 62 6c 65 73 3c 2f 69 3e 3c 2f 62 Variables</i></b
0db0: 3e 2e 20 45 78 61 6d 70 6c 65 3a 0d 0a 3c 76 65 >. Example:..<ve
0dc0: 72 62 61 74 69 6d 3e 0d 0a 2e 65 63 68 6f 20 6f rbatim>...echo o
0dd0: 6e 0d 0a 0d 0a 2d 2d 0d 0a 2d 2d 20 73 74 61 72 n....--..-- star
0de0: 74 69 6e 67 20 61 20 54 72 61 6e 73 61 63 74 69 ting a Transacti
0df0: 6f 6e 0d 0a 2d 2d 0d 0a 42 45 47 49 4e 3b 0d 0a on..--..BEGIN;..
0e00: 0d 0a 2d 2d 0d 0a 2d 2d 20 63 72 65 61 74 69 6e ..--..-- creatin
0e10: 67 20 61 20 74 61 62 6c 65 0d 0a 2d 2d 0d 0a 43 g a table..--..C
0e20: 52 45 41 54 45 20 54 41 42 4c 45 20 40 74 61 62 REATE TABLE @tab
0e30: 6c 65 40 20 28 0d 0a 20 20 40 70 6b 40 20 49 4e le@ (.. @pk@ IN
0e40: 54 45 47 45 52 20 50 52 49 4d 41 52 59 20 4b 45 TEGER PRIMARY KE
0e50: 59 20 41 55 54 4f 49 4e 43 52 45 4d 45 4e 54 2c Y AUTOINCREMENT,
0e60: 0d 0a 20 20 40 63 6f 6c 31 40 20 54 45 58 54 20 .. @col1@ TEXT
0e70: 4e 4f 54 20 4e 55 4c 4c 2c 0d 0a 20 20 40 63 6f NOT NULL,.. @co
0e80: 6c 32 40 20 44 4f 55 42 4c 45 29 3b 0d 0a 0d 0a l2@ DOUBLE);....
0e90: 2d 2d 0d 0a 2d 2d 20 70 6f 70 75 6c 61 74 69 6e --..-- populatin
0ea0: 67 20 74 68 65 20 74 61 62 6c 65 0d 0a 2d 2d 0d g the table..--.
0eb0: 0a 49 4e 53 45 52 54 20 49 4e 54 4f 20 40 74 61 .INSERT INTO @ta
0ec0: 62 6c 65 40 20 28 40 70 6b 40 2c 20 40 63 6f 6c ble@ (@pk@, @col
0ed0: 31 40 2c 20 40 63 6f 6c 32 40 29 20 56 41 4c 55 1@, @col2@) VALU
0ee0: 45 53 20 28 4e 55 4c 4c 2c 20 27 66 69 72 73 74 ES (NULL, 'first
0ef0: 27 2c 20 31 32 2e 33 34 29 3b 0d 0a 49 4e 53 45 ', 12.34);..INSE
0f00: 52 54 20 49 4e 54 4f 20 40 74 61 62 6c 65 40 20 RT INTO @table@
0f10: 28 40 70 6b 40 2c 20 40 63 6f 6c 31 40 2c 20 40 (@pk@, @col1@, @
0f20: 63 6f 6c 32 40 29 20 56 41 4c 55 45 53 20 28 4e col2@) VALUES (N
0f30: 55 4c 4c 2c 20 27 73 65 63 6f 6e 64 27 2c 20 35 ULL, 'second', 5
0f40: 36 2e 37 38 29 3b 0d 0a 49 4e 53 45 52 54 20 49 6.78);..INSERT I
0f50: 4e 54 4f 20 40 74 61 62 6c 65 40 20 28 40 70 6b NTO @table@ (@pk
0f60: 40 2c 20 40 63 6f 6c 32 40 2c 20 40 63 6f 6c 32 @, @col2@, @col2
0f70: 40 29 20 56 41 4c 55 45 53 20 28 4e 55 4c 4c 2c @) VALUES (NULL,
0f80: 20 27 74 68 69 72 64 22 2c 20 4e 55 4c 4c 29 3b 'third", NULL);
0f90: 0d 0a 0d 0a 2d 2d 0d 0a 2d 2d 20 63 6f 6d 6d 69 ....--..-- commi
0fa0: 74 74 69 6e 67 20 74 68 65 20 70 65 6e 64 69 6e tting the pendin
0fb0: 67 20 54 72 61 6e 73 61 63 74 69 6f 6e 0d 0a 2d g Transaction..-
0fc0: 2d 0d 0a 43 4f 4d 4d 49 54 3b 0d 0a 0d 0a 2e 71 -..COMMIT;.....q
0fd0: 75 69 74 0d 0a 3c 2f 76 65 72 62 61 74 69 6d 3e uit..</verbatim>
0fe0: 0d 0a 3c 75 3e 4e 6f 74 65 3c 2f 75 3e 3a 20 74 ..<u>Note</u>: t
0ff0: 68 69 73 20 73 65 63 6f 6e 64 20 76 65 72 73 69 his second versi
1000: 6f 6e 20 69 73 20 6f 62 76 69 6f 75 73 6c 79 20 on is obviously
1010: 6d 6f 72 65 20 66 6c 65 78 69 62 6c 65 20 74 68 more flexible th
1020: 61 6e 20 74 68 65 20 69 6e 69 74 69 61 6c 20 53 an the initial S
1030: 51 4c 20 73 63 72 69 70 74 2c 20 6a 75 73 74 20 QL script, just
1040: 62 65 63 61 75 73 65 20 74 68 65 72 65 20 61 72 because there ar
1050: 65 6e 27 74 20 3c 75 3e 3c 69 3e 68 61 72 64 77 en't <u><i>hardw
1060: 69 72 65 64 3c 2f 69 3e 3c 2f 75 3e 20 74 61 62 ired</i></u> tab
1070: 6c 65 2d 6e 61 6d 65 73 20 61 6e 64 20 63 6f 6c le-names and col
1080: 75 6d 6e 2d 6e 61 6d 65 73 2c 20 61 6c 6c 20 74 umn-names, all t
1090: 68 65 6d 20 61 72 65 20 6e 6f 77 20 62 65 63 6f hem are now beco
10a0: 6d 65 20 3c 75 3e 3c 69 3e 73 79 6d 62 6f 6c 69 me <u><i>symboli
10b0: 63 3c 2f 69 3e 3c 2f 75 3e 2e 3c 62 72 3e 0d 0a c</i></u>.<br>..
10c0: 53 6f 20 77 65 20 61 72 65 20 6e 6f 77 20 66 72 So we are now fr
10d0: 65 65 20 74 6f 20 72 65 75 73 65 20 6d 6f 72 65 ee to reuse more
10e0: 20 74 69 6d 65 73 20 74 68 69 73 20 53 51 4c 20 times this SQL
10f0: 42 6f 64 79 20 69 6e 20 64 69 66 66 65 72 65 6e Body in differen
1100: 74 20 63 6f 6e 74 65 78 74 73 3b 20 77 65 20 6a t contexts; we j
1110: 75 73 74 20 68 61 76 65 20 74 6f 20 61 70 70 72 ust have to appr
1120: 6f 70 72 69 61 74 65 6c 79 20 73 65 74 20 74 68 opriately set th
1130: 65 20 56 61 72 69 61 62 6c 65 20 56 61 6c 75 65 e Variable Value
1140: 73 20 6a 75 73 74 20 69 6d 6d 65 64 69 61 74 65 s just immediate
1150: 6c 79 20 62 65 66 6f 72 65 20 61 63 74 75 61 6c ly before actual
1160: 20 65 78 65 63 75 74 69 6f 6e 2e 3c 62 72 3e 3c execution.<br><
1170: 62 72 3e 0d 0a 3c 62 3e 3c 69 3e 53 51 4c 20 42 br>..<b><i>SQL B
1180: 6f 64 69 65 73 3c 2f 69 3e 3c 2f 62 3e 20 65 78 odies</i></b> ex
1190: 69 73 74 20 69 6e 20 74 77 6f 20 64 69 66 66 65 ist in two diffe
11a0: 72 65 6e 74 20 66 6f 72 6d 73 3a 0d 0a 3c 75 6c rent forms:..<ul
11b0: 3e 0d 0a 3c 6c 69 3e 3c 62 3e 72 61 77 3c 2f 62 >..<li><b>raw</b
11c0: 3e 3a 20 73 74 69 6c 6c 20 69 6e 63 6c 75 64 69 >: still includi
11d0: 6e 67 20 73 79 6d 62 6f 6c 69 63 20 56 61 72 69 ng symbolic Vari
11e0: 61 62 6c 65 73 2e 3c 2f 6c 69 3e 0d 0a 3c 6c 69 ables.</li>..<li
11f0: 3e 3c 62 3e 63 6f 6f 6b 65 64 3c 2f 62 3e 3a 20 ><b>cooked</b>:
1200: 70 72 65 73 65 6e 74 69 6e 67 20 61 6c 6c 20 73 presenting all s
1210: 79 6d 62 6f 6c 73 20 70 72 6f 70 65 72 6c 79 20 ymbols properly
1220: 72 65 70 6c 61 63 65 64 20 62 79 20 74 68 65 69 replaced by thei
1230: 72 20 61 63 74 75 61 6c 20 76 61 6c 75 65 73 2e r actual values.
1240: 3c 62 72 3e 0d 0a 52 61 74 68 65 72 20 6f 62 76 <br>..Rather obv
1250: 69 6f 75 73 6c 79 2c 20 79 6f 75 20 63 61 6e 20 iously, you can
1260: 73 75 63 63 65 73 73 66 75 6c 6c 79 20 65 78 65 successfully exe
1270: 63 75 74 65 20 6f 6e 6c 79 20 74 68 65 20 3c 62 cute only the <b
1280: 3e 3c 69 3e 63 6f 6f 6b 65 64 3c 2f 69 3e 3c 2f ><i>cooked</i></
1290: 62 3e 20 66 6f 72 6d 2e 3c 2f 6c 69 3e 0d 0a 3c b> form.</li>..<
12a0: 2f 75 6c 3e 0d 0a 3c 2f 6c 69 3e 0d 0a 3c 6c 69 /ul>..</li>..<li
12b0: 3e 0d 0a 3c 68 34 3e 53 51 4c 20 50 72 6f 63 65 >..<h4>SQL Proce
12c0: 64 75 72 65 20 42 4c 4f 42 20 6f 62 6a 65 63 74 dure BLOB object
12d0: 3c 2f 68 34 3e 0d 0a 54 68 69 73 20 73 69 6d 70 </h4>..This simp
12e0: 6c 79 20 69 73 20 61 20 3c 62 3e 3c 69 3e 42 4c ly is a <b><i>BL
12f0: 4f 42 20 65 6e 63 6f 64 65 64 3c 2f 69 3e 3c 2f OB encoded</i></
1300: 62 3e 20 70 72 65 2d 63 6f 6d 70 69 6c 65 64 20 b> pre-compiled
1310: 3c 62 3e 3c 69 3e 53 51 4c 20 42 6f 64 79 3c 2f <b><i>SQL Body</
1320: 69 3e 3c 2f 62 3e 2c 20 61 6e 64 20 69 73 20 74 i></b>, and is t
1330: 68 65 20 75 73 75 61 6c 20 74 61 72 67 65 74 20 he usual target
1340: 65 78 70 65 63 74 65 64 20 74 6f 20 62 65 20 68 expected to be h
1350: 61 6e 64 6c 65 64 20 62 79 20 70 72 61 63 74 69 andled by practi
1360: 63 61 6c 6c 79 20 61 6c 6c 20 53 51 4c 20 66 75 cally all SQL fu
1370: 6e 63 74 69 6f 6e 73 20 73 75 70 70 6f 72 74 69 nctions supporti
1380: 6e 67 20 53 74 6f 72 65 64 20 50 72 6f 63 65 64 ng Stored Proced
1390: 75 72 65 73 20 61 6e 64 20 61 6c 69 6b 65 2e 20 ures and alike.
13a0: 0d 0a 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e 0d 0a 3c ..</li>..<li>..<
13b0: 68 34 3e 53 74 6f 72 65 64 20 50 72 6f 63 65 64 h4>Stored Proced
13c0: 75 72 65 3c 2f 68 34 3e 0d 0a 41 20 3c 62 3e 3c ure</h4>..A <b><
13d0: 69 3e 53 51 4c 20 50 72 6f 63 65 64 75 72 65 20 i>SQL Procedure
13e0: 42 4c 4f 42 20 6f 62 6a 65 63 74 3c 2f 69 3e 3c BLOB object</i><
13f0: 2f 62 3e 20 70 65 72 6d 61 6e 65 6e 74 6c 79 20 /b> permanently
1400: 73 74 6f 72 65 64 20 69 6e 74 6f 20 61 20 64 61 stored into a da
1410: 74 61 62 61 73 65 2e 20 54 68 69 73 20 77 69 6c tabase. This wil
1420: 6c 20 6d 61 6b 65 20 65 61 73 69 65 72 20 72 65 l make easier re
1430: 75 73 69 6e 67 20 6d 6f 72 65 20 74 69 6d 65 73 using more times
1440: 20 74 68 65 20 73 61 6d 65 20 53 51 4c 20 77 6f the same SQL wo
1450: 72 6b 66 6c 6f 77 2c 20 70 65 72 68 61 70 73 20 rkflow, perhaps
1460: 73 6f 20 74 6f 20 69 6d 70 6c 65 6d 65 6e 74 20 so to implement
1470: 72 6f 75 74 69 6e 65 6c 79 20 70 65 72 69 6f 64 routinely period
1480: 69 63 20 74 61 73 6b 73 20 28 74 6f 20 62 65 20 ic tasks (to be
1490: 65 78 65 63 75 74 65 64 20 64 61 69 6c 79 20 2f executed daily /
14a0: 20 77 65 65 6b 6c 79 20 2f 20 6d 6f 6e 74 68 6c weekly / monthl
14b0: 79 20 61 6e 64 20 73 6f 20 6f 6e 29 2e 3c 62 72 y and so on).<br
14c0: 3e 0d 0a 53 74 6f 72 65 64 20 50 72 6f 63 65 64 >..Stored Proced
14d0: 75 72 65 73 20 61 6c 77 61 79 73 20 68 61 76 65 ures always have
14e0: 20 74 68 65 20 66 6f 6c 6c 6f 77 69 6e 67 20 65 the following e
14f0: 6c 65 6d 65 6e 74 73 3a 0d 0a 3c 75 6c 3e 0d 0a lements:..<ul>..
1500: 3c 6c 69 3e 61 20 3c 62 3e 6e 61 6d 65 3c 2f 62 <li>a <b>name</b
1510: 3e 2c 20 69 6e 74 65 6e 64 65 64 20 74 6f 20 62 >, intended to b
1520: 65 20 61 6e 20 75 6e 69 71 75 65 20 69 64 65 6e e an unique iden
1530: 74 69 66 69 65 72 20 28 3c 62 3e 3c 69 3e 50 72 tifier (<b><i>Pr
1540: 69 6d 61 72 79 20 4b 65 79 3c 2f 69 3e 3c 2f 62 imary Key</i></b
1550: 3e 29 2e 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e 61 20 >).</li>..<li>a
1560: 3c 62 3e 74 69 74 6c 65 3c 2f 62 3e 2c 20 69 2e <b>title</b>, i.
1570: 65 2e 20 61 20 73 68 6f 72 74 20 64 65 73 63 72 e. a short descr
1580: 69 70 74 69 6f 6e 20 6f 66 20 74 68 65 20 69 6e iption of the in
1590: 74 65 6e 64 65 64 20 73 63 6f 70 65 20 6f 66 20 tended scope of
15a0: 74 68 65 20 53 74 6f 72 65 64 20 50 72 6f 63 65 the Stored Proce
15b0: 64 75 72 65 2e 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e dure.</li>..<li>
15c0: 61 20 3c 62 3e 53 51 4c 20 50 72 6f 63 65 64 75 a <b>SQL Procedu
15d0: 72 65 20 42 4c 4f 42 20 4f 62 6a 65 63 74 3c 2f re BLOB Object</
15e0: 62 3e 2e 3c 2f 6c 69 3e 0d 0a 3c 2f 75 6c 3e 0d b>.</li>..</ul>.
15f0: 0a 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e 0d 0a 3c 68 .</li>..<li>..<h
1600: 34 3e 56 61 72 69 61 62 6c 65 20 77 69 74 68 20 4>Variable with
1610: 56 61 6c 75 65 20 73 74 72 69 6e 67 73 3c 2f 68 Value strings</h
1620: 34 3e 0d 0a 42 65 66 6f 72 65 20 65 78 65 63 75 4>..Before execu
1630: 74 69 6e 67 20 61 20 3c 62 3e 3c 69 3e 53 51 4c ting a <b><i>SQL
1640: 20 42 6f 64 79 3c 2f 69 3e 3c 2f 62 3e 20 69 6e Body</i></b> in
1650: 63 6c 75 64 69 6e 67 20 3c 62 3e 3c 69 3e 56 61 cluding <b><i>Va
1660: 72 69 61 62 6c 65 73 3c 2f 69 3e 3c 2f 62 3e 20 riables</i></b>
1670: 79 6f 75 20 61 72 65 20 6f 62 76 69 6f 75 73 6c you are obviousl
1680: 79 20 65 78 70 65 63 74 65 64 20 74 6f 20 73 65 y expected to se
1690: 74 20 73 6f 6d 65 20 61 70 70 72 6f 70 72 69 61 t some appropria
16a0: 74 65 20 3c 62 3e 3c 69 3e 56 61 6c 75 65 3c 2f te <b><i>Value</
16b0: 69 3e 3c 2f 62 3e 20 66 6f 72 20 65 61 63 68 20 i></b> for each
16c0: 56 61 72 69 61 62 6c 65 2c 20 73 6f 20 74 6f 20 Variable, so to
16d0: 61 6c 6c 6f 77 20 66 6f 72 20 72 65 70 6c 61 63 allow for replac
16e0: 69 6e 67 20 3c 75 3e 3c 69 3e 53 79 6d 62 6f 6c ing <u><i>Symbol
16f0: 73 3c 2f 69 3e 3c 2f 75 3e 20 77 69 74 68 20 61 s</i></u> with a
1700: 63 74 75 61 6c 20 3c 75 3e 3c 69 3e 56 61 6c 75 ctual <u><i>Valu
1710: 65 73 3c 2f 69 3e 3c 2f 75 3e 20 28 69 2e 65 2e es</i></u> (i.e.
1720: 20 66 6f 72 20 70 72 6f 70 65 72 6c 79 20 74 72 for properly tr
1730: 61 6e 73 66 6f 72 6d 69 6e 67 20 3c 62 3e 72 61 ansforming <b>ra
1740: 77 3c 2f 62 3e 20 53 51 4c 20 69 6e 74 6f 20 3c w</b> SQL into <
1750: 62 3e 63 6f 6f 6b 65 64 3c 2f 62 3e 20 53 51 4c b>cooked</b> SQL
1760: 29 2e 3c 62 72 3e 0d 0a 41 20 3c 62 3e 3c 69 3e ).<br>..A <b><i>
1770: 56 61 72 69 61 62 6c 65 20 77 69 74 68 20 56 61 Variable with Va
1780: 6c 75 65 3c 2f 69 3e 3c 2f 62 3e 20 73 74 72 69 lue</i></b> stri
1790: 6e 67 20 73 69 6d 70 6c 79 20 69 73 20 61 6e 20 ng simply is an
17a0: 61 70 70 72 6f 70 72 69 61 74 65 6c 79 20 77 65 appropriately we
17b0: 6c 6c 2d 66 6f 72 6d 61 74 74 65 64 20 54 65 78 ll-formatted Tex
17c0: 74 20 73 74 72 69 6e 67 20 64 65 63 6c 61 72 69 t string declari
17d0: 6e 67 20 62 6f 74 68 20 74 68 65 20 53 79 6d 62 ng both the Symb
17e0: 6f 6c 20 61 6e 64 20 74 68 65 20 63 6f 72 72 65 ol and the corre
17f0: 73 70 6f 6e 64 69 6e 67 20 72 65 70 6c 61 63 65 sponding replace
1800: 6d 65 6e 74 20 56 61 6c 75 65 20 28 65 78 70 72 ment Value (expr
1810: 65 73 73 65 64 20 69 6e 20 69 74 73 20 74 65 78 essed in its tex
1820: 74 75 61 6c 20 72 65 70 72 65 73 65 6e 74 61 74 tual representat
1830: 69 6f 6e 29 2e 20 45 78 61 6d 70 6c 65 73 3a 0d ion). Examples:.
1840: 0a 3c 76 65 72 62 61 74 69 6d 3e 0d 0a 27 40 76 .<verbatim>..'@v
1850: 61 6c 75 65 5f 31 40 3d 31 32 33 34 27 20 20 20 alue_1@=1234'
1860: 20 20 20 20 20 20 20 2d 2d 20 69 6e 74 65 67 65 -- intege
1870: 72 20 76 61 6c 75 65 0d 0a 27 40 76 61 6c 75 65 r value..'@value
1880: 5f 32 40 3d 31 32 2e 33 34 27 20 20 20 20 20 20 _2@=12.34'
1890: 20 20 20 2d 2d 20 64 6f 75 62 6c 65 20 76 61 6c -- double val
18a0: 75 65 0d 0a 27 40 76 61 6c 75 65 5f 33 40 3d 4e ue..'@value_3@=N
18b0: 65 77 20 59 6f 72 6b 20 43 69 74 79 27 20 2d 2d ew York City' --
18c0: 20 74 65 78 74 20 76 61 6c 75 65 0d 0a 27 40 76 text value..'@v
18d0: 61 6c 75 65 5f 34 40 3d 78 27 27 30 31 32 33 61 alue_4@=x''0123a
18e0: 62 63 64 27 27 27 20 2d 2d 20 62 6c 6f 62 20 76 bcd''' -- blob v
18f0: 61 6c 75 65 0d 0a 27 40 76 61 6c 75 65 5f 35 40 alue..'@value_5@
1900: 3d 4e 55 4c 4c 27 20 20 20 20 20 20 20 20 20 20 =NULL'
1910: 2d 2d 20 6e 75 6c 6c 20 76 61 6c 75 65 0d 0a 3c -- null value..<
1920: 2f 76 65 72 62 61 74 69 6d 3e 0d 0a 3c 74 61 62 /verbatim>..<tab
1930: 6c 65 20 62 67 63 6f 6c 6f 72 3d 22 23 66 38 66 le bgcolor="#f8f
1940: 38 64 38 22 20 63 65 6c 6c 70 61 64 64 69 6e 67 8d8" cellpadding
1950: 3d 22 36 22 20 63 65 6c 6c 73 70 61 63 69 6e 67 ="6" cellspacing
1960: 3d 22 38 22 3e 3c 74 72 3e 3c 74 64 3e 0d 0a 3c ="8"><tr><td>..<
1970: 75 3e 4e 6f 74 65 3c 2f 75 3e 3a 20 72 65 70 6c u>Note</u>: repl
1980: 61 63 69 6e 67 20 56 61 72 69 61 62 6c 65 73 20 acing Variables
1990: 77 69 74 68 20 61 63 74 75 61 6c 20 56 61 6c 75 with actual Valu
19a0: 65 73 20 69 73 20 61 20 62 6c 69 6e 64 20 70 72 es is a blind pr
19b0: 6f 63 65 73 73 20 63 6f 6d 70 6c 65 74 65 6c 79 ocess completely
19c0: 20 69 6e 73 65 6e 73 69 62 6c 65 20 74 6f 20 74 insensible to t
19d0: 68 65 20 73 70 65 63 69 66 69 63 20 73 79 6e 74 he specific synt
19e0: 61 63 74 69 63 20 63 6f 6e 74 65 78 74 2e 3c 62 actic context.<b
19f0: 72 3e 0d 0a 59 6f 75 20 61 72 65 20 66 75 6c 6c r>..You are full
1a00: 79 20 72 65 73 70 6f 6e 73 69 62 6c 65 20 66 6f y responsible fo
1a10: 72 20 63 6f 72 72 65 63 74 6c 79 20 61 70 70 6c r correctly appl
1a20: 79 20 73 69 6e 67 6c 65 2d 20 6f 72 20 64 6f 75 y single- or dou
1a30: 62 6c 65 2d 71 75 6f 74 69 6e 67 20 77 68 65 72 ble-quoting wher
1a40: 65 76 65 72 20 72 65 71 75 69 72 65 64 20 62 79 ever required by
1a50: 20 53 51 4c 20 73 79 6e 74 61 78 2e 0d 0a 3c 2f SQL syntax...</
1a60: 74 64 3e 3c 2f 74 72 3e 3c 2f 74 61 62 6c 65 3e td></tr></table>
1a70: 0d 0a 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e 0d 0a 3c ..</li>..<li>..<
1a80: 68 34 3e 53 74 6f 72 65 64 20 56 61 72 69 61 62 h4>Stored Variab
1a90: 6c 65 3c 2f 68 34 3e 0d 0a 41 20 3c 62 3e 3c 69 le</h4>..A <b><i
1aa0: 3e 56 61 72 69 61 62 6c 65 20 77 69 74 68 20 56 >Variable with V
1ab0: 61 6c 75 65 20 73 74 72 69 6e 67 3c 2f 69 3e 3c alue string</i><
1ac0: 2f 62 3e 20 70 65 72 6d 61 6e 65 6e 74 6c 79 20 /b> permanently
1ad0: 73 74 6f 72 65 64 20 69 6e 74 6f 20 61 20 64 61 stored into a da
1ae0: 74 61 62 61 73 65 2e 3c 62 72 3e 0d 0a 53 74 6f tabase.<br>..Sto
1af0: 72 65 64 20 56 61 72 69 61 62 6c 65 73 20 61 6c red Variables al
1b00: 77 61 79 73 20 68 61 76 65 20 74 68 65 20 66 6f ways have the fo
1b10: 6c 6c 6f 77 69 6e 67 20 65 6c 65 6d 65 6e 74 73 llowing elements
1b20: 3a 0d 0a 3c 75 6c 3e 0d 0a 3c 6c 69 3e 61 20 3c :..<ul>..<li>a <
1b30: 62 3e 6e 61 6d 65 3c 2f 62 3e 2c 20 69 6e 74 65 b>name</b>, inte
1b40: 6e 64 65 64 20 74 6f 20 62 65 20 61 6e 20 75 6e nded to be an un
1b50: 69 71 75 65 20 69 64 65 6e 74 69 66 69 65 72 20 ique identifier
1b60: 28 3c 62 3e 3c 69 3e 50 72 69 6d 61 72 79 20 4b (<b><i>Primary K
1b70: 65 79 3c 2f 69 3e 3c 2f 62 3e 29 2e 3c 2f 6c 69 ey</i></b>).</li
1b80: 3e 0d 0a 3c 6c 69 3e 61 20 3c 62 3e 74 69 74 6c >..<li>a <b>titl
1b90: 65 3c 2f 62 3e 2c 20 69 2e 65 2e 20 61 20 73 68 e</b>, i.e. a sh
1ba0: 6f 72 74 20 64 65 73 63 72 69 70 74 69 6f 6e 20 ort description
1bb0: 6f 66 20 74 68 65 20 69 6e 74 65 6e 64 65 64 20 of the intended
1bc0: 73 63 6f 70 65 20 6f 66 20 74 68 65 20 53 74 6f scope of the Sto
1bd0: 72 65 64 20 56 61 72 69 61 62 6c 65 2e 3c 2f 6c red Variable.</l
1be0: 69 3e 0d 0a 3c 6c 69 3e 61 20 3c 62 3e 56 61 72 i>..<li>a <b>Var
1bf0: 69 61 62 6c 65 20 77 69 74 68 20 56 61 6c 75 65 iable with Value
1c00: 20 73 74 72 69 6e 67 3c 2f 62 3e 2e 3c 2f 6c 69 string</b>.</li
1c10: 3e 0d 0a 3c 2f 75 6c 3e 0d 0a 3c 2f 6c 69 3e 0d >..</ul>..</li>.
1c20: 0a 3c 2f 6c 69 3e 0d 0a 3c 2f 6f 6c 3e 3c 62 72 .</li>..</ol><br
1c30: 3e 0d 0a 3c 68 72 3e 0d 0a 3c 68 32 3e 46 61 6d >..<hr>..<h2>Fam
1c40: 69 6c 69 61 72 69 7a 69 6e 67 20 77 69 74 68 20 iliarizing with
1c50: 53 51 4c 20 46 75 6e 63 74 69 6f 6e 73 3c 2f 68 SQL Functions</h
1c60: 32 3e 0d 0a 3c 6f 6c 3e 0d 0a 3c 6c 69 3e 0d 0a 2>..<ol>..<li>..
1c70: 3c 68 34 3e 48 61 6e 64 6c 69 6e 67 20 53 51 4c <h4>Handling SQL
1c80: 20 50 72 6f 63 65 64 75 72 65 20 42 4c 4f 42 20 Procedure BLOB
1c90: 6f 62 6a 65 63 74 73 3c 2f 68 34 3e 0d 0a 3c 76 objects</h4>..<v
1ca0: 65 72 62 61 74 69 6d 3e 0d 0a 53 45 4c 45 43 54 erbatim>..SELECT
1cb0: 20 53 71 6c 50 72 6f 63 5f 46 72 6f 6d 54 65 78 SqlProc_FromTex
1cc0: 74 28 27 53 45 4c 45 43 54 20 40 63 6f 6c 40 20 t('SELECT @col@
1cd0: 46 52 4f 4d 20 40 74 62 6c 40 27 29 3b 0d 0a 0d FROM @tbl@');...
1ce0: 0a 53 45 4c 45 43 54 20 53 71 6c 50 72 6f 63 5f .SELECT SqlProc_
1cf0: 46 72 6f 6d 46 69 6c 65 28 27 2f 68 6f 6d 65 2f FromFile('/home/
1d00: 6a 6f 65 2f 74 65 6d 70 6c 61 74 65 2e 74 78 74 joe/template.txt
1d10: 27 2c 20 43 50 31 32 35 32 27 29 3b 0d 0a 3c 2f ', CP1252');..</
1d20: 76 65 72 62 61 74 69 6d 3e 0d 0a 3c 75 6c 3e 0d verbatim>..<ul>.
1d30: 0a 3c 6c 69 3e 79 6f 75 20 63 61 6e 20 63 72 65 .<li>you can cre
1d40: 61 74 65 20 61 20 53 51 4c 20 50 72 6f 63 65 64 ate a SQL Proced
1d50: 75 72 65 20 42 4c 4f 42 20 6f 62 6a 65 63 74 20 ure BLOB object
1d60: 62 79 20 64 69 72 65 63 74 6c 79 20 70 61 73 73 by directly pass
1d70: 69 6e 67 20 61 20 54 65 78 74 20 53 51 4c 20 42 ing a Text SQL B
1d80: 6f 64 79 2e 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e 6f ody.</li>..<li>o
1d90: 72 20 61 6c 74 65 72 6e 61 74 69 76 65 6c 79 20 r alternatively
1da0: 79 6f 75 20 63 61 6e 20 6c 6f 61 64 20 74 68 65 you can load the
1db0: 20 53 51 4c 20 42 6f 64 79 20 66 72 6f 6d 20 61 SQL Body from a
1dc0: 6e 20 65 78 74 65 72 6e 61 6c 20 66 69 6c 65 2e n external file.
1dd0: 3c 62 72 3e 0d 0a 3c 75 3e 4e 6f 74 65 3c 2f 75 <br>..<u>Note</u
1de0: 3e 3a 20 74 68 69 73 20 69 73 20 61 20 73 65 63 >: this is a sec
1df0: 75 72 69 74 79 20 73 65 6e 73 69 62 6c 65 20 6f urity sensible o
1e00: 70 65 72 61 74 69 6f 6e 2c 20 73 6f 20 79 6f 75 peration, so you
1e10: 20 61 6c 77 61 79 73 20 6e 65 65 64 20 74 6f 20 always need to
1e20: 73 65 74 20 61 6e 20 65 78 70 6c 69 63 69 74 20 set an explicit
1e30: 61 75 74 68 6f 72 69 7a 61 74 69 6f 6e 20 62 79 authorization by
1e40: 20 64 65 66 69 6e 69 6e 67 20 3c 62 3e 53 50 41 defining <b>SPA
1e50: 54 49 41 4c 49 54 45 5f 53 45 43 55 52 49 54 59 TIALITE_SECURITY
1e60: 3d 72 65 6c 61 78 65 64 3c 2f 62 3e 2e 3c 2f 6c =relaxed</b>.</l
1e70: 69 3e 0d 0a 3c 6c 69 3e 42 6f 74 68 20 66 75 6e i>..<li>Both fun
1e80: 63 74 69 6f 6e 73 20 61 63 63 65 70 74 20 61 6e ctions accept an
1e90: 20 6f 70 74 69 6f 6e 61 6c 20 3c 62 3e 63 68 61 optional <b>cha
1ea0: 72 73 65 74 20 65 6e 63 6f 64 69 6e 67 3c 2f 62 rset encoding</b
1eb0: 3e 20 61 72 67 75 6d 65 6e 74 3b 20 69 6e 20 74 > argument; in t
1ec0: 68 69 73 20 63 61 73 65 20 74 68 65 20 53 51 4c his case the SQL
1ed0: 20 42 6f 64 79 20 77 69 6c 6c 20 62 65 20 61 70 Body will be ap
1ee0: 70 72 6f 70 72 69 61 74 65 6c 79 20 63 6f 6e 76 propriately conv
1ef0: 65 72 74 65 64 20 66 72 6f 6d 20 74 68 65 20 67 erted from the g
1f00: 69 76 65 6e 20 63 68 61 72 73 65 74 20 69 6e 74 iven charset int
1f10: 6f 20 3c 62 3e 55 54 46 2d 38 3c 2f 62 3e 2e 3c o <b>UTF-8</b>.<
1f20: 2f 6c 69 3e 0d 0a 3c 2f 75 6c 3e 0d 0a 3c 76 65 /li>..</ul>..<ve
1f30: 72 62 61 74 69 6d 3e 0d 0a 53 45 4c 45 43 54 20 rbatim>..SELECT
1f40: 53 71 6c 50 72 6f 63 5f 49 73 56 61 6c 69 64 20 SqlProc_IsValid
1f50: 28 20 53 71 6c 50 72 6f 63 5f 46 72 6f 6d 54 65 ( SqlProc_FromTe
1f60: 78 74 28 27 53 45 4c 45 43 54 20 40 63 6f 6c 40 xt('SELECT @col@
1f70: 20 46 52 4f 4d 20 40 74 62 6c 40 27 29 20 29 3b FROM @tbl@') );
1f80: 0d 0a 2d 2d 2d 2d 2d 0d 0a 31 0d 0a 0d 0a 53 45 ..-----..1....SE
1f90: 4c 45 43 54 20 53 71 6c 50 72 6f 63 5f 49 73 56 LECT SqlProc_IsV
1fa0: 61 6c 69 64 20 28 20 4d 61 6b 65 50 6f 69 6e 74 alid ( MakePoint
1fb0: 28 31 31 2e 35 2c 20 34 32 2e 35 2c 20 34 33 32 (11.5, 42.5, 432
1fc0: 36 29 20 29 3b 0d 0a 2d 2d 2d 2d 2d 0d 0a 30 0d 6) );..-----..0.
1fd0: 0a 3c 2f 76 65 72 62 61 74 69 6d 3e 0d 0a 3c 75 .</verbatim>..<u
1fe0: 6c 3e 0d 0a 3c 6c 69 3e 79 6f 75 20 63 61 6e 20 l>..<li>you can
1ff0: 75 73 65 20 3c 62 3e 53 71 6c 50 72 6f 63 5f 49 use <b>SqlProc_I
2000: 73 56 61 6c 69 64 3c 2f 62 3e 20 69 6e 20 6f 72 sValid</b> in or
2010: 64 65 72 20 74 6f 20 63 68 65 63 6b 20 69 66 20 der to check if
2020: 61 20 67 65 6e 65 72 69 63 20 42 4c 4f 42 20 72 a generic BLOB r
2030: 65 61 6c 6c 79 20 69 73 20 61 20 76 61 6c 69 64 eally is a valid
2040: 20 53 51 4c 20 50 72 6f 63 65 64 75 72 65 20 42 SQL Procedure B
2050: 4c 4f 42 20 4f 62 6a 65 63 74 2e 0d 0a 3c 2f 75 LOB Object...</u
2060: 6c 3e 0d 0a 3c 76 65 72 62 61 74 69 6d 3e 0d 0a l>..<verbatim>..
2070: 53 45 4c 45 43 54 20 53 71 6c 50 72 6f 63 5f 4e SELECT SqlProc_N
2080: 75 6d 56 61 72 69 61 62 6c 65 73 20 28 20 53 71 umVariables ( Sq
2090: 6c 50 72 6f 63 5f 46 72 6f 6d 54 65 78 74 28 27 lProc_FromText('
20a0: 53 45 4c 45 43 54 20 40 63 6f 6c 40 20 46 52 4f SELECT @col@ FRO
20b0: 4d 20 40 74 62 6c 40 27 29 20 29 3b 0d 0a 2d 2d M @tbl@') );..--
20c0: 2d 2d 2d 0d 0a 32 0d 0a 0d 0a 53 45 4c 45 43 54 ---..2....SELECT
20d0: 20 53 71 6c 50 72 6f 63 5f 56 61 72 69 61 62 6c SqlProc_Variabl
20e0: 65 4e 20 28 53 71 6c 50 72 6f 63 5f 46 72 6f 6d eN (SqlProc_From
20f0: 54 65 78 74 28 27 53 45 4c 45 43 54 20 40 63 6f Text('SELECT @co
2100: 6c 40 20 46 52 4f 4d 20 40 74 62 6c 40 27 29 2c l@ FROM @tbl@'),
2110: 20 30 29 3b 0d 0a 2d 2d 2d 2d 2d 0d 0a 40 63 6f 0);..-----..@co
2120: 6c 40 0d 0a 0d 0a 53 45 4c 45 43 54 20 53 71 6c l@....SELECT Sql
2130: 50 72 6f 63 5f 56 61 72 69 61 62 6c 65 4e 20 28 Proc_VariableN (
2140: 53 71 6c 50 72 6f 63 5f 46 72 6f 6d 54 65 78 74 SqlProc_FromText
2150: 28 27 53 45 4c 45 43 54 20 40 63 6f 6c 40 20 46 ('SELECT @col@ F
2160: 52 4f 4d 20 40 74 62 6c 40 27 29 2c 20 31 29 3b ROM @tbl@'), 1);
2170: 0d 0a 2d 2d 2d 2d 2d 0d 0a 40 74 62 6c 40 0d 0a ..-----..@tbl@..
2180: 0d 0a 53 45 4c 45 43 54 20 53 71 6c 50 72 6f 63 ..SELECT SqlProc
2190: 5f 41 6c 6c 56 61 72 69 61 62 6c 65 73 20 28 53 _AllVariables (S
21a0: 71 6c 50 72 6f 63 5f 46 72 6f 6d 54 65 78 74 28 qlProc_FromText(
21b0: 27 53 45 4c 45 43 54 20 40 63 6f 6c 40 20 46 52 'SELECT @col@ FR
21c0: 4f 4d 20 40 74 62 6c 40 27 29 20 29 3b 0d 0a 2d OM @tbl@') );..-
21d0: 2d 2d 2d 2d 0d 0a 40 63 6f 6c 40 20 40 74 62 6c ----..@col@ @tbl
21e0: 40 0d 0a 3c 2f 76 65 72 62 61 74 69 6d 3e 0d 0a @..</verbatim>..
21f0: 3c 75 6c 3e 0d 0a 3c 6c 69 3e 79 6f 75 20 63 61 <ul>..<li>you ca
2200: 6e 20 75 73 65 20 3c 62 3e 53 71 6c 50 72 6f 63 n use <b>SqlProc
2210: 5f 4e 75 6d 56 61 72 69 61 62 6c 65 73 3c 2f 62 _NumVariables</b
2220: 3e 20 69 6e 20 6f 72 64 65 72 20 74 6f 20 63 68 > in order to ch
2230: 65 63 6b 20 68 6f 77 20 6d 61 6e 79 20 56 61 72 eck how many Var
2240: 69 61 62 6c 65 73 20 61 72 65 20 64 65 66 69 6e iables are defin
2250: 65 64 20 62 79 20 61 20 53 51 4c 20 50 72 6f 63 ed by a SQL Proc
2260: 65 64 75 72 65 20 42 4c 4f 42 20 4f 62 6a 65 63 edure BLOB Objec
2270: 74 2e 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e 61 6e 64 t.</li>..<li>and
2280: 20 79 6f 75 20 63 61 6e 20 75 73 65 20 3c 62 3e you can use <b>
2290: 53 71 6c 50 72 6f 63 5f 56 61 72 69 61 62 6c 65 SqlProc_Variable
22a0: 4e 3c 2f 62 3e 20 69 6e 20 6f 72 64 65 72 20 74 N</b> in order t
22b0: 6f 20 72 65 74 72 69 65 76 65 20 61 20 56 61 72 o retrieve a Var
22c0: 69 61 62 6c 65 20 4e 61 6d 65 20 62 79 20 73 70 iable Name by sp
22d0: 65 63 69 66 79 69 6e 67 20 69 74 73 20 72 65 6c ecifying its rel
22e0: 61 74 69 76 65 20 3c 62 3e 49 6e 64 65 78 3c 2f ative <b>Index</
22f0: 62 3e 20 28 46 69 72 73 74 20 56 61 72 69 61 62 b> (First Variab
2300: 6c 65 20 61 6c 77 61 79 73 20 63 6f 72 72 65 73 le always corres
2310: 70 6f 6e 64 73 20 74 6f 20 3c 62 3e 49 6e 64 65 ponds to <b>Inde
2320: 78 3d 30 3c 2f 62 3e 29 2e 3c 2f 6c 69 3e 0d 0a x=0</b>).</li>..
2330: 3c 6c 69 3e 61 6e 64 20 66 69 6e 61 6c 6c 79 20 <li>and finally
2340: 79 6f 75 20 63 61 6e 20 75 73 65 20 3c 62 3e 53 you can use <b>S
2350: 71 6c 50 72 6f 63 5f 41 6c 6c 56 61 72 69 61 62 qlProc_AllVariab
2360: 6c 65 73 3c 2f 62 3e 20 69 6e 20 6f 72 64 65 72 les</b> in order
2370: 20 74 6f 20 64 69 72 65 63 74 6c 79 20 67 65 74 to directly get
2380: 20 61 6c 6c 20 56 61 72 69 61 62 6c 65 20 4e 61 all Variable Na
2390: 6d 65 73 20 66 6f 72 6d 61 74 74 65 64 20 61 73 mes formatted as
23a0: 20 61 20 73 70 61 63 65 2d 73 65 70 61 72 61 74 a space-separat
23b0: 65 64 20 6c 69 73 74 2e 3c 2f 6c 69 3e 0d 0a 3c ed list.</li>..<
23c0: 2f 75 6c 3e 0d 0a 3c 2f 6c 69 3e 0d 0a 3c 6c 69 /ul>..</li>..<li
23d0: 3e 0d 0a 3c 68 34 3e 45 72 72 6f 72 20 68 61 6e >..<h4>Error han
23e0: 64 6c 69 6e 67 3c 2f 68 34 3e 0d 0a 3c 76 65 72 dling</h4>..<ver
23f0: 62 61 74 69 6d 3e 0d 0a 53 45 4c 45 43 54 20 53 batim>..SELECT S
2400: 71 6c 50 72 6f 63 5f 47 65 74 4c 61 73 74 45 72 qlProc_GetLastEr
2410: 72 6f 72 28 29 3b 0d 0a 3c 2f 76 65 72 62 61 74 ror();..</verbat
2420: 69 6d 3e 0d 0a 41 6c 6c 20 74 68 65 73 65 20 66 im>..All these f
2430: 75 6e 63 74 69 6f 6e 73 20 77 69 6c 6c 20 72 61 unctions will ra
2440: 69 73 65 20 61 6e 20 45 78 63 65 70 74 69 6f 6e ise an Exception
2450: 20 6f 6e 20 69 6e 76 61 6c 69 64 20 61 72 67 75 on invalid argu
2460: 6d 65 6e 74 73 20 6f 72 20 65 72 72 6f 72 73 2e ments or errors.
2470: 3c 62 72 3e 0d 0a 42 79 20 63 61 6c 6c 69 6e 67 <br>..By calling
2480: 20 3c 62 3e 53 71 6c 50 72 6f 63 5f 47 65 74 4c <b>SqlProc_GetL
2490: 61 73 74 45 72 72 6f 72 3c 2f 62 3e 20 79 6f 75 astError</b> you
24a0: 27 6c 6c 20 75 73 75 61 6c 6c 79 20 67 65 74 20 'll usually get
24b0: 61 20 6d 6f 72 65 20 64 65 74 61 69 6c 65 64 20 a more detailed
24c0: 65 78 70 6c 61 6e 61 74 69 6f 6e 20 61 62 6f 75 explanation abou
24d0: 74 20 74 68 65 20 73 70 65 63 69 66 69 63 20 63 t the specific c
24e0: 61 75 73 65 20 61 63 63 6f 75 6e 74 69 6e 67 20 ause accounting
24f0: 66 6f 72 20 74 68 65 20 66 61 69 6c 75 72 65 2e for the failure.
2500: 0d 0a 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e 0d 0a 3c ..</li>..<li>..<
2510: 68 34 3e 43 72 65 61 74 69 6e 67 20 56 61 72 69 h4>Creating Vari
2520: 61 62 6c 65 73 20 77 69 74 68 20 56 61 6c 75 65 ables with Value
2530: 73 3c 2f 68 34 3e 0d 0a 3c 76 65 72 62 61 74 69 s</h4>..<verbati
2540: 6d 3e 0d 0a 53 45 4c 45 43 54 20 53 71 6c 50 72 m>..SELECT SqlPr
2550: 6f 63 5f 56 61 72 56 61 6c 75 65 20 28 27 76 61 oc_VarValue ('va
2560: 72 27 2c 20 4e 55 4c 4c 29 3b 0d 0a 2d 2d 2d 2d r', NULL);..----
2570: 2d 0d 0a 40 76 61 72 40 3d 4e 55 4c 4c 0d 0a 0d -..@var@=NULL...
2580: 0a 53 45 4c 45 43 54 20 53 71 6c 50 72 6f 63 5f .SELECT SqlProc_
2590: 56 61 72 56 61 6c 75 65 20 28 27 76 61 72 27 2c VarValue ('var',
25a0: 20 31 29 3b 0d 0a 2d 2d 2d 2d 2d 0d 0a 40 76 61 1);..-----..@va
25b0: 72 40 3d 31 0d 0a 0d 0a 53 45 4c 45 43 54 20 53 r@=1....SELECT S
25c0: 71 6c 50 72 6f 63 5f 56 61 72 56 61 6c 75 65 20 qlProc_VarValue
25d0: 28 27 76 61 72 27 2c 20 31 30 2e 35 29 3b 0d 0a ('var', 10.5);..
25e0: 2d 2d 2d 2d 2d 0d 0a 40 76 61 72 40 3d 31 30 2e -----..@var@=10.
25f0: 35 30 30 30 30 30 30 30 30 0d 0a 0d 0a 53 45 4c 500000000....SEL
2600: 45 43 54 20 53 71 6c 50 72 6f 63 5f 56 61 72 56 ECT SqlProc_VarV
2610: 61 6c 75 65 20 28 27 76 61 72 27 2c 20 27 61 6c alue ('var', 'al
2620: 70 68 61 20 62 65 74 61 27 29 3b 0d 0a 2d 2d 2d pha beta');..---
2630: 2d 2d 0d 0a 40 76 61 72 40 3d 61 6c 70 68 61 20 --..@var@=alpha
2640: 62 65 74 61 0d 0a 0d 0a 53 45 4c 45 43 54 20 53 beta....SELECT S
2650: 71 6c 50 72 6f 63 5f 56 61 72 56 61 6c 75 65 20 qlProc_VarValue
2660: 28 27 76 61 72 27 2c 20 4d 61 6b 65 50 6f 69 6e ('var', MakePoin
2670: 74 28 31 31 2e 35 2c 20 34 32 2e 35 2c 20 34 33 t(11.5, 42.5, 43
2680: 32 36 29 20 29 3b 0d 0a 2d 2d 2d 2d 2d 0d 0a 40 26) );..-----..@
2690: 76 61 72 40 3d 78 27 30 30 30 31 45 36 31 30 30 var@=x'0001E6100
26a0: 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 32 0000000000000002
26b0: 37 34 30 30 30 30 30 30 30 30 30 30 30 34 30 34 7400000000000404
26c0: 35 34 30 30 30 30 30 30 30 30 30 30 30 30 30 32 5400000000000002
26d0: 37 34 30 30 30 30 30 30 30 30 30 30 30 34 30 34 7400000000000404
26e0: 35 34 30 37 43 30 31 30 30 30 30 30 30 30 30 30 5407C01000000000
26f0: 30 30 30 30 30 30 30 30 30 32 37 34 30 30 30 30 0000000002740000
2700: 30 30 30 30 30 30 30 34 30 34 35 34 30 46 45 27 0000000404540FE'
2710: 0d 0a 3c 2f 76 65 72 62 61 74 69 6d 3e 0d 0a 3c ..</verbatim>..<
2720: 75 3e 4e 6f 74 65 3c 2f 75 3e 3a 20 68 61 6e 64 u>Note</u>: hand
2730: 20 77 72 69 74 69 6e 67 20 56 61 72 69 61 62 6c writing Variabl
2740: 65 20 77 69 74 68 20 56 61 6c 75 65 20 73 74 72 e with Value str
2750: 69 6e 67 73 20 69 73 20 61 20 72 61 74 68 65 72 ings is a rather
2760: 20 74 72 69 76 69 61 6c 20 6f 70 65 72 61 74 69 trivial operati
2770: 6f 6e 2c 20 73 6f 20 63 61 6c 6c 69 6e 67 20 74 on, so calling t
2780: 68 69 73 20 53 51 4c 20 66 75 6e 63 74 69 6f 6e his SQL function
2790: 20 69 73 20 6f 66 74 65 6e 20 6b 69 6e 64 20 6f is often kind o
27a0: 66 20 61 6e 20 6f 76 65 72 6b 69 6c 6c 2e 20 45 f an overkill. E
27b0: 78 63 65 70 74 2c 20 6d 61 79 20 62 65 2c 20 69 xcept, may be, i
27c0: 6e 20 74 68 65 20 63 61 73 65 20 6f 66 20 42 4c n the case of BL
27d0: 4f 42 20 76 61 6c 75 65 73 2e 0d 0a 3c 2f 6c 69 OB values...</li
27e0: 3e 0d 0a 3c 6c 69 3e 0d 0a 3c 68 34 3e 52 61 77 >..<li>..<h4>Raw
27f0: 20 61 6e 64 20 43 6f 6f 6b 65 64 20 53 51 4c 20 and Cooked SQL
2800: 2d 20 72 65 70 6c 61 63 69 6e 67 20 53 79 6d 62 - replacing Symb
2810: 6f 6c 73 20 77 69 74 68 20 74 68 65 69 72 20 61 ols with their a
2820: 63 74 75 61 6c 20 56 61 6c 75 65 73 3c 2f 68 34 ctual Values</h4
2830: 3e 0d 0a 3c 76 65 72 62 61 74 69 6d 3e 0d 0a 53 >..<verbatim>..S
2840: 45 4c 45 43 54 20 53 71 6c 50 72 6f 63 5f 52 61 ELECT SqlProc_Ra
2850: 77 53 51 4c 20 28 20 53 71 6c 50 72 6f 63 5f 46 wSQL ( SqlProc_F
2860: 72 6f 6d 54 65 78 74 28 27 53 45 4c 45 43 54 20 romText('SELECT
2870: 40 63 6f 6c 40 20 46 52 4f 4d 20 40 74 62 6c 40 @col@ FROM @tbl@
2880: 3b 27 29 20 29 3b 0d 0a 2d 2d 2d 2d 2d 0d 0a 53 ;') );..-----..S
2890: 45 4c 45 43 54 20 40 63 6f 6c 40 20 46 52 4f 4d ELECT @col@ FROM
28a0: 20 40 74 62 6c 40 3b 0d 0a 0d 0a 53 45 4c 45 43 @tbl@;....SELEC
28b0: 54 20 53 71 6c 50 72 6f 63 5f 43 6f 6f 6b 65 64 T SqlProc_Cooked
28c0: 53 51 4c 20 28 20 53 71 6c 50 72 6f 63 5f 46 72 SQL ( SqlProc_Fr
28d0: 6f 6d 54 65 78 74 28 27 53 45 4c 45 43 54 20 40 omText('SELECT @
28e0: 63 6f 6c 40 20 46 52 4f 4d 20 40 74 62 6c 40 3b col@ FROM @tbl@;
28f0: 27 29 2c 0d 0a 20 20 20 20 27 40 63 6f 6c 40 3d '),.. '@col@=
2900: 66 69 72 73 74 5f 6e 61 6d 65 27 2c 0d 0a 20 20 first_name',..
2910: 20 20 27 40 74 62 6c 40 3d 70 68 6f 6e 65 5f 62 '@tbl@=phone_b
2920: 6f 6f 6b 27 20 29 3b 0d 0a 2d 2d 2d 2d 2d 0d 0a ook' );..-----..
2930: 53 45 4c 45 43 54 20 66 69 72 73 74 5f 6e 61 6d SELECT first_nam
2940: 65 20 46 52 4f 4d 20 70 68 6f 6e 65 5f 62 6f 6f e FROM phone_boo
2950: 6b 3b 0d 0a 3c 2f 76 65 72 62 61 74 69 6d 3e 0d k;..</verbatim>.
2960: 0a 3c 75 6c 3e 0d 0a 3c 6c 69 3e 79 6f 75 20 63 .<ul>..<li>you c
2970: 61 6e 20 75 73 65 20 3c 62 3e 53 71 6c 50 72 6f an use <b>SqlPro
2980: 63 5f 52 61 77 53 51 4c 3c 2f 62 3e 20 69 6e 20 c_RawSQL</b> in
2990: 6f 72 64 65 72 20 74 6f 20 64 69 72 65 63 74 6c order to directl
29a0: 79 20 63 68 65 63 6b 20 74 68 65 20 53 51 4c 20 y check the SQL
29b0: 42 6f 64 79 20 65 6e 63 61 70 73 75 6c 61 74 65 Body encapsulate
29c0: 64 20 69 6e 74 6f 20 73 20 53 51 4c 20 50 72 6f d into s SQL Pro
29d0: 63 65 64 75 72 65 20 42 4c 4f 42 20 4f 62 6a 65 cedure BLOB Obje
29e0: 63 74 3b 20 61 6c 6c 20 69 6e 69 74 69 61 6c 20 ct; all initial
29f0: 56 61 72 69 61 62 6c 65 20 64 65 66 69 6e 69 74 Variable definit
2a00: 69 6f 6e 73 20 77 69 6c 6c 20 62 65 20 63 61 72 ions will be car
2a10: 65 66 75 6c 6c 79 20 70 72 65 73 65 72 76 65 64 efully preserved
2a20: 2e 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e 61 6e 64 20 .</li>..<li>and
2a30: 79 6f 75 20 63 61 6e 20 75 73 65 20 3c 62 3e 53 you can use <b>S
2a40: 71 6c 50 72 6f 63 5f 43 6f 6f 6b 65 64 53 51 4c qlProc_CookedSQL
2a50: 3c 2f 62 3e 20 69 6e 20 6f 72 64 65 72 20 74 6f </b> in order to
2a60: 20 64 69 72 65 63 74 6c 79 20 63 68 65 63 6b 20 directly check
2a70: 74 68 65 20 53 51 4c 20 42 6f 64 79 20 61 73 20 the SQL Body as
2a80: 69 74 20 61 63 74 75 61 6c 6c 79 20 61 70 70 65 it actually appe
2a90: 61 72 73 20 61 66 74 65 72 20 72 65 70 6c 61 63 ars after replac
2aa0: 69 6e 67 20 61 6c 6c 20 72 65 71 75 69 72 65 64 ing all required
2ab0: 20 56 61 72 69 61 62 6c 65 20 56 61 6c 75 65 73 Variable Values
2ac0: 2e 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e 42 6f 74 68 .</li>..<li>Both
2ad0: 20 66 75 6e 63 74 69 6f 6e 73 20 61 72 65 20 6d functions are m
2ae0: 61 69 6e 6c 79 20 69 6e 74 65 6e 64 65 64 20 66 ainly intended f
2af0: 6f 72 20 73 75 70 70 6f 72 74 69 6e 67 20 64 65 or supporting de
2b00: 62 75 67 67 69 6e 67 20 61 63 74 69 76 69 74 69 bugging activiti
2b10: 65 73 2c 20 73 6f 20 74 6f 20 6d 61 6b 65 20 61 es, so to make a
2b20: 73 20 65 61 73 79 20 61 73 20 70 6f 73 73 69 62 s easy as possib
2b30: 6c 65 20 69 64 65 6e 74 69 66 79 69 6e 67 20 65 le identifying e
2b40: 76 65 6e 74 75 61 6c 20 65 72 72 6f 72 73 2e 3c ventual errors.<
2b50: 2f 6c 69 3e 0d 0a 3c 2f 75 6c 3e 3c 62 72 3e 0d /li>..</ul><br>.
2b60: 0a 3c 74 61 62 6c 65 20 62 67 63 6f 6c 6f 72 3d .<table bgcolor=
2b70: 22 23 66 38 66 38 64 38 22 20 63 65 6c 6c 70 61 "#f8f8d8" cellpa
2b80: 64 64 69 6e 67 3d 22 36 22 20 63 65 6c 6c 73 70 dding="6" cellsp
2b90: 61 63 69 6e 67 3d 22 38 22 3e 3c 74 72 3e 3c 74 acing="8"><tr><t
2ba0: 64 3e 0d 0a 3c 75 3e 4e 6f 74 65 3c 2f 75 3e 3a d>..<u>Note</u>:
2bb0: 20 3c 62 3e 53 71 6c 50 72 6f 63 5f 43 6f 6f 6b <b>SqlProc_Cook
2bc0: 65 64 53 51 4c 3c 2f 62 3e 20 77 69 6c 6c 20 61 edSQL</b> will a
2bd0: 63 63 65 70 74 20 61 6e 20 61 72 62 69 74 72 61 ccept an arbitra
2be0: 72 79 20 6c 69 73 74 20 6f 66 20 3c 62 3e 56 61 ry list of <b>Va
2bf0: 72 69 61 62 6c 65 20 77 69 74 68 20 56 61 6c 75 riable with Valu
2c00: 65 3c 2f 62 3e 20 61 72 67 75 6d 65 6e 74 73 2e e</b> arguments.
2c10: 0d 0a 3c 75 6c 3e 0d 0a 3c 6c 69 3e 61 6e 20 65 ..<ul>..<li>an e
2c20: 6d 70 74 79 20 6c 69 73 74 20 28 6e 6f 20 56 61 mpty list (no Va
2c30: 72 69 61 62 6c 65 73 20 77 69 74 68 20 56 61 6c riables with Val
2c40: 75 65 73 20 61 74 20 61 6c 6c 29 20 69 73 20 61 ues at all) is a
2c50: 20 70 65 72 66 65 63 74 6c 79 20 6c 65 67 61 6c perfectly legal
2c60: 20 63 6f 6e 64 69 74 69 6f 6e 20 28 63 6f 75 6c condition (coul
2c70: 64 20 65 76 65 6e 74 75 61 6c 6c 79 20 6c 65 61 d eventually lea
2c80: 64 20 74 6f 20 61 6e 20 69 6e 76 61 6c 69 64 20 d to an invalid
2c90: 43 6f 6f 6b 65 64 20 53 51 4c 20 42 6f 64 79 2c Cooked SQL Body,
2ca0: 20 73 65 65 20 62 65 6c 6f 77 29 2e 3c 2f 6c 69 see below).</li
2cb0: 3e 0d 0a 3c 6c 69 3e 61 6c 6c 20 61 72 67 75 6d >..<li>all argum
2cc0: 65 6e 74 73 20 66 72 6f 6d 20 74 68 65 20 73 65 ents from the se
2cd0: 63 6f 6e 64 20 75 6e 74 69 6c 20 74 68 65 20 65 cond until the e
2ce0: 6e 64 20 61 72 65 20 65 78 70 65 63 74 65 64 20 nd are expected
2cf0: 74 6f 20 62 65 20 77 65 6c 6c 2d 66 6f 72 6d 65 to be well-forme
2d00: 64 20 56 61 72 69 61 62 6c 65 73 20 77 69 74 68 d Variables with
2d10: 20 56 61 6c 75 65 73 2e 3c 2f 6c 69 3e 0d 0a 3c Values.</li>..<
2d20: 6c 69 3e 79 6f 75 20 63 61 6e 20 64 65 66 69 6e li>you can defin
2d30: 65 20 61 73 20 6d 75 63 68 20 61 73 20 3c 62 3e e as much as <b>
2d40: 31 36 3c 2f 62 3e 20 64 69 66 66 65 72 65 6e 74 16</b> different
2d50: 20 56 61 72 69 61 62 6c 65 73 20 77 69 74 68 20 Variables with
2d60: 56 61 6c 75 65 73 2e 3c 2f 6c 69 3e 0d 0a 3c 6c Values.</li>..<l
2d70: 69 3e 61 6e 79 20 61 74 74 65 6d 70 74 20 74 6f i>any attempt to
2d80: 20 64 65 66 69 6e 65 20 74 77 69 63 65 20 61 20 define twice a
2d90: 56 61 6c 75 65 20 66 6f 72 20 74 68 65 20 73 61 Value for the sa
2da0: 6d 65 20 56 61 72 69 61 62 6c 65 20 77 69 6c 6c me Variable will
2db0: 20 62 65 20 61 6c 77 61 79 73 20 63 6f 6e 73 69 be always consi
2dc0: 64 65 72 65 64 20 61 73 20 61 20 66 61 74 61 6c dered as a fatal
2dd0: 20 65 72 72 6f 72 2e 3c 2f 6c 69 3e 0d 0a 3c 6c error.</li>..<l
2de0: 69 3e 69 66 20 6f 6e 65 20 6f 66 20 74 68 65 20 i>if one of the
2df0: 56 61 72 69 61 62 6c 65 20 61 72 67 75 6d 65 6e Variable argumen
2e00: 74 73 20 64 6f 65 73 20 6e 6f 74 20 6d 61 74 63 ts does not matc
2e10: 68 20 6f 6e 65 20 74 68 65 20 56 61 72 69 61 62 h one the Variab
2e20: 6c 65 73 20 69 6e 74 65 72 6e 61 6c 6c 79 20 64 les internally d
2e30: 65 66 69 6e 65 64 20 62 79 20 74 68 65 20 52 61 efined by the Ra
2e40: 77 20 53 51 4c 20 42 6f 64 79 20 69 74 20 77 69 w SQL Body it wi
2e50: 6c 6c 20 62 65 20 73 69 6d 70 6c 79 20 69 67 6e ll be simply ign
2e60: 6f 72 65 64 2e 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e ored.</li>..<li>
2e70: 69 66 20 61 20 56 61 72 69 61 62 6c 65 20 64 65 if a Variable de
2e80: 66 69 6e 65 64 20 69 6e 74 6f 20 74 68 65 20 52 fined into the R
2e90: 61 77 20 53 51 4c 20 42 6f 64 79 20 64 6f 65 73 aw SQL Body does
2ea0: 20 6e 6f 74 20 6d 61 74 63 68 65 73 20 61 20 63 not matches a c
2eb0: 6f 72 72 65 73 70 6f 6e 64 69 6e 67 20 56 61 72 orresponding Var
2ec0: 69 61 62 6c 65 20 61 72 67 75 6d 65 6e 74 20 74 iable argument t
2ed0: 68 65 6e 20 69 74 20 77 69 6c 6c 20 72 65 70 6c hen it will repl
2ee0: 61 63 65 64 20 62 79 20 61 20 64 65 66 61 75 6c aced by a defaul
2ef0: 74 20 27 3c 62 3e 4e 55 4c 4c 3c 2f 62 3e 27 20 t '<b>NULL</b>'
2f00: 73 74 72 69 6e 67 2e 3c 2f 6c 69 3e 0d 0a 3c 6c string.</li>..<l
2f10: 69 3e 74 68 65 20 73 61 6d 65 20 69 64 65 6e 74 i>the same ident
2f20: 69 63 61 6c 20 72 75 6c 65 73 20 66 6f 72 20 70 ical rules for p
2f30: 61 73 73 69 6e 67 20 56 61 72 69 61 62 6c 65 2d assing Variable-
2f40: 56 61 6c 75 65 20 61 72 67 75 6d 65 6e 74 73 20 Value arguments
2f50: 61 70 70 6c 79 20 74 6f 20 3c 62 3e 53 71 6c 50 apply to <b>SqlP
2f60: 72 6f 63 5f 43 6f 6f 6b 65 64 53 51 4c 3c 2f 62 roc_CookedSQL</b
2f70: 3e 2c 20 3c 62 3e 53 71 6c 50 72 6f 63 5f 45 78 >, <b>SqlProc_Ex
2f80: 65 63 75 74 65 3c 2f 62 3e 20 61 6e 64 20 3c 62 ecute</b> and <b
2f90: 3e 53 74 6f 72 65 64 50 72 6f 63 5f 45 78 65 63 >StoredProc_Exec
2fa0: 75 74 65 3c 2f 62 3e 2e 3c 2f 6c 69 3e 0d 0a 3c ute</b>.</li>..<
2fb0: 2f 75 6c 3e 0d 0a 3c 2f 74 64 3e 3c 2f 74 72 3e /ul>..</td></tr>
2fc0: 3c 2f 74 61 62 6c 65 3e 0d 0a 3c 2f 6c 69 3e 0d </table>..</li>.
2fd0: 0a 3c 6c 69 3e 0d 0a 3c 68 34 3e 45 78 65 63 75 .<li>..<h4>Execu
2fe0: 74 69 6e 67 20 61 20 53 51 4c 20 50 72 6f 63 65 ting a SQL Proce
2ff0: 64 75 72 65 3c 2f 68 34 3e 0d 0a 3c 76 65 72 62 dure</h4>..<verb
3000: 61 74 69 6d 3e 0d 0a 53 45 4c 45 43 54 20 53 71 atim>..SELECT Sq
3010: 6c 50 72 6f 63 5f 45 78 65 63 75 74 65 20 28 53 lProc_Execute (S
3020: 71 6c 50 72 6f 63 5f 46 72 6f 6d 54 65 78 74 28 qlProc_FromText(
3030: 27 53 45 4c 45 43 54 20 40 63 6f 6c 40 20 46 52 'SELECT @col@ FR
3040: 4f 4d 20 40 74 62 6c 40 3b 27 29 2c 0d 0a 20 20 OM @tbl@;'),..
3050: 20 20 27 40 63 6f 6c 40 3d 66 69 72 73 74 5f 6e '@col@=first_n
3060: 61 6d 65 27 2c 0d 0a 20 20 20 20 27 40 74 62 6c ame',.. '@tbl
3070: 40 3d 70 68 6f 6e 65 5f 62 6f 6f 6b 27 20 29 3b @=phone_book' );
3080: 0d 0a 2d 2d 2d 2d 2d 0d 0a 31 0d 0a 3c 2f 76 65 ..-----..1..</ve
3090: 72 62 61 74 69 6d 3e 0d 0a 79 6f 75 20 63 61 6e rbatim>..you can
30a0: 20 75 73 65 20 3c 62 3e 53 71 6c 50 72 6f 63 5f use <b>SqlProc_
30b0: 45 78 65 63 75 74 65 3c 2f 62 3e 20 69 6e 20 6f Execute</b> in o
30c0: 72 64 65 72 20 74 6f 20 64 69 72 65 63 74 6c 79 rder to directly
30d0: 20 65 78 65 63 75 74 65 20 74 68 65 20 77 68 6f execute the who
30e0: 6c 65 20 53 51 4c 20 42 6f 64 79 20 61 73 20 61 le SQL Body as a
30f0: 20 73 69 6e 67 6c 65 20 6d 6f 6e 6f 6c 69 74 68 single monolith
3100: 69 63 20 75 6e 69 74 2e 3c 62 72 3e 0d 0a 41 74 ic unit.<br>..At
3110: 20 74 68 65 20 65 6e 64 20 6f 66 20 74 68 65 20 the end of the
3120: 70 72 6f 63 65 73 73 20 3c 62 3e 31 3c 2f 62 3e process <b>1</b>
3130: 20 28 61 6b 61 20 3c 62 3e 54 72 75 65 3c 2f 62 (aka <b>True</b
3140: 3e 29 20 77 69 6c 6c 20 62 65 20 72 65 74 75 72 >) will be retur
3150: 6e 65 64 20 6f 6e 20 66 75 6c 6c 20 73 75 63 63 ned on full succ
3160: 65 73 73 3b 20 61 6e 20 45 78 63 65 70 74 69 6f ess; an Exceptio
3170: 6e 20 77 69 6c 6c 20 62 65 20 72 61 69 73 65 64 n will be raised
3180: 20 6f 6e 20 66 61 69 6c 75 72 65 2e 3c 62 72 3e on failure.<br>
3190: 3c 62 72 3e 0d 0a 3c 74 61 62 6c 65 20 62 67 63 <br>..<table bgc
31a0: 6f 6c 6f 72 3d 22 23 66 38 66 38 64 38 22 20 63 olor="#f8f8d8" c
31b0: 65 6c 6c 70 61 64 64 69 6e 67 3d 22 36 22 20 63 ellpadding="6" c
31c0: 65 6c 6c 73 70 61 63 69 6e 67 3d 22 38 22 3e 3c ellspacing="8"><
31d0: 74 72 3e 3c 74 64 3e 0d 0a 3c 75 3e 4e 6f 74 65 tr><td>..<u>Note
31e0: 3c 2f 75 3e 3a 20 61 6c 6c 20 3c 62 3e 44 6f 74 </u>: all <b>Dot
31f0: 20 4d 61 63 72 6f 73 3c 2f 62 3e 20 65 76 65 6e Macros</b> even
3200: 74 75 61 6c 6c 79 20 66 6f 75 6e 64 20 77 69 74 tually found wit
3210: 68 69 6e 20 74 68 65 20 53 51 4c 20 42 6f 64 79 hin the SQL Body
3220: 20 62 65 69 6e 67 20 65 78 65 63 75 74 65 64 20 being executed
3230: 77 69 6c 6c 20 62 65 20 61 6c 77 61 79 73 20 73 will be always s
3240: 69 6c 65 6e 74 6c 79 20 69 67 6e 6f 72 65 64 2e ilently ignored.
3250: 3c 62 72 3e 0d 0a 54 68 65 20 73 61 6d 65 20 72 <br>..The same r
3260: 75 6c 65 20 61 70 70 6c 69 65 73 20 74 6f 20 3c ule applies to <
3270: 62 3e 53 74 6f 72 65 64 50 72 6f 63 5f 45 78 65 b>StoredProc_Exe
3280: 63 75 74 65 3c 2f 62 3e 20 61 73 20 77 65 6c 6c cute</b> as well
3290: 2e 3c 2f 62 3e 0d 0a 3c 2f 74 64 3e 3c 2f 74 72 .</b>..</td></tr
32a0: 3e 3c 2f 74 61 62 6c 65 3e 0d 0a 3c 2f 6c 69 3e ></table>..</li>
32b0: 0d 0a 3c 2f 6f 6c 3e 0d 0a 3c 68 72 3e 0d 0a 0d ..</ol>..<hr>...
32c0: 0a 0d 0a 0d 0a 3c 62 72 3e 3c 62 72 3e 0d 0a 3c .....<br><br>..<
32d0: 74 61 62 6c 65 20 77 69 64 74 68 3d 22 31 30 30 table width="100
32e0: 25 22 3e 3c 74 72 3e 0d 0a 3c 74 64 20 77 69 64 %"><tr>..<td wid
32f0: 74 68 3d 22 33 33 25 22 20 61 6c 69 67 6e 3d 22 th="33%" align="
3300: 6c 65 66 74 22 3e 3c 2f 74 64 3e 0d 0a 3c 74 64 left"></td>..<td
3310: 20 61 6c 69 67 6e 3d 22 63 65 6e 74 65 72 22 3e align="center">
3320: 3c 61 20 68 72 65 66 3d 22 68 74 74 70 73 3a 2f <a href="https:/
3330: 2f 77 77 77 2e 67 61 69 61 2d 67 69 73 2e 69 74 /www.gaia-gis.it
3340: 2f 66 6f 73 73 69 6c 2f 6c 69 62 73 70 61 74 69 /fossil/libspati
3350: 61 6c 69 74 65 2f 77 69 6b 69 3f 6e 61 6d 65 3d alite/wiki?name=
3360: 34 2e 33 2e 30 2b 64 6f 63 22 3e 62 61 63 6b 20 4.3.0+doc">back
3370: 74 6f 20 69 6e 64 65 78 3c 2f 61 3e 3c 2f 74 64 to index</a></td
3380: 3e 0d 0a 3c 74 64 20 77 69 64 74 68 3d 22 33 33 >..<td width="33
3390: 25 22 20 61 6c 69 67 6e 3d 22 72 69 67 68 74 22 %" align="right"
33a0: 3e 3c 2f 74 64 3e 0d 0a 3c 2f 74 72 3e 3c 2f 74 ></td>..</tr></t
33b0: 61 62 6c 65 3e 0a 5a 20 30 32 33 31 63 64 31 66 able>.Z 0231cd1f
33c0: 30 31 38 64 33 61 30 64 31 31 38 31 61 63 64 32 018d3a0d1181acd2
33d0: 35 36 37 30 39 39 62 65 0a 567099be.