Wiki page
[Virtual Tables (misc)] by
sandro
2018-08-24 14:04:00.
0000: 44 20 32 30 31 38 2d 30 38 2d 32 34 54 31 34 3a D 2018-08-24T14:
0010: 30 34 3a 30 30 2e 30 33 35 0a 4c 20 56 69 72 74 04:00.035.L Virt
0020: 75 61 6c 5c 73 54 61 62 6c 65 73 5c 73 28 6d 69 ual\sTables\s(mi
0030: 73 63 29 0a 50 20 33 37 31 39 61 34 38 34 64 61 sc).P 3719a484da
0040: 37 63 61 35 61 37 32 37 39 63 39 61 38 38 62 35 7ca5a7279c9a88b5
0050: 64 62 39 65 32 30 63 30 36 65 33 64 34 36 0a 55 db9e20c06e3d46.U
0060: 20 73 61 6e 64 72 6f 0a 57 20 32 33 36 38 36 0a sandro.W 23686.
0070: 3c 61 20 68 72 65 66 3d 22 68 74 74 70 73 3a 2f <a href="https:/
0080: 2f 77 77 77 2e 67 61 69 61 2d 67 69 73 2e 69 74 /www.gaia-gis.it
0090: 2f 66 6f 73 73 69 6c 2f 6c 69 62 73 70 61 74 69 /fossil/libspati
00a0: 61 6c 69 74 65 2f 68 6f 6d 65 22 3e 62 61 63 6b alite/home">back
00b0: 20 74 6f 20 6d 61 69 6e 20 70 61 67 65 3c 2f 61 to main page</a
00c0: 3e 0d 0a 3c 62 72 3e 3c 68 72 3e 0d 0a 3c 68 31 >..<br><hr>..<h1
00d0: 3e 4c 69 73 74 20 6f 66 20 74 6f 70 69 63 73 3c >List of topics<
00e0: 2f 68 31 3e 0d 0a 3c 75 6c 3e 0d 0a 3c 6c 69 3e /h1>..<ul>..<li>
00f0: 3c 61 20 68 72 65 66 3d 22 23 56 69 72 74 75 61 <a href="#Virtua
0100: 6c 53 68 61 70 65 22 3e 3c 62 3e 56 69 72 74 75 lShape"><b>Virtu
0110: 61 6c 53 68 61 70 65 20 2d 20 45 6d 75 6c 61 74 alShape - Emulat
0120: 69 6f 6e 20 6f 66 20 53 68 61 70 65 2d 46 69 6c ion of Shape-Fil
0130: 65 73 3c 2f 62 3e 3c 2f 61 3e 3c 2f 6c 69 3e 0d es</b></a></li>.
0140: 0a 3c 6c 69 3e 3c 61 20 68 72 65 66 3d 22 23 56 .<li><a href="#V
0150: 69 72 74 75 61 6c 44 42 46 22 3e 3c 62 3e 56 69 irtualDBF"><b>Vi
0160: 72 74 75 61 6c 44 42 46 20 2d 20 45 6d 75 6c 61 rtualDBF - Emula
0170: 74 69 6f 6e 20 6f 66 20 44 42 46 20 54 61 62 6c tion of DBF Tabl
0180: 65 73 3c 2f 61 3e 3c 2f 6c 69 3e 0d 0a 3c 6c 69 es</a></li>..<li
0190: 3e 3c 61 20 68 72 65 66 3d 22 23 56 69 72 74 75 ><a href="#Virtu
01a0: 61 6c 54 65 78 74 22 3e 3c 62 3e 56 69 72 74 75 alText"><b>Virtu
01b0: 61 6c 54 65 78 74 20 2d 20 45 6d 75 6c 61 74 69 alText - Emulati
01c0: 6f 6e 20 6f 66 20 54 58 54 2f 43 53 56 2d 46 69 on of TXT/CSV-Fi
01d0: 6c 65 73 3c 2f 61 3e 3c 2f 6c 69 3e 0d 0a 3c 6c les</a></li>..<l
01e0: 69 3e 3c 61 20 68 72 65 66 3d 22 23 56 69 72 74 i><a href="#Virt
01f0: 75 61 6c 58 4c 22 3e 3c 62 3e 56 69 72 74 75 61 ualXL"><b>Virtua
0200: 6c 58 4c 20 2d 20 45 6d 75 6c 61 74 69 6f 6e 20 lXL - Emulation
0210: 6f 66 20 4d 53 20 45 78 63 65 6c 20 73 70 72 65 of MS Excel spre
0220: 61 64 73 68 65 65 74 73 3c 2f 61 3e 3c 2f 6c 69 adsheets</a></li
0230: 3e 0d 0a 3c 6c 69 3e 3c 61 20 68 72 65 66 3d 22 >..<li><a href="
0240: 23 56 69 72 74 75 61 6c 46 44 4f 22 3e 3c 62 3e #VirtualFDO"><b>
0250: 56 69 72 74 75 61 6c 46 44 4f 20 2d 20 45 6d 75 VirtualFDO - Emu
0260: 6c 61 74 69 6f 6e 20 6f 66 20 46 44 4f 20 62 69 lation of FDO bi
0270: 6e 61 72 79 20 47 65 6f 6d 65 74 72 69 65 73 20 nary Geometries
0280: 28 47 44 41 4c 29 3c 2f 61 3e 3c 2f 6c 69 3e 0d (GDAL)</a></li>.
0290: 0a 3c 6c 69 3e 3c 61 20 68 72 65 66 3d 22 23 56 .<li><a href="#V
02a0: 69 72 74 75 61 6c 47 50 4b 47 22 3e 3c 62 3e 56 irtualGPKG"><b>V
02b0: 69 72 74 75 61 6c 47 50 4b 47 20 2d 20 45 6d 75 irtualGPKG - Emu
02c0: 6c 61 74 69 6f 6e 20 6f 66 20 47 65 6f 50 61 63 lation of GeoPac
02d0: 6b 61 67 65 2d 44 61 74 61 62 61 73 65 73 3c 2f kage-Databases</
02e0: 61 3e 3c 2f 6c 69 3e 0d 0a 3c 2f 75 6c 3e 0d 0a a></li>..</ul>..
02f0: 3c 62 72 3e 3c 68 72 3e 0d 0a 3c 68 31 3e 3c 61 <br><hr>..<h1><a
0300: 20 69 64 3d 22 56 69 72 74 75 61 6c 53 68 61 70 id="VirtualShap
0310: 65 22 3e 56 69 72 74 75 61 6c 53 68 61 70 65 3c e">VirtualShape<
0320: 2f 61 3e 3c 2f 68 31 3e 0d 0a 54 68 65 20 3c 62 /a></h1>..The <b
0330: 3e 56 69 72 74 75 61 6c 53 68 61 70 65 3c 2f 62 >VirtualShape</b
0340: 3e 20 49 6e 74 65 72 66 61 63 65 20 61 6c 6c 6f > Interface allo
0350: 77 73 20 74 6f 20 64 69 72 65 63 74 6c 79 20 61 ws to directly a
0360: 63 63 65 73 73 20 61 6e 20 65 78 74 65 72 6e 61 ccess an externa
0370: 6c 20 53 68 61 70 65 46 69 6c 65 20 62 79 20 75 l ShapeFile by u
0380: 73 69 6e 67 20 73 74 61 6e 64 61 72 64 20 53 70 sing standard Sp
0390: 61 74 69 61 6c 20 53 51 4c 20 71 75 65 72 69 65 atial SQL querie
03a0: 73 2e 3c 62 72 3e 0d 0a 53 79 6e 74 61 78 20 66 s.<br>..Syntax f
03b0: 6f 72 20 63 72 65 61 74 69 6e 67 20 61 20 56 69 or creating a Vi
03c0: 72 74 75 61 6c 53 68 61 70 65 20 54 61 62 6c 65 rtualShape Table
03d0: 3a 0d 0a 3c 76 65 72 62 61 74 69 6d 3e 0d 0a 53 :..<verbatim>..S
03e0: 45 4c 45 43 54 20 43 52 45 41 54 45 20 56 49 52 ELECT CREATE VIR
03f0: 54 55 41 4c 20 54 41 42 4c 45 20 6d 79 5f 74 61 TUAL TABLE my_ta
0400: 62 6c 65 20 55 53 49 4e 47 20 56 69 72 74 75 61 ble USING Virtua
0410: 6c 53 68 61 70 65 20 28 20 73 68 70 5f 70 61 74 lShape ( shp_pat
0420: 68 20 2c 20 63 68 61 72 73 65 74 5f 65 6e 63 6f h , charset_enco
0430: 64 69 6e 67 20 2c 20 73 72 69 64 20 29 3b 0d 0a ding , srid );..
0440: 0d 0a 53 45 4c 45 43 54 20 43 52 45 41 54 45 20 ..SELECT CREATE
0450: 56 49 52 54 55 41 4c 20 54 41 42 4c 45 20 6d 79 VIRTUAL TABLE my
0460: 5f 74 61 62 6c 65 20 55 53 49 4e 47 20 56 69 72 _table USING Vir
0470: 74 75 61 6c 53 68 61 70 65 20 28 20 73 68 70 5f tualShape ( shp_
0480: 70 61 74 68 20 2c 20 63 68 61 72 73 65 74 5f 65 path , charset_e
0490: 6e 63 6f 64 69 6e 67 20 2c 20 73 72 69 64 20 2c ncoding , srid ,
04a0: 20 74 65 78 74 5f 64 61 74 65 73 20 29 3b 0d 0a text_dates );..
04b0: 0d 0a 53 45 4c 45 43 54 20 43 52 45 41 54 45 20 ..SELECT CREATE
04c0: 56 49 52 54 55 41 4c 20 54 41 42 4c 45 20 6d 79 VIRTUAL TABLE my
04d0: 5f 74 61 62 6c 65 20 55 53 49 4e 47 20 56 69 72 _table USING Vir
04e0: 74 75 61 6c 53 68 61 70 65 20 28 20 73 68 70 5f tualShape ( shp_
04f0: 70 61 74 68 20 2c 20 63 68 61 72 73 65 74 5f 65 path , charset_e
0500: 6e 63 6f 64 69 6e 67 20 2c 20 73 72 69 64 20 2c ncoding , srid ,
0510: 20 74 65 78 74 5f 64 61 74 65 73 20 2c 20 63 6f text_dates , co
0520: 6c 6e 61 6d 65 5f 63 61 73 65 20 29 3b 0d 0a 3c lname_case );..<
0530: 2f 76 65 72 62 61 74 69 6d 3e 0d 0a 53 75 70 70 /verbatim>..Supp
0540: 6f 72 74 65 64 20 61 72 67 75 6d 65 6e 74 73 20 orted arguments
0550: 61 6e 64 20 74 68 65 69 72 20 69 6e 74 65 72 70 and their interp
0560: 72 65 74 61 74 69 6f 6e 3a 0d 0a 3c 75 6c 3e 0d retation:..<ul>.
0570: 0a 3c 6c 69 3e 3c 62 3e 73 68 70 5f 70 61 74 68 .<li><b>shp_path
0580: 3c 2f 62 3e 20 28 3c 69 3e 3c 62 3e 6d 61 6e 64 </b> (<i><b>mand
0590: 61 74 6f 72 79 3c 2f 62 3e 3c 2f 69 3e 29 3a 20 atory</b></i>):
05a0: 74 68 65 20 72 65 6c 61 74 69 76 65 20 6f 72 20 the relative or
05b0: 61 62 73 6f 6c 75 74 65 20 70 61 74 68 6e 61 6d absolute pathnam
05c0: 65 20 6c 65 61 64 69 6e 67 20 74 6f 20 74 68 65 e leading to the
05d0: 20 65 78 74 65 72 6e 61 6c 20 53 68 61 70 65 66 external Shapef
05e0: 69 6c 65 2e 0d 0a 3c 75 6c 3e 0d 0a 3c 6c 69 3e ile...<ul>..<li>
05f0: 3c 62 3e 4e 6f 74 65 3c 2f 62 3e 3a 20 61 6e 79 <b>Note</b>: any
0600: 20 53 68 61 70 65 66 69 6c 65 20 72 65 71 75 69 Shapefile requi
0610: 72 65 73 20 61 74 20 6c 65 61 73 74 20 74 68 72 res at least thr
0620: 65 65 20 69 6e 64 69 76 69 64 75 61 6c 20 6d 65 ee individual me
0630: 6d 62 65 72 73 20 73 68 61 72 69 6e 67 20 74 68 mbers sharing th
0640: 65 20 73 61 6d 65 20 62 61 73 65 20 6e 61 6d 65 e same base name
0650: 20 62 75 74 20 77 69 74 68 20 64 69 66 66 65 72 but with differ
0660: 65 6e 74 20 73 75 66 66 69 78 65 73 20 28 3c 69 ent suffixes (<i
0670: 3e 2a 2e 73 68 70 3c 2f 69 3e 2c 20 3c 69 3e 2a >*.shp</i>, <i>*
0680: 2e 73 68 78 3c 2f 69 3e 20 61 6e 64 20 3c 69 3e .shx</i> and <i>
0690: 2a 2e 64 62 66 3c 2f 69 3e 29 2e 3c 62 72 3e 0d *.dbf</i>).<br>.
06a0: 0a 41 6c 6c 20 73 75 66 66 69 78 65 73 20 77 69 .All suffixes wi
06b0: 6c 6c 20 62 65 20 61 75 74 6f 6d 61 74 69 63 61 ll be automatica
06c0: 6c 6c 79 20 68 61 6e 64 6c 65 64 20 62 79 20 56 lly handled by V
06d0: 69 72 74 75 61 6c 53 68 61 70 65 2c 20 61 6e 64 irtualShape, and
06e0: 20 63 6f 6e 73 65 71 75 65 6e 74 6c 79 20 74 68 consequently th
06f0: 65 20 3c 62 3e 73 68 70 5f 70 61 74 68 3c 2f 62 e <b>shp_path</b
0700: 3e 20 61 72 67 75 6d 65 6e 74 20 3c 62 3e 3c 75 > argument <b><u
0710: 3e 3c 69 3e 6d 75 73 74 20 6e 6f 74 20 73 70 65 ><i>must not spe
0720: 63 69 66 79 20 61 6e 79 20 73 75 66 66 69 78 3c cify any suffix<
0730: 2f 69 3e 3c 2f 75 3e 3c 2f 62 3e 2c 20 6a 75 73 /i></u></b>, jus
0740: 74 20 74 68 65 20 62 61 72 65 20 62 61 73 65 20 t the bare base
0750: 70 61 74 68 20 6d 75 73 74 20 62 65 20 70 61 73 path must be pas
0760: 73 65 64 2e 3c 2f 6c 69 3e 0d 0a 3c 2f 75 6c 3e sed.</li>..</ul>
0770: 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e 3c 62 3e 63 68 </li>..<li><b>ch
0780: 61 72 73 65 74 5f 65 6e 63 6f 64 69 6e 67 3c 2f arset_encoding</
0790: 62 3e 20 28 3c 69 3e 3c 62 3e 6d 61 6e 64 61 74 b> (<i><b>mandat
07a0: 6f 72 79 3c 2f 62 3e 3c 2f 69 3e 29 3a 20 63 61 ory</b></i>): ca
07b0: 6e 6f 6e 69 63 61 6c 20 6e 61 6d 65 20 6f 66 20 nonical name of
07c0: 74 68 65 20 63 68 61 72 73 65 74 20 65 6e 63 6f the charset enco
07d0: 64 69 6e 67 20 61 64 6f 70 74 65 64 20 62 79 20 ding adopted by
07e0: 74 68 65 20 3c 62 3e 44 42 46 3c 2f 62 3e 20 6d the <b>DBF</b> m
07f0: 65 6d 62 65 72 2e 0d 0a 3c 75 6c 3e 0d 0a 3c 6c ember...<ul>..<l
0800: 69 3e 45 78 61 6d 70 6c 65 73 20 6f 66 20 76 61 i>Examples of va
0810: 6c 69 64 20 6e 61 6d 65 73 20 61 72 65 3a 20 3c lid names are: <
0820: 62 3e 41 53 43 49 49 3c 2f 62 3e 2c 20 3c 62 3e b>ASCII</b>, <b>
0830: 55 54 46 2d 38 3c 2f 62 3e 2c 20 3c 62 3e 43 50 UTF-8</b>, <b>CP
0840: 38 35 30 3c 2f 62 3e 2c 20 3c 62 3e 43 50 31 32 850</b>, <b>CP12
0850: 35 32 3c 2f 62 3e 2c 20 3c 62 3e 49 53 4f 2d 38 52</b>, <b>ISO-8
0860: 38 34 39 2d 31 3c 2f 62 3e 3c 2f 6c 69 3e 0d 0a 849-1</b></li>..
0870: 3c 6c 69 3e 59 6f 75 20 63 61 6e 20 63 68 65 63 <li>You can chec
0880: 6b 20 74 68 65 20 66 75 6c 6c 20 6c 69 73 74 20 k the full list
0890: 6f 66 20 73 75 70 70 6f 72 74 65 64 20 63 68 61 of supported cha
08a0: 72 73 65 74 20 65 6e 63 6f 64 69 6e 67 73 20 3c rset encodings <
08b0: 61 20 68 72 65 66 3d 22 68 74 74 70 73 3a 2f 2f a href="https://
08c0: 77 77 77 2e 67 6e 75 2e 6f 72 67 2f 73 6f 66 74 www.gnu.org/soft
08d0: 77 61 72 65 2f 6c 69 62 69 63 6f 6e 76 2f 22 3e ware/libiconv/">
08e0: 68 65 72 65 3c 2f 61 3e 2e 3c 2f 6c 69 3e 0d 0a here</a>.</li>..
08f0: 3c 2f 75 6c 3e 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e </ul></li>..<li>
0900: 3c 62 3e 73 72 69 64 3c 2f 62 3e 20 28 3c 69 3e <b>srid</b> (<i>
0910: 3c 62 3e 6d 61 6e 64 61 74 6f 72 79 3c 2f 62 3e <b>mandatory</b>
0920: 3c 2f 69 3e 29 3a 20 74 68 65 20 53 52 49 44 20 </i>): the SRID
0930: 76 61 6c 75 65 20 6f 66 20 61 6c 6c 20 47 65 6f value of all Geo
0940: 6d 65 74 72 69 65 73 20 77 69 74 68 69 6e 20 74 metries within t
0950: 68 65 20 53 68 61 70 65 66 69 6c 65 2e 0d 0a 3c he Shapefile...<
0960: 75 6c 3e 0d 0a 3c 6c 69 3e 45 78 61 6d 70 6c 65 ul>..<li>Example
0970: 73 20 6f 66 20 76 61 6c 69 64 20 53 52 49 44 20 s of valid SRID
0980: 76 61 6c 75 65 73 20 61 72 65 3a 20 3c 62 3e 34 values are: <b>4
0990: 33 32 36 3c 2f 62 3e 2c 20 3c 62 3e 33 30 30 33 326</b>, <b>3003
09a0: 3c 2f 62 3e 2c 20 3c 62 3e 33 32 36 33 32 3c 2f </b>, <b>32632</
09b0: 62 3e 3c 2f 6c 69 3e 0d 0a 3c 2f 75 6c 3e 3c 2f b></li>..</ul></
09c0: 6c 69 3e 0d 0a 3c 6c 69 3e 3c 62 3e 74 65 78 74 li>..<li><b>text
09d0: 5f 64 61 74 65 73 3c 2f 62 3e 20 28 3c 69 3e 3c _dates</b> (<i><
09e0: 62 3e 6f 70 74 69 6f 6e 61 6c 3c 2f 62 3e 3c 2f b>optional</b></
09f0: 69 3e 29 3a 20 74 68 69 73 20 69 73 20 61 20 3c i>): this is a <
0a00: 62 3e 42 4f 4f 4c 45 41 4e 3c 2f 62 3e 20 66 6c b>BOOLEAN</b> fl
0a10: 61 67 3a 0d 0a 3c 75 6c 3e 0d 0a 3c 6c 69 3e 69 ag:..<ul>..<li>i
0a20: 66 20 73 65 74 20 74 6f 20 3c 62 3e 30 3c 2f 62 f set to <b>0</b
0a30: 3e 20 28 3c 62 3e 46 41 4c 53 45 3c 2f 62 3e 29 > (<b>FALSE</b>)
0a40: 20 61 6c 6c 20 66 69 65 6c 64 73 20 6f 66 20 74 all fields of t
0a50: 68 65 20 3c 62 3e 44 41 54 45 3c 2f 62 3e 20 74 he <b>DATE</b> t
0a60: 79 70 65 20 77 69 6c 6c 20 62 65 20 72 65 70 72 ype will be repr
0a70: 65 73 65 6e 74 65 64 20 61 73 20 3c 61 20 68 72 esented as <a hr
0a80: 65 66 3d 22 68 74 74 70 73 3a 2f 2f 77 77 77 2e ef="https://www.
0a90: 73 71 6c 69 74 65 2e 6f 72 67 2f 6c 61 6e 67 5f sqlite.org/lang_
0aa0: 64 61 74 65 66 75 6e 63 2e 68 74 6d 6c 22 3e 6a datefunc.html">j
0ab0: 75 6c 69 61 6e 20 64 61 74 65 73 3c 2f 61 3e 3c ulian dates</a><
0ac0: 2f 6c 69 3e 0d 0a 3c 6c 69 3e 69 66 20 73 65 74 /li>..<li>if set
0ad0: 20 74 6f 20 61 6e 79 20 6f 74 68 65 72 20 69 6e to any other in
0ae0: 74 65 67 65 72 20 76 61 6c 75 65 20 28 3c 62 3e teger value (<b>
0af0: 54 52 55 45 3c 2f 62 3e 29 20 61 6c 6c 20 66 69 TRUE</b>) all fi
0b00: 65 6c 64 73 20 6f 66 20 74 68 65 20 3c 62 3e 44 elds of the <b>D
0b10: 41 54 45 3c 2f 62 3e 20 74 79 70 65 20 77 69 6c ATE</b> type wil
0b20: 6c 20 62 65 20 72 65 70 72 65 73 65 6e 74 65 64 l be represented
0b30: 20 61 73 20 54 65 78 74 20 53 74 72 69 6e 67 73 as Text Strings
0b40: 20 61 73 20 65 2e 67 2e 20 3c 62 3e 32 30 31 38 as e.g. <b>2018
0b50: 2d 30 38 2d 32 31 3c 2f 62 3e 3c 2f 6c 69 3e 0d -08-21</b></li>.
0b60: 0a 3c 6c 69 3e 69 66 20 6e 6f 74 20 65 78 70 6c .<li>if not expl
0b70: 69 63 69 74 6c 79 20 73 70 65 63 69 66 69 65 64 icitly specified
0b80: 2c 20 3c 62 3e 54 52 55 45 3c 2f 62 3e 20 77 69 , <b>TRUE</b> wi
0b90: 6c 6c 20 61 6c 77 61 79 73 20 62 65 20 61 73 73 ll always be ass
0ba0: 75 6d 65 64 20 28 64 65 66 61 75 6c 74 20 73 65 umed (default se
0bb0: 74 74 69 6e 67 29 2e 3c 2f 6c 69 3e 0d 0a 3c 2f tting).</li>..</
0bc0: 75 6c 3e 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e 3c 62 ul></li>..<li><b
0bd0: 3e 63 6f 6c 6e 61 6d 65 5f 63 61 73 65 3c 2f 62 >colname_case</b
0be0: 3e 20 28 3c 69 3e 3c 62 3e 6f 70 74 69 6f 6e 61 > (<i><b>optiona
0bf0: 6c 3c 2f 62 3e 3c 2f 69 3e 29 3a 20 74 68 69 73 l</b></i>): this
0c00: 20 61 72 67 75 6d 65 6e 74 20 73 70 65 63 69 66 argument specif
0c10: 69 65 73 20 69 66 20 61 6c 6c 20 63 6f 6c 75 6d ies if all colum
0c20: 6e 20 6e 61 6d 65 73 20 73 68 6f 75 6c 64 20 62 n names should b
0c30: 65 20 63 6f 6e 73 69 64 65 72 65 64 20 75 70 70 e considered upp
0c40: 65 72 63 61 73 65 20 6f 72 20 6c 6f 77 65 72 63 ercase or lowerc
0c50: 61 73 65 2e 3c 62 72 3e 0d 0a 56 61 6c 69 64 20 ase.<br>..Valid
0c60: 73 65 74 74 69 6e 67 73 20 61 72 65 3a 0d 0a 3c settings are:..<
0c70: 75 6c 3e 0d 0a 3c 6c 69 3e 3c 62 3e 75 70 70 65 ul>..<li><b>uppe
0c80: 72 63 61 73 65 3c 2f 62 3e 20 6f 72 20 3c 62 3e rcase</b> or <b>
0c90: 75 70 70 65 72 3c 2f 62 3e 3a 20 61 6c 6c 20 63 upper</b>: all c
0ca0: 6f 6c 75 6d 6e 20 6e 61 6d 65 73 20 77 69 6c 6c olumn names will
0cb0: 20 62 65 20 66 75 6c 6c 79 20 63 61 70 69 74 61 be fully capita
0cc0: 6c 69 7a 65 64 2e 3c 2f 6c 69 3e 0d 0a 3c 6c 69 lized.</li>..<li
0cd0: 3e 3c 62 3e 6c 6f 77 65 72 63 61 73 65 3c 2f 62 ><b>lowercase</b
0ce0: 3e 20 6f 72 20 3c 62 3e 6c 6f 77 65 72 3c 2f 62 > or <b>lower</b
0cf0: 3e 3a 20 61 6c 6c 20 63 6f 6c 75 6d 6e 20 6e 61 >: all column na
0d00: 6d 65 73 20 77 69 6c 6c 20 62 65 20 66 75 6c 6c mes will be full
0d10: 20 6c 6f 77 65 72 63 61 73 65 2e 3c 2f 6c 69 3e lowercase.</li>
0d20: 0d 0a 3c 6c 69 3e 3c 62 3e 73 61 6d 65 63 61 73 ..<li><b>samecas
0d30: 65 3c 2f 62 3e 20 6f 72 20 3c 62 3e 73 61 6d 65 e</b> or <b>same
0d40: 3c 2f 62 3e 3a 20 61 6c 6c 20 63 6f 6c 75 6d 6e </b>: all column
0d50: 20 6e 61 6d 65 73 20 77 69 6c 6c 20 62 65 20 65 names will be e
0d60: 78 61 63 74 6c 79 20 70 72 65 73 65 72 76 65 64 xactly preserved
0d70: 20 61 73 20 74 68 65 79 20 61 72 65 20 64 65 66 as they are def
0d80: 69 6e 65 64 20 69 6e 74 6f 20 74 68 65 20 44 42 ined into the DB
0d90: 46 20 6d 65 6d 62 65 72 2e 3c 2f 6c 69 3e 0d 0a F member.</li>..
0da0: 3c 6c 69 3e 69 66 20 6e 6f 74 20 73 70 65 63 69 <li>if not speci
0db0: 66 69 65 64 2c 20 6f 72 20 69 66 20 61 6e 79 20 fied, or if any
0dc0: 6f 74 68 65 72 20 64 65 66 69 6e 69 74 69 6f 6e other definition
0dd0: 20 64 65 66 69 6e 69 74 69 6f 6e 20 69 73 20 66 definition is f
0de0: 6f 75 6e 64 2c 20 3c 62 3e 6c 6f 77 65 72 63 61 ound, <b>lowerca
0df0: 73 65 3c 2f 62 3e 20 77 69 6c 6c 20 61 6c 77 61 se</b> will alwa
0e00: 79 73 20 62 65 20 61 73 73 75 6d 65 64 20 28 64 ys be assumed (d
0e10: 65 66 61 75 6c 74 20 73 65 74 74 69 6e 67 29 2e efault setting).
0e20: 3c 2f 6c 69 3e 0d 0a 3c 2f 75 6c 3e 3c 2f 6c 69 </li>..</ul></li
0e30: 3e 0d 0a 3c 2f 75 6c 3e 3c 62 72 3e 0d 0a 3c 74 >..</ul><br>..<t
0e40: 61 62 6c 65 20 62 67 63 6f 6c 6f 72 3d 22 23 66 able bgcolor="#f
0e50: 66 66 66 64 30 22 20 63 65 6c 6c 70 61 64 64 69 fffd0" cellpaddi
0e60: 6e 67 3d 22 31 38 22 3e 3c 74 72 3e 3c 74 64 3e ng="18"><tr><td>
0e70: 0d 0a 3c 62 3e 4e 6f 74 65 3c 2f 62 3e 3a 20 61 ..<b>Note</b>: a
0e80: 6e 79 20 54 65 78 74 20 53 74 72 69 6e 67 2c 20 ny Text String,
0e90: 71 75 6f 74 65 64 20 6f 72 20 6e 6f 74 2c 20 77 quoted or not, w
0ea0: 68 65 6e 20 69 74 20 61 70 70 65 61 72 73 20 61 hen it appears a
0eb0: 73 20 61 20 56 69 72 74 75 61 6c 20 54 61 62 6c s a Virtual Tabl
0ec0: 65 20 61 72 67 75 6d 65 6e 74 20 68 61 73 20 74 e argument has t
0ed0: 68 65 20 73 61 6d 65 20 65 66 66 65 63 74 2e 0d he same effect..
0ee0: 0a 3c 76 65 72 62 61 74 69 6d 3e 0d 0a 53 45 4c .<verbatim>..SEL
0ef0: 45 43 54 20 43 52 45 41 54 45 20 56 49 52 54 55 ECT CREATE VIRTU
0f00: 41 4c 20 54 41 42 4c 45 20 6d 79 5f 74 61 62 6c AL TABLE my_tabl
0f10: 65 20 55 53 49 4e 47 20 56 69 72 74 75 61 6c 53 e USING VirtualS
0f20: 68 61 70 65 28 20 2f 68 6f 6d 65 2f 73 61 6e 64 hape( /home/sand
0f30: 72 6f 2f 6d 79 73 68 70 20 2c 20 43 50 31 32 35 ro/myshp , CP125
0f40: 32 20 2c 20 33 30 30 33 20 2c 20 31 20 2c 20 6c 2 , 3003 , 1 , l
0f50: 6f 77 65 72 20 29 3b 0d 0a 6f 72 0d 0a 53 45 4c ower );..or..SEL
0f60: 45 43 54 20 43 52 45 41 54 45 20 56 49 52 54 55 ECT CREATE VIRTU
0f70: 41 4c 20 54 41 42 4c 45 20 6d 79 5f 74 61 62 6c AL TABLE my_tabl
0f80: 65 20 55 53 49 4e 47 20 56 69 72 74 75 61 6c 53 e USING VirtualS
0f90: 68 61 70 65 28 20 27 2f 68 6f 6d 65 2f 73 61 6e hape( '/home/san
0fa0: 64 72 6f 2f 6d 79 73 68 70 27 20 2c 20 27 43 50 dro/myshp' , 'CP
0fb0: 31 32 35 32 27 20 2c 20 33 30 30 33 20 2c 20 31 1252' , 3003 , 1
0fc0: 20 2c 20 27 6c 6f 77 65 72 27 20 29 3b 0d 0a 3c , 'lower' );..<
0fd0: 2f 76 65 72 62 61 74 69 6d 3e 0d 0a 42 6f 74 68 /verbatim>..Both
0fe0: 20 6e 6f 74 61 74 69 6f 6e 73 20 77 69 6c 6c 20 notations will
0ff0: 70 72 6f 64 75 63 65 20 74 68 65 20 73 61 6d 65 produce the same
1000: 20 72 65 73 75 6c 74 2e 0d 0a 3c 2f 74 64 3e 3c result...</td><
1010: 2f 74 72 3e 3c 2f 74 61 62 6c 65 3e 0d 0a 3c 62 /tr></table>..<b
1020: 72 3e 0d 0a 3c 74 61 62 6c 65 20 62 67 63 6f 6c r>..<table bgcol
1030: 6f 72 3d 22 23 64 30 66 66 64 30 22 20 63 65 6c or="#d0ffd0" cel
1040: 6c 70 61 64 64 69 6e 67 3d 22 31 38 22 3e 3c 74 lpadding="18"><t
1050: 72 3e 3c 74 64 3e 0d 0a 3c 68 33 3e 42 65 73 74 r><td>..<h3>Best
1060: 20 70 72 61 63 74 69 63 65 73 20 61 6e 64 20 6b practices and k
1070: 6e 6f 77 6e 20 6c 69 6d 69 74 61 74 69 6f 6e 73 nown limitations
1080: 3c 2f 68 33 3e 0d 0a 3c 75 6c 3e 0d 0a 3c 6c 69 </h3>..<ul>..<li
1090: 3e 56 69 72 74 75 61 6c 20 54 61 62 6c 65 73 20 >Virtual Tables
10a0: 61 72 65 20 6e 6f 74 20 72 65 61 6c 6c 79 20 67 are not really g
10b0: 65 6e 75 69 6e 65 20 44 61 74 61 62 61 73 65 20 enuine Database
10c0: 54 61 62 6c 65 73 2c 20 74 68 65 79 20 61 72 65 Tables, they are
10d0: 20 6a 75 73 74 20 65 6d 75 6c 61 74 69 6e 67 20 just emulating
10e0: 74 68 65 20 6f 72 69 67 69 6e 61 6c 20 73 6f 75 the original sou
10f0: 72 63 65 20 61 73 20 61 20 44 61 74 61 62 61 73 rce as a Databas
1100: 65 20 54 61 62 6c 65 2e 3c 2f 6c 69 3e 0d 0a 3c e Table.</li>..<
1110: 6c 69 3e 56 69 72 74 75 61 6c 20 54 61 62 6c 65 li>Virtual Table
1120: 73 20 68 61 76 65 20 76 65 72 79 20 70 6f 6f 72 s have very poor
1130: 20 73 70 65 65 64 20 70 65 72 66 6f 72 6d 61 6e speed performan
1140: 63 65 73 2c 20 64 75 65 20 74 6f 20 74 68 65 20 ces, due to the
1150: 20 65 6d 75 6c 61 74 69 6f 6e 2c 20 61 73 20 63 emulation, as c
1160: 6f 6d 70 61 72 65 64 20 74 6f 20 67 65 6e 75 69 ompared to genui
1170: 6e 65 20 44 61 74 61 62 61 73 65 20 54 61 62 6c ne Database Tabl
1180: 65 73 2e 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e 43 6f es.</li>..<li>Co
1190: 6d 70 6c 65 78 20 53 51 4c 20 71 75 65 72 69 65 mplex SQL querie
11a0: 73 20 3c 62 3e 4a 4f 49 4e 3c 2f 62 3e 69 6e 67 s <b>JOIN</b>ing
11b0: 20 73 65 76 65 72 61 6c 20 54 61 62 6c 65 73 20 several Tables
11c0: 63 61 6e 20 6f 66 74 65 6e 20 72 65 74 75 72 6e can often return
11d0: 20 6f 64 64 20 61 6e 64 20 6d 69 73 6c 65 61 64 odd and mislead
11e0: 69 6e 67 20 72 65 73 75 6c 74 73 65 74 73 2c 20 ing resultsets,
11f0: 77 68 65 6e 20 6f 6e 65 20 6f 72 20 6d 6f 72 65 when one or more
1200: 20 6f 66 20 74 68 65 20 3c 62 3e 4a 4f 49 4e 3c of the <b>JOIN<
1210: 2f 62 3e 65 64 20 54 61 62 6c 65 73 20 61 72 65 /b>ed Tables are
1220: 20 6f 66 20 74 68 65 20 56 69 72 74 75 61 6c 20 of the Virtual
1230: 74 79 70 65 2e 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e type.</li>..<li>
1240: 54 68 65 20 62 65 73 74 20 75 73 65 20 6f 66 20 The best use of
1250: 61 20 56 69 72 74 75 61 6c 20 54 61 62 6c 65 20 a Virtual Table
1260: 69 73 20 74 6f 20 70 72 65 66 6f 72 6d 20 61 20 is to preform a
1270: 62 61 73 69 63 20 64 61 74 61 20 69 6d 70 6f 72 basic data impor
1280: 74 20 70 72 6f 63 65 73 73 2c 20 6f 72 20 74 6f t process, or to
1290: 20 71 75 69 63 6b 6c 79 20 67 65 74 20 61 6e 20 quickly get an
12a0: 6f 76 65 72 61 6c 6c 20 67 6c 61 6e 63 65 20 61 overall glance a
12b0: 74 20 61 20 66 75 6c 6c 20 64 61 74 61 73 65 74 t a full dataset
12c0: 20 77 69 74 68 6f 75 74 20 6e 65 63 65 73 73 61 without necessa
12d0: 72 69 6c 79 20 69 6d 70 6f 72 74 69 6e 67 20 69 rily importing i
12e0: 74 20 69 6e 74 6f 20 74 68 65 20 44 61 74 61 62 t into the Datab
12f0: 61 73 65 2e 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e 50 ase.</li>..<li>P
1300: 72 65 74 65 6e 64 69 6e 67 20 74 6f 20 75 73 65 retending to use
1310: 20 61 20 56 69 72 74 75 61 6c 20 54 61 62 6c 65 a Virtual Table
1320: 20 61 73 20 61 20 66 75 6c 6c 20 72 65 70 6c 61 as a full repla
1330: 63 65 6d 65 6e 74 20 6f 66 20 69 6d 70 6f 72 74 cement of import
1340: 69 6e 67 20 61 6c 6c 20 64 61 74 61 20 77 69 74 ing all data wit
1350: 68 69 6e 20 61 20 67 65 6e 75 69 6e 65 20 44 61 hin a genuine Da
1360: 74 61 62 61 73 65 20 54 61 62 6c 65 20 69 73 20 tabase Table is
1370: 73 74 72 6f 6e 67 6c 79 20 64 69 73 63 6f 75 72 strongly discour
1380: 61 67 65 64 2c 20 61 6e 64 20 6e 65 76 65 72 20 aged, and never
1390: 69 73 20 61 20 67 6f 6f 64 20 69 64 65 61 2e 3c is a good idea.<
13a0: 2f 6c 69 3e 0d 0a 3c 2f 75 6c 3e 3c 62 72 3e 0d /li>..</ul><br>.
13b0: 0a 3c 62 3e 57 61 72 6e 69 6e 67 3c 2f 62 3e 3a .<b>Warning</b>:
13c0: 20 56 69 72 74 75 61 6c 53 68 61 70 65 20 54 61 VirtualShape Ta
13d0: 62 6c 65 73 20 61 72 65 20 61 6c 77 61 79 73 20 bles are always
13e0: 73 75 62 6a 65 63 74 20 74 6f 20 3c 62 3e 52 45 subject to <b>RE
13f0: 41 44 2d 4f 4e 4c 59 3c 2f 62 3e 20 72 65 73 74 AD-ONLY</b> rest
1400: 72 69 63 74 69 6f 6e 73 2e 20 41 6e 79 20 61 74 rictions. Any at
1410: 74 65 6d 70 74 20 74 6f 20 74 6f 20 65 78 65 63 tempt to to exec
1420: 75 74 65 20 61 6e 20 3c 62 3e 49 4e 53 45 52 54 ute an <b>INSERT
1430: 3c 2f 62 3e 2c 20 3c 62 3e 55 50 44 41 54 45 3c </b>, <b>UPDATE<
1440: 2f 62 3e 20 6f 72 20 3c 62 3e 44 45 4c 45 54 45 /b> or <b>DELETE
1450: 3c 2f 62 3e 20 73 74 61 74 65 6d 65 6e 74 20 77 </b> statement w
1460: 69 6c 6c 20 61 6c 77 61 79 73 20 72 65 74 75 72 ill always retur
1470: 6e 20 61 6e 20 65 72 72 6f 72 2e 3c 62 72 3e 0d n an error.<br>.
1480: 0a 3c 2f 74 64 3e 3c 2f 74 72 3e 3c 2f 74 61 62 .</td></tr></tab
1490: 6c 65 3e 0d 0a 3c 62 72 3e 0d 0a 3c 74 61 62 6c le>..<br>..<tabl
14a0: 65 20 62 67 63 6f 6c 6f 72 3d 22 23 65 30 65 30 e bgcolor="#e0e0
14b0: 65 30 22 20 63 65 6c 6c 70 61 64 64 69 6e 67 3d e0" cellpadding=
14c0: 22 31 38 22 3e 3c 74 72 3e 3c 74 64 3e 0d 0a 3c "18"><tr><td>..<
14d0: 68 33 3e 52 65 6c 61 74 65 64 20 54 6f 70 69 63 h3>Related Topic
14e0: 73 3c 2f 68 33 3e 0d 0a 3c 75 6c 3e 0d 0a 3c 6c s</h3>..<ul>..<l
14f0: 69 3e 54 68 65 20 3c 62 3e 49 6d 70 6f 72 74 53 i>The <b>ImportS
1500: 48 50 28 29 3c 2f 62 3e 20 53 51 4c 20 66 75 6e HP()</b> SQL fun
1510: 63 74 69 6f 6e 20 61 6c 6c 6f 77 73 20 74 6f 20 ction allows to
1520: 63 72 65 61 74 65 20 61 6e 64 20 70 6f 70 75 6c create and popul
1530: 61 74 65 20 61 20 67 65 6e 75 69 6e 65 20 53 70 ate a genuine Sp
1540: 61 74 69 61 6c 20 54 61 62 6c 65 20 62 79 20 69 atial Table by i
1550: 6d 70 6f 72 74 69 6e 67 20 61 6e 20 65 78 74 65 mporting an exte
1560: 72 6e 61 6c 20 53 68 61 70 65 66 69 6c 65 2e 3c rnal Shapefile.<
1570: 2f 6c 69 3e 0d 0a 3c 6c 69 3e 41 6e 64 20 74 68 /li>..<li>And th
1580: 65 20 3c 62 3e 45 78 70 6f 72 74 53 48 50 28 29 e <b>ExportSHP()
1590: 3c 2f 62 3e 20 73 69 73 74 65 72 20 66 75 6e 63 </b> sister func
15a0: 74 69 6f 6e 20 61 6c 6c 6f 77 73 20 74 68 65 20 tion allows the
15b0: 65 78 70 6f 72 74 61 74 69 6f 6e 20 61 20 77 68 exportation a wh
15c0: 6f 6c 65 20 53 70 61 74 69 61 6c 20 54 61 62 6c ole Spatial Tabl
15d0: 65 20 69 6e 74 6f 20 61 6e 20 65 78 74 65 72 6e e into an extern
15e0: 61 6c 20 53 68 61 70 65 66 69 6c 65 2e 3c 2f 6c al Shapefile.</l
15f0: 69 3e 0d 0a 3c 2f 75 6c 3e 0d 0a 3c 2f 74 64 3e i>..</ul>..</td>
1600: 3c 2f 74 72 3e 3c 2f 74 61 62 6c 65 3e 0d 0a 3c </tr></table>..<
1610: 62 72 3e 0d 0a 3c 68 72 3e 0d 0a 3c 68 31 3e 3c br>..<hr>..<h1><
1620: 61 20 69 64 3d 22 56 69 72 74 75 61 6c 44 42 46 a id="VirtualDBF
1630: 22 3e 56 69 72 74 75 61 6c 44 42 46 3c 2f 61 3e ">VirtualDBF</a>
1640: 3c 2f 68 31 3e 0d 0a 54 68 65 20 3c 62 3e 56 69 </h1>..The <b>Vi
1650: 72 74 75 61 6c 44 42 46 3c 2f 62 3e 20 49 6e 74 rtualDBF</b> Int
1660: 65 72 66 61 63 65 20 61 6c 6c 6f 77 73 20 74 6f erface allows to
1670: 20 64 69 72 65 63 74 6c 79 20 61 63 63 65 73 73 directly access
1680: 20 61 6e 20 65 78 74 65 72 6e 61 6c 20 44 42 46 an external DBF
1690: 20 74 61 62 6c 65 20 62 79 20 75 73 69 6e 67 20 table by using
16a0: 73 74 61 6e 64 61 72 64 20 53 70 61 74 69 61 6c standard Spatial
16b0: 20 53 51 4c 20 71 75 65 72 69 65 73 2e 3c 62 72 SQL queries.<br
16c0: 3e 0d 0a 53 79 6e 74 61 78 20 66 6f 72 20 63 72 >..Syntax for cr
16d0: 65 61 74 69 6e 67 20 61 20 56 69 72 74 75 61 6c eating a Virtual
16e0: 44 62 66 20 54 61 62 6c 65 3a 0d 0a 3c 76 65 72 Dbf Table:..<ver
16f0: 62 61 74 69 6d 3e 0d 0a 53 45 4c 45 43 54 20 43 batim>..SELECT C
1700: 52 45 41 54 45 20 56 49 52 54 55 41 4c 20 54 41 REATE VIRTUAL TA
1710: 42 4c 45 20 6d 79 5f 74 61 62 6c 65 20 55 53 49 BLE my_table USI
1720: 4e 47 20 56 69 72 74 75 61 6c 44 62 66 20 28 20 NG VirtualDbf (
1730: 64 62 66 5f 70 61 74 68 20 2c 20 63 68 61 72 73 dbf_path , chars
1740: 65 74 5f 65 6e 63 6f 64 69 6e 67 20 29 3b 0d 0a et_encoding );..
1750: 0d 0a 53 45 4c 45 43 54 20 43 52 45 41 54 45 20 ..SELECT CREATE
1760: 56 49 52 54 55 41 4c 20 54 41 42 4c 45 20 6d 79 VIRTUAL TABLE my
1770: 5f 74 61 62 6c 65 20 55 53 49 4e 47 20 56 69 72 _table USING Vir
1780: 74 75 61 6c 44 62 66 20 28 20 64 62 66 5f 70 61 tualDbf ( dbf_pa
1790: 74 68 20 2c 20 63 68 61 72 73 65 74 5f 65 6e 63 th , charset_enc
17a0: 6f 64 69 6e 67 20 2c 20 74 65 78 74 5f 64 61 74 oding , text_dat
17b0: 65 73 20 29 3b 0d 0a 0d 0a 53 45 4c 45 43 54 20 es );....SELECT
17c0: 43 52 45 41 54 45 20 56 49 52 54 55 41 4c 20 54 CREATE VIRTUAL T
17d0: 41 42 4c 45 20 6d 79 5f 74 61 62 6c 65 20 55 53 ABLE my_table US
17e0: 49 4e 47 20 56 69 72 74 75 61 6c 44 62 66 20 28 ING VirtualDbf (
17f0: 20 64 62 66 5f 70 61 74 68 20 2c 20 63 68 61 72 dbf_path , char
1800: 73 65 74 5f 65 6e 63 6f 64 69 6e 67 20 2c 20 74 set_encoding , t
1810: 65 78 74 5f 64 61 74 65 73 20 2c 20 63 6f 6c 6e ext_dates , coln
1820: 61 6d 65 5f 63 61 73 65 20 29 3b 0d 0a 3c 2f 76 ame_case );..</v
1830: 65 72 62 61 74 69 6d 3e 0d 0a 53 75 70 70 6f 72 erbatim>..Suppor
1840: 74 65 64 20 61 72 67 75 6d 65 6e 74 73 20 61 6e ted arguments an
1850: 64 20 74 68 65 69 72 20 69 6e 74 65 72 70 72 65 d their interpre
1860: 74 61 74 69 6f 6e 3a 0d 0a 3c 75 6c 3e 0d 0a 3c tation:..<ul>..<
1870: 6c 69 3e 3c 62 3e 64 62 66 5f 70 61 74 68 3c 2f li><b>dbf_path</
1880: 62 3e 20 28 3c 69 3e 3c 62 3e 6d 61 6e 64 61 74 b> (<i><b>mandat
1890: 6f 72 79 3c 2f 62 3e 3c 2f 69 3e 29 3a 20 74 68 ory</b></i>): th
18a0: 65 20 72 65 6c 61 74 69 76 65 20 6f 72 20 61 62 e relative or ab
18b0: 73 6f 6c 75 74 65 20 70 61 74 68 6e 61 6d 65 20 solute pathname
18c0: 6c 65 61 64 69 6e 67 20 74 6f 20 74 68 65 20 65 leading to the e
18d0: 78 74 65 72 6e 61 6c 20 44 42 46 20 66 69 6c 65 xternal DBF file
18e0: 2e 0d 0a 3c 75 6c 3e 0d 0a 3c 6c 69 3e 3c 62 3e ...<ul>..<li><b>
18f0: 4e 6f 74 65 3c 2f 62 3e 3a 20 74 68 65 20 66 75 Note</b>: the fu
1900: 6c 6c 20 70 61 74 68 6e 61 6d 65 20 6d 75 73 74 ll pathname must
1910: 20 62 65 20 70 61 73 73 65 64 2c 20 69 6e 63 6c be passed, incl
1920: 75 64 69 6e 67 20 74 68 65 20 66 69 6e 61 6c 20 uding the final
1930: 3c 69 3e 2a 2e 64 62 66 3c 2f 69 3e 20 73 75 66 <i>*.dbf</i> suf
1940: 66 69 78 2e 3c 2f 6c 69 3e 0d 0a 3c 2f 75 6c 3e fix.</li>..</ul>
1950: 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e 3c 62 3e 63 68 </li>..<li><b>ch
1960: 61 72 73 65 74 5f 65 6e 63 6f 64 69 6e 67 3c 2f arset_encoding</
1970: 62 3e 20 28 3c 69 3e 3c 62 3e 6d 61 6e 64 61 74 b> (<i><b>mandat
1980: 6f 72 79 3c 2f 62 3e 3c 2f 69 3e 29 3a 20 63 61 ory</b></i>): ca
1990: 6e 6f 6e 69 63 61 6c 20 6e 61 6d 65 20 6f 66 20 nonical name of
19a0: 74 68 65 20 63 68 61 72 73 65 74 20 65 6e 63 6f the charset enco
19b0: 64 69 6e 67 20 61 64 6f 70 74 65 64 20 62 79 20 ding adopted by
19c0: 74 68 65 20 3c 62 3e 44 42 46 3c 2f 62 3e 20 6d the <b>DBF</b> m
19d0: 65 6d 62 65 72 2e 0d 0a 3c 75 6c 3e 0d 0a 3c 6c ember...<ul>..<l
19e0: 69 3e 45 78 61 6d 70 6c 65 73 20 6f 66 20 76 61 i>Examples of va
19f0: 6c 69 64 20 6e 61 6d 65 73 20 61 72 65 3a 20 3c lid names are: <
1a00: 62 3e 41 53 43 49 49 3c 2f 62 3e 2c 20 3c 62 3e b>ASCII</b>, <b>
1a10: 55 54 46 2d 38 3c 2f 62 3e 2c 20 3c 62 3e 43 50 UTF-8</b>, <b>CP
1a20: 38 35 30 3c 2f 62 3e 2c 20 3c 62 3e 43 50 31 32 850</b>, <b>CP12
1a30: 35 32 3c 2f 62 3e 2c 20 3c 62 3e 49 53 4f 2d 38 52</b>, <b>ISO-8
1a40: 38 34 39 2d 31 3c 2f 62 3e 3c 2f 6c 69 3e 0d 0a 849-1</b></li>..
1a50: 3c 6c 69 3e 59 6f 75 20 63 61 6e 20 63 68 65 63 <li>You can chec
1a60: 6b 20 74 68 65 20 66 75 6c 6c 20 6c 69 73 74 20 k the full list
1a70: 6f 66 20 73 75 70 70 6f 72 74 65 64 20 63 68 61 of supported cha
1a80: 72 73 65 74 20 65 6e 63 6f 64 69 6e 67 73 20 3c rset encodings <
1a90: 61 20 68 72 65 66 3d 22 68 74 74 70 73 3a 2f 2f a href="https://
1aa0: 77 77 77 2e 67 6e 75 2e 6f 72 67 2f 73 6f 66 74 www.gnu.org/soft
1ab0: 77 61 72 65 2f 6c 69 62 69 63 6f 6e 76 2f 22 3e ware/libiconv/">
1ac0: 68 65 72 65 3c 2f 61 3e 2e 3c 2f 6c 69 3e 0d 0a here</a>.</li>..
1ad0: 3c 2f 75 6c 3e 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e </ul></li>..<li>
1ae0: 3c 62 3e 74 65 78 74 5f 64 61 74 65 73 3c 2f 62 <b>text_dates</b
1af0: 3e 20 28 3c 69 3e 3c 62 3e 6f 70 74 69 6f 6e 61 > (<i><b>optiona
1b00: 6c 3c 2f 62 3e 3c 2f 69 3e 29 3a 20 74 68 69 73 l</b></i>): this
1b10: 20 69 73 20 61 20 3c 62 3e 42 4f 4f 4c 45 41 4e is a <b>BOOLEAN
1b20: 3c 2f 62 3e 20 66 6c 61 67 3a 0d 0a 3c 75 6c 3e </b> flag:..<ul>
1b30: 0d 0a 3c 6c 69 3e 69 66 20 73 65 74 20 74 6f 20 ..<li>if set to
1b40: 3c 62 3e 30 3c 2f 62 3e 20 28 3c 62 3e 46 41 4c <b>0</b> (<b>FAL
1b50: 53 45 3c 2f 62 3e 29 20 61 6c 6c 20 66 69 65 6c SE</b>) all fiel
1b60: 64 73 20 6f 66 20 74 68 65 20 3c 62 3e 44 41 54 ds of the <b>DAT
1b70: 45 3c 2f 62 3e 20 74 79 70 65 20 77 69 6c 6c 20 E</b> type will
1b80: 62 65 20 72 65 70 72 65 73 65 6e 74 65 64 20 61 be represented a
1b90: 73 20 3c 61 20 68 72 65 66 3d 22 68 74 74 70 73 s <a href="https
1ba0: 3a 2f 2f 77 77 77 2e 73 71 6c 69 74 65 2e 6f 72 ://www.sqlite.or
1bb0: 67 2f 6c 61 6e 67 5f 64 61 74 65 66 75 6e 63 2e g/lang_datefunc.
1bc0: 68 74 6d 6c 22 3e 6a 75 6c 69 61 6e 20 64 61 74 html">julian dat
1bd0: 65 73 3c 2f 61 3e 3c 2f 6c 69 3e 0d 0a 3c 6c 69 es</a></li>..<li
1be0: 3e 69 66 20 73 65 74 20 74 6f 20 61 6e 79 20 6f >if set to any o
1bf0: 74 68 65 72 20 69 6e 74 65 67 65 72 20 76 61 6c ther integer val
1c00: 75 65 20 28 3c 62 3e 54 52 55 45 3c 2f 62 3e 29 ue (<b>TRUE</b>)
1c10: 20 61 6c 6c 20 66 69 65 6c 64 73 20 6f 66 20 74 all fields of t
1c20: 68 65 20 3c 62 3e 44 41 54 45 3c 2f 62 3e 20 74 he <b>DATE</b> t
1c30: 79 70 65 20 77 69 6c 6c 20 62 65 20 72 65 70 72 ype will be repr
1c40: 65 73 65 6e 74 65 64 20 61 73 20 54 65 78 74 20 esented as Text
1c50: 53 74 72 69 6e 67 73 20 61 73 20 65 2e 67 2e 20 Strings as e.g.
1c60: 3c 62 3e 32 30 31 38 2d 30 38 2d 32 31 3c 2f 62 <b>2018-08-21</b
1c70: 3e 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e 69 66 20 6e ></li>..<li>if n
1c80: 6f 74 20 65 78 70 6c 69 63 69 74 6c 79 20 73 70 ot explicitly sp
1c90: 65 63 69 66 69 65 64 2c 20 3c 62 3e 54 52 55 45 ecified, <b>TRUE
1ca0: 3c 2f 62 3e 20 77 69 6c 6c 20 61 6c 77 61 79 73 </b> will always
1cb0: 20 62 65 20 61 73 73 75 6d 65 64 20 28 64 65 66 be assumed (def
1cc0: 61 75 6c 74 20 73 65 74 74 69 6e 67 29 2e 3c 2f ault setting).</
1cd0: 6c 69 3e 0d 0a 3c 2f 75 6c 3e 3c 2f 6c 69 3e 0d li>..</ul></li>.
1ce0: 0a 3c 6c 69 3e 3c 62 3e 63 6f 6c 6e 61 6d 65 5f .<li><b>colname_
1cf0: 63 61 73 65 3c 2f 62 3e 20 28 3c 69 3e 3c 62 3e case</b> (<i><b>
1d00: 6f 70 74 69 6f 6e 61 6c 3c 2f 62 3e 3c 2f 69 3e optional</b></i>
1d10: 29 3a 20 74 68 69 73 20 61 72 67 75 6d 65 6e 74 ): this argument
1d20: 20 73 70 65 63 69 66 69 65 73 20 69 66 20 61 6c specifies if al
1d30: 6c 20 63 6f 6c 75 6d 6e 20 6e 61 6d 65 73 20 73 l column names s
1d40: 68 6f 75 6c 64 20 62 65 20 63 6f 6e 73 69 64 65 hould be conside
1d50: 72 65 64 20 75 70 70 65 72 63 61 73 65 20 6f 72 red uppercase or
1d60: 20 6c 6f 77 65 72 63 61 73 65 2e 3c 62 72 3e 0d lowercase.<br>.
1d70: 0a 56 61 6c 69 64 20 73 65 74 74 69 6e 67 73 20 .Valid settings
1d80: 61 72 65 3a 0d 0a 3c 75 6c 3e 0d 0a 3c 6c 69 3e are:..<ul>..<li>
1d90: 3c 62 3e 75 70 70 65 72 63 61 73 65 3c 2f 62 3e <b>uppercase</b>
1da0: 20 6f 72 20 3c 62 3e 75 70 70 65 72 3c 2f 62 3e or <b>upper</b>
1db0: 3a 20 61 6c 6c 20 63 6f 6c 75 6d 6e 20 6e 61 6d : all column nam
1dc0: 65 73 20 77 69 6c 6c 20 62 65 20 66 75 6c 6c 79 es will be fully
1dd0: 20 63 61 70 69 74 61 6c 69 7a 65 64 2e 3c 2f 6c capitalized.</l
1de0: 69 3e 0d 0a 3c 6c 69 3e 3c 62 3e 6c 6f 77 65 72 i>..<li><b>lower
1df0: 63 61 73 65 3c 2f 62 3e 20 6f 72 20 3c 62 3e 6c case</b> or <b>l
1e00: 6f 77 65 72 3c 2f 62 3e 3a 20 61 6c 6c 20 63 6f ower</b>: all co
1e10: 6c 75 6d 6e 20 6e 61 6d 65 73 20 77 69 6c 6c 20 lumn names will
1e20: 62 65 20 66 75 6c 6c 20 6c 6f 77 65 72 63 61 73 be full lowercas
1e30: 65 2e 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e 3c 62 3e e.</li>..<li><b>
1e40: 73 61 6d 65 63 61 73 65 3c 2f 62 3e 20 6f 72 20 samecase</b> or
1e50: 3c 62 3e 73 61 6d 65 3c 2f 62 3e 3a 20 61 6c 6c <b>same</b>: all
1e60: 20 63 6f 6c 75 6d 6e 20 6e 61 6d 65 73 20 77 69 column names wi
1e70: 6c 6c 20 62 65 20 65 78 61 63 74 6c 79 20 70 72 ll be exactly pr
1e80: 65 73 65 72 76 65 64 20 61 73 20 74 68 65 79 20 eserved as they
1e90: 61 72 65 20 64 65 66 69 6e 65 64 20 69 6e 74 6f are defined into
1ea0: 20 74 68 65 20 44 42 46 20 6d 65 6d 62 65 72 2e the DBF member.
1eb0: 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e 69 66 20 6e 6f </li>..<li>if no
1ec0: 74 20 73 70 65 63 69 66 69 65 64 2c 20 6f 72 20 t specified, or
1ed0: 69 66 20 61 6e 79 20 6f 74 68 65 72 20 64 65 66 if any other def
1ee0: 69 6e 69 74 69 6f 6e 20 64 65 66 69 6e 69 74 69 inition definiti
1ef0: 6f 6e 20 69 73 20 66 6f 75 6e 64 2c 20 3c 62 3e on is found, <b>
1f00: 6c 6f 77 65 72 63 61 73 65 3c 2f 62 3e 20 77 69 lowercase</b> wi
1f10: 6c 6c 20 61 6c 77 61 79 73 20 62 65 20 61 73 73 ll always be ass
1f20: 75 6d 65 64 20 28 64 65 66 61 75 6c 74 20 73 65 umed (default se
1f30: 74 74 69 6e 67 29 2e 3c 2f 6c 69 3e 0d 0a 3c 2f tting).</li>..</
1f40: 75 6c 3e 3c 2f 6c 69 3e 0d 0a 3c 2f 75 6c 3e 3c ul></li>..</ul><
1f50: 62 72 3e 0d 0a 3c 74 61 62 6c 65 20 62 67 63 6f br>..<table bgco
1f60: 6c 6f 72 3d 22 23 66 66 66 66 64 30 22 20 63 65 lor="#ffffd0" ce
1f70: 6c 6c 70 61 64 64 69 6e 67 3d 22 31 38 22 3e 3c llpadding="18"><
1f80: 74 72 3e 3c 74 64 3e 0d 0a 3c 62 3e 4e 6f 74 65 tr><td>..<b>Note
1f90: 3c 2f 62 3e 3a 20 61 6e 79 20 54 65 78 74 20 53 </b>: any Text S
1fa0: 74 72 69 6e 67 2c 20 71 75 6f 74 65 64 20 6f 72 tring, quoted or
1fb0: 20 6e 6f 74 2c 20 77 68 65 6e 20 69 74 20 61 70 not, when it ap
1fc0: 70 65 61 72 73 20 61 73 20 61 20 56 69 72 74 75 pears as a Virtu
1fd0: 61 6c 20 54 61 62 6c 65 20 61 72 67 75 6d 65 6e al Table argumen
1fe0: 74 20 68 61 73 20 74 68 65 20 73 61 6d 65 20 65 t has the same e
1ff0: 66 66 65 63 74 2e 0d 0a 3c 76 65 72 62 61 74 69 ffect...<verbati
2000: 6d 3e 0d 0a 53 45 4c 45 43 54 20 43 52 45 41 54 m>..SELECT CREAT
2010: 45 20 56 49 52 54 55 41 4c 20 54 41 42 4c 45 20 E VIRTUAL TABLE
2020: 6d 79 5f 74 61 62 6c 65 20 55 53 49 4e 47 20 56 my_table USING V
2030: 69 72 74 75 61 6c 44 62 66 28 20 2f 68 6f 6d 65 irtualDbf( /home
2040: 2f 73 61 6e 64 72 6f 2f 6d 79 73 68 70 20 2c 20 /sandro/myshp ,
2050: 43 50 31 32 35 32 20 2c 20 31 20 2c 20 6c 6f 77 CP1252 , 1 , low
2060: 65 72 20 29 3b 0d 0a 6f 72 0d 0a 53 45 4c 45 43 er );..or..SELEC
2070: 54 20 43 52 45 41 54 45 20 56 49 52 54 55 41 4c T CREATE VIRTUAL
2080: 20 54 41 42 4c 45 20 6d 79 5f 74 61 62 6c 65 20 TABLE my_table
2090: 55 53 49 4e 47 20 56 69 72 74 75 61 6c 44 62 66 USING VirtualDbf
20a0: 28 20 27 2f 68 6f 6d 65 2f 73 61 6e 64 72 6f 2f ( '/home/sandro/
20b0: 6d 79 73 68 70 27 20 2c 20 27 43 50 31 32 35 32 myshp' , 'CP1252
20c0: 27 20 2c 20 31 20 2c 20 27 6c 6f 77 65 72 27 20 ' , 1 , 'lower'
20d0: 29 3b 0d 0a 3c 2f 76 65 72 62 61 74 69 6d 3e 0d );..</verbatim>.
20e0: 0a 42 6f 74 68 20 6e 6f 74 61 74 69 6f 6e 73 20 .Both notations
20f0: 77 69 6c 6c 20 70 72 6f 64 75 63 65 20 74 68 65 will produce the
2100: 20 73 61 6d 65 20 72 65 73 75 6c 74 2e 0d 0a 3c same result...<
2110: 2f 74 64 3e 3c 2f 74 72 3e 3c 2f 74 61 62 6c 65 /td></tr></table
2120: 3e 0d 0a 3c 62 72 3e 0d 0a 3c 74 61 62 6c 65 20 >..<br>..<table
2130: 62 67 63 6f 6c 6f 72 3d 22 23 64 30 66 66 64 30 bgcolor="#d0ffd0
2140: 22 20 63 65 6c 6c 70 61 64 64 69 6e 67 3d 22 31 " cellpadding="1
2150: 38 22 3e 3c 74 72 3e 3c 74 64 3e 0d 0a 3c 68 33 8"><tr><td>..<h3
2160: 3e 42 65 73 74 20 70 72 61 63 74 69 63 65 73 20 >Best practices
2170: 61 6e 64 20 6b 6e 6f 77 6e 20 6c 69 6d 69 74 61 and known limita
2180: 74 69 6f 6e 73 3c 2f 68 33 3e 0d 0a 3c 75 6c 3e tions</h3>..<ul>
2190: 0d 0a 3c 6c 69 3e 56 69 72 74 75 61 6c 20 54 61 ..<li>Virtual Ta
21a0: 62 6c 65 73 20 61 72 65 20 6e 6f 74 20 72 65 61 bles are not rea
21b0: 6c 6c 79 20 67 65 6e 75 69 6e 65 20 44 61 74 61 lly genuine Data
21c0: 62 61 73 65 20 54 61 62 6c 65 73 2c 20 74 68 65 base Tables, the
21d0: 79 20 61 72 65 20 6a 75 73 74 20 65 6d 75 6c 61 y are just emula
21e0: 74 69 6e 67 20 74 68 65 20 6f 72 69 67 69 6e 61 ting the origina
21f0: 6c 20 73 6f 75 72 63 65 20 61 73 20 61 20 44 61 l source as a Da
2200: 74 61 62 61 73 65 20 54 61 62 6c 65 2e 3c 2f 6c tabase Table.</l
2210: 69 3e 0d 0a 3c 6c 69 3e 56 69 72 74 75 61 6c 20 i>..<li>Virtual
2220: 54 61 62 6c 65 73 20 68 61 76 65 20 76 65 72 79 Tables have very
2230: 20 70 6f 6f 72 20 73 70 65 65 64 20 70 65 72 66 poor speed perf
2240: 6f 72 6d 61 6e 63 65 73 2c 20 64 75 65 20 74 6f ormances, due to
2250: 20 74 68 65 20 20 65 6d 75 6c 61 74 69 6f 6e 2c the emulation,
2260: 20 61 73 20 63 6f 6d 70 61 72 65 64 20 74 6f 20 as compared to
2270: 67 65 6e 75 69 6e 65 20 44 61 74 61 62 61 73 65 genuine Database
2280: 20 54 61 62 6c 65 73 2e 3c 2f 6c 69 3e 0d 0a 3c Tables.</li>..<
2290: 6c 69 3e 43 6f 6d 70 6c 65 78 20 53 51 4c 20 71 li>Complex SQL q
22a0: 75 65 72 69 65 73 20 3c 62 3e 4a 4f 49 4e 3c 2f ueries <b>JOIN</
22b0: 62 3e 69 6e 67 20 73 65 76 65 72 61 6c 20 54 61 b>ing several Ta
22c0: 62 6c 65 73 20 63 61 6e 20 6f 66 74 65 6e 20 72 bles can often r
22d0: 65 74 75 72 6e 20 6f 64 64 20 61 6e 64 20 6d 69 eturn odd and mi
22e0: 73 6c 65 61 64 69 6e 67 20 72 65 73 75 6c 74 73 sleading results
22f0: 65 74 73 2c 20 77 68 65 6e 20 6f 6e 65 20 6f 72 ets, when one or
2300: 20 6d 6f 72 65 20 6f 66 20 74 68 65 20 3c 62 3e more of the <b>
2310: 4a 4f 49 4e 3c 2f 62 3e 65 64 20 54 61 62 6c 65 JOIN</b>ed Table
2320: 73 20 61 72 65 20 6f 66 20 74 68 65 20 56 69 72 s are of the Vir
2330: 74 75 61 6c 20 74 79 70 65 2e 3c 2f 6c 69 3e 0d tual type.</li>.
2340: 0a 3c 6c 69 3e 54 68 65 20 62 65 73 74 20 75 73 .<li>The best us
2350: 65 20 6f 66 20 61 20 56 69 72 74 75 61 6c 20 54 e of a Virtual T
2360: 61 62 6c 65 20 69 73 20 74 6f 20 70 72 65 66 6f able is to prefo
2370: 72 6d 20 61 20 62 61 73 69 63 20 64 61 74 61 20 rm a basic data
2380: 69 6d 70 6f 72 74 20 70 72 6f 63 65 73 73 2c 20 import process,
2390: 6f 72 20 74 6f 20 71 75 69 63 6b 6c 79 20 67 65 or to quickly ge
23a0: 74 20 61 6e 20 6f 76 65 72 61 6c 6c 20 67 6c 61 t an overall gla
23b0: 6e 63 65 20 61 74 20 61 20 66 75 6c 6c 20 64 61 nce at a full da
23c0: 74 61 73 65 74 20 77 69 74 68 6f 75 74 20 6e 65 taset without ne
23d0: 63 65 73 73 61 72 69 6c 79 20 69 6d 70 6f 72 74 cessarily import
23e0: 69 6e 67 20 69 74 20 69 6e 74 6f 20 74 68 65 20 ing it into the
23f0: 44 61 74 61 62 61 73 65 2e 3c 2f 6c 69 3e 0d 0a Database.</li>..
2400: 3c 6c 69 3e 50 72 65 74 65 6e 64 69 6e 67 20 74 <li>Pretending t
2410: 6f 20 75 73 65 20 61 20 56 69 72 74 75 61 6c 20 o use a Virtual
2420: 54 61 62 6c 65 20 61 73 20 61 20 66 75 6c 6c 20 Table as a full
2430: 72 65 70 6c 61 63 65 6d 65 6e 74 20 6f 66 20 69 replacement of i
2440: 6d 70 6f 72 74 69 6e 67 20 61 6c 6c 20 64 61 74 mporting all dat
2450: 61 20 77 69 74 68 69 6e 20 61 20 67 65 6e 75 69 a within a genui
2460: 6e 65 20 44 61 74 61 62 61 73 65 20 54 61 62 6c ne Database Tabl
2470: 65 20 69 73 20 73 74 72 6f 6e 67 6c 79 20 64 69 e is strongly di
2480: 73 63 6f 75 72 61 67 65 64 2c 20 61 6e 64 20 6e scouraged, and n
2490: 65 76 65 72 20 69 73 20 61 20 67 6f 6f 64 20 69 ever is a good i
24a0: 64 65 61 2e 3c 2f 6c 69 3e 0d 0a 3c 2f 75 6c 3e dea.</li>..</ul>
24b0: 3c 62 72 3e 0d 0a 3c 62 3e 57 61 72 6e 69 6e 67 <br>..<b>Warning
24c0: 3c 2f 62 3e 3a 20 56 69 72 74 75 61 6c 44 42 46 </b>: VirtualDBF
24d0: 20 54 61 62 6c 65 73 20 61 72 65 20 61 6c 77 61 Tables are alwa
24e0: 79 73 20 73 75 62 6a 65 63 74 20 74 6f 20 3c 62 ys subject to <b
24f0: 3e 52 45 41 44 2d 4f 4e 4c 59 3c 2f 62 3e 20 72 >READ-ONLY</b> r
2500: 65 73 74 72 69 63 74 69 6f 6e 73 2e 20 41 6e 79 estrictions. Any
2510: 20 61 74 74 65 6d 70 74 20 74 6f 20 74 6f 20 65 attempt to to e
2520: 78 65 63 75 74 65 20 61 6e 20 3c 62 3e 49 4e 53 xecute an <b>INS
2530: 45 52 54 3c 2f 62 3e 2c 20 3c 62 3e 55 50 44 41 ERT</b>, <b>UPDA
2540: 54 45 3c 2f 62 3e 20 6f 72 20 3c 62 3e 44 45 4c TE</b> or <b>DEL
2550: 45 54 45 3c 2f 62 3e 20 73 74 61 74 65 6d 65 6e ETE</b> statemen
2560: 74 20 77 69 6c 6c 20 61 6c 77 61 79 73 20 72 65 t will always re
2570: 74 75 72 6e 20 61 6e 20 65 72 72 6f 72 2e 3c 62 turn an error.<b
2580: 72 3e 0d 0a 3c 2f 74 64 3e 3c 2f 74 72 3e 3c 2f r>..</td></tr></
2590: 74 61 62 6c 65 3e 0d 0a 3c 62 72 3e 0d 0a 3c 74 table>..<br>..<t
25a0: 61 62 6c 65 20 62 67 63 6f 6c 6f 72 3d 22 23 65 able bgcolor="#e
25b0: 30 65 30 65 30 22 20 63 65 6c 6c 70 61 64 64 69 0e0e0" cellpaddi
25c0: 6e 67 3d 22 31 38 22 3e 3c 74 72 3e 3c 74 64 3e ng="18"><tr><td>
25d0: 0d 0a 3c 68 33 3e 52 65 6c 61 74 65 64 20 54 6f ..<h3>Related To
25e0: 70 69 63 73 3c 2f 68 33 3e 0d 0a 3c 75 6c 3e 0d pics</h3>..<ul>.
25f0: 0a 3c 6c 69 3e 54 68 65 20 3c 62 3e 49 6d 70 6f .<li>The <b>Impo
2600: 72 74 44 42 46 28 29 3c 2f 62 3e 20 53 51 4c 20 rtDBF()</b> SQL
2610: 66 75 6e 63 74 69 6f 6e 20 61 6c 6c 6f 77 73 20 function allows
2620: 74 6f 20 63 72 65 61 74 65 20 61 6e 64 20 70 6f to create and po
2630: 70 75 6c 61 74 65 20 61 20 67 65 6e 75 69 6e 65 pulate a genuine
2640: 20 44 61 74 61 62 61 73 65 20 54 61 62 6c 65 20 Database Table
2650: 62 79 20 69 6d 70 6f 72 74 69 6e 67 20 61 6e 20 by importing an
2660: 65 78 74 65 72 6e 61 6c 20 44 42 46 20 66 69 6c external DBF fil
2670: 65 2e 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e 41 6e 64 e.</li>..<li>And
2680: 20 74 68 65 20 3c 62 3e 45 78 70 6f 72 74 44 42 the <b>ExportDB
2690: 46 28 29 3c 2f 62 3e 20 73 69 73 74 65 72 20 66 F()</b> sister f
26a0: 75 6e 63 74 69 6f 6e 20 61 6c 6c 6f 77 73 20 74 unction allows t
26b0: 6f 20 64 69 72 65 63 74 6c 79 20 65 78 70 6f 72 o directly expor
26c0: 74 20 61 20 77 68 6f 6c 65 20 44 61 74 61 62 61 t a whole Databa
26d0: 73 65 20 54 61 62 6c 65 20 69 6e 74 6f 20 61 6e se Table into an
26e0: 20 65 78 74 65 72 6e 61 6c 20 44 42 46 20 66 69 external DBF fi
26f0: 6c 65 2e 3c 2f 6c 69 3e 0d 0a 3c 2f 75 6c 3e 0d le.</li>..</ul>.
2700: 0a 3c 2f 74 64 3e 3c 2f 74 72 3e 3c 2f 74 61 62 .</td></tr></tab
2710: 6c 65 3e 0d 0a 3c 62 72 3e 0d 0a 3c 68 72 3e 0d le>..<br>..<hr>.
2720: 0a 3c 68 31 3e 3c 61 20 69 64 3d 22 56 69 72 74 .<h1><a id="Virt
2730: 75 61 6c 54 65 78 74 22 3e 56 69 72 74 75 61 6c ualText">Virtual
2740: 54 65 78 74 3c 2f 61 3e 3c 2f 68 31 3e 0d 0a 54 Text</a></h1>..T
2750: 68 65 20 3c 62 3e 56 69 72 74 75 61 6c 54 65 78 he <b>VirtualTex
2760: 74 3c 2f 62 3e 20 49 6e 74 65 72 66 61 63 65 20 t</b> Interface
2770: 61 6c 6c 6f 77 73 20 74 6f 20 64 69 72 65 63 74 allows to direct
2780: 6c 79 20 61 63 63 65 73 73 20 61 6e 20 65 78 74 ly access an ext
2790: 65 72 6e 61 6c 20 54 65 78 74 20 66 69 6c 65 20 ernal Text file
27a0: 62 79 20 75 73 69 6e 67 20 73 74 61 6e 64 61 72 by using standar
27b0: 64 20 53 70 61 74 69 61 6c 20 53 51 4c 20 71 75 d Spatial SQL qu
27c0: 65 72 69 65 73 2e 3c 62 72 3e 0d 0a 54 68 65 20 eries.<br>..The
27d0: 54 65 78 74 20 46 69 6c 65 20 69 73 20 65 78 70 Text File is exp
27e0: 65 63 74 65 64 20 74 6f 20 63 6f 6e 74 61 69 6e ected to contain
27f0: 20 61 20 70 72 6f 70 65 72 6c 79 20 66 6f 72 6d a properly form
2800: 61 74 74 65 64 20 54 61 62 6c 65 20 61 63 63 6f atted Table acco
2810: 72 64 69 6e 67 6c 79 20 74 6f 20 73 6f 6d 65 20 rdingly to some
2820: 3c 62 3e 44 65 6c 69 6d 69 74 65 72 2d 53 65 70 <b>Delimiter-Sep
2830: 61 72 61 74 65 64 2d 56 61 6c 75 65 73 3c 2f 62 arated-Values</b
2840: 3e 20 66 6f 72 6d 61 74 20 28 63 6f 6d 6d 61 20 > format (comma
2850: 73 65 70 61 72 61 74 65 64 20 76 61 6c 75 65 73 separated values
2860: 20 3c 69 3e 2a 2e 63 73 76 3c 2f 69 3e 2c 20 74 <i>*.csv</i>, t
2870: 61 62 20 73 65 70 61 72 61 74 65 64 20 76 61 6c ab separated val
2880: 75 65 73 20 3c 69 3e 2a 2e 74 78 74 3c 2f 69 3e ues <i>*.txt</i>
2890: 20 61 6e 64 20 61 6c 69 6b 65 29 2e 3c 62 72 3e and alike).<br>
28a0: 0d 0a 53 79 6e 74 61 78 20 66 6f 72 20 63 72 65 ..Syntax for cre
28b0: 61 74 69 6e 67 20 61 20 56 69 72 74 75 61 6c 54 ating a VirtualT
28c0: 65 78 74 20 54 61 62 6c 65 3a 0d 0a 3c 76 65 72 ext Table:..<ver
28d0: 62 61 74 69 6d 3e 0d 0a 53 45 4c 45 43 54 20 43 batim>..SELECT C
28e0: 52 45 41 54 45 20 56 49 52 54 55 41 4c 20 54 41 REATE VIRTUAL TA
28f0: 42 4c 45 20 6d 79 5f 74 61 62 6c 65 20 55 53 49 BLE my_table USI
2900: 4e 47 20 56 69 72 74 75 61 6c 54 65 78 74 20 28 NG VirtualText (
2910: 20 74 65 78 74 66 69 6c 65 5f 70 61 74 68 20 2c textfile_path ,
2920: 20 63 68 61 72 73 65 74 5f 65 6e 63 6f 64 69 6e charset_encodin
2930: 67 20 29 3b 0d 0a 0d 0a 53 45 4c 45 43 54 20 43 g );....SELECT C
2940: 52 45 41 54 45 20 56 49 52 54 55 41 4c 20 54 41 REATE VIRTUAL TA
2950: 42 4c 45 20 6d 79 5f 74 61 62 6c 65 20 55 53 49 BLE my_table USI
2960: 4e 47 20 56 69 72 74 75 61 6c 54 65 78 74 20 28 NG VirtualText (
2970: 20 74 65 78 74 66 69 6c 65 5f 70 61 74 68 20 2c textfile_path ,
2980: 20 63 68 61 72 73 65 74 5f 65 6e 63 6f 64 69 6e charset_encodin
2990: 67 20 2c 20 66 69 72 73 74 5f 72 6f 77 5f 61 73 g , first_row_as
29a0: 5f 74 69 74 6c 65 73 20 29 3b 0d 0a 0d 0a 53 45 _titles );....SE
29b0: 4c 45 43 54 20 43 52 45 41 54 45 20 56 49 52 54 LECT CREATE VIRT
29c0: 55 41 4c 20 54 41 42 4c 45 20 6d 79 5f 74 61 62 UAL TABLE my_tab
29d0: 6c 65 20 55 53 49 4e 47 20 56 69 72 74 75 61 6c le USING Virtual
29e0: 54 65 78 74 20 28 20 74 65 78 74 66 69 6c 65 5f Text ( textfile_
29f0: 70 61 74 68 20 2c 20 63 68 61 72 73 65 74 5f 65 path , charset_e
2a00: 6e 63 6f 64 69 6e 67 20 2c 20 66 69 72 73 74 5f ncoding , first_
2a10: 72 6f 77 5f 61 73 5f 74 69 74 6c 65 73 20 2c 20 row_as_titles ,
2a20: 64 65 63 69 6d 61 6c 5f 73 65 70 61 72 61 74 6f decimal_separato
2a30: 72 20 29 3b 0d 0a 0d 0a 53 45 4c 45 43 54 20 43 r );....SELECT C
2a40: 52 45 41 54 45 20 56 49 52 54 55 41 4c 20 54 41 REATE VIRTUAL TA
2a50: 42 4c 45 20 6d 79 5f 74 61 62 6c 65 20 55 53 49 BLE my_table USI
2a60: 4e 47 20 56 69 72 74 75 61 6c 54 65 78 74 20 28 NG VirtualText (
2a70: 20 74 65 78 74 66 69 6c 65 5f 70 61 74 68 20 2c textfile_path ,
2a80: 20 63 68 61 72 73 65 74 5f 65 6e 63 6f 64 69 6e charset_encodin
2a90: 67 20 2c 20 66 69 72 73 74 5f 72 6f 77 5f 61 73 g , first_row_as
2aa0: 5f 74 69 74 6c 65 73 20 2c 20 64 65 63 69 6d 61 _titles , decima
2ab0: 6c 5f 73 65 70 61 72 61 74 6f 72 20 2c 20 74 65 l_separator , te
2ac0: 78 74 5f 73 65 70 61 72 61 74 6f 72 20 29 3b 0d xt_separator );.
2ad0: 0a 0d 0a 53 45 4c 45 43 54 20 43 52 45 41 54 45 ...SELECT CREATE
2ae0: 20 56 49 52 54 55 41 4c 20 54 41 42 4c 45 20 6d VIRTUAL TABLE m
2af0: 79 5f 74 61 62 6c 65 20 55 53 49 4e 47 20 56 69 y_table USING Vi
2b00: 72 74 75 61 6c 54 65 78 74 20 28 20 74 65 78 74 rtualText ( text
2b10: 66 69 6c 65 5f 70 61 74 68 20 2c 20 63 68 61 72 file_path , char
2b20: 73 65 74 5f 65 6e 63 6f 64 69 6e 67 20 2c 20 66 set_encoding , f
2b30: 69 72 73 74 5f 72 6f 77 5f 61 73 5f 74 69 74 6c irst_row_as_titl
2b40: 65 73 20 2c 20 64 65 63 69 6d 61 6c 5f 73 65 70 es , decimal_sep
2b50: 61 72 61 74 6f 72 20 2c 20 74 65 78 74 5f 73 65 arator , text_se
2b60: 70 61 72 61 74 6f 72 20 2c 20 66 69 65 6c 64 5f parator , field_
2b70: 73 65 70 61 72 61 74 6f 72 20 29 3b 0d 0a 3c 2f separator );..</
2b80: 76 65 72 62 61 74 69 6d 3e 0d 0a 53 75 70 70 6f verbatim>..Suppo
2b90: 72 74 65 64 20 61 72 67 75 6d 65 6e 74 73 20 61 rted arguments a
2ba0: 6e 64 20 74 68 65 69 72 20 69 6e 74 65 72 70 72 nd their interpr
2bb0: 65 74 61 74 69 6f 6e 3a 0d 0a 3c 75 6c 3e 0d 0a etation:..<ul>..
2bc0: 3c 6c 69 3e 3c 62 3e 74 65 78 74 66 69 6c 65 5f <li><b>textfile_
2bd0: 70 61 74 68 3c 2f 62 3e 20 28 3c 69 3e 3c 62 3e path</b> (<i><b>
2be0: 6d 61 6e 64 61 74 6f 72 79 3c 2f 62 3e 3c 2f 69 mandatory</b></i
2bf0: 3e 29 3a 20 74 68 65 20 72 65 6c 61 74 69 76 65 >): the relative
2c00: 20 6f 72 20 61 62 73 6f 6c 75 74 65 20 70 61 74 or absolute pat
2c10: 68 6e 61 6d 65 20 6c 65 61 64 69 6e 67 20 74 6f hname leading to
2c20: 20 74 68 65 20 65 78 74 65 72 6e 61 6c 20 54 65 the external Te
2c30: 78 74 20 66 69 6c 65 2e 0d 0a 3c 75 6c 3e 0d 0a xt file...<ul>..
2c40: 3c 6c 69 3e 3c 62 3e 4e 6f 74 65 3c 2f 62 3e 3a <li><b>Note</b>:
2c50: 20 74 68 65 20 66 75 6c 6c 20 70 61 74 68 6e 61 the full pathna
2c60: 6d 65 20 6d 75 73 74 20 62 65 20 70 61 73 73 65 me must be passe
2c70: 64 2c 20 69 6e 63 6c 75 64 69 6e 67 20 61 6e 20 d, including an
2c80: 65 76 65 6e 74 75 61 6c 20 66 69 6e 61 6c 20 73 eventual final s
2c90: 75 66 66 69 78 20 28 3c 69 3e 2a 2e 74 78 74 3c uffix (<i>*.txt<
2ca0: 2f 69 3e 2c 20 3c 69 3e 2a 2e 63 73 76 3c 2f 69 /i>, <i>*.csv</i
2cb0: 3e 20 61 6e 64 20 61 6c 69 6b 65 29 2e 3c 2f 6c > and alike).</l
2cc0: 69 3e 0d 0a 3c 2f 75 6c 3e 3c 2f 6c 69 3e 0d 0a i>..</ul></li>..
2cd0: 3c 6c 69 3e 3c 62 3e 63 68 61 72 73 65 74 5f 65 <li><b>charset_e
2ce0: 6e 63 6f 64 69 6e 67 3c 2f 62 3e 20 28 3c 69 3e ncoding</b> (<i>
2cf0: 3c 62 3e 6d 61 6e 64 61 74 6f 72 79 3c 2f 62 3e <b>mandatory</b>
2d00: 3c 2f 69 3e 29 3a 20 63 61 6e 6f 6e 69 63 61 6c </i>): canonical
2d10: 20 6e 61 6d 65 20 6f 66 20 74 68 65 20 63 68 61 name of the cha
2d20: 72 73 65 74 20 65 6e 63 6f 64 69 6e 67 20 61 64 rset encoding ad
2d30: 6f 70 74 65 64 20 62 79 20 74 68 65 20 54 65 78 opted by the Tex
2d40: 74 20 66 69 6c 65 2e 0d 0a 3c 75 6c 3e 0d 0a 3c t file...<ul>..<
2d50: 6c 69 3e 45 78 61 6d 70 6c 65 73 20 6f 66 20 76 li>Examples of v
2d60: 61 6c 69 64 20 6e 61 6d 65 73 20 61 72 65 3a 20 alid names are:
2d70: 3c 62 3e 41 53 43 49 49 3c 2f 62 3e 2c 20 3c 62 <b>ASCII</b>, <b
2d80: 3e 55 54 46 2d 38 3c 2f 62 3e 2c 20 3c 62 3e 43 >UTF-8</b>, <b>C
2d90: 50 38 35 30 3c 2f 62 3e 2c 20 3c 62 3e 43 50 31 P850</b>, <b>CP1
2da0: 32 35 32 3c 2f 62 3e 2c 20 3c 62 3e 49 53 4f 2d 252</b>, <b>ISO-
2db0: 38 38 34 39 2d 31 3c 2f 62 3e 3c 2f 6c 69 3e 0d 8849-1</b></li>.
2dc0: 0a 3c 6c 69 3e 59 6f 75 20 63 61 6e 20 63 68 65 .<li>You can che
2dd0: 63 6b 20 74 68 65 20 66 75 6c 6c 20 6c 69 73 74 ck the full list
2de0: 20 6f 66 20 73 75 70 70 6f 72 74 65 64 20 63 68 of supported ch
2df0: 61 72 73 65 74 20 65 6e 63 6f 64 69 6e 67 73 20 arset encodings
2e00: 3c 61 20 68 72 65 66 3d 22 68 74 74 70 73 3a 2f <a href="https:/
2e10: 2f 77 77 77 2e 67 6e 75 2e 6f 72 67 2f 73 6f 66 /www.gnu.org/sof
2e20: 74 77 61 72 65 2f 6c 69 62 69 63 6f 6e 76 2f 22 tware/libiconv/"
2e30: 3e 68 65 72 65 3c 2f 61 3e 2e 3c 2f 6c 69 3e 0d >here</a>.</li>.
2e40: 0a 3c 2f 75 6c 3e 3c 2f 6c 69 3e 0d 0a 3c 6c 69 .</ul></li>..<li
2e50: 3e 3c 62 3e 66 69 72 73 74 5f 72 6f 77 5f 61 73 ><b>first_row_as
2e60: 5f 74 69 74 6c 65 73 3c 2f 62 3e 20 28 3c 69 3e _titles</b> (<i>
2e70: 3c 62 3e 6f 70 74 69 6f 6e 61 6c 3c 2f 62 3e 3c <b>optional</b><
2e80: 2f 69 3e 29 3a 20 74 68 69 73 20 69 73 20 61 20 /i>): this is a
2e90: 3c 62 3e 42 4f 4f 4c 45 41 4e 3c 2f 62 3e 20 66 <b>BOOLEAN</b> f
2ea0: 6c 61 67 3a 0d 0a 3c 75 6c 3e 0d 0a 3c 6c 69 3e lag:..<ul>..<li>
2eb0: 69 66 20 73 65 74 20 74 6f 20 3c 62 3e 30 3c 2f if set to <b>0</
2ec0: 62 3e 20 28 3c 62 3e 46 41 4c 53 45 3c 2f 62 3e b> (<b>FALSE</b>
2ed0: 29 20 61 6c 6c 20 63 6f 6c 75 6d 6e 20 6e 61 6d ) all column nam
2ee0: 65 73 20 77 69 6c 6c 20 62 65 20 61 75 74 6f 6d es will be autom
2ef0: 61 74 69 63 61 6c 6c 79 20 73 65 74 20 62 79 20 atically set by
2f00: 75 73 69 6e 67 20 61 20 70 72 6f 67 72 65 73 73 using a progress
2f10: 69 76 65 20 73 65 71 75 65 6e 63 65 2e 3c 2f 6c ive sequence.</l
2f20: 69 3e 0d 0a 3c 6c 69 3e 69 66 20 73 65 74 20 74 i>..<li>if set t
2f30: 6f 20 61 6e 79 20 6f 74 68 65 72 20 69 6e 74 65 o any other inte
2f40: 67 65 72 20 76 61 6c 75 65 20 28 3c 62 3e 54 52 ger value (<b>TR
2f50: 55 45 3c 2f 62 3e 29 20 61 6c 6c 20 63 6f 6c 75 UE</b>) all colu
2f60: 6d 6e 20 6e 61 6d 65 73 20 77 69 6c 6c 20 62 79 mn names will by
2f70: 20 65 78 70 65 63 74 65 64 20 74 6f 20 62 65 20 expected to be
2f80: 64 65 66 69 6e 65 64 20 69 6e 20 74 68 65 20 76 defined in the v
2f90: 65 72 79 20 66 69 72 73 74 20 72 6f 77 20 6f 66 ery first row of
2fa0: 20 74 68 65 20 54 65 78 74 20 66 69 6c 65 2e 3c the Text file.<
2fb0: 2f 6c 69 3e 0d 0a 3c 6c 69 3e 69 66 20 6e 6f 74 /li>..<li>if not
2fc0: 20 65 78 70 6c 69 63 69 74 6c 79 20 73 70 65 63 explicitly spec
2fd0: 69 66 69 65 64 2c 20 3c 62 3e 54 52 55 45 3c 2f ified, <b>TRUE</
2fe0: 62 3e 20 77 69 6c 6c 20 61 6c 77 61 79 73 20 62 b> will always b
2ff0: 65 20 61 73 73 75 6d 65 64 20 28 64 65 66 61 75 e assumed (defau
3000: 6c 74 20 73 65 74 74 69 6e 67 29 2e 3c 2f 6c 69 lt setting).</li
3010: 3e 0d 0a 3c 2f 75 6c 3e 3c 2f 6c 69 3e 0d 0a 3c >..</ul></li>..<
3020: 75 6c 3e 0d 0a 3c 2f 75 6c 3e 3c 2f 6c 69 3e 0d ul>..</ul></li>.
3030: 0a 3c 6c 69 3e 3c 62 3e 64 65 63 69 6d 61 6c 5f .<li><b>decimal_
3040: 73 65 70 61 72 61 74 6f 72 3c 2f 62 3e 20 28 3c separator</b> (<
3050: 69 3e 3c 62 3e 6f 70 74 69 6f 6e 61 6c 3c 2f 62 i><b>optional</b
3060: 3e 3c 2f 69 3e 29 3a 20 74 68 65 20 63 68 61 72 ></i>): the char
3070: 61 63 74 65 72 20 61 63 74 69 6e 67 20 61 73 20 acter acting as
3080: 61 20 73 65 70 61 72 61 74 6f 72 20 62 65 74 77 a separator betw
3090: 65 65 6e 20 74 68 65 20 69 6e 74 65 67 65 72 20 een the integer
30a0: 61 6e 64 20 64 65 63 69 6d 61 6c 20 70 61 72 74 and decimal part
30b0: 73 20 6f 66 20 61 20 6e 75 6d 62 65 72 2e 3c 62 s of a number.<b
30c0: 72 3e 0d 0a 56 61 6c 69 64 20 76 61 6c 75 65 73 r>..Valid values
30d0: 20 61 72 65 20 61 6e 79 20 70 72 69 6e 74 61 62 are any printab
30e0: 6c 65 20 63 68 61 72 61 63 74 65 72 20 6f 72 20 le character or
30f0: 74 68 65 20 73 70 65 63 69 61 6c 20 6d 6e 65 6d the special mnem
3100: 6f 6e 69 63 20 6e 6f 74 61 74 69 6f 6e 73 20 3c onic notations <
3110: 62 3e 50 4f 49 4e 54 3c 2f 62 3e 20 6f 72 20 3c b>POINT</b> or <
3120: 62 3e 43 4f 4d 4d 41 3c 2f 62 3e 2e 3c 62 72 3e b>COMMA</b>.<br>
3130: 0d 0a 49 66 20 6e 6f 74 20 65 78 70 6c 69 63 69 ..If not explici
3140: 74 6c 79 20 73 70 65 63 69 66 69 65 64 2c 20 3c tly specified, <
3150: 62 3e 50 4f 49 4e 54 3c 2f 62 3e 20 77 69 6c 6c b>POINT</b> will
3160: 20 61 6c 77 61 79 73 20 62 65 20 61 73 73 75 6d always be assum
3170: 65 64 20 28 64 65 66 61 75 6c 74 20 73 65 74 74 ed (default sett
3180: 69 6e 67 29 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e 3c ing)</li>..<li><
3190: 62 3e 74 65 78 74 5f 73 65 70 61 72 61 74 6f 72 b>text_separator
31a0: 3c 2f 62 3e 20 28 3c 69 3e 3c 62 3e 6f 70 74 69 </b> (<i><b>opti
31b0: 6f 6e 61 6c 3c 2f 62 3e 3c 2f 69 3e 29 3a 20 74 onal</b></i>): t
31c0: 68 65 20 63 68 61 72 61 63 74 65 72 20 61 63 74 he character act
31d0: 69 6e 67 20 61 73 20 61 20 73 74 72 69 6e 67 20 ing as a string
31e0: 64 65 6c 69 6d 69 74 65 72 2e 3c 62 72 3e 0d 0a delimiter.<br>..
31f0: 56 61 6c 69 64 20 76 61 6c 75 65 73 20 61 72 65 Valid values are
3200: 20 61 6e 79 20 70 72 69 6e 74 61 62 6c 65 20 63 any printable c
3210: 68 61 72 61 63 74 65 72 20 6f 72 20 74 68 65 20 haracter or the
3220: 73 70 65 63 69 61 6c 20 6d 6e 65 6d 6f 6e 69 63 special mnemonic
3230: 20 6e 6f 74 61 74 69 6f 6e 73 20 3c 62 3e 53 49 notations <b>SI
3240: 4e 47 4c 45 51 55 4f 54 45 3c 2f 62 3e 2c 20 3c NGLEQUOTE</b>, <
3250: 62 3e 44 4f 55 42 4c 45 51 55 4f 54 45 3c 2f 62 b>DOUBLEQUOTE</b
3260: 3e 20 6f 72 20 3c 62 3e 4e 4f 4e 45 3c 2f 62 3e > or <b>NONE</b>
3270: 2e 3c 62 72 3e 0d 0a 49 66 20 6e 6f 74 20 65 78 .<br>..If not ex
3280: 70 6c 69 63 69 74 6c 79 20 73 70 65 63 69 66 69 plicitly specifi
3290: 65 64 2c 20 3c 62 3e 44 4f 55 42 4c 45 51 55 4f ed, <b>DOUBLEQUO
32a0: 54 45 3c 2f 62 3e 20 77 69 6c 6c 20 61 6c 77 61 TE</b> will alwa
32b0: 79 73 20 62 65 20 61 73 73 75 6d 65 64 20 28 64 ys be assumed (d
32c0: 65 66 61 75 6c 74 20 73 65 74 74 69 6e 67 29 3c efault setting)<
32d0: 2f 6c 69 3e 0d 0a 3c 6c 69 3e 3c 62 3e 66 69 65 /li>..<li><b>fie
32e0: 6c 64 5f 73 65 70 61 72 61 74 6f 72 3c 2f 62 3e ld_separator</b>
32f0: 20 28 3c 69 3e 3c 62 3e 6f 70 74 69 6f 6e 61 6c (<i><b>optional
3300: 3c 2f 62 3e 3c 2f 69 3e 29 3a 20 74 68 65 20 63 </b></i>): the c
3310: 68 61 72 61 63 74 65 72 20 61 63 74 69 6e 67 20 haracter acting
3320: 61 73 20 61 20 64 65 6c 69 6d 69 74 65 72 20 62 as a delimiter b
3330: 65 74 77 65 65 6e 20 63 6f 6e 73 65 63 75 74 69 etween consecuti
3340: 76 65 20 66 69 65 6c 64 73 2e 3c 62 72 3e 0d 0a ve fields.<br>..
3350: 56 61 6c 69 64 20 76 61 6c 75 65 73 20 61 72 65 Valid values are
3360: 20 61 6e 79 20 70 72 69 6e 74 61 62 6c 65 20 63 any printable c
3370: 68 61 72 61 63 74 65 72 20 6f 72 20 74 68 65 20 haracter or the
3380: 73 70 65 63 69 61 6c 20 6d 6e 65 6d 6f 6e 69 63 special mnemonic
3390: 20 6e 6f 74 61 74 69 6f 6e 73 20 3c 62 3e 54 41 notations <b>TA
33a0: 42 3c 2f 62 3e 2e 3c 62 72 3e 0d 0a 49 66 20 6e B</b>.<br>..If n
33b0: 6f 74 20 65 78 70 6c 69 63 69 74 6c 79 20 73 70 ot explicitly sp
33c0: 65 63 69 66 69 65 64 2c 20 3c 62 3e 54 41 42 3c ecified, <b>TAB<
33d0: 2f 62 3e 20 77 69 6c 6c 20 61 6c 77 61 79 73 20 /b> will always
33e0: 62 65 20 61 73 73 75 6d 65 64 20 28 64 65 66 61 be assumed (defa
33f0: 75 6c 74 20 73 65 74 74 69 6e 67 29 3c 2f 6c 69 ult setting)</li
3400: 3e 0d 0a 3c 2f 75 6c 3e 3c 62 72 3e 0d 0a 3c 74 >..</ul><br>..<t
3410: 61 62 6c 65 20 62 67 63 6f 6c 6f 72 3d 22 23 66 able bgcolor="#f
3420: 66 66 66 64 30 22 20 63 65 6c 6c 70 61 64 64 69 fffd0" cellpaddi
3430: 6e 67 3d 22 31 38 22 3e 3c 74 72 3e 3c 74 64 3e ng="18"><tr><td>
3440: 0d 0a 3c 62 3e 4e 6f 74 65 3c 2f 62 3e 3a 20 61 ..<b>Note</b>: a
3450: 6e 79 20 54 65 78 74 20 53 74 72 69 6e 67 2c 20 ny Text String,
3460: 71 75 6f 74 65 64 20 6f 72 20 6e 6f 74 2c 20 77 quoted or not, w
3470: 68 65 6e 20 69 74 20 61 70 70 65 61 72 73 20 61 hen it appears a
3480: 73 20 61 20 56 69 72 74 75 61 6c 20 54 61 62 6c s a Virtual Tabl
3490: 65 20 61 72 67 75 6d 65 6e 74 20 68 61 73 20 74 e argument has t
34a0: 68 65 20 73 61 6d 65 20 65 66 66 65 63 74 2e 0d he same effect..
34b0: 0a 3c 76 65 72 62 61 74 69 6d 3e 0d 0a 53 45 4c .<verbatim>..SEL
34c0: 45 43 54 20 43 52 45 41 54 45 20 56 49 52 54 55 ECT CREATE VIRTU
34d0: 41 4c 20 54 41 42 4c 45 20 6d 79 5f 74 61 62 6c AL TABLE my_tabl
34e0: 65 20 55 53 49 4e 47 20 56 69 72 74 75 61 6c 54 e USING VirtualT
34f0: 65 78 74 28 20 2f 68 6f 6d 65 2f 73 61 6e 64 72 ext( /home/sandr
3500: 6f 2f 6d 79 66 69 6c 65 2e 74 78 74 20 2c 20 43 o/myfile.txt , C
3510: 50 31 32 35 32 20 2c 20 31 20 2c 20 50 4f 49 4e P1252 , 1 , POIN
3520: 54 20 2c 20 4e 4f 4e 45 20 2c 20 54 41 42 20 29 T , NONE , TAB )
3530: 3b 0d 0a 6f 72 0d 0a 53 45 4c 45 43 54 20 43 52 ;..or..SELECT CR
3540: 45 41 54 45 20 56 49 52 54 55 41 4c 20 54 41 42 EATE VIRTUAL TAB
3550: 4c 45 20 6d 79 5f 74 61 62 6c 65 20 55 53 49 4e LE my_table USIN
3560: 47 20 56 69 72 74 75 61 6c 54 65 78 74 28 20 27 G VirtualText( '
3570: 2f 68 6f 6d 65 2f 73 61 6e 64 72 6f 2f 6d 79 66 /home/sandro/myf
3580: 69 6c 65 2e 74 78 74 27 20 2c 20 27 43 50 31 32 ile.txt' , 'CP12
3590: 35 32 27 20 2c 20 31 20 2c 20 27 50 4f 49 4e 54 52' , 1 , 'POINT
35a0: 27 20 2c 20 27 4e 4f 4e 45 27 20 2c 20 27 54 41 ' , 'NONE' , 'TA
35b0: 42 27 20 29 3b 0d 0a 3c 2f 76 65 72 62 61 74 69 B' );..</verbati
35c0: 6d 3e 0d 0a 42 6f 74 68 20 6e 6f 74 61 74 69 6f m>..Both notatio
35d0: 6e 73 20 77 69 6c 6c 20 70 72 6f 64 75 63 65 20 ns will produce
35e0: 74 68 65 20 73 61 6d 65 20 72 65 73 75 6c 74 2e the same result.
35f0: 0d 0a 3c 2f 74 64 3e 3c 2f 74 72 3e 3c 2f 74 61 ..</td></tr></ta
3600: 62 6c 65 3e 0d 0a 3c 62 72 3e 0d 0a 3c 74 61 62 ble>..<br>..<tab
3610: 6c 65 20 62 67 63 6f 6c 6f 72 3d 22 23 64 30 66 le bgcolor="#d0f
3620: 66 64 30 22 20 63 65 6c 6c 70 61 64 64 69 6e 67 fd0" cellpadding
3630: 3d 22 31 38 22 3e 3c 74 72 3e 3c 74 64 3e 0d 0a ="18"><tr><td>..
3640: 3c 68 33 3e 42 65 73 74 20 70 72 61 63 74 69 63 <h3>Best practic
3650: 65 73 20 61 6e 64 20 6b 6e 6f 77 6e 20 6c 69 6d es and known lim
3660: 69 74 61 74 69 6f 6e 73 3c 2f 68 33 3e 0d 0a 3c itations</h3>..<
3670: 75 6c 3e 0d 0a 3c 6c 69 3e 3c 62 3e 42 65 20 61 ul>..<li><b>Be a
3680: 77 61 72 65 3c 2f 62 3e 3a 20 6f 70 65 6e 69 6e ware</b>: openin
3690: 67 20 62 69 67 20 6f 72 20 68 75 67 65 20 74 65 g big or huge te
36a0: 78 74 20 66 69 6c 65 73 20 63 6f 75 6c 64 20 65 xt files could e
36b0: 61 73 69 6c 79 20 72 65 71 75 69 72 65 20 6d 61 asily require ma
36c0: 73 73 69 76 65 20 52 41 4d 20 61 6c 6c 6f 63 61 ssive RAM alloca
36d0: 74 69 6f 6e 73 2e 3c 2f 6c 69 3e 0d 0a 3c 6c 69 tions.</li>..<li
36e0: 3e 3c 62 3e 57 61 72 6e 69 6e 67 3c 2f 62 3e 3a ><b>Warning</b>:
36f0: 20 61 74 74 65 6d 70 74 69 6e 67 20 74 6f 20 61 attempting to a
3700: 63 63 65 73 73 20 61 6e 20 65 78 74 65 72 6e 61 ccess an externa
3710: 6c 20 54 65 78 74 20 66 69 6c 65 20 62 79 20 62 l Text file by b
3720: 6c 69 6e 64 6c 79 20 73 70 65 63 69 66 79 69 6e lindly specifyin
3730: 67 20 72 61 6e 64 6f 6d 6c 79 20 63 68 6f 73 65 g randomly chose
3740: 6e 20 64 65 6c 69 6d 69 74 65 72 73 20 6f 72 20 n delimiters or
3750: 73 65 70 61 72 61 74 6f 72 73 20 6d 61 79 20 65 separators may e
3760: 61 73 69 6c 79 20 68 61 76 65 20 63 61 74 61 73 asily have catas
3770: 74 72 6f 70 68 69 63 20 65 66 66 65 63 74 73 2e trophic effects.
3780: 3c 62 72 3e 0d 0a 41 6c 77 61 79 73 20 63 61 72 <br>..Always car
3790: 65 66 75 6c 6c 79 20 63 68 65 63 6b 20 74 68 65 efully check the
37a0: 20 61 63 74 75 61 6c 20 73 74 72 75 63 74 75 72 actual structur
37b0: 65 20 6f 66 20 74 68 65 20 54 65 78 74 20 66 69 e of the Text fi
37c0: 6c 65 20 62 65 66 6f 72 65 20 61 74 74 65 6d 70 le before attemp
37d0: 74 69 6e 67 20 74 6f 20 61 63 63 65 73 73 20 69 ting to access i
37e0: 74 2e 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e 56 69 72 t.</li>..<li>Vir
37f0: 74 75 61 6c 20 54 61 62 6c 65 73 20 61 72 65 20 tual Tables are
3800: 6e 6f 74 20 72 65 61 6c 6c 79 20 67 65 6e 75 69 not really genui
3810: 6e 65 20 44 61 74 61 62 61 73 65 20 54 61 62 6c ne Database Tabl
3820: 65 73 2c 20 74 68 65 79 20 61 72 65 20 6a 75 73 es, they are jus
3830: 74 20 65 6d 75 6c 61 74 69 6e 67 20 74 68 65 20 t emulating the
3840: 6f 72 69 67 69 6e 61 6c 20 73 6f 75 72 63 65 20 original source
3850: 61 73 20 61 20 44 61 74 61 62 61 73 65 20 54 61 as a Database Ta
3860: 62 6c 65 2e 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e 56 ble.</li>..<li>V
3870: 69 72 74 75 61 6c 20 54 61 62 6c 65 73 20 68 61 irtual Tables ha
3880: 76 65 20 76 65 72 79 20 70 6f 6f 72 20 73 70 65 ve very poor spe
3890: 65 64 20 70 65 72 66 6f 72 6d 61 6e 63 65 73 2c ed performances,
38a0: 20 64 75 65 20 74 6f 20 74 68 65 20 20 65 6d 75 due to the emu
38b0: 6c 61 74 69 6f 6e 2c 20 61 73 20 63 6f 6d 70 61 lation, as compa
38c0: 72 65 64 20 74 6f 20 67 65 6e 75 69 6e 65 20 44 red to genuine D
38d0: 61 74 61 62 61 73 65 20 54 61 62 6c 65 73 2e 3c atabase Tables.<
38e0: 2f 6c 69 3e 0d 0a 3c 6c 69 3e 43 6f 6d 70 6c 65 /li>..<li>Comple
38f0: 78 20 53 51 4c 20 71 75 65 72 69 65 73 20 3c 62 x SQL queries <b
3900: 3e 4a 4f 49 4e 3c 2f 62 3e 69 6e 67 20 73 65 76 >JOIN</b>ing sev
3910: 65 72 61 6c 20 54 61 62 6c 65 73 20 63 61 6e 20 eral Tables can
3920: 6f 66 74 65 6e 20 72 65 74 75 72 6e 20 6f 64 64 often return odd
3930: 20 61 6e 64 20 6d 69 73 6c 65 61 64 69 6e 67 20 and misleading
3940: 72 65 73 75 6c 74 73 65 74 73 2c 20 77 68 65 6e resultsets, when
3950: 20 6f 6e 65 20 6f 72 20 6d 6f 72 65 20 6f 66 20 one or more of
3960: 74 68 65 20 3c 62 3e 4a 4f 49 4e 3c 2f 62 3e 65 the <b>JOIN</b>e
3970: 64 20 54 61 62 6c 65 73 20 61 72 65 20 6f 66 20 d Tables are of
3980: 74 68 65 20 56 69 72 74 75 61 6c 20 74 79 70 65 the Virtual type
3990: 2e 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e 54 68 65 20 .</li>..<li>The
39a0: 62 65 73 74 20 75 73 65 20 6f 66 20 61 20 56 69 best use of a Vi
39b0: 72 74 75 61 6c 20 54 61 62 6c 65 20 69 73 20 74 rtual Table is t
39c0: 6f 20 70 72 65 66 6f 72 6d 20 61 20 62 61 73 69 o preform a basi
39d0: 63 20 64 61 74 61 20 69 6d 70 6f 72 74 20 70 72 c data import pr
39e0: 6f 63 65 73 73 2c 20 6f 72 20 74 6f 20 71 75 69 ocess, or to qui
39f0: 63 6b 6c 79 20 67 65 74 20 61 6e 20 6f 76 65 72 ckly get an over
3a00: 61 6c 6c 20 67 6c 61 6e 63 65 20 61 74 20 61 20 all glance at a
3a10: 66 75 6c 6c 20 64 61 74 61 73 65 74 20 77 69 74 full dataset wit
3a20: 68 6f 75 74 20 6e 65 63 65 73 73 61 72 69 6c 79 hout necessarily
3a30: 20 69 6d 70 6f 72 74 69 6e 67 20 69 74 20 69 6e importing it in
3a40: 74 6f 20 74 68 65 20 44 61 74 61 62 61 73 65 2e to the Database.
3a50: 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e 50 72 65 74 65 </li>..<li>Prete
3a60: 6e 64 69 6e 67 20 74 6f 20 75 73 65 20 61 20 56 nding to use a V
3a70: 69 72 74 75 61 6c 20 54 61 62 6c 65 20 61 73 20 irtual Table as
3a80: 61 20 66 75 6c 6c 20 72 65 70 6c 61 63 65 6d 65 a full replaceme
3a90: 6e 74 20 6f 66 20 69 6d 70 6f 72 74 69 6e 67 20 nt of importing
3aa0: 61 6c 6c 20 64 61 74 61 20 77 69 74 68 69 6e 20 all data within
3ab0: 61 20 67 65 6e 75 69 6e 65 20 44 61 74 61 62 61 a genuine Databa
3ac0: 73 65 20 54 61 62 6c 65 20 69 73 20 73 74 72 6f se Table is stro
3ad0: 6e 67 6c 79 20 64 69 73 63 6f 75 72 61 67 65 64 ngly discouraged
3ae0: 2c 20 61 6e 64 20 6e 65 76 65 72 20 69 73 20 61 , and never is a
3af0: 20 67 6f 6f 64 20 69 64 65 61 2e 3c 2f 6c 69 3e good idea.</li>
3b00: 0d 0a 3c 2f 75 6c 3e 3c 62 72 3e 0d 0a 3c 62 3e ..</ul><br>..<b>
3b10: 57 61 72 6e 69 6e 67 3c 2f 62 3e 3a 20 56 69 72 Warning</b>: Vir
3b20: 74 75 61 6c 54 65 78 74 20 54 61 62 6c 65 73 20 tualText Tables
3b30: 61 72 65 20 61 6c 77 61 79 73 20 73 75 62 6a 65 are always subje
3b40: 63 74 20 74 6f 20 3c 62 3e 52 45 41 44 2d 4f 4e ct to <b>READ-ON
3b50: 4c 59 3c 2f 62 3e 20 72 65 73 74 72 69 63 74 69 LY</b> restricti
3b60: 6f 6e 73 2e 20 41 6e 79 20 61 74 74 65 6d 70 74 ons. Any attempt
3b70: 20 74 6f 20 74 6f 20 65 78 65 63 75 74 65 20 61 to to execute a
3b80: 6e 20 3c 62 3e 49 4e 53 45 52 54 3c 2f 62 3e 2c n <b>INSERT</b>,
3b90: 20 3c 62 3e 55 50 44 41 54 45 3c 2f 62 3e 20 6f <b>UPDATE</b> o
3ba0: 72 20 3c 62 3e 44 45 4c 45 54 45 3c 2f 62 3e 20 r <b>DELETE</b>
3bb0: 73 74 61 74 65 6d 65 6e 74 20 77 69 6c 6c 20 61 statement will a
3bc0: 6c 77 61 79 73 20 72 65 74 75 72 6e 20 61 6e 20 lways return an
3bd0: 65 72 72 6f 72 2e 3c 62 72 3e 0d 0a 3c 2f 74 64 error.<br>..</td
3be0: 3e 3c 2f 74 72 3e 3c 2f 74 61 62 6c 65 3e 0d 0a ></tr></table>..
3bf0: 3c 62 72 3e 0d 0a 3c 68 72 3e 0d 0a 3c 68 31 3e <br>..<hr>..<h1>
3c00: 3c 61 20 69 64 3d 22 56 69 72 74 75 61 6c 58 4c <a id="VirtualXL
3c10: 22 3e 56 69 72 74 75 61 6c 58 4c 3c 2f 61 3e 3c ">VirtualXL</a><
3c20: 2f 68 31 3e 0d 0a 54 68 65 20 3c 62 3e 56 69 72 /h1>..The <b>Vir
3c30: 74 75 61 6c 58 4c 3c 2f 62 3e 20 49 6e 74 65 72 tualXL</b> Inter
3c40: 66 61 63 65 20 61 6c 6c 6f 77 73 20 74 6f 20 64 face allows to d
3c50: 69 72 65 63 74 6c 79 20 61 63 63 65 73 73 20 61 irectly access a
3c60: 6e 20 65 78 74 65 72 6e 61 6c 20 4d 53 20 45 78 n external MS Ex
3c70: 63 65 6c 20 73 70 72 65 61 64 73 68 65 65 74 20 cel spreadsheet
3c80: 28 4c 65 67 61 63 79 20 62 69 6e 61 72 79 20 66 (Legacy binary f
3c90: 6f 72 6d 61 74 20 3c 62 3e 2a 2e 78 6c 73 3c 2f ormat <b>*.xls</
3ca0: 62 3e 2c 20 69 2e 65 2e 20 6e 6f 74 20 20 3c 62 b>, i.e. not <b
3cb0: 3e 2a 2e 78 6c 73 6d 3c 2f 62 3e 20 6f 72 20 27 >*.xlsm</b> or '
3cc0: 4c 69 62 72 65 4f 66 66 69 63 65 20 43 61 6c 63 LibreOffice Calc
3cd0: 27 20 3c 62 3e 2a 2e 6f 64 73 3c 2f 62 3e 20 66 ' <b>*.ods</b> f
3ce0: 69 6c 65 73 29 20 20 62 79 20 75 73 69 6e 67 20 iles) by using
3cf0: 73 74 61 6e 64 61 72 64 20 53 70 61 74 69 61 6c standard Spatial
3d00: 20 53 51 4c 20 71 75 65 72 69 65 73 2e 3c 62 72 SQL queries.<br
3d10: 3e 0d 0a 53 79 6e 74 61 78 20 66 6f 72 20 63 72 >..Syntax for cr
3d20: 65 61 74 69 6e 67 20 61 20 56 69 72 74 75 61 6c eating a Virtual
3d30: 58 4c 20 54 61 62 6c 65 3a 0d 0a 3c 76 65 72 62 XL Table:..<verb
3d40: 61 74 69 6d 3e 0d 0a 53 45 4c 45 43 54 20 43 52 atim>..SELECT CR
3d50: 45 41 54 45 20 56 49 52 54 55 41 4c 20 54 41 42 EATE VIRTUAL TAB
3d60: 4c 45 20 6d 79 5f 74 61 62 6c 65 20 55 53 49 4e LE my_table USIN
3d70: 47 20 56 69 72 74 75 61 6c 58 4c 20 28 20 78 6c G VirtualXL ( xl
3d80: 73 5f 70 61 74 68 20 29 3b 0d 0a 0d 0a 53 45 4c s_path );....SEL
3d90: 45 43 54 20 43 52 45 41 54 45 20 56 49 52 54 55 ECT CREATE VIRTU
3da0: 41 4c 20 54 41 42 4c 45 20 6d 79 5f 74 61 62 6c AL TABLE my_tabl
3db0: 65 20 55 53 49 4e 47 20 56 69 72 74 75 61 6c 58 e USING VirtualX
3dc0: 4c 20 28 20 78 6c 73 5f 70 61 74 68 20 2c 20 77 L ( xls_path , w
3dd0: 6f 72 6b 73 68 65 65 74 5f 69 6e 64 65 78 20 29 orksheet_index )
3de0: 3b 0d 0a 0d 0a 53 45 4c 45 43 54 20 43 52 45 41 ;....SELECT CREA
3df0: 54 45 20 56 49 52 54 55 41 4c 20 54 41 42 4c 45 TE VIRTUAL TABLE
3e00: 20 6d 79 5f 74 61 62 6c 65 20 55 53 49 4e 47 20 my_table USING
3e10: 56 69 72 74 75 61 6c 58 4c 20 28 20 78 6c 73 5f VirtualXL ( xls_
3e20: 70 61 74 68 20 2c 20 77 6f 72 6b 73 68 65 65 74 path , worksheet
3e30: 5f 69 6e 64 65 78 20 2c 20 66 69 72 73 74 5f 72 _index , first_r
3e40: 6f 77 5f 61 73 5f 74 69 74 6c 65 73 20 29 3b 0d ow_as_titles );.
3e50: 0a 3c 2f 76 65 72 62 61 74 69 6d 3e 0d 0a 53 75 .</verbatim>..Su
3e60: 70 70 6f 72 74 65 64 20 61 72 67 75 6d 65 6e 74 pported argument
3e70: 73 20 61 6e 64 20 74 68 65 69 72 20 69 6e 74 65 s and their inte
3e80: 72 70 72 65 74 61 74 69 6f 6e 3a 0d 0a 3c 75 6c rpretation:..<ul
3e90: 3e 0d 0a 3c 6c 69 3e 3c 62 3e 78 6c 73 5f 70 61 >..<li><b>xls_pa
3ea0: 74 68 3c 2f 62 3e 20 28 3c 69 3e 3c 62 3e 6d 61 th</b> (<i><b>ma
3eb0: 6e 64 61 74 6f 72 79 3c 2f 62 3e 3c 2f 69 3e 29 ndatory</b></i>)
3ec0: 3a 20 74 68 65 20 72 65 6c 61 74 69 76 65 20 6f : the relative o
3ed0: 72 20 61 62 73 6f 6c 75 74 65 20 70 61 74 68 6e r absolute pathn
3ee0: 61 6d 65 20 6c 65 61 64 69 6e 67 20 74 6f 20 74 ame leading to t
3ef0: 68 65 20 65 78 74 65 72 6e 61 6c 20 4d 53 20 45 he external MS E
3f00: 78 63 65 6c 20 73 70 72 65 61 64 73 68 65 65 74 xcel spreadsheet
3f10: 20 28 6f 6c 64 20 62 69 6e 61 72 79 20 66 6f 72 (old binary for
3f20: 6d 61 74 20 3c 69 3e 2a 2e 78 6c 73 3c 2f 69 3e mat <i>*.xls</i>
3f30: 29 2e 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e 3c 62 3e ).</li>..<li><b>
3f40: 77 6f 72 6b 73 68 65 65 74 5f 69 6e 64 65 78 3c worksheet_index<
3f50: 2f 62 3e 20 28 3c 69 3e 3c 62 3e 6f 70 74 69 6f /b> (<i><b>optio
3f60: 6e 61 6c 3c 2f 62 3e 3c 2f 69 3e 29 3a 20 74 68 nal</b></i>): th
3f70: 65 20 69 6e 64 65 78 20 69 64 65 6e 74 69 66 79 e index identify
3f80: 69 6e 67 20 6f 6e 65 20 6f 66 20 74 68 65 20 77 ing one of the w
3f90: 6f 72 6b 73 68 65 65 74 73 20 77 69 74 68 69 6e orksheets within
3fa0: 20 74 68 65 20 45 78 63 65 6c 20 64 6f 63 75 6d the Excel docum
3fb0: 65 6e 74 2e 3c 62 72 3e 0d 0a 4d 53 20 45 78 63 ent.<br>..MS Exc
3fc0: 65 6c 20 6d 61 79 20 63 6f 6e 74 61 69 6e 20 6d el may contain m
3fd0: 6f 72 65 20 74 68 61 6e 20 6f 6e 65 20 77 6f 72 ore than one wor
3fe0: 6b 73 68 65 65 74 2c 20 61 6e 64 20 65 61 63 68 ksheet, and each
3ff0: 20 69 6e 64 69 76 69 64 75 61 6c 20 77 6f 72 6b individual work
4000: 73 68 65 65 74 20 69 73 20 69 64 65 6e 74 69 66 sheet is identif
4010: 69 65 64 20 62 79 20 69 74 73 20 6f 77 6e 20 69 ied by its own i
4020: 6e 64 65 78 20 28 3c 62 3e 7a 65 72 6f 2d 62 61 ndex (<b>zero-ba
4030: 73 65 64 3c 2f 62 3e 20 69 6e 64 65 78 3b 20 74 sed</b> index; t
4040: 68 65 20 66 69 72 73 74 20 77 6f 72 6b 73 68 65 he first workshe
4050: 65 74 20 61 6c 77 61 79 73 20 68 61 73 20 3c 62 et always has <b
4060: 3e 69 6e 64 65 78 3d 30 3c 2f 62 3e 29 2e 3c 62 >index=0</b>).<b
4070: 72 3e 0d 0a 49 66 20 6e 6f 74 20 65 78 70 6c 69 r>..If not expli
4080: 63 69 74 6c 79 20 73 70 65 63 69 66 69 65 64 20 citly specified
4090: 74 68 65 20 66 69 72 73 74 20 77 6f 72 6b 73 68 the first worksh
40a0: 65 65 74 20 77 69 6c 6c 20 61 6c 77 61 79 73 20 eet will always
40b0: 62 65 20 61 73 73 75 6d 65 64 20 28 64 65 66 61 be assumed (defa
40c0: 75 6c 74 20 76 61 6c 75 65 29 2e 3c 2f 6c 69 3e ult value).</li>
40d0: 0d 0a 3c 6c 69 3e 3c 62 3e 66 69 72 73 74 5f 72 ..<li><b>first_r
40e0: 6f 77 5f 61 73 5f 74 69 74 6c 65 73 3c 2f 62 3e ow_as_titles</b>
40f0: 20 28 3c 69 3e 3c 62 3e 6f 70 74 69 6f 6e 61 6c (<i><b>optional
4100: 3c 2f 62 3e 3c 2f 69 3e 29 3a 20 74 68 69 73 20 </b></i>): this
4110: 69 73 20 61 20 3c 62 3e 42 4f 4f 4c 45 41 4e 3c is a <b>BOOLEAN<
4120: 2f 62 3e 20 66 6c 61 67 3a 0d 0a 3c 75 6c 3e 0d /b> flag:..<ul>.
4130: 0a 3c 6c 69 3e 69 66 20 73 65 74 20 74 6f 20 3c .<li>if set to <
4140: 62 3e 30 3c 2f 62 3e 20 28 3c 62 3e 46 41 4c 53 b>0</b> (<b>FALS
4150: 45 3c 2f 62 3e 29 20 61 6c 6c 20 63 6f 6c 75 6d E</b>) all colum
4160: 6e 20 6e 61 6d 65 73 20 77 69 6c 6c 20 62 65 20 n names will be
4170: 61 75 74 6f 6d 61 74 69 63 61 6c 6c 79 20 73 65 automatically se
4180: 74 20 62 79 20 75 73 69 6e 67 20 61 20 70 72 6f t by using a pro
4190: 67 72 65 73 73 69 76 65 20 73 65 71 75 65 6e 63 gressive sequenc
41a0: 65 2e 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e 69 66 20 e.</li>..<li>if
41b0: 73 65 74 20 74 6f 20 61 6e 79 20 6f 74 68 65 72 set to any other
41c0: 20 69 6e 74 65 67 65 72 20 76 61 6c 75 65 20 28 integer value (
41d0: 3c 62 3e 54 52 55 45 3c 2f 62 3e 29 20 61 6c 6c <b>TRUE</b>) all
41e0: 20 63 6f 6c 75 6d 6e 20 6e 61 6d 65 73 20 77 69 column names wi
41f0: 6c 6c 20 62 79 20 65 78 70 65 63 74 65 64 20 74 ll by expected t
4200: 6f 20 62 65 20 64 65 66 69 6e 65 64 20 69 6e 20 o be defined in
4210: 74 68 65 20 76 65 72 79 20 66 69 72 73 74 20 72 the very first r
4220: 6f 77 20 6f 66 20 74 68 65 20 53 70 72 65 61 64 ow of the Spread
4230: 73 68 65 65 74 2e 3c 2f 6c 69 3e 0d 0a 3c 6c 69 sheet.</li>..<li
4240: 3e 69 66 20 6e 6f 74 20 65 78 70 6c 69 63 69 74 >if not explicit
4250: 6c 79 20 73 70 65 63 69 66 69 65 64 2c 20 3c 62 ly specified, <b
4260: 3e 54 52 55 45 3c 2f 62 3e 20 77 69 6c 6c 20 61 >TRUE</b> will a
4270: 6c 77 61 79 73 20 62 65 20 61 73 73 75 6d 65 64 lways be assumed
4280: 20 28 64 65 66 61 75 6c 74 20 73 65 74 74 69 6e (default settin
4290: 67 29 2e 3c 2f 6c 69 3e 0d 0a 3c 2f 75 6c 3e 3c g).</li>..</ul><
42a0: 2f 6c 69 3e 0d 0a 3c 75 6c 3e 0d 0a 3c 2f 75 6c /li>..<ul>..</ul
42b0: 3e 3c 2f 6c 69 3e 0d 0a 3c 2f 75 6c 3e 3c 62 72 ></li>..</ul><br
42c0: 3e 0d 0a 3c 74 61 62 6c 65 20 62 67 63 6f 6c 6f >..<table bgcolo
42d0: 72 3d 22 23 66 66 66 66 64 30 22 20 63 65 6c 6c r="#ffffd0" cell
42e0: 70 61 64 64 69 6e 67 3d 22 31 38 22 3e 3c 74 72 padding="18"><tr
42f0: 3e 3c 74 64 3e 0d 0a 3c 62 3e 4e 6f 74 65 3c 2f ><td>..<b>Note</
4300: 62 3e 3a 20 61 6e 79 20 54 65 78 74 20 53 74 72 b>: any Text Str
4310: 69 6e 67 2c 20 71 75 6f 74 65 64 20 6f 72 20 6e ing, quoted or n
4320: 6f 74 2c 20 77 68 65 6e 20 69 74 20 61 70 70 65 ot, when it appe
4330: 61 72 73 20 61 73 20 61 20 56 69 72 74 75 61 6c ars as a Virtual
4340: 20 54 61 62 6c 65 20 61 72 67 75 6d 65 6e 74 20 Table argument
4350: 68 61 73 20 74 68 65 20 73 61 6d 65 20 65 66 66 has the same eff
4360: 65 63 74 2e 0d 0a 3c 76 65 72 62 61 74 69 6d 3e ect...<verbatim>
4370: 0d 0a 53 45 4c 45 43 54 20 43 52 45 41 54 45 20 ..SELECT CREATE
4380: 56 49 52 54 55 41 4c 20 54 41 42 4c 45 20 6d 79 VIRTUAL TABLE my
4390: 5f 74 61 62 6c 65 20 55 53 49 4e 47 20 56 69 72 _table USING Vir
43a0: 74 75 61 6c 58 4c 28 20 2f 68 6f 6d 65 2f 73 61 tualXL( /home/sa
43b0: 6e 64 72 6f 2f 6d 79 73 70 72 65 61 64 73 68 65 ndro/myspreadshe
43c0: 65 74 2e 78 6c 73 20 2c 20 33 2c 20 31 20 29 3b et.xls , 3, 1 );
43d0: 0d 0a 6f 72 0d 0a 53 45 4c 45 43 54 20 43 52 45 ..or..SELECT CRE
43e0: 41 54 45 20 56 49 52 54 55 41 4c 20 54 41 42 4c ATE VIRTUAL TABL
43f0: 45 20 6d 79 5f 74 61 62 6c 65 20 55 53 49 4e 47 E my_table USING
4400: 20 56 69 72 74 75 61 6c 58 4c 28 20 27 2f 68 6f VirtualXL( '/ho
4410: 6d 65 2f 73 61 6e 64 72 6f 2f 6d 79 73 70 72 65 me/sandro/myspre
4420: 61 64 73 68 65 65 74 2e 78 6c 73 27 20 2c 20 33 adsheet.xls' , 3
4430: 2c 20 31 20 29 3b 0d 0a 3c 2f 76 65 72 62 61 74 , 1 );..</verbat
4440: 69 6d 3e 0d 0a 42 6f 74 68 20 6e 6f 74 61 74 69 im>..Both notati
4450: 6f 6e 73 20 77 69 6c 6c 20 70 72 6f 64 75 63 65 ons will produce
4460: 20 74 68 65 20 73 61 6d 65 20 72 65 73 75 6c 74 the same result
4470: 2e 0d 0a 3c 2f 74 64 3e 3c 2f 74 72 3e 3c 2f 74 ...</td></tr></t
4480: 61 62 6c 65 3e 0d 0a 3c 62 72 3e 0d 0a 3c 74 61 able>..<br>..<ta
4490: 62 6c 65 20 62 67 63 6f 6c 6f 72 3d 22 23 64 30 ble bgcolor="#d0
44a0: 66 66 64 30 22 20 63 65 6c 6c 70 61 64 64 69 6e ffd0" cellpaddin
44b0: 67 3d 22 31 38 22 3e 3c 74 72 3e 3c 74 64 3e 0d g="18"><tr><td>.
44c0: 0a 3c 68 33 3e 42 65 73 74 20 70 72 61 63 74 69 .<h3>Best practi
44d0: 63 65 73 20 61 6e 64 20 6b 6e 6f 77 6e 20 6c 69 ces and known li
44e0: 6d 69 74 61 74 69 6f 6e 73 3c 2f 68 33 3e 0d 0a mitations</h3>..
44f0: 3c 75 6c 3e 0d 0a 3c 6c 69 3e 56 69 72 74 75 61 <ul>..<li>Virtua
4500: 6c 20 54 61 62 6c 65 73 20 61 72 65 20 6e 6f 74 l Tables are not
4510: 20 72 65 61 6c 6c 79 20 67 65 6e 75 69 6e 65 20 really genuine
4520: 44 61 74 61 62 61 73 65 20 54 61 62 6c 65 73 2c Database Tables,
4530: 20 74 68 65 79 20 61 72 65 20 6a 75 73 74 20 65 they are just e
4540: 6d 75 6c 61 74 69 6e 67 20 74 68 65 20 6f 72 69 mulating the ori
4550: 67 69 6e 61 6c 20 73 6f 75 72 63 65 20 61 73 20 ginal source as
4560: 61 20 44 61 74 61 62 61 73 65 20 54 61 62 6c 65 a Database Table
4570: 2e 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e 56 69 72 74 .</li>..<li>Virt
4580: 75 61 6c 20 54 61 62 6c 65 73 20 68 61 76 65 20 ual Tables have
4590: 76 65 72 79 20 70 6f 6f 72 20 73 70 65 65 64 20 very poor speed
45a0: 70 65 72 66 6f 72 6d 61 6e 63 65 73 2c 20 64 75 performances, du
45b0: 65 20 74 6f 20 74 68 65 20 20 65 6d 75 6c 61 74 e to the emulat
45c0: 69 6f 6e 2c 20 61 73 20 63 6f 6d 70 61 72 65 64 ion, as compared
45d0: 20 74 6f 20 67 65 6e 75 69 6e 65 20 44 61 74 61 to genuine Data
45e0: 62 61 73 65 20 54 61 62 6c 65 73 2e 3c 2f 6c 69 base Tables.</li
45f0: 3e 0d 0a 3c 6c 69 3e 43 6f 6d 70 6c 65 78 20 53 >..<li>Complex S
4600: 51 4c 20 71 75 65 72 69 65 73 20 3c 62 3e 4a 4f QL queries <b>JO
4610: 49 4e 3c 2f 62 3e 69 6e 67 20 73 65 76 65 72 61 IN</b>ing severa
4620: 6c 20 54 61 62 6c 65 73 20 63 61 6e 20 6f 66 74 l Tables can oft
4630: 65 6e 20 72 65 74 75 72 6e 20 6f 64 64 20 61 6e en return odd an
4640: 64 20 6d 69 73 6c 65 61 64 69 6e 67 20 72 65 73 d misleading res
4650: 75 6c 74 73 65 74 73 2c 20 77 68 65 6e 20 6f 6e ultsets, when on
4660: 65 20 6f 72 20 6d 6f 72 65 20 6f 66 20 74 68 65 e or more of the
4670: 20 3c 62 3e 4a 4f 49 4e 3c 2f 62 3e 65 64 20 54 <b>JOIN</b>ed T
4680: 61 62 6c 65 73 20 61 72 65 20 6f 66 20 74 68 65 ables are of the
4690: 20 56 69 72 74 75 61 6c 20 74 79 70 65 2e 3c 2f Virtual type.</
46a0: 6c 69 3e 0d 0a 3c 6c 69 3e 54 68 65 20 62 65 73 li>..<li>The bes
46b0: 74 20 75 73 65 20 6f 66 20 61 20 56 69 72 74 75 t use of a Virtu
46c0: 61 6c 20 54 61 62 6c 65 20 69 73 20 74 6f 20 70 al Table is to p
46d0: 72 65 66 6f 72 6d 20 61 20 62 61 73 69 63 20 64 reform a basic d
46e0: 61 74 61 20 69 6d 70 6f 72 74 20 70 72 6f 63 65 ata import proce
46f0: 73 73 2c 20 6f 72 20 74 6f 20 71 75 69 63 6b 6c ss, or to quickl
4700: 79 20 67 65 74 20 61 6e 20 6f 76 65 72 61 6c 6c y get an overall
4710: 20 67 6c 61 6e 63 65 20 61 74 20 61 20 66 75 6c glance at a ful
4720: 6c 20 64 61 74 61 73 65 74 20 77 69 74 68 6f 75 l dataset withou
4730: 74 20 6e 65 63 65 73 73 61 72 69 6c 79 20 69 6d t necessarily im
4740: 70 6f 72 74 69 6e 67 20 69 74 20 69 6e 74 6f 20 porting it into
4750: 74 68 65 20 44 61 74 61 62 61 73 65 2e 3c 2f 6c the Database.</l
4760: 69 3e 0d 0a 3c 6c 69 3e 50 72 65 74 65 6e 64 69 i>..<li>Pretendi
4770: 6e 67 20 74 6f 20 75 73 65 20 61 20 56 69 72 74 ng to use a Virt
4780: 75 61 6c 20 54 61 62 6c 65 20 61 73 20 61 20 66 ual Table as a f
4790: 75 6c 6c 20 72 65 70 6c 61 63 65 6d 65 6e 74 20 ull replacement
47a0: 6f 66 20 69 6d 70 6f 72 74 69 6e 67 20 61 6c 6c of importing all
47b0: 20 64 61 74 61 20 77 69 74 68 69 6e 20 61 20 67 data within a g
47c0: 65 6e 75 69 6e 65 20 44 61 74 61 62 61 73 65 20 enuine Database
47d0: 54 61 62 6c 65 20 69 73 20 73 74 72 6f 6e 67 6c Table is strongl
47e0: 79 20 64 69 73 63 6f 75 72 61 67 65 64 2c 20 61 y discouraged, a
47f0: 6e 64 20 6e 65 76 65 72 20 69 73 20 61 20 67 6f nd never is a go
4800: 6f 64 20 69 64 65 61 2e 3c 2f 6c 69 3e 0d 0a 3c od idea.</li>..<
4810: 2f 75 6c 3e 3c 62 72 3e 0d 0a 3c 62 3e 57 61 72 /ul><br>..<b>War
4820: 6e 69 6e 67 3c 2f 62 3e 3a 20 56 69 72 74 75 61 ning</b>: Virtua
4830: 6c 58 4c 20 54 61 62 6c 65 73 20 61 72 65 20 61 lXL Tables are a
4840: 6c 77 61 79 73 20 73 75 62 6a 65 63 74 20 74 6f lways subject to
4850: 20 3c 62 3e 52 45 41 44 2d 4f 4e 4c 59 3c 2f 62 <b>READ-ONLY</b
4860: 3e 20 72 65 73 74 72 69 63 74 69 6f 6e 73 2e 20 > restrictions.
4870: 41 6e 79 20 61 74 74 65 6d 70 74 20 74 6f 20 74 Any attempt to t
4880: 6f 20 65 78 65 63 75 74 65 20 61 6e 20 3c 62 3e o execute an <b>
4890: 49 4e 53 45 52 54 3c 2f 62 3e 2c 20 3c 62 3e 55 INSERT</b>, <b>U
48a0: 50 44 41 54 45 3c 2f 62 3e 20 6f 72 20 3c 62 3e PDATE</b> or <b>
48b0: 44 45 4c 45 54 45 3c 2f 62 3e 20 73 74 61 74 65 DELETE</b> state
48c0: 6d 65 6e 74 20 77 69 6c 6c 20 61 6c 77 61 79 73 ment will always
48d0: 20 72 65 74 75 72 6e 20 61 6e 20 65 72 72 6f 72 return an error
48e0: 2e 3c 62 72 3e 0d 0a 3c 2f 74 64 3e 3c 2f 74 72 .<br>..</td></tr
48f0: 3e 3c 2f 74 61 62 6c 65 3e 0d 0a 3c 62 72 3e 0d ></table>..<br>.
4900: 0a 3c 74 61 62 6c 65 20 62 67 63 6f 6c 6f 72 3d .<table bgcolor=
4910: 22 23 65 30 65 30 65 30 22 20 63 65 6c 6c 70 61 "#e0e0e0" cellpa
4920: 64 64 69 6e 67 3d 22 31 38 22 3e 3c 74 72 3e 3c dding="18"><tr><
4930: 74 64 3e 0d 0a 3c 68 33 3e 52 65 6c 61 74 65 64 td>..<h3>Related
4940: 20 54 6f 70 69 63 73 3c 2f 68 33 3e 0d 0a 54 68 Topics</h3>..Th
4950: 65 20 3c 62 3e 49 6d 70 6f 72 74 58 4c 53 28 29 e <b>ImportXLS()
4960: 3c 2f 62 3e 20 53 51 4c 20 66 75 6e 63 74 69 6f </b> SQL functio
4970: 6e 20 61 6c 6c 6f 77 73 20 74 6f 20 63 72 65 61 n allows to crea
4980: 74 65 20 61 6e 64 20 70 6f 70 75 6c 61 74 65 20 te and populate
4990: 61 20 67 65 6e 75 69 6e 65 20 44 61 74 61 62 61 a genuine Databa
49a0: 73 65 20 54 61 62 6c 65 20 62 79 20 69 6d 70 6f se Table by impo
49b0: 72 74 69 6e 67 20 61 6e 20 65 78 74 65 72 6e 61 rting an externa
49c0: 6c 20 4d 53 20 45 78 63 65 6c 20 73 70 72 65 61 l MS Excel sprea
49d0: 64 73 68 65 65 74 2e 0d 0a 3c 2f 74 64 3e 3c 2f dsheet...</td></
49e0: 74 72 3e 3c 2f 74 61 62 6c 65 3e 0d 0a 3c 62 72 tr></table>..<br
49f0: 3e 0d 0a 3c 68 72 3e 0d 0a 3c 68 31 3e 3c 61 20 >..<hr>..<h1><a
4a00: 69 64 3d 22 56 69 72 74 75 61 6c 46 44 4f 22 3e id="VirtualFDO">
4a10: 56 69 72 74 75 61 6c 46 44 4f 3c 2f 61 3e 3c 2f VirtualFDO</a></
4a20: 68 31 3e 0d 0a 54 68 65 20 3c 62 3e 56 69 72 74 h1>..The <b>Virt
4a30: 75 61 6c 46 44 4f 3c 2f 62 3e 20 49 6e 74 65 72 ualFDO</b> Inter
4a40: 66 61 63 65 20 61 6c 6c 6f 77 73 20 74 6f 20 64 face allows to d
4a50: 69 72 65 63 74 6c 79 20 61 63 63 65 73 73 20 61 irectly access a
4a60: 20 53 70 61 74 69 61 6c 20 54 61 62 6c 65 20 63 Spatial Table c
4a70: 6f 6e 74 61 69 6e 69 6e 67 20 3c 62 3e 46 44 4f ontaining <b>FDO
4a80: 20 62 69 6e 61 72 79 20 47 65 6f 6d 65 74 72 69 binary Geometri
4a90: 65 73 3c 2f 62 3e 20 65 78 61 63 74 6c 79 20 61 es</b> exactly a
4aa0: 73 20 69 66 20 77 61 73 20 61 20 53 70 61 74 69 s if was a Spati
4ab0: 61 4c 69 74 65 27 73 20 6f 77 6e 20 6e 61 74 69 aLite's own nati
4ac0: 76 65 20 54 61 62 6c 65 2e 3c 62 72 3e 0d 0a 46 ve Table.<br>..F
4ad0: 44 4f 20 69 73 20 61 6e 20 61 6c 74 65 72 6e 61 DO is an alterna
4ae0: 74 69 76 65 20 62 69 6e 61 72 79 20 66 6f 72 6d tive binary form
4af0: 61 74 20 66 6f 72 20 47 65 6f 6d 65 74 72 69 65 at for Geometrie
4b00: 73 20 73 74 6f 72 65 64 20 77 69 74 68 69 6e 20 s stored within
4b10: 61 20 53 51 4c 69 74 65 20 44 61 74 61 62 61 73 a SQLite Databas
4b20: 65 3b 20 79 6f 75 20 63 61 6e 20 65 76 65 6e 74 e; you can event
4b30: 75 61 6c 6c 79 20 72 65 61 64 20 74 68 65 20 3c ually read the <
4b40: 61 20 68 72 65 66 3d 22 68 74 74 70 73 3a 2f 2f a href="https://
4b50: 74 72 61 63 2e 6f 73 67 65 6f 2e 6f 72 67 2f 66 trac.osgeo.org/f
4b60: 64 6f 2f 77 69 6b 69 2f 46 44 4f 52 66 63 31 36 do/wiki/FDORfc16
4b70: 22 3e 52 46 43 20 31 36 3c 2f 61 3e 20 73 70 65 ">RFC 16</a> spe
4b80: 63 69 66 69 63 61 74 69 6f 6e 20 66 6f 72 20 6d cification for m
4b90: 6f 72 65 20 64 65 74 61 69 6c 73 2e 3c 62 72 3e ore details.<br>
4ba0: 0d 0a 53 79 6e 74 61 78 20 66 6f 72 20 63 72 65 ..Syntax for cre
4bb0: 61 74 69 6e 67 20 61 20 56 69 72 74 75 61 6c 46 ating a VirtualF
4bc0: 44 4f 20 54 61 62 6c 65 3a 0d 0a 3c 76 65 72 62 DO Table:..<verb
4bd0: 61 74 69 6d 3e 0d 0a 53 45 4c 45 43 54 20 43 52 atim>..SELECT CR
4be0: 45 41 54 45 20 56 49 52 54 55 41 4c 20 54 41 42 EATE VIRTUAL TAB
4bf0: 4c 45 20 6d 79 5f 74 61 62 6c 65 20 55 53 49 4e LE my_table USIN
4c00: 47 20 56 69 72 74 75 61 6c 46 64 6f 20 28 20 74 G VirtualFdo ( t
4c10: 61 62 6c 65 5f 6e 61 6d 65 20 29 3b 0d 0a 3c 2f able_name );..</
4c20: 76 65 72 62 61 74 69 6d 3e 0d 0a 53 75 70 70 6f verbatim>..Suppo
4c30: 72 74 65 64 20 61 72 67 75 6d 65 6e 74 20 61 6e rted argument an
4c40: 64 20 69 74 73 20 69 6e 74 65 72 70 72 65 74 61 d its interpreta
4c50: 74 69 6f 6e 3a 0d 0a 3c 75 6c 3e 0d 0a 3c 6c 69 tion:..<ul>..<li
4c60: 3e 3c 62 3e 74 61 62 6c 65 5f 6e 61 6d 65 3c 2f ><b>table_name</
4c70: 62 3e 20 28 3c 69 3e 3c 62 3e 6d 61 6e 64 61 74 b> (<i><b>mandat
4c80: 6f 72 79 3c 2f 62 3e 3c 2f 69 3e 29 3a 20 74 68 ory</b></i>): th
4c90: 65 20 6e 61 6d 65 20 6f 66 20 74 68 65 20 54 61 e name of the Ta
4ca0: 62 6c 65 20 69 6e 20 74 68 65 20 63 75 72 72 65 ble in the curre
4cb0: 6e 74 20 44 61 74 61 62 61 73 65 20 63 6f 6e 74 nt Database cont
4cc0: 61 69 6e 69 6e 67 20 6f 6e 65 20 6f 72 20 6d 6f aining one or mo
4cd0: 72 65 20 46 44 4f 20 47 65 6f 6d 65 74 72 79 20 re FDO Geometry
4ce0: 43 6f 6c 75 6d 6e 73 20 74 6f 20 62 65 20 61 75 Columns to be au
4cf0: 74 6f 6d 61 74 69 63 61 6c 6c 79 20 74 72 61 6e tomatically tran
4d00: 73 6c 61 74 65 64 20 74 6f 2f 66 72 6f 6d 20 53 slated to/from S
4d10: 70 61 74 69 61 4c 69 74 65 27 73 20 6f 77 6e 20 patiaLite's own
4d20: 6e 61 74 69 76 65 20 62 69 6e 61 72 79 20 42 4c native binary BL
4d30: 4f 42 2d 66 6f 72 6d 61 74 2e 3c 2f 6c 69 3e 0d OB-format.</li>.
4d40: 0a 3c 2f 75 6c 3e 3c 62 72 3e 0d 0a 3c 74 61 62 .</ul><br>..<tab
4d50: 6c 65 20 62 67 63 6f 6c 6f 72 3d 22 23 66 66 66 le bgcolor="#fff
4d60: 66 64 30 22 20 63 65 6c 6c 70 61 64 64 69 6e 67 fd0" cellpadding
4d70: 3d 22 31 38 22 3e 3c 74 72 3e 3c 74 64 3e 0d 0a ="18"><tr><td>..
4d80: 3c 62 3e 4e 6f 74 65 3c 2f 62 3e 3a 20 61 6e 79 <b>Note</b>: any
4d90: 20 54 65 78 74 20 53 74 72 69 6e 67 2c 20 71 75 Text String, qu
4da0: 6f 74 65 64 20 6f 72 20 6e 6f 74 2c 20 77 68 65 oted or not, whe
4db0: 6e 20 69 74 20 61 70 70 65 61 72 73 20 61 73 20 n it appears as
4dc0: 61 20 56 69 72 74 75 61 6c 20 54 61 62 6c 65 20 a Virtual Table
4dd0: 61 72 67 75 6d 65 6e 74 20 68 61 73 20 74 68 65 argument has the
4de0: 20 73 61 6d 65 20 65 66 66 65 63 74 2e 0d 0a 3c same effect...<
4df0: 76 65 72 62 61 74 69 6d 3e 0d 0a 53 45 4c 45 43 verbatim>..SELEC
4e00: 54 20 43 52 45 41 54 45 20 56 49 52 54 55 41 4c T CREATE VIRTUAL
4e10: 20 54 41 42 4c 45 20 6d 79 5f 74 61 62 6c 65 20 TABLE my_table
4e20: 55 53 49 4e 47 20 56 69 72 74 75 61 6c 46 64 6f USING VirtualFdo
4e30: 28 20 6d 79 5f 70 61 72 63 65 6c 73 20 29 3b 0d ( my_parcels );.
4e40: 0a 6f 72 0d 0a 53 45 4c 45 43 54 20 43 52 45 41 .or..SELECT CREA
4e50: 54 45 20 56 49 52 54 55 41 4c 20 54 41 42 4c 45 TE VIRTUAL TABLE
4e60: 20 6d 79 5f 74 61 62 6c 65 20 55 53 49 4e 47 20 my_table USING
4e70: 56 69 72 74 75 61 6c 46 64 6f 28 20 27 6d 79 5f VirtualFdo( 'my_
4e80: 70 61 72 63 65 6c 73 27 20 29 3b 0d 0a 3c 2f 76 parcels' );..</v
4e90: 65 72 62 61 74 69 6d 3e 0d 0a 42 6f 74 68 20 6e erbatim>..Both n
4ea0: 6f 74 61 74 69 6f 6e 73 20 77 69 6c 6c 20 70 72 otations will pr
4eb0: 6f 64 75 63 65 20 74 68 65 20 73 61 6d 65 20 72 oduce the same r
4ec0: 65 73 75 6c 74 2e 0d 0a 3c 2f 74 64 3e 3c 2f 74 esult...</td></t
4ed0: 72 3e 3c 2f 74 61 62 6c 65 3e 0d 0a 3c 62 72 3e r></table>..<br>
4ee0: 0d 0a 3c 74 61 62 6c 65 20 62 67 63 6f 6c 6f 72 ..<table bgcolor
4ef0: 3d 22 23 64 30 66 66 64 30 22 20 63 65 6c 6c 70 ="#d0ffd0" cellp
4f00: 61 64 64 69 6e 67 3d 22 31 38 22 3e 3c 74 72 3e adding="18"><tr>
4f10: 3c 74 64 3e 0d 0a 3c 68 33 3e 42 65 73 74 20 70 <td>..<h3>Best p
4f20: 72 61 63 74 69 63 65 73 20 61 6e 64 20 6b 6e 6f ractices and kno
4f30: 77 6e 20 6c 69 6d 69 74 61 74 69 6f 6e 73 3c 2f wn limitations</
4f40: 68 33 3e 0d 0a 3c 75 6c 3e 0d 0a 3c 6c 69 3e 56 h3>..<ul>..<li>V
4f50: 69 72 74 75 61 6c 20 54 61 62 6c 65 73 20 61 72 irtual Tables ar
4f60: 65 20 6e 6f 74 20 72 65 61 6c 6c 79 20 67 65 6e e not really gen
4f70: 75 69 6e 65 20 44 61 74 61 62 61 73 65 20 54 61 uine Database Ta
4f80: 62 6c 65 73 2c 20 74 68 65 79 20 61 72 65 20 6a bles, they are j
4f90: 75 73 74 20 65 6d 75 6c 61 74 69 6e 67 20 74 68 ust emulating th
4fa0: 65 20 6f 72 69 67 69 6e 61 6c 20 73 6f 75 72 63 e original sourc
4fb0: 65 20 61 73 20 61 20 44 61 74 61 62 61 73 65 20 e as a Database
4fc0: 54 61 62 6c 65 2e 3c 2f 6c 69 3e 0d 0a 3c 6c 69 Table.</li>..<li
4fd0: 3e 56 69 72 74 75 61 6c 20 54 61 62 6c 65 73 20 >Virtual Tables
4fe0: 68 61 76 65 20 76 65 72 79 20 70 6f 6f 72 20 73 have very poor s
4ff0: 70 65 65 64 20 70 65 72 66 6f 72 6d 61 6e 63 65 peed performance
5000: 73 2c 20 64 75 65 20 74 6f 20 74 68 65 20 20 65 s, due to the e
5010: 6d 75 6c 61 74 69 6f 6e 2c 20 61 73 20 63 6f 6d mulation, as com
5020: 70 61 72 65 64 20 74 6f 20 67 65 6e 75 69 6e 65 pared to genuine
5030: 20 44 61 74 61 62 61 73 65 20 54 61 62 6c 65 73 Database Tables
5040: 2e 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e 43 6f 6d 70 .</li>..<li>Comp
5050: 6c 65 78 20 53 51 4c 20 71 75 65 72 69 65 73 20 lex SQL queries
5060: 3c 62 3e 4a 4f 49 4e 3c 2f 62 3e 69 6e 67 20 73 <b>JOIN</b>ing s
5070: 65 76 65 72 61 6c 20 54 61 62 6c 65 73 20 63 61 everal Tables ca
5080: 6e 20 6f 66 74 65 6e 20 72 65 74 75 72 6e 20 6f n often return o
5090: 64 64 20 61 6e 64 20 6d 69 73 6c 65 61 64 69 6e dd and misleadin
50a0: 67 20 72 65 73 75 6c 74 73 65 74 73 2c 20 77 68 g resultsets, wh
50b0: 65 6e 20 6f 6e 65 20 6f 72 20 6d 6f 72 65 20 6f en one or more o
50c0: 66 20 74 68 65 20 3c 62 3e 4a 4f 49 4e 3c 2f 62 f the <b>JOIN</b
50d0: 3e 65 64 20 54 61 62 6c 65 73 20 61 72 65 20 6f >ed Tables are o
50e0: 66 20 74 68 65 20 56 69 72 74 75 61 6c 20 74 79 f the Virtual ty
50f0: 70 65 2e 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e 54 68 pe.</li>..<li>Th
5100: 65 20 62 65 73 74 20 75 73 65 20 6f 66 20 61 20 e best use of a
5110: 56 69 72 74 75 61 6c 20 54 61 62 6c 65 20 69 73 Virtual Table is
5120: 20 74 6f 20 70 72 65 66 6f 72 6d 20 61 20 62 61 to preform a ba
5130: 73 69 63 20 64 61 74 61 20 69 6d 70 6f 72 74 20 sic data import
5140: 70 72 6f 63 65 73 73 2c 20 6f 72 20 74 6f 20 71 process, or to q
5150: 75 69 63 6b 6c 79 20 67 65 74 20 61 6e 20 6f 76 uickly get an ov
5160: 65 72 61 6c 6c 20 67 6c 61 6e 63 65 20 61 74 20 erall glance at
5170: 61 20 66 75 6c 6c 20 64 61 74 61 73 65 74 20 77 a full dataset w
5180: 69 74 68 6f 75 74 20 6e 65 63 65 73 73 61 72 69 ithout necessari
5190: 6c 79 20 69 6d 70 6f 72 74 69 6e 67 20 69 74 20 ly importing it
51a0: 69 6e 74 6f 20 74 68 65 20 44 61 74 61 62 61 73 into the Databas
51b0: 65 2e 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e 50 72 65 e.</li>..<li>Pre
51c0: 74 65 6e 64 69 6e 67 20 74 6f 20 75 73 65 20 61 tending to use a
51d0: 20 56 69 72 74 75 61 6c 20 54 61 62 6c 65 20 61 Virtual Table a
51e0: 73 20 61 20 66 75 6c 6c 20 72 65 70 6c 61 63 65 s a full replace
51f0: 6d 65 6e 74 20 6f 66 20 69 6d 70 6f 72 74 69 6e ment of importin
5200: 67 20 61 6c 6c 20 64 61 74 61 20 77 69 74 68 69 g all data withi
5210: 6e 20 61 20 67 65 6e 75 69 6e 65 20 44 61 74 61 n a genuine Data
5220: 62 61 73 65 20 54 61 62 6c 65 20 69 73 20 73 74 base Table is st
5230: 72 6f 6e 67 6c 79 20 64 69 73 63 6f 75 72 61 67 rongly discourag
5240: 65 64 2c 20 61 6e 64 20 6e 65 76 65 72 20 69 73 ed, and never is
5250: 20 61 20 67 6f 6f 64 20 69 64 65 61 2e 3c 2f 6c a good idea.</l
5260: 69 3e 0d 0a 3c 2f 75 6c 3e 3c 62 72 3e 0d 0a 3c i>..</ul><br>..<
5270: 62 3e 4e 6f 74 65 3c 2f 62 3e 3a 20 56 69 72 74 b>Note</b>: Virt
5280: 75 61 6c 46 44 4f 20 54 61 62 6c 65 73 20 73 75 ualFDO Tables su
5290: 70 70 6f 72 74 20 75 6e 72 65 73 74 72 69 63 74 pport unrestrict
52a0: 65 64 20 3c 62 3e 52 45 41 44 2d 57 52 49 54 45 ed <b>READ-WRITE
52b0: 3c 2f 62 3e 20 6f 70 65 72 61 74 69 6f 6e 73 2c </b> operations,
52c0: 20 74 68 69 73 20 69 6e 63 6c 75 64 69 6e 67 20 this including
52d0: 65 78 65 63 75 74 69 6e 67 20 3c 62 3e 49 4e 53 executing <b>INS
52e0: 45 52 54 3c 2f 62 3e 2c 20 3c 62 3e 55 50 44 41 ERT</b>, <b>UPDA
52f0: 54 45 3c 2f 62 3e 20 61 6e 64 20 3c 62 3e 44 45 TE</b> and <b>DE
5300: 4c 45 54 45 3c 2f 62 3e 20 73 74 61 74 65 6d 65 LETE</b> stateme
5310: 6e 74 73 2e 3c 62 72 3e 0d 0a 3c 2f 74 64 3e 3c nts.<br>..</td><
5320: 2f 74 72 3e 3c 2f 74 61 62 6c 65 3e 0d 0a 3c 62 /tr></table>..<b
5330: 72 3e 0d 0a 3c 68 72 3e 0d 0a 3c 68 31 3e 3c 61 r>..<hr>..<h1><a
5340: 20 69 64 3d 22 56 69 72 74 75 61 6c 47 50 4b 47 id="VirtualGPKG
5350: 22 3e 56 69 72 74 75 61 6c 47 50 4b 47 3c 2f 61 ">VirtualGPKG</a
5360: 3e 3c 2f 68 31 3e 0d 0a 54 68 65 20 3c 62 3e 56 ></h1>..The <b>V
5370: 69 72 74 75 61 6c 47 50 4b 47 3c 2f 62 3e 20 49 irtualGPKG</b> I
5380: 6e 74 65 72 66 61 63 65 20 61 6c 6c 6f 77 73 20 nterface allows
5390: 74 6f 20 64 69 72 65 63 74 6c 79 20 61 63 63 65 to directly acce
53a0: 73 73 20 53 70 61 74 69 61 6c 20 54 61 62 6c 65 ss Spatial Table
53b0: 73 20 66 72 6f 6d 20 61 20 3c 62 3e 47 65 6f 50 s from a <b>GeoP
53c0: 61 63 6b 61 67 65 20 44 61 74 61 62 61 73 65 3c ackage Database<
53d0: 2f 62 3e 20 65 78 61 63 74 6c 79 20 61 73 20 69 /b> exactly as i
53e0: 66 20 77 61 73 20 61 20 53 70 61 74 69 61 4c 69 f was a SpatiaLi
53f0: 74 65 27 73 20 6f 77 6e 20 6e 61 74 69 76 65 20 te's own native
5400: 44 61 74 61 62 61 73 65 2e 3c 62 72 3e 0d 0a 47 Database.<br>..G
5410: 65 6f 50 61 63 6b 61 67 65 20 28 3c 69 3e 61 6b eoPackage (<i>ak
5420: 61 3c 2f 69 3e 20 3c 62 3e 47 50 4b 47 3c 2f 62 a</i> <b>GPKG</b
5430: 3e 29 20 69 73 20 61 6e 20 61 6c 74 65 72 6e 61 >) is an alterna
5440: 74 69 76 65 20 53 70 61 74 69 61 6c 20 44 61 74 tive Spatial Dat
5450: 61 62 61 73 65 20 62 75 69 6c 74 20 6f 6e 20 74 abase built on t
5460: 68 65 20 74 6f 70 20 6f 66 20 53 51 4c 69 74 65 he top of SQLite
5470: 3b 20 79 6f 75 20 63 61 6e 20 65 76 65 6e 74 75 ; you can eventu
5480: 61 6c 6c 79 20 72 65 61 64 20 74 68 65 20 3c 61 ally read the <a
5490: 20 68 72 65 66 3d 22 68 74 74 70 3a 2f 2f 77 77 href="http://ww
54a0: 77 2e 67 65 6f 70 61 63 6b 61 67 65 2e 6f 72 67 w.geopackage.org
54b0: 2f 67 75 69 64 61 6e 63 65 2f 67 65 74 74 69 6e /guidance/gettin
54c0: 67 2d 73 74 61 72 74 65 64 2e 68 74 6d 6c 22 3e g-started.html">
54d0: 6f 66 66 69 63 69 61 6c 20 73 70 65 63 69 66 69 official specifi
54e0: 63 61 74 69 6f 6e 3c 2f 61 3e 20 66 6f 72 20 6d cation</a> for m
54f0: 6f 72 65 20 64 65 74 61 69 6c 73 2e 3c 62 72 3e ore details.<br>
5500: 0d 0a 53 79 6e 74 61 78 20 66 6f 72 20 63 72 65 ..Syntax for cre
5510: 61 74 69 6e 67 20 61 20 56 69 72 74 75 61 6c 46 ating a VirtualF
5520: 44 4f 20 54 61 62 6c 65 3a 0d 0a 3c 76 65 72 62 DO Table:..<verb
5530: 61 74 69 6d 3e 0d 0a 53 45 4c 45 43 54 20 43 52 atim>..SELECT CR
5540: 45 41 54 45 20 56 49 52 54 55 41 4c 20 54 41 42 EATE VIRTUAL TAB
5550: 4c 45 20 6d 79 5f 74 61 62 6c 65 20 55 53 49 4e LE my_table USIN
5560: 47 20 56 69 72 74 75 61 6c 47 70 6b 67 20 28 20 G VirtualGpkg (
5570: 74 61 62 6c 65 5f 6e 61 6d 65 20 29 3b 0d 0a 3c table_name );..<
5580: 2f 76 65 72 62 61 74 69 6d 3e 0d 0a 53 75 70 70 /verbatim>..Supp
5590: 6f 72 74 65 64 20 61 72 67 75 6d 65 6e 74 20 61 orted argument a
55a0: 6e 64 20 69 74 73 20 69 6e 74 65 72 70 72 65 74 nd its interpret
55b0: 61 74 69 6f 6e 3a 0d 0a 3c 75 6c 3e 0d 0a 3c 6c ation:..<ul>..<l
55c0: 69 3e 3c 62 3e 74 61 62 6c 65 5f 6e 61 6d 65 3c i><b>table_name<
55d0: 2f 62 3e 20 28 3c 69 3e 3c 62 3e 6d 61 6e 64 61 /b> (<i><b>manda
55e0: 74 6f 72 79 3c 2f 62 3e 3c 2f 69 3e 29 3a 20 74 tory</b></i>): t
55f0: 68 65 20 6e 61 6d 65 20 6f 66 20 74 68 65 20 54 he name of the T
5600: 61 62 6c 65 20 69 6e 20 74 68 65 20 63 75 72 72 able in the curr
5610: 65 6e 74 20 44 61 74 61 62 61 73 65 20 63 6f 6e ent Database con
5620: 74 61 69 6e 69 6e 67 20 6f 6e 65 20 6f 72 20 6d taining one or m
5630: 6f 72 65 20 47 50 4b 47 20 47 65 6f 6d 65 74 72 ore GPKG Geometr
5640: 79 20 43 6f 6c 75 6d 6e 73 20 74 6f 20 62 65 20 y Columns to be
5650: 61 75 74 6f 6d 61 74 69 63 61 6c 6c 79 20 74 72 automatically tr
5660: 61 6e 73 6c 61 74 65 64 20 74 6f 2f 66 72 6f 6d anslated to/from
5670: 20 53 70 61 74 69 61 4c 69 74 65 27 73 20 6f 77 SpatiaLite's ow
5680: 6e 20 6e 61 74 69 76 65 20 62 69 6e 61 72 79 20 n native binary
5690: 42 4c 4f 42 2d 66 6f 72 6d 61 74 2e 3c 2f 6c 69 BLOB-format.</li
56a0: 3e 0d 0a 3c 2f 75 6c 3e 3c 62 72 3e 0d 0a 3c 74 >..</ul><br>..<t
56b0: 61 62 6c 65 20 62 67 63 6f 6c 6f 72 3d 22 23 66 able bgcolor="#f
56c0: 66 66 66 64 30 22 20 63 65 6c 6c 70 61 64 64 69 fffd0" cellpaddi
56d0: 6e 67 3d 22 31 38 22 3e 3c 74 72 3e 3c 74 64 3e ng="18"><tr><td>
56e0: 0d 0a 3c 62 3e 4e 6f 74 65 3c 2f 62 3e 3a 20 61 ..<b>Note</b>: a
56f0: 6e 79 20 54 65 78 74 20 53 74 72 69 6e 67 2c 20 ny Text String,
5700: 71 75 6f 74 65 64 20 6f 72 20 6e 6f 74 2c 20 77 quoted or not, w
5710: 68 65 6e 20 69 74 20 61 70 70 65 61 72 73 20 61 hen it appears a
5720: 73 20 61 20 56 69 72 74 75 61 6c 20 54 61 62 6c s a Virtual Tabl
5730: 65 20 61 72 67 75 6d 65 6e 74 20 68 61 73 20 74 e argument has t
5740: 68 65 20 73 61 6d 65 20 65 66 66 65 63 74 2e 0d he same effect..
5750: 0a 3c 76 65 72 62 61 74 69 6d 3e 0d 0a 53 45 4c .<verbatim>..SEL
5760: 45 43 54 20 43 52 45 41 54 45 20 56 49 52 54 55 ECT CREATE VIRTU
5770: 41 4c 20 54 41 42 4c 45 20 6d 79 5f 74 61 62 6c AL TABLE my_tabl
5780: 65 20 55 53 49 4e 47 20 56 69 72 74 75 61 6c 47 e USING VirtualG
5790: 70 6b 73 28 20 6d 79 5f 70 61 72 63 65 6c 73 20 pks( my_parcels
57a0: 29 3b 0d 0a 6f 72 0d 0a 53 45 4c 45 43 54 20 43 );..or..SELECT C
57b0: 52 45 41 54 45 20 56 49 52 54 55 41 4c 20 54 41 REATE VIRTUAL TA
57c0: 42 4c 45 20 6d 79 5f 74 61 62 6c 65 20 55 53 49 BLE my_table USI
57d0: 4e 47 20 56 69 72 74 75 61 6c 47 70 6b 67 28 20 NG VirtualGpkg(
57e0: 27 6d 79 5f 70 61 72 63 65 6c 73 27 20 29 3b 0d 'my_parcels' );.
57f0: 0a 3c 2f 76 65 72 62 61 74 69 6d 3e 0d 0a 42 6f .</verbatim>..Bo
5800: 74 68 20 6e 6f 74 61 74 69 6f 6e 73 20 77 69 6c th notations wil
5810: 6c 20 70 72 6f 64 75 63 65 20 74 68 65 20 73 61 l produce the sa
5820: 6d 65 20 72 65 73 75 6c 74 2e 0d 0a 3c 2f 74 64 me result...</td
5830: 3e 3c 2f 74 72 3e 3c 2f 74 61 62 6c 65 3e 0d 0a ></tr></table>..
5840: 3c 62 72 3e 0d 0a 3c 74 61 62 6c 65 20 62 67 63 <br>..<table bgc
5850: 6f 6c 6f 72 3d 22 23 64 30 66 66 64 30 22 20 63 olor="#d0ffd0" c
5860: 65 6c 6c 70 61 64 64 69 6e 67 3d 22 31 38 22 3e ellpadding="18">
5870: 3c 74 72 3e 3c 74 64 3e 0d 0a 3c 68 33 3e 42 65 <tr><td>..<h3>Be
5880: 73 74 20 70 72 61 63 74 69 63 65 73 20 61 6e 64 st practices and
5890: 20 6b 6e 6f 77 6e 20 6c 69 6d 69 74 61 74 69 6f known limitatio
58a0: 6e 73 3c 2f 68 33 3e 0d 0a 3c 75 6c 3e 0d 0a 3c ns</h3>..<ul>..<
58b0: 6c 69 3e 56 69 72 74 75 61 6c 20 54 61 62 6c 65 li>Virtual Table
58c0: 73 20 61 72 65 20 6e 6f 74 20 72 65 61 6c 6c 79 s are not really
58d0: 20 67 65 6e 75 69 6e 65 20 44 61 74 61 62 61 73 genuine Databas
58e0: 65 20 54 61 62 6c 65 73 2c 20 74 68 65 79 20 61 e Tables, they a
58f0: 72 65 20 6a 75 73 74 20 65 6d 75 6c 61 74 69 6e re just emulatin
5900: 67 20 74 68 65 20 6f 72 69 67 69 6e 61 6c 20 73 g the original s
5910: 6f 75 72 63 65 20 61 73 20 61 20 44 61 74 61 62 ource as a Datab
5920: 61 73 65 20 54 61 62 6c 65 2e 3c 2f 6c 69 3e 0d ase Table.</li>.
5930: 0a 3c 6c 69 3e 56 69 72 74 75 61 6c 20 54 61 62 .<li>Virtual Tab
5940: 6c 65 73 20 68 61 76 65 20 76 65 72 79 20 70 6f les have very po
5950: 6f 72 20 73 70 65 65 64 20 70 65 72 66 6f 72 6d or speed perform
5960: 61 6e 63 65 73 2c 20 64 75 65 20 74 6f 20 74 68 ances, due to th
5970: 65 20 20 65 6d 75 6c 61 74 69 6f 6e 2c 20 61 73 e emulation, as
5980: 20 63 6f 6d 70 61 72 65 64 20 74 6f 20 67 65 6e compared to gen
5990: 75 69 6e 65 20 44 61 74 61 62 61 73 65 20 54 61 uine Database Ta
59a0: 62 6c 65 73 2e 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e bles.</li>..<li>
59b0: 43 6f 6d 70 6c 65 78 20 53 51 4c 20 71 75 65 72 Complex SQL quer
59c0: 69 65 73 20 3c 62 3e 4a 4f 49 4e 3c 2f 62 3e 69 ies <b>JOIN</b>i
59d0: 6e 67 20 73 65 76 65 72 61 6c 20 54 61 62 6c 65 ng several Table
59e0: 73 20 63 61 6e 20 6f 66 74 65 6e 20 72 65 74 75 s can often retu
59f0: 72 6e 20 6f 64 64 20 61 6e 64 20 6d 69 73 6c 65 rn odd and misle
5a00: 61 64 69 6e 67 20 72 65 73 75 6c 74 73 65 74 73 ading resultsets
5a10: 2c 20 77 68 65 6e 20 6f 6e 65 20 6f 72 20 6d 6f , when one or mo
5a20: 72 65 20 6f 66 20 74 68 65 20 3c 62 3e 4a 4f 49 re of the <b>JOI
5a30: 4e 3c 2f 62 3e 65 64 20 54 61 62 6c 65 73 20 61 N</b>ed Tables a
5a40: 72 65 20 6f 66 20 74 68 65 20 56 69 72 74 75 61 re of the Virtua
5a50: 6c 20 74 79 70 65 2e 3c 2f 6c 69 3e 0d 0a 3c 6c l type.</li>..<l
5a60: 69 3e 54 68 65 20 62 65 73 74 20 75 73 65 20 6f i>The best use o
5a70: 66 20 61 20 56 69 72 74 75 61 6c 20 54 61 62 6c f a Virtual Tabl
5a80: 65 20 69 73 20 74 6f 20 70 72 65 66 6f 72 6d 20 e is to preform
5a90: 61 20 62 61 73 69 63 20 64 61 74 61 20 69 6d 70 a basic data imp
5aa0: 6f 72 74 20 70 72 6f 63 65 73 73 2c 20 6f 72 20 ort process, or
5ab0: 74 6f 20 71 75 69 63 6b 6c 79 20 67 65 74 20 61 to quickly get a
5ac0: 6e 20 6f 76 65 72 61 6c 6c 20 67 6c 61 6e 63 65 n overall glance
5ad0: 20 61 74 20 61 20 66 75 6c 6c 20 64 61 74 61 73 at a full datas
5ae0: 65 74 20 77 69 74 68 6f 75 74 20 6e 65 63 65 73 et without neces
5af0: 73 61 72 69 6c 79 20 69 6d 70 6f 72 74 69 6e 67 sarily importing
5b00: 20 69 74 20 69 6e 74 6f 20 74 68 65 20 44 61 74 it into the Dat
5b10: 61 62 61 73 65 2e 3c 2f 6c 69 3e 0d 0a 3c 6c 69 abase.</li>..<li
5b20: 3e 50 72 65 74 65 6e 64 69 6e 67 20 74 6f 20 75 >Pretending to u
5b30: 73 65 20 61 20 56 69 72 74 75 61 6c 20 54 61 62 se a Virtual Tab
5b40: 6c 65 20 61 73 20 61 20 66 75 6c 6c 20 72 65 70 le as a full rep
5b50: 6c 61 63 65 6d 65 6e 74 20 6f 66 20 69 6d 70 6f lacement of impo
5b60: 72 74 69 6e 67 20 61 6c 6c 20 64 61 74 61 20 77 rting all data w
5b70: 69 74 68 69 6e 20 61 20 67 65 6e 75 69 6e 65 20 ithin a genuine
5b80: 44 61 74 61 62 61 73 65 20 54 61 62 6c 65 20 69 Database Table i
5b90: 73 20 73 74 72 6f 6e 67 6c 79 20 64 69 73 63 6f s strongly disco
5ba0: 75 72 61 67 65 64 2c 20 61 6e 64 20 6e 65 76 65 uraged, and neve
5bb0: 72 20 69 73 20 61 20 67 6f 6f 64 20 69 64 65 61 r is a good idea
5bc0: 2e 3c 2f 6c 69 3e 0d 0a 3c 2f 75 6c 3e 3c 62 72 .</li>..</ul><br
5bd0: 3e 0d 0a 3c 62 3e 4e 6f 74 65 3c 2f 62 3e 3a 20 >..<b>Note</b>:
5be0: 56 69 72 74 75 61 6c 47 50 4b 47 20 54 61 62 6c VirtualGPKG Tabl
5bf0: 65 73 20 73 75 70 70 6f 72 74 20 75 6e 72 65 73 es support unres
5c00: 74 72 69 63 74 65 64 20 3c 62 3e 52 45 41 44 2d tricted <b>READ-
5c10: 57 52 49 54 45 3c 2f 62 3e 20 6f 70 65 72 61 74 WRITE</b> operat
5c20: 69 6f 6e 73 2c 20 74 68 69 73 20 69 6e 63 6c 75 ions, this inclu
5c30: 64 69 6e 67 20 65 78 65 63 75 74 69 6e 67 20 3c ding executing <
5c40: 62 3e 49 4e 53 45 52 54 3c 2f 62 3e 2c 20 3c 62 b>INSERT</b>, <b
5c50: 3e 55 50 44 41 54 45 3c 2f 62 3e 20 61 6e 64 20 >UPDATE</b> and
5c60: 3c 62 3e 44 45 4c 45 54 45 3c 2f 62 3e 20 73 74 <b>DELETE</b> st
5c70: 61 74 65 6d 65 6e 74 73 2e 3c 62 72 3e 0d 0a 3c atements.<br>..<
5c80: 2f 74 64 3e 3c 2f 74 72 3e 3c 2f 74 61 62 6c 65 /td></tr></table
5c90: 3e 0d 0a 3c 62 72 3e 0d 0a 3c 68 72 3e 0d 0a 3c >..<br>..<hr>..<
5ca0: 62 72 3e 0d 0a 3c 61 20 68 72 65 66 3d 22 68 74 br>..<a href="ht
5cb0: 74 70 73 3a 2f 2f 77 77 77 2e 67 61 69 61 2d 67 tps://www.gaia-g
5cc0: 69 73 2e 69 74 2f 66 6f 73 73 69 6c 2f 6c 69 62 is.it/fossil/lib
5cd0: 73 70 61 74 69 61 6c 69 74 65 2f 68 6f 6d 65 22 spatialite/home"
5ce0: 3e 62 61 63 6b 20 74 6f 20 6d 61 69 6e 20 70 61 >back to main pa
5cf0: 67 65 3c 2f 61 3e 0a 5a 20 65 63 39 31 37 30 64 ge</a>.Z ec9170d
5d00: 34 30 62 64 32 64 37 39 32 35 66 38 66 31 63 30 40bd2d7925f8f1c0
5d10: 30 38 38 33 33 62 61 62 39 0a 08833bab9.