Artifact
00e3958bc4a3cf17f05a6bdb319b92a3fae43f78:
Wiki page
[ZippedSHP] by
sandro
2020-05-08 13:37:15.
0000: 44 20 32 30 32 30 2d 30 35 2d 30 38 54 31 33 3a D 2020-05-08T13:
0010: 33 37 3a 31 35 2e 31 34 34 0a 4c 20 5a 69 70 70 37:15.144.L Zipp
0020: 65 64 53 48 50 0a 50 20 61 32 61 31 39 39 35 64 edSHP.P a2a1995d
0030: 30 30 33 36 38 36 30 39 35 37 37 39 33 36 37 62 003686095779367b
0040: 38 31 31 32 63 35 38 66 31 65 61 30 36 30 33 37 8112c58f1ea06037
0050: 0a 55 20 73 61 6e 64 72 6f 0a 57 20 31 30 33 35 .U sandro.W 1035
0060: 35 0a 42 61 63 6b 20 74 6f 20 3c 61 20 68 72 65 5.Back to <a hre
0070: 66 3d 22 68 74 74 70 73 3a 2f 2f 77 77 77 2e 67 f="https://www.g
0080: 61 69 61 2d 67 69 73 2e 69 74 2f 66 6f 73 73 69 aia-gis.it/fossi
0090: 6c 2f 6c 69 62 73 70 61 74 69 61 6c 69 74 65 2f l/libspatialite/
00a0: 77 69 6b 69 3f 6e 61 6d 65 3d 35 2e 30 2e 30 2d wiki?name=5.0.0-
00b0: 64 6f 63 22 3e 6d 61 69 6e 20 53 70 61 74 69 61 doc">main Spatia
00c0: 4c 69 74 65 20 70 61 67 65 3c 2f 61 3e 0d 0a 3c Lite page</a>..<
00d0: 68 32 3e 52 65 61 64 69 6e 67 20 53 48 50 20 61 h2>Reading SHP a
00e0: 6e 64 20 44 42 46 20 66 69 6c 65 73 20 64 69 72 nd DBF files dir
00f0: 65 63 74 6c 79 20 66 72 6f 6d 20 77 69 74 68 69 ectly from withi
0100: 6e 20 61 20 5a 69 70 66 69 6c 65 3c 2f 68 32 3e n a Zipfile</h2>
0110: 0d 0a 53 74 61 72 74 69 6e 67 20 73 69 6e 63 65 ..Starting since
0120: 20 76 65 72 73 69 6f 6e 20 3c 62 3e 35 2e 30 2e version <b>5.0.
0130: 30 3c 2f 62 3e 20 53 70 61 74 69 61 4c 69 74 65 0</b> SpatiaLite
0140: 20 68 61 73 20 74 68 65 20 63 61 70 61 62 69 6c has the capabil
0150: 69 74 79 20 74 6f 20 64 69 72 65 63 74 6c 79 20 ity to directly
0160: 72 65 61 64 20 61 6e 79 20 3c 62 3e 53 68 61 70 read any <b>Shap
0170: 65 66 69 6c 65 3c 2f 62 3e 20 28 6f 72 20 3c 62 efile</b> (or <b
0180: 3e 44 42 46 3c 2f 62 3e 20 66 69 6c 65 29 20 63 >DBF</b> file) c
0190: 6f 6e 74 61 69 6e 65 64 20 77 69 74 68 69 6e 20 ontained within
01a0: 61 20 63 6f 6d 70 72 65 73 73 65 64 20 3c 62 3e a compressed <b>
01b0: 5a 69 70 66 69 6c 65 3c 2f 62 3e 2e 3c 62 72 3e Zipfile</b>.<br>
01c0: 0d 0a 53 65 76 65 72 61 6c 20 63 6c 6f 73 65 6c ..Several closel
01d0: 79 20 72 65 6c 61 74 65 64 20 53 51 4c 20 66 75 y related SQL fu
01e0: 6e 63 74 69 6f 6e 73 20 68 61 76 65 20 62 65 65 nctions have bee
01f0: 6e 20 69 6e 74 72 6f 64 75 63 65 64 20 61 73 20 n introduced as
0200: 77 65 6c 6c 2e 0d 0a 3c 68 33 3e 41 63 63 65 73 well...<h3>Acces
0210: 73 69 6e 67 20 61 20 5a 69 70 70 65 64 20 53 48 sing a Zipped SH
0220: 50 3c 2f 68 33 3e 0d 0a 41 6c 6c 20 74 68 65 73 P</h3>..All thes
0230: 65 20 6e 65 77 20 53 51 4c 20 66 75 6e 63 74 69 e new SQL functi
0240: 6f 6e 73 20 61 72 65 20 6e 6f 77 20 73 75 70 70 ons are now supp
0250: 6f 72 74 65 64 3a 0d 0a 3c 75 6c 3e 0d 0a 3c 6c orted:..<ul>..<l
0260: 69 3e 3c 62 3e 49 6d 70 6f 72 74 5a 69 70 53 48 i><b>ImportZipSH
0270: 50 28 29 3c 2f 62 3e 3a 20 74 68 65 20 6d 61 69 P()</b>: the mai
0280: 6e 20 66 75 6e 63 74 69 6f 6e 20 61 6c 6c 6f 77 n function allow
0290: 69 6e 67 20 74 6f 20 69 6d 70 6f 72 74 20 61 20 ing to import a
02a0: 77 68 6f 6c 65 20 53 68 61 70 65 66 69 6c 65 20 whole Shapefile
02b0: 69 6e 74 6f 20 61 20 6e 65 77 20 53 70 61 74 69 into a new Spati
02c0: 61 6c 20 54 61 62 6c 65 20 69 6e 74 6f 20 74 68 al Table into th
02d0: 65 20 63 75 72 72 65 6e 74 6c 79 20 63 6f 6e 6e e currently conn
02e0: 65 63 74 65 64 20 44 61 74 61 62 61 73 65 2e 3c ected Database.<
02f0: 2f 6c 69 3e 0d 0a 3c 6c 69 3e 3c 62 3e 50 52 4f /li>..<li><b>PRO
0300: 4a 5f 47 75 65 73 73 53 72 69 64 46 72 6f 6d 5a J_GuessSridFromZ
0310: 69 70 53 48 50 28 29 3c 2f 62 3e 3a 20 61 20 68 ipSHP()</b>: a h
0320: 65 6c 70 65 72 20 66 75 6e 63 74 69 6f 6e 20 66 elper function f
0330: 6f 72 20 61 74 74 65 6d 70 74 69 6e 67 20 74 6f or attempting to
0340: 20 67 75 65 73 73 20 74 68 65 20 53 52 49 44 20 guess the SRID
0350: 66 6f 72 20 61 20 67 69 76 65 6e 20 7a 69 70 70 for a given zipp
0360: 65 64 20 53 48 50 2e 3c 2f 6c 69 3e 0d 0a 3c 6c ed SHP.</li>..<l
0370: 69 3e 3c 62 3e 5a 69 70 66 69 6c 65 5f 4e 75 6d i><b>Zipfile_Num
0380: 53 48 50 28 29 3c 2f 62 3e 3a 20 61 20 68 65 6c SHP()</b>: a hel
0390: 70 65 72 20 66 75 6e 63 74 69 6f 6e 20 72 65 74 per function ret
03a0: 75 72 6e 69 6e 67 20 74 68 65 20 74 6f 74 61 6c urning the total
03b0: 20 63 6f 75 6e 74 20 6f 66 20 53 68 61 70 65 66 count of Shapef
03c0: 69 6c 65 73 20 63 6f 6e 74 61 69 6e 65 64 20 77 iles contained w
03d0: 69 74 68 69 6e 20 61 20 67 69 76 65 6e 20 5a 69 ithin a given Zi
03e0: 70 66 69 6c 65 2e 3c 2f 6c 69 3e 0d 0a 3c 6c 69 pfile.</li>..<li
03f0: 3e 3c 62 3e 5a 69 70 66 69 6c 65 5f 53 68 70 4e ><b>Zipfile_ShpN
0400: 28 29 3c 2f 62 3e 3a 20 61 20 68 65 6c 70 65 72 ()</b>: a helper
0410: 20 66 75 6e 63 74 69 6f 6e 20 72 65 74 75 72 6e function return
0420: 69 6e 67 20 74 68 65 20 3c 62 3e 3c 69 3e 62 61 ing the <b><i>ba
0430: 73 65 6e 61 6d 65 3c 2f 69 3e 3c 2f 62 3e 20 66 sename</i></b> f
0440: 6f 72 20 74 68 65 20 3c 62 3e 4e 74 68 3c 2f 62 or the <b>Nth</b
0450: 3e 20 53 68 61 70 65 66 69 6c 65 20 63 6f 6e 74 > Shapefile cont
0460: 61 69 6e 65 64 20 77 69 74 68 69 6e 20 61 20 67 ained within a g
0470: 69 76 65 6e 20 5a 69 70 66 69 6c 65 2e 3c 2f 6c iven Zipfile.</l
0480: 69 3e 0d 0a 3c 2f 75 6c 3e 0d 0a 3c 62 72 3e 0d i>..</ul>..<br>.
0490: 0a 57 65 27 6c 6c 20 6e 6f 77 20 73 74 61 72 74 .We'll now start
04a0: 20 61 20 71 75 69 63 6b 20 74 75 74 6f 72 69 61 a quick tutoria
04b0: 6c 20 61 62 6f 75 74 20 75 73 69 6e 67 20 61 6c l about using al
04c0: 6c 20 74 68 65 73 65 20 6e 65 77 20 53 51 4c 20 l these new SQL
04d0: 66 75 6e 63 74 69 6f 6e 73 2e 0d 0a 3c 62 3e 4e functions...<b>N
04e0: 6f 74 65 3c 2f 62 3e 3a 20 74 68 65 20 74 75 74 ote</b>: the tut
04f0: 6f 72 69 61 6c 20 69 73 20 62 61 73 65 64 20 6f orial is based o
0500: 6e 20 74 68 65 20 64 61 74 61 73 65 74 20 79 6f n the dataset yo
0510: 75 20 63 61 6e 20 64 6f 77 6e 6c 6f 61 64 20 66 u can download f
0520: 72 6f 6d 20 3c 61 20 68 72 65 66 3d 22 68 74 74 rom <a href="htt
0530: 70 3a 2f 2f 77 77 77 2e 69 73 74 61 74 2e 69 74 p://www.istat.it
0540: 2f 73 74 6f 72 61 67 65 2f 63 61 72 74 6f 67 72 /storage/cartogr
0550: 61 66 69 61 2f 63 6f 6e 66 69 6e 69 5f 61 6d 6d afia/confini_amm
0560: 69 6e 69 73 74 72 61 74 69 76 69 2f 6e 6f 6e 5f inistrativi/non_
0570: 67 65 6e 65 72 61 6c 69 7a 7a 61 74 69 2f 4c 69 generalizzati/Li
0580: 6d 69 74 69 30 31 30 31 32 30 32 30 2e 7a 69 70 miti01012020.zip
0590: 22 3e 68 65 72 65 3c 2f 61 3e 0d 0a 3c 76 65 72 ">here</a>..<ver
05a0: 62 61 74 69 6d 3e 0d 0a 53 45 4c 45 43 54 20 5a batim>..SELECT Z
05b0: 69 70 66 69 6c 65 5f 4e 75 6d 53 48 50 20 28 20 ipfile_NumSHP (
05c0: 27 63 3a 2f 75 73 65 72 73 2f 61 66 75 72 69 2f 'c:/users/afuri/
05d0: 44 6f 77 6e 6c 6f 61 64 73 2f 4c 69 6d 69 74 69 Downloads/Limiti
05e0: 30 31 30 31 32 30 32 30 2e 7a 69 70 27 20 29 0d 01012020.zip' ).
05f0: 0a 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0d 0a 34 .------------..4
0600: 0d 0a 3c 2f 76 65 72 62 61 74 69 6d 3e 0d 0a 3c ..</verbatim>..<
0610: 75 6c 3e 0d 0a 3c 6c 69 3e 74 68 65 20 53 51 4c ul>..<li>the SQL
0620: 20 66 75 6e 63 74 69 6f 6e 20 3c 62 3e 5a 69 70 function <b>Zip
0630: 66 69 6c 65 5f 4e 75 6d 53 48 50 28 29 3c 2f 62 file_NumSHP()</b
0640: 3e 20 77 69 6c 6c 20 69 6e 73 70 65 63 74 20 61 > will inspect a
0650: 20 5a 69 70 66 69 6c 65 20 74 68 65 6e 20 72 65 Zipfile then re
0660: 74 75 72 6e 69 6e 67 20 74 68 65 20 74 6f 74 61 turning the tota
0670: 6c 20 63 6f 75 6e 74 20 6f 66 20 53 68 61 70 65 l count of Shape
0680: 66 69 6c 65 73 20 69 74 20 63 6f 6e 74 61 69 6e files it contain
0690: 73 2e 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e 69 74 20 s.</li>..<li>it
06a0: 72 65 71 75 69 72 65 73 20 6a 75 73 74 20 61 20 requires just a
06b0: 73 69 6e 67 6c 65 20 61 72 67 75 6d 65 6e 74 3a single argument:
06c0: 20 74 68 65 20 61 62 73 6f 6c 75 74 65 20 6f 72 the absolute or
06d0: 20 72 65 6c 61 74 69 76 65 20 70 61 74 68 20 6c relative path l
06e0: 65 61 64 69 6e 67 20 74 6f 20 74 68 65 20 5a 69 eading to the Zi
06f0: 70 66 69 6c 65 2e 3c 2f 6c 69 3e 0d 0a 3c 6c 69 pfile.</li>..<li
0700: 3e 3c 62 3e 4e 6f 74 65 3c 2f 62 3e 20 69 74 20 ><b>Note</b> it
0710: 77 69 6c 6c 20 72 65 74 75 72 6e 20 3c 62 3e 30 will return <b>0
0720: 3c 2f 62 3e 20 69 66 20 74 68 65 20 5a 69 70 66 </b> if the Zipf
0730: 69 6c 65 20 64 6f 65 73 20 6e 6f 74 20 63 6f 6e ile does not con
0740: 74 61 69 6e 20 61 6e 79 20 53 68 61 70 65 66 69 tain any Shapefi
0750: 6c 65 2e 0d 0a 3c 75 6c 3e 0d 0a 3c 6c 69 3e 3c le...<ul>..<li><
0760: 62 3e 4e 55 4c 4c 3c 2f 62 3e 20 77 69 6c 6c 20 b>NULL</b> will
0770: 62 65 20 72 65 74 75 72 6e 65 64 20 69 66 20 74 be returned if t
0780: 68 65 20 5a 69 70 66 69 6c 65 20 64 6f 65 73 20 he Zipfile does
0790: 6e 6f 74 20 65 78 69 73 74 20 6f 66 20 69 66 20 not exist of if
07a0: 69 74 27 73 20 63 6f 72 72 75 70 74 65 64 20 6f it's corrupted o
07b0: 72 20 69 6e 76 61 6c 69 64 2e 3c 2f 6c 69 3e 0d r invalid.</li>.
07c0: 0a 3c 2f 75 6c 3e 3c 2f 6c 69 3e 0d 0a 3c 2f 75 .</ul></li>..</u
07d0: 6c 3e 0d 0a 3c 76 65 72 62 61 74 69 6d 3e 0d 0a l>..<verbatim>..
07e0: 53 45 4c 45 43 54 20 5a 69 70 66 69 6c 65 5f 73 SELECT Zipfile_s
07f0: 68 70 4e 20 28 20 27 63 3a 2f 75 73 65 72 73 2f hpN ( 'c:/users/
0800: 61 66 75 72 69 2f 44 6f 77 6e 6c 6f 61 64 73 2f afuri/Downloads/
0810: 4c 69 6d 69 74 69 30 31 30 31 32 30 32 30 2e 7a Limiti01012020.z
0820: 69 70 27 20 2c 20 31 20 29 0d 0a 2d 2d 2d 2d 2d ip' , 1 )..-----
0830: 2d 0d 0a 4c 69 6d 69 74 69 30 31 30 31 32 30 32 -..Limiti0101202
0840: 30 2f 43 6f 6d 30 31 30 31 32 30 32 30 2f 43 6f 0/Com01012020/Co
0850: 6d 30 31 30 31 32 30 32 30 5f 57 47 53 38 34 0d m01012020_WGS84.
0860: 0a 0d 0a 53 45 4c 45 43 54 20 5a 69 70 66 69 6c ...SELECT Zipfil
0870: 65 5f 73 68 70 4e 20 28 20 27 63 3a 2f 75 73 65 e_shpN ( 'c:/use
0880: 72 73 2f 61 66 75 72 69 2f 44 6f 77 6e 6c 6f 61 rs/afuri/Downloa
0890: 64 73 2f 4c 69 6d 69 74 69 30 31 30 31 32 30 32 ds/Limiti0101202
08a0: 30 2e 7a 69 70 27 20 2c 20 32 20 29 0d 0a 2d 2d 0.zip' , 2 )..--
08b0: 2d 2d 2d 2d 0d 0a 4c 69 6d 69 74 69 30 31 30 31 ----..Limiti0101
08c0: 32 30 32 30 2f 50 72 6f 76 43 4d 30 31 30 31 32 2020/ProvCM01012
08d0: 30 32 30 2f 50 72 6f 76 43 4d 30 31 30 31 32 30 020/ProvCM010120
08e0: 32 30 5f 57 47 53 38 34 0d 0a 0d 0a 53 45 4c 45 20_WGS84....SELE
08f0: 43 54 20 5a 69 70 66 69 6c 65 5f 73 68 70 4e 20 CT Zipfile_shpN
0900: 28 20 27 63 3a 2f 75 73 65 72 73 2f 61 66 75 72 ( 'c:/users/afur
0910: 69 2f 44 6f 77 6e 6c 6f 61 64 73 2f 4c 69 6d 69 i/Downloads/Limi
0920: 74 69 30 31 30 31 32 30 32 30 2e 7a 69 70 27 20 ti01012020.zip'
0930: 2c 20 33 20 29 0d 0a 2d 2d 2d 2d 2d 2d 0d 0a 4c , 3 )..------..L
0940: 69 6d 69 74 69 30 31 30 31 32 30 32 30 2f 52 65 imiti01012020/Re
0950: 67 30 31 30 31 32 30 32 30 2f 52 65 67 30 31 30 g01012020/Reg010
0960: 31 32 30 32 30 5f 57 47 53 38 34 0d 0a 0d 0a 53 12020_WGS84....S
0970: 45 4c 45 43 54 20 5a 69 70 66 69 6c 65 5f 73 68 ELECT Zipfile_sh
0980: 70 4e 20 28 20 27 63 3a 2f 75 73 65 72 73 2f 61 pN ( 'c:/users/a
0990: 66 75 72 69 2f 44 6f 77 6e 6c 6f 61 64 73 2f 4c furi/Downloads/L
09a0: 69 6d 69 74 69 30 31 30 31 32 30 32 30 2e 7a 69 imiti01012020.zi
09b0: 70 27 20 2c 20 34 20 29 0d 0a 2d 2d 2d 2d 2d 2d p' , 4 )..------
09c0: 2d 0d 0a 4c 69 6d 69 74 69 30 31 30 31 32 30 32 -..Limiti0101202
09d0: 30 2f 52 69 70 47 65 6f 30 31 30 31 32 30 32 30 0/RipGeo01012020
09e0: 2f 52 69 70 47 65 6f 30 31 30 31 32 30 32 30 5f /RipGeo01012020_
09f0: 57 47 53 38 34 0d 0a 3c 2f 76 65 72 62 61 74 69 WGS84..</verbati
0a00: 6d 3e 3c 75 6c 3e 0d 0a 3c 6c 69 3e 74 68 65 20 m><ul>..<li>the
0a10: 53 51 4c 20 66 75 6e 63 74 69 6f 6e 20 3c 62 3e SQL function <b>
0a20: 5a 69 70 66 69 6c 65 5f 53 68 70 4e 28 29 3c 2f Zipfile_ShpN()</
0a30: 62 3e 20 77 69 6c 6c 20 69 6e 73 70 65 63 74 20 b> will inspect
0a40: 61 20 5a 69 70 66 69 6c 65 20 74 68 65 6e 20 72 a Zipfile then r
0a50: 65 74 75 72 6e 69 6e 67 20 74 68 65 20 3c 62 3e eturning the <b>
0a60: 3c 69 3e 62 61 73 65 6e 61 6d 65 3c 2f 69 3e 3c <i>basename</i><
0a70: 2f 62 3e 20 6f 66 20 74 68 65 20 3c 62 3e 4e 74 /b> of the <b>Nt
0a80: 68 3c 2f 62 3e 20 53 68 61 70 65 66 69 6c 65 20 h</b> Shapefile
0a90: 69 74 20 63 6f 6e 74 61 69 6e 73 2e 3c 2f 6c 69 it contains.</li
0aa0: 3e 0d 0a 3c 6c 69 3e 69 74 20 72 65 71 75 69 72 >..<li>it requir
0ab0: 65 73 20 74 77 6f 20 61 72 67 75 6d 65 6e 74 73 es two arguments
0ac0: 3a 0d 0a 3c 75 6c 3e 0d 0a 3c 6c 69 3e 74 68 65 :..<ul>..<li>the
0ad0: 20 61 62 73 6f 6c 75 74 65 20 6f 72 20 72 65 6c absolute or rel
0ae0: 61 74 69 76 65 20 70 61 74 68 20 6c 65 61 64 69 ative path leadi
0af0: 6e 67 20 74 6f 20 74 68 65 20 5a 69 70 66 69 6c ng to the Zipfil
0b00: 65 2e 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e 74 68 65 e.</li>..<li>the
0b10: 20 72 65 6c 61 74 69 76 65 20 69 6e 64 65 78 20 relative index
0b20: 28 3c 62 3e 31 20 62 61 73 65 64 3c 2f 62 3e 29 (<b>1 based</b>)
0b30: 20 6f 66 20 74 68 65 20 53 68 61 70 65 66 69 6c of the Shapefil
0b40: 65 20 77 69 74 68 69 6e 20 74 68 65 20 5a 69 70 e within the Zip
0b50: 66 69 6c 65 2e 3c 2f 6c 69 3e 0d 0a 3c 2f 75 6c file.</li>..</ul
0b60: 3e 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e 3c 62 3e 4e ></li>..<li><b>N
0b70: 6f 74 65 3c 2f 62 3e 3a 20 3c 62 3e 4e 55 4c 4c ote</b>: <b>NULL
0b80: 3c 2f 62 3e 20 77 69 6c 6c 20 62 65 20 72 65 74 </b> will be ret
0b90: 75 72 6e 65 64 20 69 66 20 74 68 65 20 5a 69 70 urned if the Zip
0ba0: 66 69 6c 65 20 64 6f 65 73 20 6e 6f 74 20 65 78 file does not ex
0bb0: 69 73 74 20 6f 66 20 69 66 20 69 74 27 73 20 69 ist of if it's i
0bc0: 6e 76 61 6c 69 64 20 6f 72 20 69 66 20 74 68 65 nvalid or if the
0bd0: 20 69 6e 64 65 78 20 76 61 6c 75 65 20 69 73 20 index value is
0be0: 6f 75 74 73 69 64 65 20 74 68 65 20 65 78 70 65 outside the expe
0bf0: 63 74 65 64 20 72 61 6e 67 65 2e 3c 2f 6c 69 3e cted range.</li>
0c00: 0d 0a 3c 2f 75 6c 3e 0d 0a 3c 76 65 72 62 61 74 ..</ul>..<verbat
0c10: 69 6d 3e 0d 0a 53 45 4c 45 43 54 20 50 52 4f 4a im>..SELECT PROJ
0c20: 5f 47 75 65 73 73 53 72 69 64 46 72 6f 6d 5a 69 _GuessSridFromZi
0c30: 70 53 48 50 20 28 20 27 63 3a 2f 75 73 65 72 73 pSHP ( 'c:/users
0c40: 2f 61 66 75 72 69 2f 44 6f 77 6e 6c 6f 61 64 73 /afuri/Downloads
0c50: 2f 4c 69 6d 69 74 69 30 31 30 31 32 30 32 30 2e /Limiti01012020.
0c60: 7a 69 70 27 20 2c 20 27 4c 69 6d 69 74 69 30 31 zip' , 'Limiti01
0c70: 30 31 32 30 32 30 2f 43 6f 6d 30 31 30 31 32 30 012020/Com010120
0c80: 32 30 2f 43 6f 6d 30 31 30 31 32 30 32 30 5f 57 20/Com01012020_W
0c90: 47 53 38 34 27 20 29 0d 0a 2d 2d 2d 2d 2d 2d 2d GS84' )..-------
0ca0: 2d 2d 2d 2d 2d 0d 0a 33 32 36 33 32 0d 0a 3c 2f -----..32632..</
0cb0: 76 65 72 62 61 74 69 6d 3e 0d 0a 3c 6c 69 3e 74 verbatim>..<li>t
0cc0: 68 65 20 53 51 4c 20 66 75 6e 63 74 69 6f 6e 20 he SQL function
0cd0: 3c 62 3e 50 52 4f 4a 5f 47 75 65 73 73 53 72 69 <b>PROJ_GuessSri
0ce0: 64 46 72 6f 6d 5a 69 70 53 48 50 28 29 3c 2f 62 dFromZipSHP()</b
0cf0: 3e 20 77 69 6c 6c 20 69 6e 73 70 65 63 74 20 61 > will inspect a
0d00: 20 5a 69 70 66 69 6c 65 20 74 68 65 6e 20 72 65 Zipfile then re
0d10: 74 75 72 6e 69 6e 67 20 74 68 65 20 3c 62 3e 53 turning the <b>S
0d20: 52 49 44 3c 2f 62 3e 20 76 61 6c 75 65 20 64 65 RID</b> value de
0d30: 63 6c 61 72 65 64 20 62 79 20 74 68 65 20 3c 62 clared by the <b
0d40: 3e 2e 50 52 4a 3c 2f 62 3e 20 6d 65 6d 62 65 72 >.PRJ</b> member
0d50: 20 20 6f 66 20 74 68 65 20 53 68 61 70 65 66 69 of the Shapefi
0d60: 6c 65 20 63 6f 6e 74 61 69 6e 65 64 20 69 6e 74 le contained int
0d70: 6f 20 74 68 65 20 5a 69 70 66 69 6c 65 73 20 61 o the Zipfiles a
0d80: 73 20 69 64 65 6e 74 69 66 69 65 64 20 62 79 20 s identified by
0d90: 69 74 73 20 3c 62 3e 3c 69 3e 62 61 73 65 6e 61 its <b><i>basena
0da0: 6d 65 3c 2f 69 3e 3c 2f 62 3e 2e 3c 2f 6c 69 3e me</i></b>.</li>
0db0: 0d 0a 3c 6c 69 3e 69 74 20 72 65 71 75 69 72 65 ..<li>it require
0dc0: 73 20 74 77 6f 20 61 72 67 75 6d 65 6e 74 73 3a s two arguments:
0dd0: 0d 0a 3c 75 6c 3e 0d 0a 3c 6c 69 3e 74 68 65 20 ..<ul>..<li>the
0de0: 61 62 73 6f 6c 75 74 65 20 6f 72 20 72 65 6c 61 absolute or rela
0df0: 74 69 76 65 20 70 61 74 68 20 6c 65 61 64 69 6e tive path leadin
0e00: 67 20 74 6f 20 74 68 65 20 5a 69 70 66 69 6c 65 g to the Zipfile
0e10: 2e 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e 74 68 65 20 .</li>..<li>the
0e20: 3c 62 3e 3c 69 3e 62 61 73 65 6e 61 6d 65 3c 2f <b><i>basename</
0e30: 69 3e 3c 2f 62 3e 20 6f 66 20 74 68 65 20 53 68 i></b> of the Sh
0e40: 61 70 65 66 69 6c 65 20 77 69 74 68 69 6e 20 74 apefile within t
0e50: 68 65 20 5a 69 70 66 69 6c 65 20 28 77 69 74 68 he Zipfile (with
0e60: 6f 75 74 20 61 64 64 69 6e 67 20 61 6e 79 20 3c out adding any <
0e70: 62 3e 2e 73 68 70 3c 2f 62 3e 2c 20 3c 62 3e 2e b>.shp</b>, <b>.
0e80: 73 68 78 3c 2f 62 3e 20 6f 72 20 3c 62 3e 2e 64 shx</b> or <b>.d
0e90: 62 66 3c 2f 62 3e 20 73 75 66 66 69 78 29 2e 3c bf</b> suffix).<
0ea0: 2f 6c 69 3e 0d 0a 3c 2f 75 6c 3e 3c 2f 6c 69 3e /li>..</ul></li>
0eb0: 0d 0a 3c 6c 69 3e 3c 62 3e 4e 6f 74 65 3c 2f 62 ..<li><b>Note</b
0ec0: 3e 3a 20 3c 62 3e 2d 31 3c 2f 62 3e 20 77 69 6c >: <b>-1</b> wil
0ed0: 6c 20 62 65 20 72 65 74 75 72 6e 65 64 20 69 66 l be returned if
0ee0: 20 74 68 65 20 53 68 61 70 65 66 69 6c 65 20 68 the Shapefile h
0ef0: 61 73 20 6e 6f 20 3c 62 3e 2e 50 52 4a 3c 2f 62 as no <b>.PRJ</b
0f00: 3e 20 6d 65 6d 62 65 72 2c 20 6f 66 20 69 66 20 > member, of if
0f10: 69 74 20 63 6f 6e 74 61 69 6e 73 20 61 6e 20 69 it contains an i
0f20: 6e 76 61 6c 69 64 20 57 4b 54 20 64 65 66 69 6e nvalid WKT defin
0f30: 69 74 69 6f 6e 2e 3c 2f 6c 69 3e 0d 0a 3c 75 6c ition.</li>..<ul
0f40: 3e 0d 0a 3c 2f 6c 69 3e 3c 62 3e 4e 55 4c 4c 3c >..</li><b>NULL<
0f50: 2f 62 3e 20 77 69 6c 6c 20 62 65 20 72 65 74 75 /b> will be retu
0f60: 72 6e 65 64 20 6f 6e 20 69 6e 76 61 6c 69 64 20 rned on invalid
0f70: 61 72 67 75 6d 65 6e 74 73 20 6f 72 20 69 66 20 arguments or if
0f80: 74 68 65 20 53 68 61 70 65 66 69 6c 65 20 64 6f the Shapefile do
0f90: 65 73 20 6e 6f 74 20 65 78 69 73 74 2e 3c 2f 6c es not exist.</l
0fa0: 69 3e 0d 0a 3c 2f 6c 69 3e 3c 2f 75 6c 3e 0d 0a i>..</li></ul>..
0fb0: 3c 2f 75 6c 3e 0d 0a 3c 76 65 72 62 61 74 69 6d </ul>..<verbatim
0fc0: 3e 0d 0a 53 45 4c 45 43 54 20 49 6d 70 6f 72 74 >..SELECT Import
0fd0: 5a 69 70 53 48 50 20 28 20 27 63 3a 2f 75 73 65 ZipSHP ( 'c:/use
0fe0: 72 73 2f 61 66 75 72 69 2f 44 6f 77 6e 6c 6f 61 rs/afuri/Downloa
0ff0: 64 73 2f 4c 69 6d 69 74 69 30 31 30 31 32 30 32 ds/Limiti0101202
1000: 30 2e 7a 69 70 27 20 2c 20 0d 0a 20 20 20 20 20 0.zip' , ..
1010: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
1020: 20 27 4c 69 6d 69 74 69 30 31 30 31 32 30 32 30 'Limiti01012020
1030: 2f 43 6f 6d 30 31 30 31 32 30 32 30 2f 43 6f 6d /Com01012020/Com
1040: 30 31 30 31 32 30 32 30 5f 57 47 53 38 34 27 20 01012020_WGS84'
1050: 2c 20 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 , ..
1060: 20 20 20 20 20 20 20 20 20 20 27 63 6f 6d 75 6e 'comun
1070: 69 27 2c 20 27 55 54 46 2d 38 27 20 29 20 0d 0a i', 'UTF-8' ) ..
1080: 2d 2d 2d 2d 2d 2d 2d 2d 2d 0d 0a 37 39 30 34 0d ---------..7904.
1090: 0a 3c 2f 76 65 72 62 61 74 69 6d 3e 0d 0a 54 68 .</verbatim>..Th
10a0: 65 20 3c 62 3e 49 6d 70 6f 72 74 5a 69 70 53 48 e <b>ImportZipSH
10b0: 50 28 29 3c 2f 62 3e 20 63 6c 6f 73 65 6c 79 20 P()</b> closely
10c0: 6d 69 6d 69 63 73 20 3c 62 3e 49 6d 70 6f 72 74 mimics <b>Import
10d0: 53 48 50 28 29 3c 2f 62 3e 2c 20 65 78 63 65 70 SHP()</b>, excep
10e0: 74 20 69 6e 20 74 68 61 74 20 69 74 20 72 65 71 t in that it req
10f0: 75 69 72 65 73 20 6f 6e 65 20 6d 6f 72 65 20 61 uires one more a
1100: 72 67 75 6d 65 6e 74 20 73 70 65 63 69 66 79 69 rgument specifyi
1110: 6e 67 20 74 68 65 20 70 61 74 68 6e 61 6d 65 20 ng the pathname
1120: 6f 66 20 74 68 65 20 5a 69 70 66 69 6c 65 20 63 of the Zipfile c
1130: 6f 6e 74 61 69 6e 69 6e 67 20 74 68 65 20 53 68 ontaining the Sh
1140: 61 70 65 66 69 6c 65 20 74 6f 20 62 65 20 69 6d apefile to be im
1150: 70 6f 72 74 65 64 2e 3c 62 72 3e 0d 0a 4f 6e 20 ported.<br>..On
1160: 73 75 63 63 65 73 73 20 69 74 20 77 69 6c 6c 20 success it will
1170: 72 65 74 75 72 6e 20 74 68 65 20 6e 75 6d 62 65 return the numbe
1180: 72 20 6f 66 20 66 65 61 74 75 72 65 73 20 69 6e r of features in
1190: 73 65 72 74 65 64 20 69 6e 74 6f 20 74 68 65 20 serted into the
11a0: 53 70 61 74 69 61 6c 20 54 61 62 6c 65 20 74 68 Spatial Table th
11b0: 61 74 20 68 61 73 20 6a 75 73 74 20 62 65 65 6e at has just been
11c0: 20 63 72 65 61 74 65 64 3b 20 6f 6e 20 66 61 69 created; on fai
11d0: 6c 75 72 65 20 69 74 20 77 69 6c 6c 20 6a 75 73 lure it will jus
11e0: 74 20 72 65 74 75 72 6e 20 3c 62 3e 4e 55 4c 4c t return <b>NULL
11f0: 3c 2f 62 3e 2e 3c 62 72 3e 3c 62 72 3e 0d 0a 49 </b>.<br><br>..I
1200: 6e 20 69 74 73 20 73 69 6d 70 6c 65 73 74 20 66 n its simplest f
1210: 6f 72 6d 20 69 74 20 72 65 71 75 69 72 65 73 20 orm it requires
1220: 6a 75 73 74 20 66 6f 75 72 20 61 72 67 75 6d 65 just four argume
1230: 6e 74 73 3a 0d 0a 3c 75 6c 3e 0d 0a 3c 6c 69 3e nts:..<ul>..<li>
1240: 74 68 65 20 61 62 73 6f 6c 75 74 65 20 6f 72 20 the absolute or
1250: 72 65 6c 61 74 69 76 65 20 70 61 74 68 20 6c 65 relative path le
1260: 61 64 69 6e 67 20 74 6f 20 74 68 65 20 5a 69 70 ading to the Zip
1270: 66 69 6c 65 2e 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e file.</li>..<li>
1280: 74 68 65 20 3c 62 3e 3c 69 3e 62 61 73 65 6e 61 the <b><i>basena
1290: 6d 65 3c 2f 69 3e 3c 2f 62 3e 20 6f 66 20 74 68 me</i></b> of th
12a0: 65 20 53 68 61 70 65 66 69 6c 65 20 77 69 74 68 e Shapefile with
12b0: 69 6e 20 74 68 65 20 5a 69 70 66 69 6c 65 20 28 in the Zipfile (
12c0: 77 69 74 68 6f 75 74 20 61 64 64 69 6e 67 20 61 without adding a
12d0: 6e 79 20 3c 62 3e 2e 73 68 70 3c 2f 62 3e 2c 20 ny <b>.shp</b>,
12e0: 3c 62 3e 2e 73 68 78 3c 2f 62 3e 20 6f 72 20 3c <b>.shx</b> or <
12f0: 62 3e 2e 64 62 66 3c 2f 62 3e 20 73 75 66 66 69 b>.dbf</b> suffi
1300: 78 29 2e 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e 74 68 x).</li>..<li>th
1310: 65 20 6e 61 6d 65 20 6f 66 20 74 68 65 20 53 70 e name of the Sp
1320: 61 74 69 61 6c 20 54 61 62 6c 65 20 74 6f 20 62 atial Table to b
1330: 65 20 63 72 65 61 74 65 64 20 61 6e 64 20 74 68 e created and th
1340: 65 6e 20 70 6f 70 75 6c 61 74 65 64 20 62 79 20 en populated by
1350: 69 6d 70 6f 72 74 69 6e 67 20 74 68 65 20 77 68 importing the wh
1360: 6f 6c 65 20 53 68 61 70 65 66 69 6c 65 2e 3c 2f ole Shapefile.</
1370: 6c 69 3e 0d 0a 3c 6c 69 3e 74 68 65 20 6e 61 6d li>..<li>the nam
1380: 65 20 6f 66 20 74 68 65 20 63 68 61 72 73 65 74 e of the charset
1390: 20 65 6e 63 6f 64 69 6e 67 20 61 64 6f 70 74 65 encoding adopte
13a0: 64 20 62 79 20 74 68 65 20 3c 62 3e 2e 64 62 66 d by the <b>.dbf
13b0: 3c 2f 62 3e 20 6d 65 6d 62 65 72 20 6f 66 20 74 </b> member of t
13c0: 68 65 20 53 68 61 70 65 66 69 6c 65 2e 3c 2f 6c he Shapefile.</l
13d0: 69 3e 0d 0a 3c 2f 75 6c 3e 0d 0a 3c 76 65 72 62 i>..</ul>..<verb
13e0: 61 74 69 6d 3e 0d 0a 53 45 4c 45 43 54 20 49 6d atim>..SELECT Im
13f0: 70 6f 72 74 5a 69 70 53 48 50 20 28 20 27 63 3a portZipSHP ( 'c:
1400: 2f 75 73 65 72 73 2f 61 66 75 72 69 2f 44 6f 77 /users/afuri/Dow
1410: 6e 6c 6f 61 64 73 2f 4c 69 6d 69 74 69 30 31 30 nloads/Limiti010
1420: 31 32 30 32 30 2e 7a 69 70 27 20 2c 20 0d 0a 20 12020.zip' , ..
1430: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
1440: 20 20 20 20 20 27 4c 69 6d 69 74 69 30 31 30 31 'Limiti0101
1450: 32 30 32 30 2f 52 65 67 30 31 30 31 32 30 32 30 2020/Reg01012020
1460: 2f 52 65 67 30 31 30 31 32 30 32 30 5f 57 47 53 /Reg01012020_WGS
1470: 38 34 27 20 2c 20 0d 0a 20 20 20 20 20 20 20 20 84' , ..
1480: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 27 72 'r
1490: 65 67 69 6f 6e 69 27 2c 20 27 55 54 46 2d 38 27 egioni', 'UTF-8'
14a0: 20 2c 20 33 32 36 33 32 20 2c 20 27 74 68 65 5f , 32632 , 'the_
14b0: 67 65 6f 6d 27 20 2c 20 27 63 6f 64 5f 72 65 67 geom' , 'cod_reg
14c0: 27 20 2c 0d 0a 20 20 20 20 20 20 20 20 20 20 20 ' ,..
14d0: 20 20 20 20 20 20 20 20 20 20 20 27 4d 55 4c 54 'MULT
14e0: 49 50 4f 4c 59 47 4f 4e 27 20 2c 20 30 20 2c 20 IPOLYGON' , 0 ,
14f0: 30 20 2c 20 31 20 2c 20 30 20 2c 20 27 4c 4f 57 0 , 1 , 0 , 'LOW
1500: 45 52 27 20 2c 20 31 20 2c 20 30 20 29 20 0d 0a ER' , 1 , 0 ) ..
1510: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0d 0a 32 -------------..2
1520: 30 0d 0a 3c 2f 76 65 72 62 61 74 69 6d 3e 0d 0a 0..</verbatim>..
1530: 49 6e 20 69 74 73 20 63 6f 6d 70 6c 65 74 65 20 In its complete
1540: 66 6f 72 6d 20 3c 62 3e 49 6d 70 6f 72 74 5a 69 form <b>ImportZi
1550: 70 53 48 50 28 29 3c 2f 62 3e 20 73 75 70 70 6f pSHP()</b> suppo
1560: 72 74 73 20 74 68 65 73 65 20 66 75 72 74 68 65 rts these furthe
1570: 72 20 6f 70 74 69 6f 6e 61 6c 20 61 72 67 75 6d r optional argum
1580: 65 6e 74 73 3a 0d 0a 3c 75 6c 3e 0d 0a 3c 6c 69 ents:..<ul>..<li
1590: 3e 61 6e 20 65 78 70 6c 63 69 74 6c 79 20 73 74 >an explcitly st
15a0: 61 74 65 64 20 53 52 49 44 3c 2f 6c 69 3e 0d 0a ated SRID</li>..
15b0: 3c 6c 69 3e 74 68 65 20 6e 61 6d 65 20 6f 66 20 <li>the name of
15c0: 74 68 65 20 47 65 6f 6d 65 74 72 79 20 43 6f 6c the Geometry Col
15d0: 75 6d 6e 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e 74 68 umn</li>..<li>th
15e0: 65 20 6e 61 6d 65 20 6f 66 20 74 68 65 20 53 68 e name of the Sh
15f0: 61 70 65 66 69 6c 65 73 20 63 6f 6c 75 6d 6e 20 apefiles column
1600: 74 6f 20 62 65 20 61 73 73 75 6d 65 64 20 61 73 to be assumed as
1610: 20 74 68 65 20 50 72 69 6d 61 72 79 20 4b 65 79 the Primary Key
1620: 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e 61 6e 20 65 78 </li>..<li>an ex
1630: 70 6c 69 63 69 74 6c 79 20 73 65 74 20 47 65 6f plicitly set Geo
1640: 6d 65 74 72 79 20 54 79 70 65 3c 2f 6c 69 3e 0d metry Type</li>.
1650: 0a 3c 6c 69 3e 61 20 3c 69 3e 62 6f 6f 6c 65 61 .<li>a <i>boolea
1660: 6e 3c 2f 69 3e 20 66 6c 61 67 20 72 65 71 75 65 n</i> flag reque
1670: 73 74 69 6e 67 20 74 6f 20 63 61 73 74 20 61 6c sting to cast al
1680: 6c 20 63 6f 6f 72 64 69 6e 61 74 65 73 20 74 6f l coordinates to
1690: 20 58 59 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e 61 20 XY</li>..<li>a
16a0: 3c 69 3e 62 6f 6f 6c 65 61 6e 3c 2f 69 3e 20 66 <i>boolean</i> f
16b0: 6c 61 67 20 72 65 71 75 65 73 74 69 6e 67 20 66 lag requesting f
16c0: 6f 72 20 43 6f 6d 70 72 65 73 73 65 64 20 47 65 or Compressed Ge
16d0: 6f 6d 65 74 72 69 65 73 3c 2f 6c 69 3e 0d 0a 3c ometries</li>..<
16e0: 6c 69 3e 61 20 3c 69 3e 62 6f 6f 6c 65 61 6e 3c li>a <i>boolean<
16f0: 2f 69 3e 20 66 6c 61 67 20 72 65 71 75 65 73 74 /i> flag request
1700: 69 6e 67 20 66 6f 72 20 63 72 65 61 74 69 6e 67 ing for creating
1710: 20 61 20 53 70 61 74 69 61 6c 20 49 6e 64 65 78 a Spatial Index
1720: 20 73 75 70 70 6f 72 74 69 6e 67 20 74 68 65 20 supporting the
1730: 47 65 6f 6d 65 74 72 79 20 43 6f 6c 75 6d 6e 3c Geometry Column<
1740: 2f 6c 69 3e 0d 0a 3c 6c 69 3e 61 20 3c 69 3e 62 /li>..<li>a <i>b
1750: 6f 6f 6c 65 61 6e 3c 2f 69 3e 20 66 6c 61 67 20 oolean</i> flag
1760: 72 65 71 75 65 73 74 69 6e 67 20 66 6f 72 20 69 requesting for i
1770: 6d 70 6f 72 74 69 6e 67 20 61 6c 6c 20 64 61 74 mporting all dat
1780: 65 20 76 61 6c 75 65 73 20 61 73 20 70 6c 61 69 e values as plai
1790: 6e 20 74 65 78 74 20 28 69 6e 73 74 65 61 64 20 n text (instead
17a0: 6f 66 20 61 73 20 4a 75 6c 69 61 6e 20 44 61 74 of as Julian Dat
17b0: 65 73 29 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e 61 20 es)</li>..<li>a
17c0: 74 65 78 74 20 73 74 72 69 6e 67 20 73 75 63 68 text string such
17d0: 20 61 73 20 3c 62 3e 4c 4f 57 45 52 3c 2f 62 3e as <b>LOWER</b>
17e0: 2c 20 3c 62 3e 55 50 50 45 52 3c 2f 62 3e 20 6f , <b>UPPER</b> o
17f0: 72 20 3c 62 3e 53 41 4d 45 3c 2f 62 3e 20 73 70 r <b>SAME</b> sp
1800: 65 63 69 66 79 69 6e 67 20 69 66 20 61 6c 6c 20 ecifying if all
1810: 63 6f 6c 75 6d 6e 20 6e 61 6d 65 73 20 73 68 6f column names sho
1820: 75 6c 64 20 62 65 20 72 65 73 70 65 63 74 69 76 uld be respectiv
1830: 65 6c 79 20 4c 6f 77 65 72 63 61 73 65 20 6f 72 ely Lowercase or
1840: 20 55 70 70 65 72 63 61 73 65 20 6f 72 20 61 73 Uppercase or as
1850: 20 69 73 2e 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e 61 is.</li>..<li>a
1860: 20 3c 69 3e 62 6f 6f 6c 65 61 6e 3c 2f 69 3e 20 <i>boolean</i>
1870: 66 6c 61 67 20 66 6f 72 20 69 6d 6d 65 64 69 61 flag for immedia
1880: 74 65 6c 79 20 75 70 64 61 74 69 6e 67 20 74 61 tely updating ta
1890: 62 6c 65 27 73 20 53 74 61 74 69 73 74 69 63 73 ble's Statistics
18a0: 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e 61 20 3c 69 3e </li>..<li>a <i>
18b0: 62 6f 6f 6c 65 61 6e 3c 2f 69 3e 20 66 6c 61 67 boolean</i> flag
18c0: 20 61 63 74 69 76 61 74 69 6e 67 20 76 65 72 62 activating verb
18d0: 6f 73 65 20 6d 6f 64 65 3c 2f 6c 69 3e 20 20 0d ose mode</li> .
18e0: 0a 3c 2f 75 6c 3e 0d 0a 3c 62 72 3e 3c 62 72 3e .</ul>..<br><br>
18f0: 0d 0a 3c 68 72 3e 0d 0a 3c 68 33 3e 41 63 63 65 ..<hr>..<h3>Acce
1900: 73 73 69 6e 67 20 61 20 5a 69 70 70 65 64 20 44 ssing a Zipped D
1910: 42 46 3c 2f 68 33 3e 0d 0a 41 6c 6c 20 74 68 65 BF</h3>..All the
1920: 73 65 20 6e 65 77 20 53 51 4c 20 66 75 6e 63 74 se new SQL funct
1930: 69 6f 6e 73 20 61 72 65 20 6e 6f 77 20 73 75 70 ions are now sup
1940: 70 6f 72 74 65 64 3a 0d 0a 3c 75 6c 3e 0d 0a 3c ported:..<ul>..<
1950: 6c 69 3e 3c 62 3e 49 6d 70 6f 72 74 5a 69 70 44 li><b>ImportZipD
1960: 42 46 28 29 3c 2f 62 3e 3a 20 74 68 65 20 6d 61 BF()</b>: the ma
1970: 69 6e 20 66 75 6e 63 74 69 6f 6e 20 61 6c 6c 6f in function allo
1980: 77 69 6e 67 20 74 6f 20 69 6d 70 6f 72 74 20 61 wing to import a
1990: 20 77 68 6f 6c 65 20 44 42 46 20 66 69 6c 65 20 whole DBF file
19a0: 69 6e 74 6f 20 61 20 6e 65 77 20 54 61 62 6c 65 into a new Table
19b0: 20 69 6e 74 6f 20 74 68 65 20 63 75 72 72 65 6e into the curren
19c0: 74 6c 79 20 63 6f 6e 6e 65 63 74 65 64 20 44 61 tly connected Da
19d0: 74 61 62 61 73 65 2e 3c 2f 6c 69 3e 0d 0a 3c 6c tabase.</li>..<l
19e0: 69 3e 3c 62 3e 5a 69 70 66 69 6c 65 5f 4e 75 6d i><b>Zipfile_Num
19f0: 44 42 46 28 29 3c 2f 62 3e 3a 20 61 20 68 65 6c DBF()</b>: a hel
1a00: 70 65 72 20 66 75 6e 63 74 69 6f 6e 20 72 65 74 per function ret
1a10: 75 72 6e 69 6e 67 20 74 68 65 20 74 6f 74 61 6c urning the total
1a20: 20 63 6f 75 6e 74 20 6f 66 20 44 42 46 20 66 69 count of DBF fi
1a30: 6c 65 73 20 63 6f 6e 74 61 69 6e 65 64 20 77 69 les contained wi
1a40: 74 68 69 6e 20 61 20 67 69 76 65 6e 20 5a 69 70 thin a given Zip
1a50: 66 69 6c 65 2e 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e file.</li>..<li>
1a60: 3c 62 3e 5a 69 70 66 69 6c 65 5f 44 62 66 4e 28 <b>Zipfile_DbfN(
1a70: 29 3c 2f 62 3e 3a 20 61 20 68 65 6c 70 65 72 20 )</b>: a helper
1a80: 66 75 6e 63 74 69 6f 6e 20 72 65 74 75 72 6e 69 function returni
1a90: 6e 67 20 74 68 65 20 3c 62 3e 3c 69 3e 66 69 6c ng the <b><i>fil
1aa0: 65 6e 61 6d 65 3c 2f 69 3e 3c 2f 62 3e 20 66 6f ename</i></b> fo
1ab0: 72 20 74 68 65 20 3c 62 3e 4e 74 68 3c 2f 62 3e r the <b>Nth</b>
1ac0: 20 44 42 46 20 66 69 6c 65 20 63 6f 6e 74 61 69 DBF file contai
1ad0: 6e 65 64 20 77 69 74 68 69 6e 20 61 20 67 69 76 ned within a giv
1ae0: 65 6e 20 5a 69 70 66 69 6c 65 2e 3c 2f 6c 69 3e en Zipfile.</li>
1af0: 0d 0a 3c 2f 75 6c 3e 0d 0a 3c 62 72 3e 0d 0a 57 ..</ul>..<br>..W
1b00: 65 27 6c 6c 20 63 6f 6e 74 69 6e 75 65 20 74 6f e'll continue to
1b10: 20 75 73 65 20 74 68 65 20 73 61 6d 65 20 5a 69 use the same Zi
1b20: 70 66 69 6c 65 20 69 6e 20 74 68 69 73 20 74 75 pfile in this tu
1b30: 74 6f 72 69 61 6c 20 74 6f 6f 2e 0d 0a 3c 76 65 torial too...<ve
1b40: 72 62 61 74 69 6d 3e 0d 0a 53 45 4c 45 43 54 20 rbatim>..SELECT
1b50: 5a 69 70 66 69 6c 65 5f 4e 75 6d 44 42 46 20 28 Zipfile_NumDBF (
1b60: 20 27 63 3a 2f 75 73 65 72 73 2f 61 66 75 72 69 'c:/users/afuri
1b70: 2f 44 6f 77 6e 6c 6f 61 64 73 2f 4c 69 6d 69 74 /Downloads/Limit
1b80: 69 30 31 30 31 32 30 32 30 2e 7a 69 70 27 20 29 i01012020.zip' )
1b90: 0d 0a 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0d 0a ..------------..
1ba0: 34 0d 0a 3c 2f 76 65 72 62 61 74 69 6d 3e 0d 0a 4..</verbatim>..
1bb0: 3c 75 6c 3e 0d 0a 3c 6c 69 3e 74 68 65 20 53 51 <ul>..<li>the SQ
1bc0: 4c 20 66 75 6e 63 74 69 6f 6e 20 3c 62 3e 5a 69 L function <b>Zi
1bd0: 70 66 69 6c 65 5f 4e 75 6d 44 42 46 28 29 3c 2f pfile_NumDBF()</
1be0: 62 3e 20 77 69 6c 6c 20 69 6e 73 70 65 63 74 20 b> will inspect
1bf0: 61 20 5a 69 70 66 69 6c 65 20 74 68 65 6e 20 72 a Zipfile then r
1c00: 65 74 75 72 6e 69 6e 67 20 74 68 65 20 74 6f 74 eturning the tot
1c10: 61 6c 20 63 6f 75 6e 74 20 6f 66 20 44 42 46 20 al count of DBF
1c20: 66 69 6c 65 73 20 69 74 20 63 6f 6e 74 61 69 6e files it contain
1c30: 73 2e 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e 69 74 20 s.</li>..<li>it
1c40: 72 65 71 75 69 72 65 73 20 6a 75 73 74 20 61 20 requires just a
1c50: 73 69 6e 67 6c 65 20 61 72 67 75 6d 65 6e 74 3a single argument:
1c60: 20 74 68 65 20 61 62 73 6f 6c 75 74 65 20 6f 72 the absolute or
1c70: 20 72 65 6c 61 74 69 76 65 20 70 61 74 68 20 6c relative path l
1c80: 65 61 64 69 6e 67 20 74 6f 20 74 68 65 20 5a 69 eading to the Zi
1c90: 70 66 69 6c 65 2e 3c 2f 6c 69 3e 0d 0a 3c 6c 69 pfile.</li>..<li
1ca0: 3e 3c 62 3e 4e 6f 74 65 3c 2f 62 3e 20 69 74 20 ><b>Note</b> it
1cb0: 77 69 6c 6c 20 72 65 74 75 72 6e 20 3c 62 3e 30 will return <b>0
1cc0: 3c 2f 62 3e 20 69 66 20 74 68 65 20 5a 69 70 66 </b> if the Zipf
1cd0: 69 6c 65 20 64 6f 65 73 20 6e 6f 74 20 63 6f 6e ile does not con
1ce0: 74 61 69 6e 20 61 6e 79 20 44 42 46 20 66 69 6c tain any DBF fil
1cf0: 65 2e 0d 0a 3c 75 6c 3e 0d 0a 3c 6c 69 3e 3c 62 e...<ul>..<li><b
1d00: 3e 4e 55 4c 4c 3c 2f 62 3e 20 77 69 6c 6c 20 62 >NULL</b> will b
1d10: 65 20 72 65 74 75 72 6e 65 64 20 69 66 20 74 68 e returned if th
1d20: 65 20 5a 69 70 66 69 6c 65 20 64 6f 65 73 20 6e e Zipfile does n
1d30: 6f 74 20 65 78 69 73 74 20 6f 66 20 69 66 20 69 ot exist of if i
1d40: 74 27 73 20 63 6f 72 72 75 70 74 65 64 20 6f 72 t's corrupted or
1d50: 20 69 6e 76 61 6c 69 64 2e 3c 2f 6c 69 3e 0d 0a invalid.</li>..
1d60: 3c 2f 75 6c 3e 3c 2f 6c 69 3e 0d 0a 3c 2f 75 6c </ul></li>..</ul
1d70: 3e 0d 0a 3c 76 65 72 62 61 74 69 6d 3e 0d 0a 53 >..<verbatim>..S
1d80: 45 4c 45 43 54 20 5a 69 70 66 69 6c 65 5f 64 62 ELECT Zipfile_db
1d90: 66 4e 20 28 20 27 63 3a 2f 75 73 65 72 73 2f 61 fN ( 'c:/users/a
1da0: 66 75 72 69 2f 44 6f 77 6e 6c 6f 61 64 73 2f 4c furi/Downloads/L
1db0: 69 6d 69 74 69 30 31 30 31 32 30 32 30 2e 7a 69 imiti01012020.zi
1dc0: 70 27 20 2c 20 31 20 29 0d 0a 2d 2d 2d 2d 2d 2d p' , 1 )..------
1dd0: 0d 0a 4c 69 6d 69 74 69 30 31 30 31 32 30 32 30 ..Limiti01012020
1de0: 2f 43 6f 6d 30 31 30 31 32 30 32 30 2f 43 6f 6d /Com01012020/Com
1df0: 30 31 30 31 32 30 32 30 5f 57 47 53 38 34 2e 64 01012020_WGS84.d
1e00: 62 66 0d 0a 0d 0a 53 45 4c 45 43 54 20 5a 69 70 bf....SELECT Zip
1e10: 66 69 6c 65 5f 64 62 66 4e 20 28 20 27 63 3a 2f file_dbfN ( 'c:/
1e20: 75 73 65 72 73 2f 61 66 75 72 69 2f 44 6f 77 6e users/afuri/Down
1e30: 6c 6f 61 64 73 2f 4c 69 6d 69 74 69 30 31 30 31 loads/Limiti0101
1e40: 32 30 32 30 2e 7a 69 70 27 20 2c 20 32 20 29 0d 2020.zip' , 2 ).
1e50: 0a 2d 2d 2d 2d 2d 2d 0d 0a 4c 69 6d 69 74 69 30 .------..Limiti0
1e60: 31 30 31 32 30 32 30 2f 50 72 6f 76 43 4d 30 31 1012020/ProvCM01
1e70: 30 31 32 30 32 30 2f 50 72 6f 76 43 4d 30 31 30 012020/ProvCM010
1e80: 31 32 30 32 30 5f 57 47 53 38 34 2e 64 62 66 0d 12020_WGS84.dbf.
1e90: 0a 0d 0a 53 45 4c 45 43 54 20 5a 69 70 66 69 6c ...SELECT Zipfil
1ea0: 65 5f 64 62 66 4e 20 28 20 27 63 3a 2f 75 73 65 e_dbfN ( 'c:/use
1eb0: 72 73 2f 61 66 75 72 69 2f 44 6f 77 6e 6c 6f 61 rs/afuri/Downloa
1ec0: 64 73 2f 4c 69 6d 69 74 69 30 31 30 31 32 30 32 ds/Limiti0101202
1ed0: 30 2e 7a 69 70 27 20 2c 20 33 20 29 0d 0a 2d 2d 0.zip' , 3 )..--
1ee0: 2d 2d 2d 2d 0d 0a 4c 69 6d 69 74 69 30 31 30 31 ----..Limiti0101
1ef0: 32 30 32 30 2f 52 65 67 30 31 30 31 32 30 32 30 2020/Reg01012020
1f00: 2f 52 65 67 30 31 30 31 32 30 32 30 5f 57 47 53 /Reg01012020_WGS
1f10: 38 34 2e 64 62 66 0d 0a 0d 0a 53 45 4c 45 43 54 84.dbf....SELECT
1f20: 20 5a 69 70 66 69 6c 65 5f 64 62 66 4e 20 28 20 Zipfile_dbfN (
1f30: 27 63 3a 2f 75 73 65 72 73 2f 61 66 75 72 69 2f 'c:/users/afuri/
1f40: 44 6f 77 6e 6c 6f 61 64 73 2f 4c 69 6d 69 74 69 Downloads/Limiti
1f50: 30 31 30 31 32 30 32 30 2e 7a 69 70 27 20 2c 20 01012020.zip' ,
1f60: 34 20 29 0d 0a 2d 2d 2d 2d 2d 2d 2d 0d 0a 4c 69 4 )..-------..Li
1f70: 6d 69 74 69 30 31 30 31 32 30 32 30 2f 52 69 70 miti01012020/Rip
1f80: 47 65 6f 30 31 30 31 32 30 32 30 2f 52 69 70 47 Geo01012020/RipG
1f90: 65 6f 30 31 30 31 32 30 32 30 5f 57 47 53 38 34 eo01012020_WGS84
1fa0: 2e 64 62 66 0d 0a 3c 2f 76 65 72 62 61 74 69 6d .dbf..</verbatim
1fb0: 3e 3c 75 6c 3e 0d 0a 3c 6c 69 3e 74 68 65 20 53 ><ul>..<li>the S
1fc0: 51 4c 20 66 75 6e 63 74 69 6f 6e 20 3c 62 3e 5a QL function <b>Z
1fd0: 69 70 66 69 6c 65 5f 44 62 66 4e 28 29 3c 2f 62 ipfile_DbfN()</b
1fe0: 3e 20 77 69 6c 6c 20 69 6e 73 70 65 63 74 20 61 > will inspect a
1ff0: 20 5a 69 70 66 69 6c 65 20 74 68 65 6e 20 72 65 Zipfile then re
2000: 74 75 72 6e 69 6e 67 20 74 68 65 20 3c 62 3e 3c turning the <b><
2010: 69 3e 66 69 6c 65 6e 61 6d 65 3c 2f 69 3e 3c 2f i>filename</i></
2020: 62 3e 20 6f 66 20 74 68 65 20 3c 62 3e 4e 74 68 b> of the <b>Nth
2030: 3c 2f 62 3e 20 44 42 46 20 66 69 6c 65 20 69 74 </b> DBF file it
2040: 20 63 6f 6e 74 61 69 6e 73 2e 3c 2f 6c 69 3e 0d contains.</li>.
2050: 0a 3c 6c 69 3e 69 74 20 72 65 71 75 69 72 65 73 .<li>it requires
2060: 20 74 77 6f 20 61 72 67 75 6d 65 6e 74 73 3a 0d two arguments:.
2070: 0a 3c 75 6c 3e 0d 0a 3c 6c 69 3e 74 68 65 20 61 .<ul>..<li>the a
2080: 62 73 6f 6c 75 74 65 20 6f 72 20 72 65 6c 61 74 bsolute or relat
2090: 69 76 65 20 70 61 74 68 20 6c 65 61 64 69 6e 67 ive path leading
20a0: 20 74 6f 20 74 68 65 20 5a 69 70 66 69 6c 65 2e to the Zipfile.
20b0: 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e 74 68 65 20 72 </li>..<li>the r
20c0: 65 6c 61 74 69 76 65 20 69 6e 64 65 78 20 28 3c elative index (<
20d0: 62 3e 31 20 62 61 73 65 64 3c 2f 62 3e 29 20 6f b>1 based</b>) o
20e0: 66 20 74 68 65 20 44 42 46 20 66 69 6c 65 20 77 f the DBF file w
20f0: 69 74 68 69 6e 20 74 68 65 20 5a 69 70 66 69 6c ithin the Zipfil
2100: 65 2e 3c 2f 6c 69 3e 0d 0a 3c 2f 75 6c 3e 3c 2f e.</li>..</ul></
2110: 6c 69 3e 0d 0a 3c 6c 69 3e 3c 62 3e 4e 6f 74 65 li>..<li><b>Note
2120: 3c 2f 62 3e 3a 20 3c 62 3e 4e 55 4c 4c 3c 2f 62 </b>: <b>NULL</b
2130: 3e 20 77 69 6c 6c 20 62 65 20 72 65 74 75 72 6e > will be return
2140: 65 64 20 69 66 20 74 68 65 20 5a 69 70 66 69 6c ed if the Zipfil
2150: 65 20 64 6f 65 73 20 6e 6f 74 20 65 78 69 73 74 e does not exist
2160: 20 6f 66 20 69 66 20 69 74 27 73 20 69 6e 76 61 of if it's inva
2170: 6c 69 64 20 6f 72 20 69 66 20 74 68 65 20 69 6e lid or if the in
2180: 64 65 78 20 76 61 6c 75 65 20 69 73 20 6f 75 74 dex value is out
2190: 73 69 64 65 20 74 68 65 20 65 78 70 65 63 74 65 side the expecte
21a0: 64 20 72 61 6e 67 65 2e 3c 2f 6c 69 3e 0d 0a 3c d range.</li>..<
21b0: 2f 75 6c 3e 0d 0a 3c 76 65 72 62 61 74 69 6d 3e /ul>..<verbatim>
21c0: 0d 0a 53 45 4c 45 43 54 20 49 6d 70 6f 72 74 5a ..SELECT ImportZ
21d0: 69 70 44 42 46 20 28 20 27 63 3a 2f 75 73 65 72 ipDBF ( 'c:/user
21e0: 73 2f 61 66 75 72 69 2f 44 6f 77 6e 6c 6f 61 64 s/afuri/Download
21f0: 73 2f 4c 69 6d 69 74 69 30 31 30 31 32 30 32 30 s/Limiti01012020
2200: 2e 7a 69 70 27 20 2c 20 0d 0a 20 20 20 20 20 20 .zip' , ..
2210: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
2220: 27 4c 69 6d 69 74 69 30 31 30 31 32 30 32 30 2f 'Limiti01012020/
2230: 43 6f 6d 30 31 30 31 32 30 32 30 2f 43 6f 6d 30 Com01012020/Com0
2240: 31 30 31 32 30 32 30 5f 57 47 53 38 34 2e 64 62 1012020_WGS84.db
2250: 66 27 20 2c 20 0d 0a 20 20 20 20 20 20 20 20 20 f' , ..
2260: 20 20 20 20 20 20 20 20 20 20 20 20 20 27 63 6f 'co
2270: 6d 75 6e 69 5f 64 62 66 27 2c 20 27 55 54 46 2d muni_dbf', 'UTF-
2280: 38 27 20 29 20 0d 0a 2d 2d 2d 2d 2d 2d 2d 2d 2d 8' ) ..---------
2290: 0d 0a 37 39 30 34 0d 0a 3c 2f 76 65 72 62 61 74 ..7904..</verbat
22a0: 69 6d 3e 0d 0a 54 68 65 20 3c 62 3e 49 6d 70 6f im>..The <b>Impo
22b0: 72 74 5a 69 70 44 42 46 28 29 3c 2f 62 3e 20 63 rtZipDBF()</b> c
22c0: 6c 6f 73 65 6c 79 20 6d 69 6d 69 63 73 20 3c 62 losely mimics <b
22d0: 3e 49 6d 70 6f 72 74 44 42 46 28 29 3c 2f 62 3e >ImportDBF()</b>
22e0: 2c 20 65 78 63 65 70 74 20 69 6e 20 74 68 61 74 , except in that
22f0: 20 69 74 20 72 65 71 75 69 72 65 73 20 6f 6e 65 it requires one
2300: 20 6d 6f 72 65 20 61 72 67 75 6d 65 6e 74 20 73 more argument s
2310: 70 65 63 69 66 79 69 6e 67 20 74 68 65 20 70 61 pecifying the pa
2320: 74 68 6e 61 6d 65 20 6f 66 20 74 68 65 20 5a 69 thname of the Zi
2330: 70 66 69 6c 65 20 63 6f 6e 74 61 69 6e 69 6e 67 pfile containing
2340: 20 74 68 65 20 44 42 46 20 66 69 6c 65 20 74 6f the DBF file to
2350: 20 62 65 20 69 6d 70 6f 72 74 65 64 2e 3c 62 72 be imported.<br
2360: 3e 0d 0a 4f 6e 20 73 75 63 63 65 73 73 20 69 74 >..On success it
2370: 20 77 69 6c 6c 20 72 65 74 75 72 6e 20 74 68 65 will return the
2380: 20 6e 75 6d 62 65 72 20 6f 66 20 72 6f 77 73 20 number of rows
2390: 69 6e 73 65 72 74 65 64 20 69 6e 74 6f 20 74 68 inserted into th
23a0: 65 20 54 61 62 6c 65 20 74 68 61 74 20 68 61 73 e Table that has
23b0: 20 6a 75 73 74 20 62 65 65 6e 20 63 72 65 61 74 just been creat
23c0: 65 64 3b 20 6f 6e 20 66 61 69 6c 75 72 65 20 69 ed; on failure i
23d0: 74 20 77 69 6c 6c 20 6a 75 73 74 20 72 65 74 75 t will just retu
23e0: 72 6e 20 3c 62 3e 4e 55 4c 4c 3c 2f 62 3e 2e 3c rn <b>NULL</b>.<
23f0: 62 72 3e 3c 62 72 3e 0d 0a 49 6e 20 69 74 73 20 br><br>..In its
2400: 73 69 6d 70 6c 65 73 74 20 66 6f 72 6d 20 69 74 simplest form it
2410: 20 72 65 71 75 69 72 65 73 20 6a 75 73 74 20 66 requires just f
2420: 6f 75 72 20 61 72 67 75 6d 65 6e 74 73 3a 0d 0a our arguments:..
2430: 3c 75 6c 3e 0d 0a 3c 6c 69 3e 74 68 65 20 61 62 <ul>..<li>the ab
2440: 73 6f 6c 75 74 65 20 6f 72 20 72 65 6c 61 74 69 solute or relati
2450: 76 65 20 70 61 74 68 20 6c 65 61 64 69 6e 67 20 ve path leading
2460: 74 6f 20 74 68 65 20 5a 69 70 66 69 6c 65 2e 3c to the Zipfile.<
2470: 2f 6c 69 3e 0d 0a 3c 6c 69 3e 74 68 65 20 3c 62 /li>..<li>the <b
2480: 3e 3c 69 3e 66 69 6c 65 6e 61 6d 65 3c 2f 69 3e ><i>filename</i>
2490: 3c 2f 62 3e 20 6f 66 20 74 68 65 20 44 42 46 20 </b> of the DBF
24a0: 66 69 6c 65 20 77 69 74 68 69 6e 20 74 68 65 20 file within the
24b0: 5a 69 70 66 69 6c 65 20 28 69 6e 63 6c 75 64 69 Zipfile (includi
24c0: 6e 67 20 69 74 73 20 20 3c 62 3e 2e 64 62 66 3c ng its <b>.dbf<
24d0: 2f 62 3e 20 73 75 66 66 69 78 29 2e 3c 2f 6c 69 /b> suffix).</li
24e0: 3e 0d 0a 3c 6c 69 3e 74 68 65 20 6e 61 6d 65 20 >..<li>the name
24f0: 6f 66 20 74 68 65 20 54 61 62 6c 65 20 74 6f 20 of the Table to
2500: 62 65 20 63 72 65 61 74 65 64 20 61 6e 64 20 74 be created and t
2510: 68 65 6e 20 70 6f 70 75 6c 61 74 65 64 20 62 79 hen populated by
2520: 20 69 6d 70 6f 72 74 69 6e 67 20 74 68 65 20 77 importing the w
2530: 68 6f 6c 65 20 44 42 46 20 66 69 6c 65 2e 3c 2f hole DBF file.</
2540: 6c 69 3e 0d 0a 3c 6c 69 3e 74 68 65 20 6e 61 6d li>..<li>the nam
2550: 65 20 6f 66 20 74 68 65 20 63 68 61 72 73 65 74 e of the charset
2560: 20 65 6e 63 6f 64 69 6e 67 20 61 64 6f 70 74 65 encoding adopte
2570: 64 20 62 79 20 74 68 65 20 44 42 46 20 66 69 6c d by the DBF fil
2580: 65 2e 3c 2f 6c 69 3e 0d 0a 3c 2f 75 6c 3e 0d 0a e.</li>..</ul>..
2590: 3c 76 65 72 62 61 74 69 6d 3e 0d 0a 53 45 4c 45 <verbatim>..SELE
25a0: 43 54 20 49 6d 70 6f 72 74 5a 69 70 44 42 46 20 CT ImportZipDBF
25b0: 28 20 27 63 3a 2f 75 73 65 72 73 2f 61 66 75 72 ( 'c:/users/afur
25c0: 69 2f 44 6f 77 6e 6c 6f 61 64 73 2f 4c 69 6d 69 i/Downloads/Limi
25d0: 74 69 30 31 30 31 32 30 32 30 2e 7a 69 70 27 20 ti01012020.zip'
25e0: 2c 20 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 , ..
25f0: 20 20 20 20 20 20 20 20 20 20 27 4c 69 6d 69 74 'Limit
2600: 69 30 31 30 31 32 30 32 30 2f 52 65 67 30 31 30 i01012020/Reg010
2610: 31 32 30 32 30 2f 52 65 67 30 31 30 31 32 30 32 12020/Reg0101202
2620: 30 5f 57 47 53 38 34 2e 64 62 66 27 20 2c 20 0d 0_WGS84.dbf' , .
2630: 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 .
2640: 20 20 20 20 20 20 20 27 72 65 67 69 6f 6e 69 5f 'regioni_
2650: 64 62 66 27 2c 20 27 55 54 46 2d 38 27 20 2c 20 dbf', 'UTF-8' ,
2660: 27 63 6f 64 5f 72 65 67 27 20 2c 20 31 20 2c 20 'cod_reg' , 1 ,
2670: 27 4c 4f 57 45 52 27 20 29 20 0d 0a 2d 2d 2d 2d 'LOWER' ) ..----
2680: 2d 2d 2d 2d 2d 2d 2d 2d 2d 0d 0a 32 30 0d 0a 3c ---------..20..<
2690: 2f 76 65 72 62 61 74 69 6d 3e 0d 0a 49 6e 20 69 /verbatim>..In i
26a0: 74 73 20 63 6f 6d 70 6c 65 74 65 20 66 6f 72 6d ts complete form
26b0: 20 3c 62 3e 49 6d 70 6f 72 74 5a 69 70 44 42 46 <b>ImportZipDBF
26c0: 28 29 3c 2f 62 3e 20 73 75 70 70 6f 72 74 73 20 ()</b> supports
26d0: 74 68 65 73 65 20 66 75 72 74 68 65 72 20 6f 70 these further op
26e0: 74 69 6f 6e 61 6c 20 61 72 67 75 6d 65 6e 74 73 tional arguments
26f0: 3a 0d 0a 3c 75 6c 3e 0d 0a 3c 6c 69 3e 74 68 65 :..<ul>..<li>the
2700: 20 6e 61 6d 65 20 6f 66 20 74 68 65 20 44 42 46 name of the DBF
2710: 20 63 6f 6c 75 6d 6e 20 74 6f 20 62 65 20 61 73 column to be as
2720: 73 75 6d 65 64 20 61 73 20 74 68 65 20 50 72 69 sumed as the Pri
2730: 6d 61 72 79 20 4b 65 79 3c 2f 6c 69 3e 0d 0a 3c mary Key</li>..<
2740: 6c 69 3e 61 20 3c 69 3e 62 6f 6f 6c 65 61 6e 3c li>a <i>boolean<
2750: 2f 69 3e 20 66 6c 61 67 20 72 65 71 75 65 73 74 /i> flag request
2760: 69 6e 67 20 66 6f 72 20 69 6d 70 6f 72 74 69 6e ing for importin
2770: 67 20 61 6c 6c 20 64 61 74 65 20 76 61 6c 75 65 g all date value
2780: 73 20 61 73 20 70 6c 61 69 6e 20 74 65 78 74 20 s as plain text
2790: 28 69 6e 73 74 65 61 64 20 6f 66 20 61 73 20 4a (instead of as J
27a0: 75 6c 69 61 6e 20 44 61 74 65 73 29 3c 2f 6c 69 ulian Dates)</li
27b0: 3e 0d 0a 3c 6c 69 3e 61 20 74 65 78 74 20 73 74 >..<li>a text st
27c0: 72 69 6e 67 20 73 75 63 68 20 61 73 20 3c 62 3e ring such as <b>
27d0: 4c 4f 57 45 52 3c 2f 62 3e 2c 20 3c 62 3e 55 50 LOWER</b>, <b>UP
27e0: 50 45 52 3c 2f 62 3e 20 6f 72 20 3c 62 3e 53 41 PER</b> or <b>SA
27f0: 4d 45 3c 2f 62 3e 20 73 70 65 63 69 66 79 69 6e ME</b> specifyin
2800: 67 20 69 66 20 61 6c 6c 20 63 6f 6c 75 6d 6e 20 g if all column
2810: 6e 61 6d 65 73 20 73 68 6f 75 6c 64 20 62 65 20 names should be
2820: 72 65 73 70 65 63 74 69 76 65 6c 79 20 4c 6f 77 respectively Low
2830: 65 72 63 61 73 65 20 6f 72 20 55 70 70 65 72 63 ercase or Upperc
2840: 61 73 65 20 6f 72 20 61 73 20 69 73 2e 3c 2f 6c ase or as is.</l
2850: 69 3e 20 0d 0a 3c 2f 75 6c 3e 0d 0a 3c 62 72 3e i> ..</ul>..<br>
2860: 3c 68 72 3e 3c 62 72 3e 0d 0a 42 61 63 6b 20 74 <hr><br>..Back t
2870: 6f 20 3c 61 20 68 72 65 66 3d 22 68 74 74 70 73 o <a href="https
2880: 3a 2f 2f 77 77 77 2e 67 61 69 61 2d 67 69 73 2e ://www.gaia-gis.
2890: 69 74 2f 66 6f 73 73 69 6c 2f 6c 69 62 73 70 61 it/fossil/libspa
28a0: 74 69 61 6c 69 74 65 2f 77 69 6b 69 3f 6e 61 6d tialite/wiki?nam
28b0: 65 3d 35 2e 30 2e 30 2d 64 6f 63 22 3e 6d 61 69 e=5.0.0-doc">mai
28c0: 6e 20 53 70 61 74 69 61 4c 69 74 65 20 70 61 67 n SpatiaLite pag
28d0: 65 3c 2f 61 3e 0a 5a 20 34 66 37 63 62 36 39 38 e</a>.Z 4f7cb698
28e0: 65 64 36 62 32 66 36 39 62 61 36 36 65 38 64 66 ed6b2f69ba66e8df
28f0: 31 63 32 32 62 62 64 38 0a 1c22bbd8.