Artifact
966c6569e451cbda50655dcfa0f860b2e60228ef:
Wiki page
[about Pause()] by
sandro
2019-05-29 20:14:35.
0000: 44 20 32 30 31 39 2d 30 35 2d 32 39 54 32 30 3a D 2019-05-29T20:
0010: 31 34 3a 33 35 2e 36 38 32 0a 4c 20 61 62 6f 75 14:35.682.L abou
0020: 74 5c 73 50 61 75 73 65 28 29 0a 55 20 73 61 6e t\sPause().U san
0030: 64 72 6f 0a 57 20 32 35 35 36 0a 3c 61 20 68 72 dro.W 2556.<a hr
0040: 65 66 3d 22 68 74 74 70 73 3a 2f 2f 77 77 77 2e ef="https://www.
0050: 67 61 69 61 2d 67 69 73 2e 69 74 2f 66 6f 73 73 gaia-gis.it/foss
0060: 69 6c 2f 6c 69 62 73 70 61 74 69 61 6c 69 74 65 il/libspatialite
0070: 2f 77 69 6b 69 3f 6e 61 6d 65 3d 34 2e 33 2e 30 /wiki?name=4.3.0
0080: 2d 64 6f 63 22 3e 62 61 63 6b 3c 2f 61 3e 3c 68 -doc">back</a><h
0090: 72 3e 3c 62 72 3e 0d 0a 3c 68 31 3e 49 6e 74 72 r><br>..<h1>Intr
00a0: 6f 64 75 63 74 69 6f 6e 3c 2f 68 31 3e 0d 0a 4d oduction</h1>..M
00b0: 61 6e 79 20 70 6f 77 65 72 20 75 73 65 72 73 20 any power users
00c0: 72 6f 75 74 69 6e 65 6c 79 20 75 73 65 20 53 70 routinely use Sp
00d0: 61 74 69 61 4c 69 74 65 20 66 6f 72 20 65 78 65 atiaLite for exe
00e0: 63 75 74 69 6e 67 20 3c 62 3e 76 65 72 79 20 63 cuting <b>very c
00f0: 6f 6d 70 6c 65 78 20 53 51 4c 20 53 63 72 69 70 omplex SQL Scrip
0100: 74 73 3c 2f 62 3e 2c 20 6d 61 79 20 62 65 20 6c ts</b>, may be l
0110: 61 72 67 65 6c 79 20 62 61 73 65 64 20 6f 6e 20 argely based on
0120: 3c 62 3e 53 74 6f 72 65 64 20 50 72 6f 63 65 64 <b>Stored Proced
0130: 75 72 65 73 3c 2f 62 3e 2e 3c 62 72 3e 0d 0a 53 ures</b>.<br>..S
0140: 6f 6d 65 74 69 6d 65 73 20 61 74 74 65 6d 70 74 ometimes attempt
0150: 69 6e 67 20 74 6f 20 64 65 62 75 67 20 61 20 63 ing to debug a c
0160: 6f 6d 70 6c 65 78 20 53 51 4c 20 73 63 72 69 70 omplex SQL scrip
0170: 74 20 6d 61 79 20 65 61 73 69 6c 79 20 62 65 63 t may easily bec
0180: 6f 6d 65 20 61 20 64 69 66 66 69 63 75 6c 74 20 ome a difficult
0190: 61 6e 64 20 66 72 75 73 74 72 61 74 69 6e 67 20 and frustrating
01a0: 61 63 74 69 76 69 74 79 2e 3c 62 72 3e 3c 62 72 activity.<br><br
01b0: 3e 0d 0a 49 6e 20 6f 72 64 65 72 20 74 6f 20 66 >..In order to f
01c0: 61 63 69 6c 69 74 61 74 65 20 74 68 65 20 64 65 acilitate the de
01d0: 62 75 67 67 69 6e 67 20 6f 66 20 53 51 4c 20 53 bugging of SQL S
01e0: 63 72 69 70 74 73 20 61 73 20 6d 75 63 68 20 61 cripts as much a
01f0: 73 20 70 6f 73 73 69 62 6c 65 2c 20 53 70 61 74 s possible, Spat
0200: 69 61 4c 69 74 65 20 28 73 74 61 72 74 69 6e 67 iaLite (starting
0210: 20 73 69 6e 63 65 20 3c 62 3e 76 65 72 73 69 6f since <b>versio
0220: 6e 20 35 2e 30 2e 30 3c 2f 62 3e 29 20 73 75 70 n 5.0.0</b>) sup
0230: 70 6f 72 74 73 20 61 20 73 70 65 63 69 66 69 63 ports a specific
0240: 20 3c 62 3e 50 61 75 73 65 28 29 3c 2f 62 3e 20 <b>Pause()</b>
0250: 53 51 4c 20 66 75 6e 63 74 69 6f 6e 2e 3c 62 72 SQL function.<br
0260: 3e 0d 0a 54 68 69 73 20 66 75 6e 63 74 69 6f 6e >..This function
0270: 20 69 73 20 69 6e 74 65 6e 74 65 64 20 74 6f 20 is intented to
0280: 62 65 20 74 68 65 20 63 6f 6e 63 65 70 74 75 61 be the conceptua
0290: 6c 20 65 71 75 69 76 61 6c 65 6e 74 20 6f 66 20 l equivalent of
02a0: 77 68 61 74 20 61 20 3c 61 20 68 72 65 66 3d 22 what a <a href="
02b0: 68 74 74 70 73 3a 2f 2f 65 6e 2e 77 69 6b 69 70 https://en.wikip
02c0: 65 64 69 61 2e 6f 72 67 2f 77 69 6b 69 2f 42 72 edia.org/wiki/Br
02d0: 65 61 6b 70 6f 69 6e 74 22 3e 62 72 65 61 6b 70 eakpoint">breakp
02e0: 6f 69 6e 74 3c 2f 61 3e 20 69 73 20 69 6e 74 65 oint</a> is inte
02f0: 6e 64 65 64 20 74 6f 20 62 65 20 66 6f 72 20 6f nded to be for o
0300: 72 64 69 6e 61 72 79 20 64 65 62 75 67 67 65 72 rdinary debugger
0310: 20 74 6f 6f 6c 73 2e 3c 62 72 3e 3c 62 72 3e 0d tools.<br><br>.
0320: 0a 46 65 77 20 62 61 73 69 63 20 63 6f 6e 63 65 .Few basic conce
0330: 70 74 73 3a 0d 0a 3c 75 6c 3e 0d 0a 3c 6c 69 3e pts:..<ul>..<li>
0340: 79 6f 75 2c 20 61 73 20 74 68 65 20 64 65 76 65 you, as the deve
0350: 6c 6f 70 65 72 20 6f 66 20 74 68 65 20 53 51 4c loper of the SQL
0360: 20 53 63 72 69 70 74 2c 20 61 72 65 20 66 72 65 Script, are fre
0370: 65 20 74 6f 20 63 61 6c 6c 20 3c 62 3e 50 61 75 e to call <b>Pau
0380: 73 65 28 29 3c 2f 62 3e 20 61 74 20 73 6f 6d 65 se()</b> at some
0390: 20 63 72 69 74 69 63 61 6c 20 70 6f 69 6e 74 20 critical point
03a0: 6f 66 20 74 68 65 20 53 63 72 69 70 74 20 28 3c of the Script (<
03b0: 69 3e 77 68 65 72 65 20 79 6f 75 20 73 75 73 70 i>where you susp
03c0: 65 63 74 20 74 68 61 74 20 6e 61 73 74 79 20 74 ect that nasty t
03d0: 68 69 6e 67 73 20 68 61 76 65 20 6a 75 73 74 20 hings have just
03e0: 68 61 70 70 65 6e 65 64 3c 2f 69 3e 29 2e 3c 2f happened</i>).</
03f0: 6c 69 3e 0d 0a 3c 6c 69 3e 6f 6e 63 65 20 3c 62 li>..<li>once <b
0400: 3e 50 61 75 73 65 28 29 3c 2f 62 3e 20 69 73 20 >Pause()</b> is
0410: 65 78 65 63 75 74 65 64 20 69 74 20 73 75 64 64 executed it sudd
0420: 65 6e 6c 79 20 73 74 6f 70 73 20 61 6e 79 20 66 enly stops any f
0430: 75 72 74 68 65 72 20 65 78 65 63 75 74 69 6f 6e urther execution
0440: 20 6f 66 20 74 68 65 20 63 61 6c 6c 69 6e 67 20 of the calling
0450: 70 72 6f 63 65 73 73 2c 20 74 68 61 74 20 77 69 process, that wi
0460: 6c 6c 20 69 6e 64 65 66 69 6e 69 74 65 6c 79 20 ll indefinitely
0470: 72 65 6d 61 69 6e 20 69 6e 20 61 20 66 72 6f 7a remain in a froz
0480: 65 6e 20 73 74 61 74 65 2e 3c 2f 6c 69 3e 0d 0a en state.</li>..
0490: 3c 6c 69 3e 74 68 69 73 20 67 69 76 65 73 20 79 <li>this gives y
04a0: 6f 75 20 74 68 65 20 6f 70 70 6f 72 74 75 6e 69 ou the opportuni
04b0: 74 79 20 74 6f 20 73 74 61 72 74 20 61 20 73 65 ty to start a se
04c0: 63 6f 6e 64 20 68 69 6e 73 74 61 6e 63 65 20 6f cond hinstance o
04d0: 66 20 53 70 61 74 69 61 4c 69 74 65 20 74 6f 20 f SpatiaLite to
04e0: 62 65 20 75 73 65 64 20 66 6f 72 20 69 6e 73 70 be used for insp
04f0: 65 63 74 69 6e 67 20 61 6e 79 20 70 6f 73 73 69 ecting any possi
0500: 62 6c 65 20 64 65 74 61 69 6c 20 69 6e 20 74 68 ble detail in th
0510: 65 20 77 6f 72 6b 20 64 61 74 61 62 61 73 65 2c e work database,
0520: 3c 62 72 3e 0d 0a 41 6e 64 20 79 6f 75 27 6c 6c <br>..And you'll
0530: 20 62 65 20 65 76 65 6e 74 75 61 6c 6c 79 20 66 be eventually f
0540: 72 65 65 20 74 6f 20 63 6f 72 72 65 63 74 20 6f ree to correct o
0550: 6e 20 74 68 65 20 66 6c 79 20 73 6f 6d 65 20 77 n the fly some w
0560: 72 6f 6e 67 20 76 61 6c 75 65 20 79 6f 75 27 6c rong value you'l
0570: 6c 20 6e 6f 74 69 63 65 20 73 6f 6d 65 77 68 65 l notice somewhe
0580: 72 65 2e 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e 77 68 re.</li>..<li>wh
0590: 65 6e 20 79 6f 75 27 76 65 20 63 6f 6d 70 6c 65 en you've comple
05a0: 74 65 64 20 61 6c 6c 20 79 6f 75 72 20 64 65 62 ted all your deb
05b0: 75 67 20 61 63 74 69 76 69 74 69 65 73 2c 20 79 ug activities, y
05c0: 6f 75 20 73 69 6d 70 6c 79 20 68 61 76 65 20 74 ou simply have t
05d0: 6f 20 74 61 6b 65 20 74 68 65 20 61 70 70 72 6f o take the appro
05e0: 70 72 69 61 74 65 20 3c 62 3e 63 6f 6e 74 69 6e priate <b>contin
05f0: 75 65 20 61 63 74 69 6f 6e 3c 2f 62 3e 2c 3c 62 ue action</b>,<b
0600: 72 3e 0d 0a 54 68 65 20 53 51 4c 20 53 63 72 69 r>..The SQL Scri
0610: 70 74 20 77 69 6c 6c 20 74 68 65 6e 20 72 65 73 pt will then res
0620: 75 6d 65 20 69 74 73 20 6e 6f 72 6d 61 6c 20 65 ume its normal e
0630: 78 65 63 75 74 69 6f 6e 20 65 78 61 63 74 6c 79 xecution exactly
0640: 20 66 72 6f 6d 20 74 68 65 20 73 74 61 74 65 6d from the statem
0650: 65 6e 74 20 69 6d 6d 65 64 69 61 74 65 6c 79 20 ent immediately
0660: 66 6f 6c 6c 6f 77 69 6e 67 20 3c 62 3e 50 61 75 following <b>Pau
0670: 73 65 28 29 3c 2f 62 3e 3c 2f 6c 69 3e 0d 0a 3c se()</b></li>..<
0680: 6c 69 3e 3c 62 3e 3c 75 3e 4e 6f 74 65 3c 2f 75 li><b><u>Note</u
0690: 3e 3c 2f 62 3e 3a 20 6e 6f 74 68 69 6e 67 20 66 ></b>: nothing f
06a0: 6f 72 62 69 64 73 20 74 6f 20 63 61 6c 6c 20 3c orbids to call <
06b0: 62 3e 50 61 75 73 65 28 29 3c 2f 62 3e 20 61 73 b>Pause()</b> as
06c0: 20 6d 61 6e 79 20 74 69 6d 65 73 20 61 73 20 79 many times as y
06d0: 6f 75 20 63 61 6e 20 66 69 6e 64 20 75 73 65 66 ou can find usef
06e0: 75 6c 20 66 72 6f 6d 20 77 69 74 68 69 6e 20 74 ul from within t
06f0: 68 65 20 73 61 6d 65 20 53 51 4c 20 53 63 72 69 he same SQL Scri
0700: 70 74 2e 3c 2f 6c 69 3e 20 0d 0a 3c 2f 75 6c 3e pt.</li> ..</ul>
0710: 0d 0a 3c 62 72 3e 0d 0a 3c 74 61 62 6c 65 20 63 ..<br>..<table c
0720: 65 6c 6c 70 61 64 64 69 6e 67 3d 22 36 22 20 63 ellpadding="6" c
0730: 65 6c 6c 73 70 61 63 69 6e 67 3d 22 36 22 20 62 ellspacing="6" b
0740: 67 63 6f 6c 6f 72 3d 22 23 66 66 66 66 64 30 22 gcolor="#ffffd0"
0750: 3e 0d 0a 3c 74 72 3e 3c 74 64 3e 0d 0a 3c 68 33 >..<tr><td>..<h3
0760: 3e 49 6d 70 6f 72 74 61 6e 74 20 6e 6f 74 69 63 >Important notic
0770: 65 3a 20 50 61 75 73 65 28 29 20 61 6e 64 20 54 e: Pause() and T
0780: 72 61 6e 73 61 63 74 69 6f 6e 73 3c 2f 68 33 3e ransactions</h3>
0790: 0d 0a 3c 62 3e 3c 75 3e 52 65 63 61 6c 6c 3c 2f ..<b><u>Recall</
07a0: 75 3e 3c 2f 62 3e 3a 20 61 6c 6c 20 63 68 61 6e u></b>: all chan
07b0: 67 65 73 20 63 6f 6e 74 61 69 6e 65 64 20 77 69 ges contained wi
07c0: 74 68 69 6e 20 61 20 3c 62 3e 70 65 6e 64 69 6e thin a <b>pendin
07d0: 67 3c 2f 62 3e 20 28 3c 69 3e 61 6b 61 3c 2f 69 g</b> (<i>aka</i
07e0: 3e 20 3c 62 3e 75 6e 63 6f 6d 6d 69 74 74 65 64 > <b>uncommitted
07f0: 3c 2f 62 3e 20 53 51 4c 20 54 72 61 6e 73 61 63 </b> SQL Transac
0800: 74 69 6f 6e 20 61 72 65 20 73 74 72 69 63 74 6c tion are strictl
0810: 79 20 70 72 69 76 61 74 65 2e 3c 62 72 3e 0d 0a y private.<br>..
0820: 54 68 69 73 20 70 72 61 63 74 69 63 61 6c 6c 79 This practically
0830: 20 6d 65 61 6e 73 20 74 68 61 74 20 61 6c 6c 20 means that all
0840: 74 68 65 6d 20 77 69 6c 6c 20 72 65 6d 61 69 6e them will remain
0850: 20 63 6f 6d 70 6c 65 74 65 6c 79 20 69 6e 76 69 completely invi
0860: 73 69 62 69 6c 65 20 74 6f 20 61 6e 79 20 6f 74 sibile to any ot
0870: 68 65 72 20 63 6f 6e 6e 65 63 74 69 6f 6e 20 61 her connection a
0880: 63 63 65 73 73 69 6e 67 20 74 68 65 20 73 61 6d ccessing the sam
0890: 65 20 64 61 74 61 62 61 73 65 2e 3c 62 72 3e 0d e database.<br>.
08a0: 0a 42 75 74 20 61 20 64 65 62 75 67 67 69 6e 67 .But a debugging
08b0: 20 73 65 73 73 69 6f 6e 20 61 73 20 70 72 65 76 session as prev
08c0: 69 6f 75 73 6c 79 20 64 65 66 69 6e 65 64 20 6e iously defined n
08d0: 65 63 65 73 73 61 72 69 6c 79 20 72 65 71 75 69 ecessarily requi
08e0: 72 65 73 20 75 73 69 6e 67 20 61 74 20 6c 65 61 res using at lea
08f0: 73 74 20 74 77 6f 20 64 69 66 66 65 72 65 6e 74 st two different
0900: 20 63 6f 6e 6e 65 63 74 69 6f 6e 73 3c 62 72 3e connections<br>
0910: 0d 0a 28 3c 69 3e 74 68 65 20 6f 6e 65 20 73 75 ..(<i>the one su
0920: 73 70 65 6e 64 65 64 20 62 79 20 3c 62 3e 50 61 spended by <b>Pa
0930: 75 73 65 28 29 3c 2f 62 3e 20 61 6e 64 20 74 68 use()</b> and th
0940: 65 20 6f 74 68 65 72 20 75 73 65 64 20 66 6f 72 e other used for
0950: 20 69 6e 73 70 65 63 74 69 6e 67 20 74 68 65 20 inspecting the
0960: 64 61 74 61 62 61 73 65 29 2e 3c 62 72 3e 3c 62 database).<br><b
0970: 72 3e 0d 0a 3c 62 3e 3c 69 3e 53 68 6f 72 74 20 r>..<b><i>Short
0980: 63 6f 6e 63 6c 75 73 69 6f 6e 3c 2f 69 3e 3c 2f conclusion</i></
0990: 62 3e 3a 20 74 68 65 20 6f 6e 6c 79 20 73 61 66 b>: the only saf
09a0: 65 20 77 61 79 20 66 6f 72 20 63 61 6c 6c 69 6e e way for callin
09b0: 67 20 3c 62 3e 50 61 75 73 65 28 29 3c 2f 62 3e g <b>Pause()</b>
09c0: 20 69 73 0d 0a 3c 2f 74 64 3e 3c 74 72 3e 0d 0a is..</td><tr>..
09d0: 3c 2f 74 61 62 6c 65 3e 0d 0a 3c 68 72 3e 3c 62 </table>..<hr><b
09e0: 72 3e 0d 0a 3c 61 20 68 72 65 66 3d 22 68 74 74 r>..<a href="htt
09f0: 70 73 3a 2f 2f 77 77 77 2e 67 61 69 61 2d 67 69 ps://www.gaia-gi
0a00: 73 2e 69 74 2f 66 6f 73 73 69 6c 2f 6c 69 62 73 s.it/fossil/libs
0a10: 70 61 74 69 61 6c 69 74 65 2f 77 69 6b 69 3f 6e patialite/wiki?n
0a20: 61 6d 65 3d 34 2e 33 2e 30 2d 64 6f 63 22 3e 62 ame=4.3.0-doc">b
0a30: 61 63 6b 3c 2f 61 3e 0a 5a 20 37 31 37 66 66 35 ack</a>.Z 717ff5
0a40: 61 30 35 63 31 38 37 36 36 62 61 64 65 65 35 33 a05c18766badee53
0a50: 35 64 33 36 66 63 37 65 65 38 0a 5d36fc7ee8.