Wiki page
[Virtual Tables (misc)] by
sandro
2018-08-23 16:50:35.
0000: 44 20 32 30 31 38 2d 30 38 2d 32 33 54 31 36 3a D 2018-08-23T16:
0010: 35 30 3a 33 35 2e 35 38 32 0a 4c 20 56 69 72 74 50:35.582.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 36 39 31 61 61 33 34 39 64 30 sc).P 691aa349d0
0040: 33 64 64 39 63 38 37 62 61 64 34 62 63 65 34 36 3dd9c87bad4bce46
0050: 30 36 66 64 65 63 37 35 65 34 62 31 37 66 0a 55 06fdec75e4b17f.U
0060: 20 73 61 6e 64 72 6f 0a 57 20 32 33 36 30 37 0a sandro.W 23607.
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 71 ..<b>Note</b>: q
0e80: 75 6f 74 69 6e 67 20 6f 72 20 6e 6f 74 20 61 6e uoting or not an
0e90: 79 20 54 65 78 74 20 53 74 72 69 6e 67 20 77 68 y Text String wh
0ea0: 65 6e 20 69 74 20 61 70 70 65 61 72 73 20 61 73 en it appears as
0eb0: 20 61 20 56 69 72 74 75 61 6c 20 54 61 62 6c 65 a Virtual Table
0ec0: 20 61 72 67 75 6d 65 6e 74 20 68 61 73 20 61 62 argument has ab
0ed0: 73 6f 6c 75 74 65 6c 79 20 6e 6f 20 65 66 66 65 solutely no effe
0ee0: 63 74 2e 0d 0a 3c 76 65 72 62 61 74 69 6d 3e 0d ct...<verbatim>.
0ef0: 0a 53 45 4c 45 43 54 20 43 52 45 41 54 45 20 56 .SELECT CREATE V
0f00: 49 52 54 55 41 4c 20 54 41 42 4c 45 20 6d 79 5f IRTUAL TABLE my_
0f10: 74 61 62 6c 65 20 55 53 49 4e 47 20 56 69 72 74 table USING Virt
0f20: 75 61 6c 53 68 61 70 65 28 20 2f 68 6f 6d 65 2f ualShape( /home/
0f30: 73 61 6e 64 72 6f 2f 6d 79 73 68 70 20 2c 20 43 sandro/myshp , C
0f40: 50 31 32 35 32 20 2c 20 33 30 30 33 20 2c 20 31 P1252 , 3003 , 1
0f50: 20 2c 20 6c 6f 77 65 72 20 29 3b 0d 0a 6f 72 0d , lower );..or.
0f60: 0a 53 45 4c 45 43 54 20 43 52 45 41 54 45 20 56 .SELECT CREATE V
0f70: 49 52 54 55 41 4c 20 54 41 42 4c 45 20 6d 79 5f IRTUAL TABLE my_
0f80: 74 61 62 6c 65 20 55 53 49 4e 47 20 56 69 72 74 table USING Virt
0f90: 75 61 6c 53 68 61 70 65 28 20 27 2f 68 6f 6d 65 ualShape( '/home
0fa0: 2f 73 61 6e 64 72 6f 2f 6d 79 73 68 70 27 20 2c /sandro/myshp' ,
0fb0: 20 27 43 50 31 32 35 32 27 20 2c 20 33 30 30 33 'CP1252' , 3003
0fc0: 20 2c 20 31 20 2c 20 27 6c 6f 77 65 72 27 20 29 , 1 , 'lower' )
0fd0: 3b 0d 0a 3c 2f 76 65 72 62 61 74 69 6d 3e 0d 0a ;..</verbatim>..
0fe0: 42 6f 74 68 20 6e 6f 74 61 74 69 6f 6e 73 20 77 Both notations w
0ff0: 69 6c 6c 20 70 72 6f 64 75 63 65 20 74 68 65 20 ill produce the
1000: 73 61 6d 65 20 72 65 73 75 6c 74 2e 0d 0a 3c 2f same result...</
1010: 74 64 3e 3c 2f 74 72 3e 3c 2f 74 61 62 6c 65 3e td></tr></table>
1020: 0d 0a 3c 62 72 3e 0d 0a 3c 74 61 62 6c 65 20 62 ..<br>..<table b
1030: 67 63 6f 6c 6f 72 3d 22 23 64 30 66 66 64 30 22 gcolor="#d0ffd0"
1040: 20 63 65 6c 6c 70 61 64 64 69 6e 67 3d 22 31 38 cellpadding="18
1050: 22 3e 3c 74 72 3e 3c 74 64 3e 0d 0a 3c 68 33 3e "><tr><td>..<h3>
1060: 42 65 73 74 20 70 72 61 63 74 69 63 65 73 20 61 Best practices a
1070: 6e 64 20 6b 6e 6f 77 6e 20 6c 69 6d 69 74 61 74 nd known limitat
1080: 69 6f 6e 73 3c 2f 68 33 3e 0d 0a 3c 75 6c 3e 0d ions</h3>..<ul>.
1090: 0a 3c 6c 69 3e 56 69 72 74 75 61 6c 20 54 61 62 .<li>Virtual Tab
10a0: 6c 65 73 20 61 72 65 20 6e 6f 74 20 72 65 61 6c les are not real
10b0: 6c 79 20 67 65 6e 75 69 6e 65 20 44 61 74 61 62 ly genuine Datab
10c0: 61 73 65 20 54 61 62 6c 65 73 2c 20 74 68 65 79 ase Tables, they
10d0: 20 61 72 65 20 6a 75 73 74 20 65 6d 75 6c 61 74 are just emulat
10e0: 69 6e 67 20 74 68 65 20 6f 72 69 67 69 6e 61 6c ing the original
10f0: 20 73 6f 75 72 63 65 20 61 73 20 61 20 44 61 74 source as a Dat
1100: 61 62 61 73 65 20 54 61 62 6c 65 2e 3c 2f 6c 69 abase Table.</li
1110: 3e 0d 0a 3c 6c 69 3e 56 69 72 74 75 61 6c 20 54 >..<li>Virtual T
1120: 61 62 6c 65 73 20 68 61 76 65 20 76 65 72 79 20 ables have very
1130: 70 6f 6f 72 20 73 70 65 65 64 20 70 65 72 66 6f poor speed perfo
1140: 72 6d 61 6e 63 65 73 2c 20 64 75 65 20 74 6f 20 rmances, due to
1150: 74 68 65 20 20 65 6d 75 6c 61 74 69 6f 6e 2c 20 the emulation,
1160: 61 73 20 63 6f 6d 70 61 72 65 64 20 74 6f 20 67 as compared to g
1170: 65 6e 75 69 6e 65 20 44 61 74 61 62 61 73 65 20 enuine Database
1180: 54 61 62 6c 65 73 2e 3c 2f 6c 69 3e 0d 0a 3c 6c Tables.</li>..<l
1190: 69 3e 43 6f 6d 70 6c 65 78 20 53 51 4c 20 71 75 i>Complex SQL qu
11a0: 65 72 69 65 73 20 3c 62 3e 4a 4f 49 4e 3c 2f 62 eries <b>JOIN</b
11b0: 3e 69 6e 67 20 73 65 76 65 72 61 6c 20 54 61 62 >ing several Tab
11c0: 6c 65 73 20 63 61 6e 20 6f 66 74 65 6e 20 72 65 les can often re
11d0: 74 75 72 6e 20 6f 64 64 20 61 6e 64 20 6d 69 73 turn odd and mis
11e0: 6c 65 61 64 69 6e 67 20 72 65 73 75 6c 74 73 65 leading resultse
11f0: 74 73 2c 20 77 68 65 6e 20 6f 6e 65 20 6f 72 20 ts, when one or
1200: 6d 6f 72 65 20 6f 66 20 74 68 65 20 3c 62 3e 4a more of the <b>J
1210: 4f 49 4e 3c 2f 62 3e 65 64 20 54 61 62 6c 65 73 OIN</b>ed Tables
1220: 20 61 72 65 20 6f 66 20 74 68 65 20 56 69 72 74 are of the Virt
1230: 75 61 6c 20 74 79 70 65 2e 3c 2f 6c 69 3e 0d 0a ual type.</li>..
1240: 3c 6c 69 3e 54 68 65 20 62 65 73 74 20 75 73 65 <li>The best use
1250: 20 6f 66 20 61 20 56 69 72 74 75 61 6c 20 54 61 of a Virtual Ta
1260: 62 6c 65 20 69 73 20 74 6f 20 70 72 65 66 6f 72 ble is to prefor
1270: 6d 20 61 20 62 61 73 69 63 20 64 61 74 61 20 69 m a basic data i
1280: 6d 70 6f 72 74 20 70 72 6f 63 65 73 73 2c 20 6f mport process, o
1290: 72 20 74 6f 20 71 75 69 63 6b 6c 79 20 67 65 74 r to quickly get
12a0: 20 61 6e 20 6f 76 65 72 61 6c 6c 20 67 6c 61 6e an overall glan
12b0: 63 65 20 61 74 20 61 20 66 75 6c 6c 20 64 61 74 ce at a full dat
12c0: 61 73 65 74 20 77 69 74 68 6f 75 74 20 6e 65 63 aset without nec
12d0: 65 73 73 61 72 69 6c 79 20 69 6d 70 6f 72 74 69 essarily importi
12e0: 6e 67 20 69 74 20 69 6e 74 6f 20 74 68 65 20 44 ng it into the D
12f0: 61 74 61 62 61 73 65 2e 3c 2f 6c 69 3e 0d 0a 3c atabase.</li>..<
1300: 6c 69 3e 50 72 65 74 65 6e 64 69 6e 67 20 74 6f li>Pretending to
1310: 20 75 73 65 20 61 20 56 69 72 74 75 61 6c 20 54 use a Virtual T
1320: 61 62 6c 65 20 61 73 20 61 20 66 75 6c 6c 20 72 able as a full r
1330: 65 70 6c 61 63 65 6d 65 6e 74 20 6f 66 20 69 6d eplacement of im
1340: 70 6f 72 74 69 6e 67 20 61 6c 6c 20 64 61 74 61 porting all data
1350: 20 77 69 74 68 69 6e 20 61 20 67 65 6e 75 69 6e within a genuin
1360: 65 20 44 61 74 61 62 61 73 65 20 54 61 62 6c 65 e Database Table
1370: 20 69 73 20 73 74 72 6f 6e 67 6c 79 20 64 69 73 is strongly dis
1380: 63 6f 75 72 61 67 65 64 2c 20 61 6e 64 20 6e 65 couraged, and ne
1390: 76 65 72 20 69 73 20 61 20 67 6f 6f 64 20 69 64 ver is a good id
13a0: 65 61 2e 3c 2f 6c 69 3e 0d 0a 3c 2f 75 6c 3e 3c ea.</li>..</ul><
13b0: 62 72 3e 0d 0a 3c 62 3e 57 61 72 6e 69 6e 67 3c br>..<b>Warning<
13c0: 2f 62 3e 3a 20 56 69 72 74 75 61 6c 53 68 61 70 /b>: VirtualShap
13d0: 65 20 54 61 62 6c 65 73 20 61 72 65 20 61 6c 77 e Tables are alw
13e0: 61 79 73 20 73 75 62 6a 65 63 74 20 74 6f 20 3c ays subject to <
13f0: 62 3e 52 45 41 44 2d 4f 4e 4c 59 3c 2f 62 3e 20 b>READ-ONLY</b>
1400: 72 65 73 74 72 69 63 74 69 6f 6e 73 2e 20 41 6e restrictions. An
1410: 79 20 61 74 74 65 6d 70 74 20 74 6f 20 74 6f 20 y attempt to to
1420: 65 78 65 63 75 74 65 20 61 6e 20 3c 62 3e 49 4e execute an <b>IN
1430: 53 45 52 54 3c 2f 62 3e 2c 20 3c 62 3e 55 50 44 SERT</b>, <b>UPD
1440: 41 54 45 3c 2f 62 3e 20 6f 72 20 3c 62 3e 44 45 ATE</b> or <b>DE
1450: 4c 45 54 45 3c 2f 62 3e 20 73 74 61 74 65 6d 65 LETE</b> stateme
1460: 6e 74 20 77 69 6c 6c 20 61 6c 77 61 79 73 20 72 nt will always r
1470: 65 74 75 72 6e 20 61 6e 20 65 72 72 6f 72 2e 3c eturn an error.<
1480: 62 72 3e 0d 0a 3c 2f 74 64 3e 3c 2f 74 72 3e 3c br>..</td></tr><
1490: 2f 74 61 62 6c 65 3e 0d 0a 3c 62 72 3e 0d 0a 3c /table>..<br>..<
14a0: 74 61 62 6c 65 20 62 67 63 6f 6c 6f 72 3d 22 23 table bgcolor="#
14b0: 65 30 65 30 65 30 22 20 63 65 6c 6c 70 61 64 64 e0e0e0" cellpadd
14c0: 69 6e 67 3d 22 31 38 22 3e 3c 74 72 3e 3c 74 64 ing="18"><tr><td
14d0: 3e 0d 0a 3c 68 33 3e 52 65 6c 61 74 65 64 20 54 >..<h3>Related T
14e0: 6f 70 69 63 73 3c 2f 68 33 3e 0d 0a 3c 75 6c 3e opics</h3>..<ul>
14f0: 0d 0a 3c 6c 69 3e 54 68 65 20 3c 62 3e 49 6d 70 ..<li>The <b>Imp
1500: 6f 72 74 53 48 50 28 29 3c 2f 62 3e 20 53 51 4c ortSHP()</b> SQL
1510: 20 66 75 6e 63 74 69 6f 6e 20 61 6c 6c 6f 77 73 function allows
1520: 20 74 6f 20 63 72 65 61 74 65 20 61 6e 64 20 70 to create and p
1530: 6f 70 75 6c 61 74 65 20 61 20 67 65 6e 75 69 6e opulate a genuin
1540: 65 20 53 70 61 74 69 61 6c 20 54 61 62 6c 65 20 e Spatial Table
1550: 62 79 20 69 6d 70 6f 72 74 69 6e 67 20 61 6e 20 by importing an
1560: 65 78 74 65 72 6e 61 6c 20 53 68 61 70 65 66 69 external Shapefi
1570: 6c 65 2e 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e 41 6e le.</li>..<li>An
1580: 64 20 74 68 65 20 3c 62 3e 45 78 70 6f 72 74 53 d the <b>ExportS
1590: 48 50 28 29 3c 2f 62 3e 20 73 69 73 74 65 72 20 HP()</b> sister
15a0: 66 75 6e 63 74 69 6f 6e 20 61 6c 6c 6f 77 73 20 function allows
15b0: 74 68 65 20 65 78 70 6f 72 74 61 74 69 6f 6e 20 the exportation
15c0: 61 20 77 68 6f 6c 65 20 53 70 61 74 69 61 6c 20 a whole Spatial
15d0: 54 61 62 6c 65 20 69 6e 74 6f 20 61 6e 20 65 78 Table into an ex
15e0: 74 65 72 6e 61 6c 20 53 68 61 70 65 66 69 6c 65 ternal Shapefile
15f0: 2e 3c 2f 6c 69 3e 0d 0a 3c 2f 75 6c 3e 0d 0a 3c .</li>..</ul>..<
1600: 2f 74 64 3e 3c 2f 74 72 3e 3c 2f 74 61 62 6c 65 /td></tr></table
1610: 3e 0d 0a 3c 62 72 3e 0d 0a 3c 68 72 3e 0d 0a 3c >..<br>..<hr>..<
1620: 68 31 3e 3c 61 20 69 64 3d 22 56 69 72 74 75 61 h1><a id="Virtua
1630: 6c 44 42 46 22 3e 56 69 72 74 75 61 6c 44 42 46 lDBF">VirtualDBF
1640: 3c 2f 61 3e 3c 2f 68 31 3e 0d 0a 54 68 65 20 3c </a></h1>..The <
1650: 62 3e 56 69 72 74 75 61 6c 44 42 46 3c 2f 62 3e b>VirtualDBF</b>
1660: 20 49 6e 74 65 72 66 61 63 65 20 61 6c 6c 6f 77 Interface allow
1670: 73 20 74 6f 20 64 69 72 65 63 74 6c 79 20 61 63 s to directly ac
1680: 63 65 73 73 20 61 6e 20 65 78 74 65 72 6e 61 6c cess an external
1690: 20 44 42 46 20 74 61 62 6c 65 20 62 79 20 75 73 DBF table by us
16a0: 69 6e 67 20 73 74 61 6e 64 61 72 64 20 53 70 61 ing standard Spa
16b0: 74 69 61 6c 20 53 51 4c 20 71 75 65 72 69 65 73 tial SQL queries
16c0: 2e 3c 62 72 3e 0d 0a 53 79 6e 74 61 78 20 66 6f .<br>..Syntax fo
16d0: 72 20 63 72 65 61 74 69 6e 67 20 61 20 56 69 72 r creating a Vir
16e0: 74 75 61 6c 44 62 66 20 54 61 62 6c 65 3a 0d 0a tualDbf Table:..
16f0: 3c 76 65 72 62 61 74 69 6d 3e 0d 0a 53 45 4c 45 <verbatim>..SELE
1700: 43 54 20 43 52 45 41 54 45 20 56 49 52 54 55 41 CT CREATE VIRTUA
1710: 4c 20 54 41 42 4c 45 20 6d 79 5f 74 61 62 6c 65 L TABLE my_table
1720: 20 55 53 49 4e 47 20 56 69 72 74 75 61 6c 44 62 USING VirtualDb
1730: 66 20 28 20 64 62 66 5f 70 61 74 68 20 2c 20 63 f ( dbf_path , c
1740: 68 61 72 73 65 74 5f 65 6e 63 6f 64 69 6e 67 20 harset_encoding
1750: 29 3b 0d 0a 0d 0a 53 45 4c 45 43 54 20 43 52 45 );....SELECT CRE
1760: 41 54 45 20 56 49 52 54 55 41 4c 20 54 41 42 4c ATE VIRTUAL TABL
1770: 45 20 6d 79 5f 74 61 62 6c 65 20 55 53 49 4e 47 E my_table USING
1780: 20 56 69 72 74 75 61 6c 44 62 66 20 28 20 64 62 VirtualDbf ( db
1790: 66 5f 70 61 74 68 20 2c 20 63 68 61 72 73 65 74 f_path , charset
17a0: 5f 65 6e 63 6f 64 69 6e 67 20 2c 20 74 65 78 74 _encoding , text
17b0: 5f 64 61 74 65 73 20 29 3b 0d 0a 0d 0a 53 45 4c _dates );....SEL
17c0: 45 43 54 20 43 52 45 41 54 45 20 56 49 52 54 55 ECT CREATE VIRTU
17d0: 41 4c 20 54 41 42 4c 45 20 6d 79 5f 74 61 62 6c AL TABLE my_tabl
17e0: 65 20 55 53 49 4e 47 20 56 69 72 74 75 61 6c 44 e USING VirtualD
17f0: 62 66 20 28 20 64 62 66 5f 70 61 74 68 20 2c 20 bf ( dbf_path ,
1800: 63 68 61 72 73 65 74 5f 65 6e 63 6f 64 69 6e 67 charset_encoding
1810: 20 2c 20 74 65 78 74 5f 64 61 74 65 73 20 2c 20 , text_dates ,
1820: 63 6f 6c 6e 61 6d 65 5f 63 61 73 65 20 29 3b 0d colname_case );.
1830: 0a 3c 2f 76 65 72 62 61 74 69 6d 3e 0d 0a 53 75 .</verbatim>..Su
1840: 70 70 6f 72 74 65 64 20 61 72 67 75 6d 65 6e 74 pported argument
1850: 73 20 61 6e 64 20 74 68 65 69 72 20 69 6e 74 65 s and their inte
1860: 72 70 72 65 74 61 74 69 6f 6e 3a 0d 0a 3c 75 6c rpretation:..<ul
1870: 3e 0d 0a 3c 6c 69 3e 3c 62 3e 64 62 66 5f 70 61 >..<li><b>dbf_pa
1880: 74 68 3c 2f 62 3e 20 28 3c 69 3e 3c 62 3e 6d 61 th</b> (<i><b>ma
1890: 6e 64 61 74 6f 72 79 3c 2f 62 3e 3c 2f 69 3e 29 ndatory</b></i>)
18a0: 3a 20 74 68 65 20 72 65 6c 61 74 69 76 65 20 6f : the relative o
18b0: 72 20 61 62 73 6f 6c 75 74 65 20 70 61 74 68 6e r absolute pathn
18c0: 61 6d 65 20 6c 65 61 64 69 6e 67 20 74 6f 20 74 ame leading to t
18d0: 68 65 20 65 78 74 65 72 6e 61 6c 20 44 42 46 20 he external DBF
18e0: 66 69 6c 65 2e 0d 0a 3c 75 6c 3e 0d 0a 3c 6c 69 file...<ul>..<li
18f0: 3e 3c 62 3e 4e 6f 74 65 3c 2f 62 3e 3a 20 74 68 ><b>Note</b>: th
1900: 65 20 66 75 6c 6c 20 70 61 74 68 6e 61 6d 65 20 e full pathname
1910: 6d 75 73 74 20 62 65 20 70 61 73 73 65 64 2c 20 must be passed,
1920: 69 6e 63 6c 75 64 69 6e 67 20 74 68 65 20 66 69 including the fi
1930: 6e 61 6c 20 3c 69 3e 2a 2e 64 62 66 3c 2f 69 3e nal <i>*.dbf</i>
1940: 20 73 75 66 66 69 78 2e 3c 2f 6c 69 3e 0d 0a 3c suffix.</li>..<
1950: 2f 75 6c 3e 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e 3c /ul></li>..<li><
1960: 62 3e 63 68 61 72 73 65 74 5f 65 6e 63 6f 64 69 b>charset_encodi
1970: 6e 67 3c 2f 62 3e 20 28 3c 69 3e 3c 62 3e 6d 61 ng</b> (<i><b>ma
1980: 6e 64 61 74 6f 72 79 3c 2f 62 3e 3c 2f 69 3e 29 ndatory</b></i>)
1990: 3a 20 63 61 6e 6f 6e 69 63 61 6c 20 6e 61 6d 65 : canonical name
19a0: 20 6f 66 20 74 68 65 20 63 68 61 72 73 65 74 20 of the charset
19b0: 65 6e 63 6f 64 69 6e 67 20 61 64 6f 70 74 65 64 encoding adopted
19c0: 20 62 79 20 74 68 65 20 3c 62 3e 44 42 46 3c 2f by the <b>DBF</
19d0: 62 3e 20 6d 65 6d 62 65 72 2e 0d 0a 3c 75 6c 3e b> member...<ul>
19e0: 0d 0a 3c 6c 69 3e 45 78 61 6d 70 6c 65 73 20 6f ..<li>Examples o
19f0: 66 20 76 61 6c 69 64 20 6e 61 6d 65 73 20 61 72 f valid names ar
1a00: 65 3a 20 3c 62 3e 41 53 43 49 49 3c 2f 62 3e 2c e: <b>ASCII</b>,
1a10: 20 3c 62 3e 55 54 46 2d 38 3c 2f 62 3e 2c 20 3c <b>UTF-8</b>, <
1a20: 62 3e 43 50 38 35 30 3c 2f 62 3e 2c 20 3c 62 3e b>CP850</b>, <b>
1a30: 43 50 31 32 35 32 3c 2f 62 3e 2c 20 3c 62 3e 49 CP1252</b>, <b>I
1a40: 53 4f 2d 38 38 34 39 2d 31 3c 2f 62 3e 3c 2f 6c SO-8849-1</b></l
1a50: 69 3e 0d 0a 3c 6c 69 3e 59 6f 75 20 63 61 6e 20 i>..<li>You can
1a60: 63 68 65 63 6b 20 74 68 65 20 66 75 6c 6c 20 6c check the full l
1a70: 69 73 74 20 6f 66 20 73 75 70 70 6f 72 74 65 64 ist of supported
1a80: 20 63 68 61 72 73 65 74 20 65 6e 63 6f 64 69 6e charset encodin
1a90: 67 73 20 3c 61 20 68 72 65 66 3d 22 68 74 74 70 gs <a href="http
1aa0: 73 3a 2f 2f 77 77 77 2e 67 6e 75 2e 6f 72 67 2f s://www.gnu.org/
1ab0: 73 6f 66 74 77 61 72 65 2f 6c 69 62 69 63 6f 6e software/libicon
1ac0: 76 2f 22 3e 68 65 72 65 3c 2f 61 3e 2e 3c 2f 6c v/">here</a>.</l
1ad0: 69 3e 0d 0a 3c 2f 75 6c 3e 3c 2f 6c 69 3e 0d 0a i>..</ul></li>..
1ae0: 3c 6c 69 3e 3c 62 3e 74 65 78 74 5f 64 61 74 65 <li><b>text_date
1af0: 73 3c 2f 62 3e 20 28 3c 69 3e 3c 62 3e 6f 70 74 s</b> (<i><b>opt
1b00: 69 6f 6e 61 6c 3c 2f 62 3e 3c 2f 69 3e 29 3a 20 ional</b></i>):
1b10: 74 68 69 73 20 69 73 20 61 20 3c 62 3e 42 4f 4f this is a <b>BOO
1b20: 4c 45 41 4e 3c 2f 62 3e 20 66 6c 61 67 3a 0d 0a LEAN</b> flag:..
1b30: 3c 75 6c 3e 0d 0a 3c 6c 69 3e 69 66 20 73 65 74 <ul>..<li>if set
1b40: 20 74 6f 20 3c 62 3e 30 3c 2f 62 3e 20 28 3c 62 to <b>0</b> (<b
1b50: 3e 46 41 4c 53 45 3c 2f 62 3e 29 20 61 6c 6c 20 >FALSE</b>) all
1b60: 66 69 65 6c 64 73 20 6f 66 20 74 68 65 20 3c 62 fields of the <b
1b70: 3e 44 41 54 45 3c 2f 62 3e 20 74 79 70 65 20 77 >DATE</b> type w
1b80: 69 6c 6c 20 62 65 20 72 65 70 72 65 73 65 6e 74 ill be represent
1b90: 65 64 20 61 73 20 3c 61 20 68 72 65 66 3d 22 68 ed as <a href="h
1ba0: 74 74 70 73 3a 2f 2f 77 77 77 2e 73 71 6c 69 74 ttps://www.sqlit
1bb0: 65 2e 6f 72 67 2f 6c 61 6e 67 5f 64 61 74 65 66 e.org/lang_datef
1bc0: 75 6e 63 2e 68 74 6d 6c 22 3e 6a 75 6c 69 61 6e unc.html">julian
1bd0: 20 64 61 74 65 73 3c 2f 61 3e 3c 2f 6c 69 3e 0d dates</a></li>.
1be0: 0a 3c 6c 69 3e 69 66 20 73 65 74 20 74 6f 20 61 .<li>if set to a
1bf0: 6e 79 20 6f 74 68 65 72 20 69 6e 74 65 67 65 72 ny other integer
1c00: 20 76 61 6c 75 65 20 28 3c 62 3e 54 52 55 45 3c value (<b>TRUE<
1c10: 2f 62 3e 29 20 61 6c 6c 20 66 69 65 6c 64 73 20 /b>) all fields
1c20: 6f 66 20 74 68 65 20 3c 62 3e 44 41 54 45 3c 2f of the <b>DATE</
1c30: 62 3e 20 74 79 70 65 20 77 69 6c 6c 20 62 65 20 b> type will be
1c40: 72 65 70 72 65 73 65 6e 74 65 64 20 61 73 20 54 represented as T
1c50: 65 78 74 20 53 74 72 69 6e 67 73 20 61 73 20 65 ext Strings as e
1c60: 2e 67 2e 20 3c 62 3e 32 30 31 38 2d 30 38 2d 32 .g. <b>2018-08-2
1c70: 31 3c 2f 62 3e 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e 1</b></li>..<li>
1c80: 69 66 20 6e 6f 74 20 65 78 70 6c 69 63 69 74 6c if not explicitl
1c90: 79 20 73 70 65 63 69 66 69 65 64 2c 20 3c 62 3e y specified, <b>
1ca0: 54 52 55 45 3c 2f 62 3e 20 77 69 6c 6c 20 61 6c TRUE</b> will al
1cb0: 77 61 79 73 20 62 65 20 61 73 73 75 6d 65 64 20 ways be assumed
1cc0: 28 64 65 66 61 75 6c 74 20 73 65 74 74 69 6e 67 (default setting
1cd0: 29 2e 3c 2f 6c 69 3e 0d 0a 3c 2f 75 6c 3e 3c 2f ).</li>..</ul></
1ce0: 6c 69 3e 0d 0a 3c 6c 69 3e 3c 62 3e 63 6f 6c 6e li>..<li><b>coln
1cf0: 61 6d 65 5f 63 61 73 65 3c 2f 62 3e 20 28 3c 69 ame_case</b> (<i
1d00: 3e 3c 62 3e 6f 70 74 69 6f 6e 61 6c 3c 2f 62 3e ><b>optional</b>
1d10: 3c 2f 69 3e 29 3a 20 74 68 69 73 20 61 72 67 75 </i>): this argu
1d20: 6d 65 6e 74 20 73 70 65 63 69 66 69 65 73 20 69 ment specifies i
1d30: 66 20 61 6c 6c 20 63 6f 6c 75 6d 6e 20 6e 61 6d f all column nam
1d40: 65 73 20 73 68 6f 75 6c 64 20 62 65 20 63 6f 6e es should be con
1d50: 73 69 64 65 72 65 64 20 75 70 70 65 72 63 61 73 sidered uppercas
1d60: 65 20 6f 72 20 6c 6f 77 65 72 63 61 73 65 2e 3c e or lowercase.<
1d70: 62 72 3e 0d 0a 56 61 6c 69 64 20 73 65 74 74 69 br>..Valid setti
1d80: 6e 67 73 20 61 72 65 3a 0d 0a 3c 75 6c 3e 0d 0a ngs are:..<ul>..
1d90: 3c 6c 69 3e 3c 62 3e 75 70 70 65 72 63 61 73 65 <li><b>uppercase
1da0: 3c 2f 62 3e 20 6f 72 20 3c 62 3e 75 70 70 65 72 </b> or <b>upper
1db0: 3c 2f 62 3e 3a 20 61 6c 6c 20 63 6f 6c 75 6d 6e </b>: all column
1dc0: 20 6e 61 6d 65 73 20 77 69 6c 6c 20 62 65 20 66 names will be f
1dd0: 75 6c 6c 79 20 63 61 70 69 74 61 6c 69 7a 65 64 ully capitalized
1de0: 2e 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e 3c 62 3e 6c .</li>..<li><b>l
1df0: 6f 77 65 72 63 61 73 65 3c 2f 62 3e 20 6f 72 20 owercase</b> or
1e00: 3c 62 3e 6c 6f 77 65 72 3c 2f 62 3e 3a 20 61 6c <b>lower</b>: al
1e10: 6c 20 63 6f 6c 75 6d 6e 20 6e 61 6d 65 73 20 77 l column names w
1e20: 69 6c 6c 20 62 65 20 66 75 6c 6c 20 6c 6f 77 65 ill be full lowe
1e30: 72 63 61 73 65 2e 3c 2f 6c 69 3e 0d 0a 3c 6c 69 rcase.</li>..<li
1e40: 3e 3c 62 3e 73 61 6d 65 63 61 73 65 3c 2f 62 3e ><b>samecase</b>
1e50: 20 6f 72 20 3c 62 3e 73 61 6d 65 3c 2f 62 3e 3a or <b>same</b>:
1e60: 20 61 6c 6c 20 63 6f 6c 75 6d 6e 20 6e 61 6d 65 all column name
1e70: 73 20 77 69 6c 6c 20 62 65 20 65 78 61 63 74 6c s will be exactl
1e80: 79 20 70 72 65 73 65 72 76 65 64 20 61 73 20 74 y preserved as t
1e90: 68 65 79 20 61 72 65 20 64 65 66 69 6e 65 64 20 hey are defined
1ea0: 69 6e 74 6f 20 74 68 65 20 44 42 46 20 6d 65 6d into the DBF mem
1eb0: 62 65 72 2e 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e 69 ber.</li>..<li>i
1ec0: 66 20 6e 6f 74 20 73 70 65 63 69 66 69 65 64 2c f not specified,
1ed0: 20 6f 72 20 69 66 20 61 6e 79 20 6f 74 68 65 72 or if any other
1ee0: 20 64 65 66 69 6e 69 74 69 6f 6e 20 64 65 66 69 definition defi
1ef0: 6e 69 74 69 6f 6e 20 69 73 20 66 6f 75 6e 64 2c nition is found,
1f00: 20 3c 62 3e 6c 6f 77 65 72 63 61 73 65 3c 2f 62 <b>lowercase</b
1f10: 3e 20 77 69 6c 6c 20 61 6c 77 61 79 73 20 62 65 > will always be
1f20: 20 61 73 73 75 6d 65 64 20 28 64 65 66 61 75 6c assumed (defaul
1f30: 74 20 73 65 74 74 69 6e 67 29 2e 3c 2f 6c 69 3e t setting).</li>
1f40: 0d 0a 3c 2f 75 6c 3e 3c 2f 6c 69 3e 0d 0a 3c 2f ..</ul></li>..</
1f50: 75 6c 3e 3c 62 72 3e 0d 0a 3c 74 61 62 6c 65 20 ul><br>..<table
1f60: 62 67 63 6f 6c 6f 72 3d 22 23 66 66 66 66 64 30 bgcolor="#ffffd0
1f70: 22 20 63 65 6c 6c 70 61 64 64 69 6e 67 3d 22 31 " cellpadding="1
1f80: 38 22 3e 3c 74 72 3e 3c 74 64 3e 0d 0a 3c 62 3e 8"><tr><td>..<b>
1f90: 4e 6f 74 65 3c 2f 62 3e 3a 20 71 75 6f 74 69 6e Note</b>: quotin
1fa0: 67 20 6f 72 20 6e 6f 74 20 61 6e 79 20 54 65 78 g or not any Tex
1fb0: 74 20 53 74 72 69 6e 67 20 77 68 65 6e 20 69 74 t String when it
1fc0: 20 61 70 70 65 61 72 73 20 61 73 20 61 20 56 69 appears as a Vi
1fd0: 72 74 75 61 6c 20 54 61 62 6c 65 20 61 72 67 75 rtual Table argu
1fe0: 6d 65 6e 74 20 68 61 73 20 61 62 73 6f 6c 75 74 ment has absolut
1ff0: 65 6c 79 20 6e 6f 20 65 66 66 65 63 74 2e 0d 0a ely no effect...
2000: 3c 76 65 72 62 61 74 69 6d 3e 0d 0a 53 45 4c 45 <verbatim>..SELE
2010: 43 54 20 43 52 45 41 54 45 20 56 49 52 54 55 41 CT CREATE VIRTUA
2020: 4c 20 54 41 42 4c 45 20 6d 79 5f 74 61 62 6c 65 L TABLE my_table
2030: 20 55 53 49 4e 47 20 56 69 72 74 75 61 6c 44 62 USING VirtualDb
2040: 66 28 20 2f 68 6f 6d 65 2f 73 61 6e 64 72 6f 2f f( /home/sandro/
2050: 6d 79 73 68 70 20 2c 20 43 50 31 32 35 32 20 2c myshp , CP1252 ,
2060: 20 31 20 2c 20 6c 6f 77 65 72 20 29 3b 0d 0a 6f 1 , lower );..o
2070: 72 0d 0a 53 45 4c 45 43 54 20 43 52 45 41 54 45 r..SELECT CREATE
2080: 20 56 49 52 54 55 41 4c 20 54 41 42 4c 45 20 6d VIRTUAL TABLE m
2090: 79 5f 74 61 62 6c 65 20 55 53 49 4e 47 20 56 69 y_table USING Vi
20a0: 72 74 75 61 6c 44 62 66 28 20 27 2f 68 6f 6d 65 rtualDbf( '/home
20b0: 2f 73 61 6e 64 72 6f 2f 6d 79 73 68 70 27 20 2c /sandro/myshp' ,
20c0: 20 27 43 50 31 32 35 32 27 20 2c 20 31 20 2c 20 'CP1252' , 1 ,
20d0: 27 6c 6f 77 65 72 27 20 29 3b 0d 0a 3c 2f 76 65 'lower' );..</ve
20e0: 72 62 61 74 69 6d 3e 0d 0a 42 6f 74 68 20 6e 6f rbatim>..Both no
20f0: 74 61 74 69 6f 6e 73 20 77 69 6c 6c 20 70 72 6f tations will pro
2100: 64 75 63 65 20 74 68 65 20 73 61 6d 65 20 72 65 duce the same re
2110: 73 75 6c 74 2e 0d 0a 3c 2f 74 64 3e 3c 2f 74 72 sult...</td></tr
2120: 3e 3c 2f 74 61 62 6c 65 3e 0d 0a 3c 62 72 3e 0d ></table>..<br>.
2130: 0a 3c 74 61 62 6c 65 20 62 67 63 6f 6c 6f 72 3d .<table bgcolor=
2140: 22 23 64 30 66 66 64 30 22 20 63 65 6c 6c 70 61 "#d0ffd0" cellpa
2150: 64 64 69 6e 67 3d 22 31 38 22 3e 3c 74 72 3e 3c dding="18"><tr><
2160: 74 64 3e 0d 0a 3c 68 33 3e 42 65 73 74 20 70 72 td>..<h3>Best pr
2170: 61 63 74 69 63 65 73 20 61 6e 64 20 6b 6e 6f 77 actices and know
2180: 6e 20 6c 69 6d 69 74 61 74 69 6f 6e 73 3c 2f 68 n limitations</h
2190: 33 3e 0d 0a 3c 75 6c 3e 0d 0a 3c 6c 69 3e 56 69 3>..<ul>..<li>Vi
21a0: 72 74 75 61 6c 20 54 61 62 6c 65 73 20 61 72 65 rtual Tables are
21b0: 20 6e 6f 74 20 72 65 61 6c 6c 79 20 67 65 6e 75 not really genu
21c0: 69 6e 65 20 44 61 74 61 62 61 73 65 20 54 61 62 ine Database Tab
21d0: 6c 65 73 2c 20 74 68 65 79 20 61 72 65 20 6a 75 les, they are ju
21e0: 73 74 20 65 6d 75 6c 61 74 69 6e 67 20 74 68 65 st emulating the
21f0: 20 6f 72 69 67 69 6e 61 6c 20 73 6f 75 72 63 65 original source
2200: 20 61 73 20 61 20 44 61 74 61 62 61 73 65 20 54 as a Database T
2210: 61 62 6c 65 2e 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e able.</li>..<li>
2220: 56 69 72 74 75 61 6c 20 54 61 62 6c 65 73 20 68 Virtual Tables h
2230: 61 76 65 20 76 65 72 79 20 70 6f 6f 72 20 73 70 ave very poor sp
2240: 65 65 64 20 70 65 72 66 6f 72 6d 61 6e 63 65 73 eed performances
2250: 2c 20 64 75 65 20 74 6f 20 74 68 65 20 20 65 6d , due to the em
2260: 75 6c 61 74 69 6f 6e 2c 20 61 73 20 63 6f 6d 70 ulation, as comp
2270: 61 72 65 64 20 74 6f 20 67 65 6e 75 69 6e 65 20 ared to genuine
2280: 44 61 74 61 62 61 73 65 20 54 61 62 6c 65 73 2e Database Tables.
2290: 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e 43 6f 6d 70 6c </li>..<li>Compl
22a0: 65 78 20 53 51 4c 20 71 75 65 72 69 65 73 20 3c ex SQL queries <
22b0: 62 3e 4a 4f 49 4e 3c 2f 62 3e 69 6e 67 20 73 65 b>JOIN</b>ing se
22c0: 76 65 72 61 6c 20 54 61 62 6c 65 73 20 63 61 6e veral Tables can
22d0: 20 6f 66 74 65 6e 20 72 65 74 75 72 6e 20 6f 64 often return od
22e0: 64 20 61 6e 64 20 6d 69 73 6c 65 61 64 69 6e 67 d and misleading
22f0: 20 72 65 73 75 6c 74 73 65 74 73 2c 20 77 68 65 resultsets, whe
2300: 6e 20 6f 6e 65 20 6f 72 20 6d 6f 72 65 20 6f 66 n one or more of
2310: 20 74 68 65 20 3c 62 3e 4a 4f 49 4e 3c 2f 62 3e the <b>JOIN</b>
2320: 65 64 20 54 61 62 6c 65 73 20 61 72 65 20 6f 66 ed Tables are of
2330: 20 74 68 65 20 56 69 72 74 75 61 6c 20 74 79 70 the Virtual typ
2340: 65 2e 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e 54 68 65 e.</li>..<li>The
2350: 20 62 65 73 74 20 75 73 65 20 6f 66 20 61 20 56 best use of a V
2360: 69 72 74 75 61 6c 20 54 61 62 6c 65 20 69 73 20 irtual Table is
2370: 74 6f 20 70 72 65 66 6f 72 6d 20 61 20 62 61 73 to preform a bas
2380: 69 63 20 64 61 74 61 20 69 6d 70 6f 72 74 20 70 ic data import p
2390: 72 6f 63 65 73 73 2c 20 6f 72 20 74 6f 20 71 75 rocess, or to qu
23a0: 69 63 6b 6c 79 20 67 65 74 20 61 6e 20 6f 76 65 ickly get an ove
23b0: 72 61 6c 6c 20 67 6c 61 6e 63 65 20 61 74 20 61 rall glance at a
23c0: 20 66 75 6c 6c 20 64 61 74 61 73 65 74 20 77 69 full dataset wi
23d0: 74 68 6f 75 74 20 6e 65 63 65 73 73 61 72 69 6c thout necessaril
23e0: 79 20 69 6d 70 6f 72 74 69 6e 67 20 69 74 20 69 y importing it i
23f0: 6e 74 6f 20 74 68 65 20 44 61 74 61 62 61 73 65 nto the Database
2400: 2e 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e 50 72 65 74 .</li>..<li>Pret
2410: 65 6e 64 69 6e 67 20 74 6f 20 75 73 65 20 61 20 ending to use a
2420: 56 69 72 74 75 61 6c 20 54 61 62 6c 65 20 61 73 Virtual Table as
2430: 20 61 20 66 75 6c 6c 20 72 65 70 6c 61 63 65 6d a full replacem
2440: 65 6e 74 20 6f 66 20 69 6d 70 6f 72 74 69 6e 67 ent of importing
2450: 20 61 6c 6c 20 64 61 74 61 20 77 69 74 68 69 6e all data within
2460: 20 61 20 67 65 6e 75 69 6e 65 20 44 61 74 61 62 a genuine Datab
2470: 61 73 65 20 54 61 62 6c 65 20 69 73 20 73 74 72 ase Table is str
2480: 6f 6e 67 6c 79 20 64 69 73 63 6f 75 72 61 67 65 ongly discourage
2490: 64 2c 20 61 6e 64 20 6e 65 76 65 72 20 69 73 20 d, and never is
24a0: 61 20 67 6f 6f 64 20 69 64 65 61 2e 3c 2f 6c 69 a good idea.</li
24b0: 3e 0d 0a 3c 2f 75 6c 3e 3c 62 72 3e 0d 0a 3c 62 >..</ul><br>..<b
24c0: 3e 57 61 72 6e 69 6e 67 3c 2f 62 3e 3a 20 56 69 >Warning</b>: Vi
24d0: 72 74 75 61 6c 44 42 46 20 54 61 62 6c 65 73 20 rtualDBF Tables
24e0: 61 72 65 20 61 6c 77 61 79 73 20 73 75 62 6a 65 are always subje
24f0: 63 74 20 74 6f 20 3c 62 3e 52 45 41 44 2d 4f 4e ct to <b>READ-ON
2500: 4c 59 3c 2f 62 3e 20 72 65 73 74 72 69 63 74 69 LY</b> restricti
2510: 6f 6e 73 2e 20 41 6e 79 20 61 74 74 65 6d 70 74 ons. Any attempt
2520: 20 74 6f 20 74 6f 20 65 78 65 63 75 74 65 20 61 to to execute a
2530: 6e 20 3c 62 3e 49 4e 53 45 52 54 3c 2f 62 3e 2c n <b>INSERT</b>,
2540: 20 3c 62 3e 55 50 44 41 54 45 3c 2f 62 3e 20 6f <b>UPDATE</b> o
2550: 72 20 3c 62 3e 44 45 4c 45 54 45 3c 2f 62 3e 20 r <b>DELETE</b>
2560: 73 74 61 74 65 6d 65 6e 74 20 77 69 6c 6c 20 61 statement will a
2570: 6c 77 61 79 73 20 72 65 74 75 72 6e 20 61 6e 20 lways return an
2580: 65 72 72 6f 72 2e 3c 62 72 3e 0d 0a 3c 2f 74 64 error.<br>..</td
2590: 3e 3c 2f 74 72 3e 3c 2f 74 61 62 6c 65 3e 0d 0a ></tr></table>..
25a0: 3c 62 72 3e 0d 0a 3c 74 61 62 6c 65 20 62 67 63 <br>..<table bgc
25b0: 6f 6c 6f 72 3d 22 23 65 30 65 30 65 30 22 20 63 olor="#e0e0e0" c
25c0: 65 6c 6c 70 61 64 64 69 6e 67 3d 22 31 38 22 3e ellpadding="18">
25d0: 3c 74 72 3e 3c 74 64 3e 0d 0a 3c 68 33 3e 52 65 <tr><td>..<h3>Re
25e0: 6c 61 74 65 64 20 54 6f 70 69 63 73 3c 2f 68 33 lated Topics</h3
25f0: 3e 0d 0a 3c 75 6c 3e 0d 0a 3c 6c 69 3e 54 68 65 >..<ul>..<li>The
2600: 20 3c 62 3e 49 6d 70 6f 72 74 44 42 46 28 29 3c <b>ImportDBF()<
2610: 2f 62 3e 20 53 51 4c 20 66 75 6e 63 74 69 6f 6e /b> SQL function
2620: 20 61 6c 6c 6f 77 73 20 74 6f 20 63 72 65 61 74 allows to creat
2630: 65 20 61 6e 64 20 70 6f 70 75 6c 61 74 65 20 61 e and populate a
2640: 20 67 65 6e 75 69 6e 65 20 44 61 74 61 62 61 73 genuine Databas
2650: 65 20 54 61 62 6c 65 20 62 79 20 69 6d 70 6f 72 e Table by impor
2660: 74 69 6e 67 20 61 6e 20 65 78 74 65 72 6e 61 6c ting an external
2670: 20 44 42 46 20 66 69 6c 65 2e 3c 2f 6c 69 3e 0d DBF file.</li>.
2680: 0a 3c 6c 69 3e 41 6e 64 20 74 68 65 20 3c 62 3e .<li>And the <b>
2690: 45 78 70 6f 72 74 44 42 46 28 29 3c 2f 62 3e 20 ExportDBF()</b>
26a0: 73 69 73 74 65 72 20 66 75 6e 63 74 69 6f 6e 20 sister function
26b0: 61 6c 6c 6f 77 73 20 74 6f 20 64 69 72 65 63 74 allows to direct
26c0: 6c 79 20 65 78 70 6f 72 74 20 61 20 77 68 6f 6c ly export a whol
26d0: 65 20 44 61 74 61 62 61 73 65 20 54 61 62 6c 65 e Database Table
26e0: 20 69 6e 74 6f 20 61 6e 20 65 78 74 65 72 6e 61 into an externa
26f0: 6c 20 44 42 46 20 66 69 6c 65 2e 3c 2f 6c 69 3e l DBF file.</li>
2700: 0d 0a 3c 2f 75 6c 3e 0d 0a 3c 2f 74 64 3e 3c 2f ..</ul>..</td></
2710: 74 72 3e 3c 2f 74 61 62 6c 65 3e 0d 0a 3c 62 72 tr></table>..<br
2720: 3e 0d 0a 3c 68 72 3e 0d 0a 3c 68 31 3e 3c 61 20 >..<hr>..<h1><a
2730: 69 64 3d 22 56 69 72 74 75 61 6c 54 65 78 74 22 id="VirtualText"
2740: 3e 56 69 72 74 75 61 6c 54 65 78 74 3c 2f 61 3e >VirtualText</a>
2750: 3c 2f 68 31 3e 0d 0a 54 68 65 20 3c 62 3e 56 69 </h1>..The <b>Vi
2760: 72 74 75 61 6c 54 65 78 74 3c 2f 62 3e 20 49 6e rtualText</b> In
2770: 74 65 72 66 61 63 65 20 61 6c 6c 6f 77 73 20 74 terface allows t
2780: 6f 20 64 69 72 65 63 74 6c 79 20 61 63 63 65 73 o directly acces
2790: 73 20 61 6e 20 65 78 74 65 72 6e 61 6c 20 54 65 s an external Te
27a0: 78 74 20 66 69 6c 65 20 62 79 20 75 73 69 6e 67 xt file by using
27b0: 20 73 74 61 6e 64 61 72 64 20 53 70 61 74 69 61 standard Spatia
27c0: 6c 20 53 51 4c 20 71 75 65 72 69 65 73 2e 3c 62 l SQL queries.<b
27d0: 72 3e 0d 0a 54 68 65 20 54 65 78 74 20 46 69 6c r>..The Text Fil
27e0: 65 20 69 73 20 65 78 70 65 63 74 65 64 20 74 6f e is expected to
27f0: 20 63 6f 6e 74 61 69 6e 20 61 20 70 72 6f 70 65 contain a prope
2800: 72 6c 79 20 66 6f 72 6d 61 74 74 65 64 20 54 61 rly formatted Ta
2810: 62 6c 65 20 61 63 63 6f 72 64 69 6e 67 6c 79 20 ble accordingly
2820: 74 6f 20 73 6f 6d 65 20 3c 62 3e 44 65 6c 69 6d to some <b>Delim
2830: 69 74 65 72 2d 53 65 70 61 72 61 74 65 64 2d 56 iter-Separated-V
2840: 61 6c 75 65 73 3c 2f 62 3e 20 66 6f 72 6d 61 74 alues</b> format
2850: 20 28 63 6f 6d 6d 61 20 73 65 70 61 72 61 74 65 (comma separate
2860: 64 20 76 61 6c 75 65 73 20 3c 69 3e 2a 2e 63 73 d values <i>*.cs
2870: 76 3c 2f 69 3e 2c 20 74 61 62 20 73 65 70 61 72 v</i>, tab separ
2880: 61 74 65 64 20 76 61 6c 75 65 73 20 3c 69 3e 2a ated values <i>*
2890: 2e 74 78 74 3c 2f 69 3e 20 61 6e 64 20 61 6c 69 .txt</i> and ali
28a0: 6b 65 29 2e 3c 62 72 3e 0d 0a 53 79 6e 74 61 78 ke).<br>..Syntax
28b0: 20 66 6f 72 20 63 72 65 61 74 69 6e 67 20 61 20 for creating a
28c0: 56 69 72 74 75 61 6c 54 65 78 74 20 54 61 62 6c VirtualText Tabl
28d0: 65 3a 0d 0a 3c 76 65 72 62 61 74 69 6d 3e 0d 0a e:..<verbatim>..
28e0: 53 45 4c 45 43 54 20 43 52 45 41 54 45 20 56 49 SELECT CREATE VI
28f0: 52 54 55 41 4c 20 54 41 42 4c 45 20 6d 79 5f 74 RTUAL TABLE my_t
2900: 61 62 6c 65 20 55 53 49 4e 47 20 56 69 72 74 75 able USING Virtu
2910: 61 6c 54 65 78 74 20 28 20 74 65 78 74 66 69 6c alText ( textfil
2920: 65 5f 70 61 74 68 20 2c 20 63 68 61 72 73 65 74 e_path , charset
2930: 5f 65 6e 63 6f 64 69 6e 67 20 29 3b 0d 0a 0d 0a _encoding );....
2940: 53 45 4c 45 43 54 20 43 52 45 41 54 45 20 56 49 SELECT CREATE VI
2950: 52 54 55 41 4c 20 54 41 42 4c 45 20 6d 79 5f 74 RTUAL TABLE my_t
2960: 61 62 6c 65 20 55 53 49 4e 47 20 56 69 72 74 75 able USING Virtu
2970: 61 6c 54 65 78 74 20 28 20 74 65 78 74 66 69 6c alText ( textfil
2980: 65 5f 70 61 74 68 20 2c 20 63 68 61 72 73 65 74 e_path , charset
2990: 5f 65 6e 63 6f 64 69 6e 67 20 2c 20 66 69 72 73 _encoding , firs
29a0: 74 5f 72 6f 77 5f 61 73 5f 74 69 74 6c 65 73 20 t_row_as_titles
29b0: 29 3b 0d 0a 0d 0a 53 45 4c 45 43 54 20 43 52 45 );....SELECT CRE
29c0: 41 54 45 20 56 49 52 54 55 41 4c 20 54 41 42 4c ATE VIRTUAL TABL
29d0: 45 20 6d 79 5f 74 61 62 6c 65 20 55 53 49 4e 47 E my_table USING
29e0: 20 56 69 72 74 75 61 6c 54 65 78 74 20 28 20 74 VirtualText ( t
29f0: 65 78 74 66 69 6c 65 5f 70 61 74 68 20 2c 20 63 extfile_path , c
2a00: 68 61 72 73 65 74 5f 65 6e 63 6f 64 69 6e 67 20 harset_encoding
2a10: 2c 20 66 69 72 73 74 5f 72 6f 77 5f 61 73 5f 74 , first_row_as_t
2a20: 69 74 6c 65 73 20 2c 20 64 65 63 69 6d 61 6c 5f itles , decimal_
2a30: 73 65 70 61 72 61 74 6f 72 20 29 3b 0d 0a 0d 0a separator );....
2a40: 53 45 4c 45 43 54 20 43 52 45 41 54 45 20 56 49 SELECT CREATE VI
2a50: 52 54 55 41 4c 20 54 41 42 4c 45 20 6d 79 5f 74 RTUAL TABLE my_t
2a60: 61 62 6c 65 20 55 53 49 4e 47 20 56 69 72 74 75 able USING Virtu
2a70: 61 6c 54 65 78 74 20 28 20 74 65 78 74 66 69 6c alText ( textfil
2a80: 65 5f 70 61 74 68 20 2c 20 63 68 61 72 73 65 74 e_path , charset
2a90: 5f 65 6e 63 6f 64 69 6e 67 20 2c 20 66 69 72 73 _encoding , firs
2aa0: 74 5f 72 6f 77 5f 61 73 5f 74 69 74 6c 65 73 20 t_row_as_titles
2ab0: 2c 20 64 65 63 69 6d 61 6c 5f 73 65 70 61 72 61 , decimal_separa
2ac0: 74 6f 72 20 2c 20 74 65 78 74 5f 73 65 70 61 72 tor , text_separ
2ad0: 61 74 6f 72 20 29 3b 0d 0a 0d 0a 53 45 4c 45 43 ator );....SELEC
2ae0: 54 20 43 52 45 41 54 45 20 56 49 52 54 55 41 4c T CREATE VIRTUAL
2af0: 20 54 41 42 4c 45 20 6d 79 5f 74 61 62 6c 65 20 TABLE my_table
2b00: 55 53 49 4e 47 20 56 69 72 74 75 61 6c 54 65 78 USING VirtualTex
2b10: 74 20 28 20 74 65 78 74 66 69 6c 65 5f 70 61 74 t ( textfile_pat
2b20: 68 20 2c 20 63 68 61 72 73 65 74 5f 65 6e 63 6f h , charset_enco
2b30: 64 69 6e 67 20 2c 20 66 69 72 73 74 5f 72 6f 77 ding , first_row
2b40: 5f 61 73 5f 74 69 74 6c 65 73 20 2c 20 64 65 63 _as_titles , dec
2b50: 69 6d 61 6c 5f 73 65 70 61 72 61 74 6f 72 20 2c imal_separator ,
2b60: 20 74 65 78 74 5f 73 65 70 61 72 61 74 6f 72 20 text_separator
2b70: 2c 20 66 69 65 6c 64 5f 73 65 70 61 72 61 74 6f , field_separato
2b80: 72 20 29 3b 0d 0a 3c 2f 76 65 72 62 61 74 69 6d r );..</verbatim
2b90: 3e 0d 0a 53 75 70 70 6f 72 74 65 64 20 61 72 67 >..Supported arg
2ba0: 75 6d 65 6e 74 73 20 61 6e 64 20 74 68 65 69 72 uments and their
2bb0: 20 69 6e 74 65 72 70 72 65 74 61 74 69 6f 6e 3a interpretation:
2bc0: 0d 0a 3c 75 6c 3e 0d 0a 3c 6c 69 3e 3c 62 3e 74 ..<ul>..<li><b>t
2bd0: 65 78 74 66 69 6c 65 5f 70 61 74 68 3c 2f 62 3e extfile_path</b>
2be0: 20 28 3c 69 3e 3c 62 3e 6d 61 6e 64 61 74 6f 72 (<i><b>mandator
2bf0: 79 3c 2f 62 3e 3c 2f 69 3e 29 3a 20 74 68 65 20 y</b></i>): the
2c00: 72 65 6c 61 74 69 76 65 20 6f 72 20 61 62 73 6f relative or abso
2c10: 6c 75 74 65 20 70 61 74 68 6e 61 6d 65 20 6c 65 lute pathname le
2c20: 61 64 69 6e 67 20 74 6f 20 74 68 65 20 65 78 74 ading to the ext
2c30: 65 72 6e 61 6c 20 54 65 78 74 20 66 69 6c 65 2e ernal Text file.
2c40: 0d 0a 3c 75 6c 3e 0d 0a 3c 6c 69 3e 3c 62 3e 4e ..<ul>..<li><b>N
2c50: 6f 74 65 3c 2f 62 3e 3a 20 74 68 65 20 66 75 6c ote</b>: the ful
2c60: 6c 20 70 61 74 68 6e 61 6d 65 20 6d 75 73 74 20 l pathname must
2c70: 62 65 20 70 61 73 73 65 64 2c 20 69 6e 63 6c 75 be passed, inclu
2c80: 64 69 6e 67 20 61 6e 20 65 76 65 6e 74 75 61 6c ding an eventual
2c90: 20 66 69 6e 61 6c 20 73 75 66 66 69 78 20 28 3c final suffix (<
2ca0: 69 3e 2a 2e 74 78 74 3c 2f 69 3e 2c 20 3c 69 3e i>*.txt</i>, <i>
2cb0: 2a 2e 63 73 76 3c 2f 69 3e 20 61 6e 64 20 61 6c *.csv</i> and al
2cc0: 69 6b 65 29 2e 3c 2f 6c 69 3e 0d 0a 3c 2f 75 6c ike).</li>..</ul
2cd0: 3e 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e 3c 62 3e 63 ></li>..<li><b>c
2ce0: 68 61 72 73 65 74 5f 65 6e 63 6f 64 69 6e 67 3c harset_encoding<
2cf0: 2f 62 3e 20 28 3c 69 3e 3c 62 3e 6d 61 6e 64 61 /b> (<i><b>manda
2d00: 74 6f 72 79 3c 2f 62 3e 3c 2f 69 3e 29 3a 20 63 tory</b></i>): c
2d10: 61 6e 6f 6e 69 63 61 6c 20 6e 61 6d 65 20 6f 66 anonical name of
2d20: 20 74 68 65 20 63 68 61 72 73 65 74 20 65 6e 63 the charset enc
2d30: 6f 64 69 6e 67 20 61 64 6f 70 74 65 64 20 62 79 oding adopted by
2d40: 20 74 68 65 20 54 65 78 74 20 66 69 6c 65 2e 0d the Text file..
2d50: 0a 3c 75 6c 3e 0d 0a 3c 6c 69 3e 45 78 61 6d 70 .<ul>..<li>Examp
2d60: 6c 65 73 20 6f 66 20 76 61 6c 69 64 20 6e 61 6d les of valid nam
2d70: 65 73 20 61 72 65 3a 20 3c 62 3e 41 53 43 49 49 es are: <b>ASCII
2d80: 3c 2f 62 3e 2c 20 3c 62 3e 55 54 46 2d 38 3c 2f </b>, <b>UTF-8</
2d90: 62 3e 2c 20 3c 62 3e 43 50 38 35 30 3c 2f 62 3e b>, <b>CP850</b>
2da0: 2c 20 3c 62 3e 43 50 31 32 35 32 3c 2f 62 3e 2c , <b>CP1252</b>,
2db0: 20 3c 62 3e 49 53 4f 2d 38 38 34 39 2d 31 3c 2f <b>ISO-8849-1</
2dc0: 62 3e 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e 59 6f 75 b></li>..<li>You
2dd0: 20 63 61 6e 20 63 68 65 63 6b 20 74 68 65 20 66 can check the f
2de0: 75 6c 6c 20 6c 69 73 74 20 6f 66 20 73 75 70 70 ull list of supp
2df0: 6f 72 74 65 64 20 63 68 61 72 73 65 74 20 65 6e orted charset en
2e00: 63 6f 64 69 6e 67 73 20 3c 61 20 68 72 65 66 3d codings <a href=
2e10: 22 68 74 74 70 73 3a 2f 2f 77 77 77 2e 67 6e 75 "https://www.gnu
2e20: 2e 6f 72 67 2f 73 6f 66 74 77 61 72 65 2f 6c 69 .org/software/li
2e30: 62 69 63 6f 6e 76 2f 22 3e 68 65 72 65 3c 2f 61 biconv/">here</a
2e40: 3e 2e 3c 2f 6c 69 3e 0d 0a 3c 2f 75 6c 3e 3c 2f >.</li>..</ul></
2e50: 6c 69 3e 0d 0a 3c 6c 69 3e 3c 62 3e 66 69 72 73 li>..<li><b>firs
2e60: 74 5f 72 6f 77 5f 61 73 5f 74 69 74 6c 65 73 3c t_row_as_titles<
2e70: 2f 62 3e 20 28 3c 69 3e 3c 62 3e 6f 70 74 69 6f /b> (<i><b>optio
2e80: 6e 61 6c 3c 2f 62 3e 3c 2f 69 3e 29 3a 20 74 68 nal</b></i>): th
2e90: 69 73 20 69 73 20 61 20 3c 62 3e 42 4f 4f 4c 45 is is a <b>BOOLE
2ea0: 41 4e 3c 2f 62 3e 20 66 6c 61 67 3a 0d 0a 3c 75 AN</b> flag:..<u
2eb0: 6c 3e 0d 0a 3c 6c 69 3e 69 66 20 73 65 74 20 74 l>..<li>if set t
2ec0: 6f 20 3c 62 3e 30 3c 2f 62 3e 20 28 3c 62 3e 46 o <b>0</b> (<b>F
2ed0: 41 4c 53 45 3c 2f 62 3e 29 20 61 6c 6c 20 63 6f ALSE</b>) all co
2ee0: 6c 75 6d 6e 20 6e 61 6d 65 73 20 77 69 6c 6c 20 lumn names will
2ef0: 62 65 20 61 75 74 6f 6d 61 74 69 63 61 6c 6c 79 be automatically
2f00: 20 73 65 74 20 62 79 20 75 73 69 6e 67 20 61 20 set by using a
2f10: 70 72 6f 67 72 65 73 73 69 76 65 20 73 65 71 75 progressive sequ
2f20: 65 6e 63 65 2e 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e ence.</li>..<li>
2f30: 69 66 20 73 65 74 20 74 6f 20 61 6e 79 20 6f 74 if set to any ot
2f40: 68 65 72 20 69 6e 74 65 67 65 72 20 76 61 6c 75 her integer valu
2f50: 65 20 28 3c 62 3e 54 52 55 45 3c 2f 62 3e 29 20 e (<b>TRUE</b>)
2f60: 61 6c 6c 20 63 6f 6c 75 6d 6e 20 6e 61 6d 65 73 all column names
2f70: 20 77 69 6c 6c 20 62 79 20 65 78 70 65 63 74 65 will by expecte
2f80: 64 20 74 6f 20 62 65 20 64 65 66 69 6e 65 64 20 d to be defined
2f90: 69 6e 20 74 68 65 20 76 65 72 79 20 66 69 72 73 in the very firs
2fa0: 74 20 72 6f 77 20 6f 66 20 74 68 65 20 54 65 78 t row of the Tex
2fb0: 74 20 66 69 6c 65 2e 3c 2f 6c 69 3e 0d 0a 3c 6c t file.</li>..<l
2fc0: 69 3e 69 66 20 6e 6f 74 20 65 78 70 6c 69 63 69 i>if not explici
2fd0: 74 6c 79 20 73 70 65 63 69 66 69 65 64 2c 20 3c tly specified, <
2fe0: 62 3e 54 52 55 45 3c 2f 62 3e 20 77 69 6c 6c 20 b>TRUE</b> will
2ff0: 61 6c 77 61 79 73 20 62 65 20 61 73 73 75 6d 65 always be assume
3000: 64 20 28 64 65 66 61 75 6c 74 20 73 65 74 74 69 d (default setti
3010: 6e 67 29 2e 3c 2f 6c 69 3e 0d 0a 3c 2f 75 6c 3e ng).</li>..</ul>
3020: 3c 2f 6c 69 3e 0d 0a 3c 75 6c 3e 0d 0a 3c 2f 75 </li>..<ul>..</u
3030: 6c 3e 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e 3c 62 3e l></li>..<li><b>
3040: 64 65 63 69 6d 61 6c 5f 73 65 70 61 72 61 74 6f decimal_separato
3050: 72 3c 2f 62 3e 20 28 3c 69 3e 3c 62 3e 6f 70 74 r</b> (<i><b>opt
3060: 69 6f 6e 61 6c 3c 2f 62 3e 3c 2f 69 3e 29 3a 20 ional</b></i>):
3070: 74 68 65 20 63 68 61 72 61 63 74 65 72 20 61 63 the character ac
3080: 74 69 6e 67 20 61 73 20 61 20 73 65 70 61 72 61 ting as a separa
3090: 74 6f 72 20 62 65 74 77 65 65 6e 20 74 68 65 20 tor between the
30a0: 69 6e 74 65 67 65 72 20 61 6e 64 20 64 65 63 69 integer and deci
30b0: 6d 61 6c 20 70 61 72 74 73 20 6f 66 20 61 20 6e mal parts of a n
30c0: 75 6d 62 65 72 2e 3c 62 72 3e 0d 0a 56 61 6c 69 umber.<br>..Vali
30d0: 64 20 76 61 6c 75 65 73 20 61 72 65 20 61 6e 79 d values are any
30e0: 20 70 72 69 6e 74 61 62 6c 65 20 63 68 61 72 61 printable chara
30f0: 63 74 65 72 20 6f 72 20 74 68 65 20 73 70 65 63 cter or the spec
3100: 69 61 6c 20 6d 6e 65 6d 6f 6e 69 63 20 6e 6f 74 ial mnemonic not
3110: 61 74 69 6f 6e 73 20 3c 62 3e 50 4f 49 4e 54 3c ations <b>POINT<
3120: 2f 62 3e 20 6f 72 20 3c 62 3e 43 4f 4d 4d 41 3c /b> or <b>COMMA<
3130: 2f 62 3e 2e 3c 62 72 3e 0d 0a 49 66 20 6e 6f 74 /b>.<br>..If not
3140: 20 65 78 70 6c 69 63 69 74 6c 79 20 73 70 65 63 explicitly spec
3150: 69 66 69 65 64 2c 20 3c 62 3e 50 4f 49 4e 54 3c ified, <b>POINT<
3160: 2f 62 3e 20 77 69 6c 6c 20 61 6c 77 61 79 73 20 /b> will always
3170: 62 65 20 61 73 73 75 6d 65 64 20 28 64 65 66 61 be assumed (defa
3180: 75 6c 74 20 73 65 74 74 69 6e 67 29 3c 2f 6c 69 ult setting)</li
3190: 3e 0d 0a 3c 6c 69 3e 3c 62 3e 74 65 78 74 5f 73 >..<li><b>text_s
31a0: 65 70 61 72 61 74 6f 72 3c 2f 62 3e 20 28 3c 69 eparator</b> (<i
31b0: 3e 3c 62 3e 6f 70 74 69 6f 6e 61 6c 3c 2f 62 3e ><b>optional</b>
31c0: 3c 2f 69 3e 29 3a 20 74 68 65 20 63 68 61 72 61 </i>): the chara
31d0: 63 74 65 72 20 61 63 74 69 6e 67 20 61 73 20 61 cter acting as a
31e0: 20 73 74 72 69 6e 67 20 64 65 6c 69 6d 69 74 65 string delimite
31f0: 72 2e 3c 62 72 3e 0d 0a 56 61 6c 69 64 20 76 61 r.<br>..Valid va
3200: 6c 75 65 73 20 61 72 65 20 61 6e 79 20 70 72 69 lues are any pri
3210: 6e 74 61 62 6c 65 20 63 68 61 72 61 63 74 65 72 ntable character
3220: 20 6f 72 20 74 68 65 20 73 70 65 63 69 61 6c 20 or the special
3230: 6d 6e 65 6d 6f 6e 69 63 20 6e 6f 74 61 74 69 6f mnemonic notatio
3240: 6e 73 20 3c 62 3e 53 49 4e 47 4c 45 51 55 4f 54 ns <b>SINGLEQUOT
3250: 45 3c 2f 62 3e 2c 20 3c 62 3e 44 4f 55 42 4c 45 E</b>, <b>DOUBLE
3260: 51 55 4f 54 45 3c 2f 62 3e 20 6f 72 20 3c 62 3e QUOTE</b> or <b>
3270: 4e 4f 4e 45 3c 2f 62 3e 2e 3c 62 72 3e 0d 0a 49 NONE</b>.<br>..I
3280: 66 20 6e 6f 74 20 65 78 70 6c 69 63 69 74 6c 79 f not explicitly
3290: 20 73 70 65 63 69 66 69 65 64 2c 20 3c 62 3e 44 specified, <b>D
32a0: 4f 55 42 4c 45 51 55 4f 54 45 3c 2f 62 3e 20 77 OUBLEQUOTE</b> w
32b0: 69 6c 6c 20 61 6c 77 61 79 73 20 62 65 20 61 73 ill always be as
32c0: 73 75 6d 65 64 20 28 64 65 66 61 75 6c 74 20 73 sumed (default s
32d0: 65 74 74 69 6e 67 29 3c 2f 6c 69 3e 0d 0a 3c 6c etting)</li>..<l
32e0: 69 3e 3c 62 3e 66 69 65 6c 64 5f 73 65 70 61 72 i><b>field_separ
32f0: 61 74 6f 72 3c 2f 62 3e 20 28 3c 69 3e 3c 62 3e ator</b> (<i><b>
3300: 6f 70 74 69 6f 6e 61 6c 3c 2f 62 3e 3c 2f 69 3e optional</b></i>
3310: 29 3a 20 74 68 65 20 63 68 61 72 61 63 74 65 72 ): the character
3320: 20 61 63 74 69 6e 67 20 61 73 20 61 20 64 65 6c acting as a del
3330: 69 6d 69 74 65 72 20 62 65 74 77 65 65 6e 20 63 imiter between c
3340: 6f 6e 73 65 63 75 74 69 76 65 20 66 69 65 6c 64 onsecutive field
3350: 73 2e 3c 62 72 3e 0d 0a 56 61 6c 69 64 20 76 61 s.<br>..Valid va
3360: 6c 75 65 73 20 61 72 65 20 61 6e 79 20 70 72 69 lues are any pri
3370: 6e 74 61 62 6c 65 20 63 68 61 72 61 63 74 65 72 ntable character
3380: 20 6f 72 20 74 68 65 20 73 70 65 63 69 61 6c 20 or the special
3390: 6d 6e 65 6d 6f 6e 69 63 20 6e 6f 74 61 74 69 6f mnemonic notatio
33a0: 6e 73 20 3c 62 3e 54 41 42 3c 2f 62 3e 2e 3c 62 ns <b>TAB</b>.<b
33b0: 72 3e 0d 0a 49 66 20 6e 6f 74 20 65 78 70 6c 69 r>..If not expli
33c0: 63 69 74 6c 79 20 73 70 65 63 69 66 69 65 64 2c citly specified,
33d0: 20 3c 62 3e 54 41 42 3c 2f 62 3e 20 77 69 6c 6c <b>TAB</b> will
33e0: 20 61 6c 77 61 79 73 20 62 65 20 61 73 73 75 6d always be assum
33f0: 65 64 20 28 64 65 66 61 75 6c 74 20 73 65 74 74 ed (default sett
3400: 69 6e 67 29 3c 2f 6c 69 3e 0d 0a 3c 2f 75 6c 3e ing)</li>..</ul>
3410: 3c 62 72 3e 0d 0a 3c 74 61 62 6c 65 20 62 67 63 <br>..<table bgc
3420: 6f 6c 6f 72 3d 22 23 66 66 66 66 64 30 22 20 63 olor="#ffffd0" c
3430: 65 6c 6c 70 61 64 64 69 6e 67 3d 22 31 38 22 3e ellpadding="18">
3440: 3c 74 72 3e 3c 74 64 3e 0d 0a 3c 62 3e 4e 6f 74 <tr><td>..<b>Not
3450: 65 3c 2f 62 3e 3a 20 71 75 6f 74 69 6e 67 20 6f e</b>: quoting o
3460: 72 20 6e 6f 74 20 61 6e 79 20 54 65 78 74 20 53 r not any Text S
3470: 74 72 69 6e 67 20 77 68 65 6e 20 69 74 20 61 70 tring when it ap
3480: 70 65 61 72 73 20 61 73 20 61 20 56 69 72 74 75 pears as a Virtu
3490: 61 6c 20 54 61 62 6c 65 20 61 72 67 75 6d 65 6e al Table argumen
34a0: 74 20 68 61 73 20 61 62 73 6f 6c 75 74 65 6c 79 t has absolutely
34b0: 20 6e 6f 20 65 66 66 65 63 74 2e 0d 0a 3c 76 65 no effect...<ve
34c0: 72 62 61 74 69 6d 3e 0d 0a 53 45 4c 45 43 54 20 rbatim>..SELECT
34d0: 43 52 45 41 54 45 20 56 49 52 54 55 41 4c 20 54 CREATE VIRTUAL T
34e0: 41 42 4c 45 20 6d 79 5f 74 61 62 6c 65 20 55 53 ABLE my_table US
34f0: 49 4e 47 20 56 69 72 74 75 61 6c 54 65 78 74 28 ING VirtualText(
3500: 20 2f 68 6f 6d 65 2f 73 61 6e 64 72 6f 2f 6d 79 /home/sandro/my
3510: 66 69 6c 65 2e 74 78 74 20 2c 20 43 50 31 32 35 file.txt , CP125
3520: 32 20 2c 20 31 20 2c 20 50 4f 49 4e 54 20 2c 20 2 , 1 , POINT ,
3530: 4e 4f 4e 45 20 2c 20 54 41 42 20 29 3b 0d 0a 6f NONE , TAB );..o
3540: 72 0d 0a 53 45 4c 45 43 54 20 43 52 45 41 54 45 r..SELECT CREATE
3550: 20 56 49 52 54 55 41 4c 20 54 41 42 4c 45 20 6d VIRTUAL TABLE m
3560: 79 5f 74 61 62 6c 65 20 55 53 49 4e 47 20 56 69 y_table USING Vi
3570: 72 74 75 61 6c 54 65 78 74 28 20 27 2f 68 6f 6d rtualText( '/hom
3580: 65 2f 73 61 6e 64 72 6f 2f 6d 79 66 69 6c 65 2e e/sandro/myfile.
3590: 74 78 74 27 20 2c 20 27 43 50 31 32 35 32 27 20 txt' , 'CP1252'
35a0: 2c 20 31 20 2c 20 27 50 4f 49 4e 54 27 20 2c 20 , 1 , 'POINT' ,
35b0: 27 4e 4f 4e 45 27 20 2c 20 27 54 41 42 27 20 29 'NONE' , 'TAB' )
35c0: 3b 0d 0a 3c 2f 76 65 72 62 61 74 69 6d 3e 0d 0a ;..</verbatim>..
35d0: 42 6f 74 68 20 6e 6f 74 61 74 69 6f 6e 73 20 77 Both notations w
35e0: 69 6c 6c 20 70 72 6f 64 75 63 65 20 74 68 65 20 ill produce the
35f0: 73 61 6d 65 20 72 65 73 75 6c 74 2e 0d 0a 3c 2f same result...</
3600: 74 64 3e 3c 2f 74 72 3e 3c 2f 74 61 62 6c 65 3e td></tr></table>
3610: 0d 0a 3c 62 72 3e 0d 0a 3c 74 61 62 6c 65 20 62 ..<br>..<table b
3620: 67 63 6f 6c 6f 72 3d 22 23 64 30 66 66 64 30 22 gcolor="#d0ffd0"
3630: 20 63 65 6c 6c 70 61 64 64 69 6e 67 3d 22 31 38 cellpadding="18
3640: 22 3e 3c 74 72 3e 3c 74 64 3e 0d 0a 3c 68 33 3e "><tr><td>..<h3>
3650: 42 65 73 74 20 70 72 61 63 74 69 63 65 73 20 61 Best practices a
3660: 6e 64 20 6b 6e 6f 77 6e 20 6c 69 6d 69 74 61 74 nd known limitat
3670: 69 6f 6e 73 3c 2f 68 33 3e 0d 0a 3c 75 6c 3e 0d ions</h3>..<ul>.
3680: 0a 3c 6c 69 3e 3c 62 3e 42 65 20 61 77 61 72 65 .<li><b>Be aware
3690: 3c 2f 62 3e 3a 20 6f 70 65 6e 69 6e 67 20 62 69 </b>: opening bi
36a0: 67 20 6f 72 20 68 75 67 65 20 74 65 78 74 20 66 g or huge text f
36b0: 69 6c 65 73 20 63 6f 75 6c 64 20 65 61 73 69 6c iles could easil
36c0: 79 20 72 65 71 75 69 72 65 20 6d 61 73 73 69 76 y require massiv
36d0: 65 20 52 41 4d 20 61 6c 6c 6f 63 61 74 69 6f 6e e RAM allocation
36e0: 73 2e 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e 3c 62 3e s.</li>..<li><b>
36f0: 57 61 72 6e 69 6e 67 3c 2f 62 3e 3a 20 61 74 74 Warning</b>: att
3700: 65 6d 70 74 69 6e 67 20 74 6f 20 61 63 63 65 73 empting to acces
3710: 73 20 61 6e 20 65 78 74 65 72 6e 61 6c 20 54 65 s an external Te
3720: 78 74 20 66 69 6c 65 20 62 79 20 62 6c 69 6e 64 xt file by blind
3730: 6c 79 20 73 70 65 63 69 66 79 69 6e 67 20 72 61 ly specifying ra
3740: 6e 64 6f 6d 6c 79 20 63 68 6f 73 65 6e 20 64 65 ndomly chosen de
3750: 6c 69 6d 69 74 65 72 73 20 6f 72 20 73 65 70 61 limiters or sepa
3760: 72 61 74 6f 72 73 20 6d 61 79 20 65 61 73 69 6c rators may easil
3770: 79 20 68 61 76 65 20 63 61 74 61 73 74 72 6f 70 y have catastrop
3780: 68 69 63 20 65 66 66 65 63 74 73 2e 3c 62 72 3e hic effects.<br>
3790: 0d 0a 41 6c 77 61 79 73 20 63 61 72 65 66 75 6c ..Always careful
37a0: 6c 79 20 63 68 65 63 6b 20 74 68 65 20 61 63 74 ly check the act
37b0: 75 61 6c 20 73 74 72 75 63 74 75 72 65 20 6f 66 ual structure of
37c0: 20 74 68 65 20 54 65 78 74 20 66 69 6c 65 20 62 the Text file b
37d0: 65 66 6f 72 65 20 61 74 74 65 6d 70 74 69 6e 67 efore attempting
37e0: 20 74 6f 20 61 63 63 65 73 73 20 69 74 2e 3c 2f to access it.</
37f0: 6c 69 3e 0d 0a 3c 6c 69 3e 56 69 72 74 75 61 6c li>..<li>Virtual
3800: 20 54 61 62 6c 65 73 20 61 72 65 20 6e 6f 74 20 Tables are not
3810: 72 65 61 6c 6c 79 20 67 65 6e 75 69 6e 65 20 44 really genuine D
3820: 61 74 61 62 61 73 65 20 54 61 62 6c 65 73 2c 20 atabase Tables,
3830: 74 68 65 79 20 61 72 65 20 6a 75 73 74 20 65 6d they are just em
3840: 75 6c 61 74 69 6e 67 20 74 68 65 20 6f 72 69 67 ulating the orig
3850: 69 6e 61 6c 20 73 6f 75 72 63 65 20 61 73 20 61 inal source as a
3860: 20 44 61 74 61 62 61 73 65 20 54 61 62 6c 65 2e Database Table.
3870: 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e 56 69 72 74 75 </li>..<li>Virtu
3880: 61 6c 20 54 61 62 6c 65 73 20 68 61 76 65 20 76 al Tables have v
3890: 65 72 79 20 70 6f 6f 72 20 73 70 65 65 64 20 70 ery poor speed p
38a0: 65 72 66 6f 72 6d 61 6e 63 65 73 2c 20 64 75 65 erformances, due
38b0: 20 74 6f 20 74 68 65 20 20 65 6d 75 6c 61 74 69 to the emulati
38c0: 6f 6e 2c 20 61 73 20 63 6f 6d 70 61 72 65 64 20 on, as compared
38d0: 74 6f 20 67 65 6e 75 69 6e 65 20 44 61 74 61 62 to genuine Datab
38e0: 61 73 65 20 54 61 62 6c 65 73 2e 3c 2f 6c 69 3e ase Tables.</li>
38f0: 0d 0a 3c 6c 69 3e 43 6f 6d 70 6c 65 78 20 53 51 ..<li>Complex SQ
3900: 4c 20 71 75 65 72 69 65 73 20 3c 62 3e 4a 4f 49 L queries <b>JOI
3910: 4e 3c 2f 62 3e 69 6e 67 20 73 65 76 65 72 61 6c N</b>ing several
3920: 20 54 61 62 6c 65 73 20 63 61 6e 20 6f 66 74 65 Tables can ofte
3930: 6e 20 72 65 74 75 72 6e 20 6f 64 64 20 61 6e 64 n return odd and
3940: 20 6d 69 73 6c 65 61 64 69 6e 67 20 72 65 73 75 misleading resu
3950: 6c 74 73 65 74 73 2c 20 77 68 65 6e 20 6f 6e 65 ltsets, when one
3960: 20 6f 72 20 6d 6f 72 65 20 6f 66 20 74 68 65 20 or more of the
3970: 3c 62 3e 4a 4f 49 4e 3c 2f 62 3e 65 64 20 54 61 <b>JOIN</b>ed Ta
3980: 62 6c 65 73 20 61 72 65 20 6f 66 20 74 68 65 20 bles are of the
3990: 56 69 72 74 75 61 6c 20 74 79 70 65 2e 3c 2f 6c Virtual type.</l
39a0: 69 3e 0d 0a 3c 6c 69 3e 54 68 65 20 62 65 73 74 i>..<li>The best
39b0: 20 75 73 65 20 6f 66 20 61 20 56 69 72 74 75 61 use of a Virtua
39c0: 6c 20 54 61 62 6c 65 20 69 73 20 74 6f 20 70 72 l Table is to pr
39d0: 65 66 6f 72 6d 20 61 20 62 61 73 69 63 20 64 61 eform a basic da
39e0: 74 61 20 69 6d 70 6f 72 74 20 70 72 6f 63 65 73 ta import proces
39f0: 73 2c 20 6f 72 20 74 6f 20 71 75 69 63 6b 6c 79 s, or to quickly
3a00: 20 67 65 74 20 61 6e 20 6f 76 65 72 61 6c 6c 20 get an overall
3a10: 67 6c 61 6e 63 65 20 61 74 20 61 20 66 75 6c 6c glance at a full
3a20: 20 64 61 74 61 73 65 74 20 77 69 74 68 6f 75 74 dataset without
3a30: 20 6e 65 63 65 73 73 61 72 69 6c 79 20 69 6d 70 necessarily imp
3a40: 6f 72 74 69 6e 67 20 69 74 20 69 6e 74 6f 20 74 orting it into t
3a50: 68 65 20 44 61 74 61 62 61 73 65 2e 3c 2f 6c 69 he Database.</li
3a60: 3e 0d 0a 3c 6c 69 3e 50 72 65 74 65 6e 64 69 6e >..<li>Pretendin
3a70: 67 20 74 6f 20 75 73 65 20 61 20 56 69 72 74 75 g to use a Virtu
3a80: 61 6c 20 54 61 62 6c 65 20 61 73 20 61 20 66 75 al Table as a fu
3a90: 6c 6c 20 72 65 70 6c 61 63 65 6d 65 6e 74 20 6f ll replacement o
3aa0: 66 20 69 6d 70 6f 72 74 69 6e 67 20 61 6c 6c 20 f importing all
3ab0: 64 61 74 61 20 77 69 74 68 69 6e 20 61 20 67 65 data within a ge
3ac0: 6e 75 69 6e 65 20 44 61 74 61 62 61 73 65 20 54 nuine Database T
3ad0: 61 62 6c 65 20 69 73 20 73 74 72 6f 6e 67 6c 79 able is strongly
3ae0: 20 64 69 73 63 6f 75 72 61 67 65 64 2c 20 61 6e discouraged, an
3af0: 64 20 6e 65 76 65 72 20 69 73 20 61 20 67 6f 6f d never is a goo
3b00: 64 20 69 64 65 61 2e 3c 2f 6c 69 3e 0d 0a 3c 2f d idea.</li>..</
3b10: 75 6c 3e 3c 62 72 3e 0d 0a 3c 62 3e 57 61 72 6e ul><br>..<b>Warn
3b20: 69 6e 67 3c 2f 62 3e 3a 20 56 69 72 74 75 61 6c ing</b>: Virtual
3b30: 54 65 78 74 20 54 61 62 6c 65 73 20 61 72 65 20 Text Tables are
3b40: 61 6c 77 61 79 73 20 73 75 62 6a 65 63 74 20 74 always subject t
3b50: 6f 20 3c 62 3e 52 45 41 44 2d 4f 4e 4c 59 3c 2f o <b>READ-ONLY</
3b60: 62 3e 20 72 65 73 74 72 69 63 74 69 6f 6e 73 2e b> restrictions.
3b70: 20 41 6e 79 20 61 74 74 65 6d 70 74 20 74 6f 20 Any attempt to
3b80: 74 6f 20 65 78 65 63 75 74 65 20 61 6e 20 3c 62 to execute an <b
3b90: 3e 49 4e 53 45 52 54 3c 2f 62 3e 2c 20 3c 62 3e >INSERT</b>, <b>
3ba0: 55 50 44 41 54 45 3c 2f 62 3e 20 6f 72 20 3c 62 UPDATE</b> or <b
3bb0: 3e 44 45 4c 45 54 45 3c 2f 62 3e 20 73 74 61 74 >DELETE</b> stat
3bc0: 65 6d 65 6e 74 20 77 69 6c 6c 20 61 6c 77 61 79 ement will alway
3bd0: 73 20 72 65 74 75 72 6e 20 61 6e 20 65 72 72 6f s return an erro
3be0: 72 2e 3c 62 72 3e 0d 0a 3c 2f 74 64 3e 3c 2f 74 r.<br>..</td></t
3bf0: 72 3e 3c 2f 74 61 62 6c 65 3e 0d 0a 3c 62 72 3e r></table>..<br>
3c00: 0d 0a 3c 68 72 3e 0d 0a 3c 68 31 3e 3c 61 20 69 ..<hr>..<h1><a i
3c10: 64 3d 22 56 69 72 74 75 61 6c 58 4c 22 3e 56 69 d="VirtualXL">Vi
3c20: 72 74 75 61 6c 58 4c 3c 2f 61 3e 3c 2f 68 31 3e rtualXL</a></h1>
3c30: 0d 0a 54 68 65 20 3c 62 3e 56 69 72 74 75 61 6c ..The <b>Virtual
3c40: 58 4c 3c 2f 62 3e 20 49 6e 74 65 72 66 61 63 65 XL</b> Interface
3c50: 20 61 6c 6c 6f 77 73 20 74 6f 20 64 69 72 65 63 allows to direc
3c60: 74 6c 79 20 61 63 63 65 73 73 20 61 6e 20 65 78 tly access an ex
3c70: 74 65 72 6e 61 6c 20 4d 53 20 45 78 63 65 6c 20 ternal MS Excel
3c80: 73 70 72 65 61 64 73 68 65 65 74 20 62 79 20 75 spreadsheet by u
3c90: 73 69 6e 67 20 73 74 61 6e 64 61 72 64 20 53 70 sing standard Sp
3ca0: 61 74 69 61 6c 20 53 51 4c 20 71 75 65 72 69 65 atial SQL querie
3cb0: 73 2e 3c 62 72 3e 0d 0a 53 79 6e 74 61 78 20 66 s.<br>..Syntax f
3cc0: 6f 72 20 63 72 65 61 74 69 6e 67 20 61 20 56 69 or creating a Vi
3cd0: 72 74 75 61 6c 58 4c 20 54 61 62 6c 65 3a 0d 0a rtualXL Table:..
3ce0: 3c 76 65 72 62 61 74 69 6d 3e 0d 0a 53 45 4c 45 <verbatim>..SELE
3cf0: 43 54 20 43 52 45 41 54 45 20 56 49 52 54 55 41 CT CREATE VIRTUA
3d00: 4c 20 54 41 42 4c 45 20 6d 79 5f 74 61 62 6c 65 L TABLE my_table
3d10: 20 55 53 49 4e 47 20 56 69 72 74 75 61 6c 58 4c USING VirtualXL
3d20: 20 28 20 78 6c 73 5f 70 61 74 68 20 29 3b 0d 0a ( xls_path );..
3d30: 0d 0a 53 45 4c 45 43 54 20 43 52 45 41 54 45 20 ..SELECT CREATE
3d40: 56 49 52 54 55 41 4c 20 54 41 42 4c 45 20 6d 79 VIRTUAL TABLE my
3d50: 5f 74 61 62 6c 65 20 55 53 49 4e 47 20 56 69 72 _table USING Vir
3d60: 74 75 61 6c 58 4c 20 28 20 78 6c 73 5f 70 61 74 tualXL ( xls_pat
3d70: 68 20 2c 20 77 6f 72 6b 73 68 65 65 74 5f 69 6e h , worksheet_in
3d80: 64 65 78 20 29 3b 0d 0a 0d 0a 53 45 4c 45 43 54 dex );....SELECT
3d90: 20 43 52 45 41 54 45 20 56 49 52 54 55 41 4c 20 CREATE VIRTUAL
3da0: 54 41 42 4c 45 20 6d 79 5f 74 61 62 6c 65 20 55 TABLE my_table U
3db0: 53 49 4e 47 20 56 69 72 74 75 61 6c 58 4c 20 28 SING VirtualXL (
3dc0: 20 78 6c 73 5f 70 61 74 68 20 2c 20 77 6f 72 6b xls_path , work
3dd0: 73 68 65 65 74 5f 69 6e 64 65 78 20 2c 20 66 69 sheet_index , fi
3de0: 72 73 74 5f 72 6f 77 5f 61 73 5f 74 69 74 6c 65 rst_row_as_title
3df0: 73 20 29 3b 0d 0a 3c 2f 76 65 72 62 61 74 69 6d s );..</verbatim
3e00: 3e 0d 0a 53 75 70 70 6f 72 74 65 64 20 61 72 67 >..Supported arg
3e10: 75 6d 65 6e 74 73 20 61 6e 64 20 74 68 65 69 72 uments and their
3e20: 20 69 6e 74 65 72 70 72 65 74 61 74 69 6f 6e 3a interpretation:
3e30: 0d 0a 3c 75 6c 3e 0d 0a 3c 6c 69 3e 3c 62 3e 78 ..<ul>..<li><b>x
3e40: 6c 73 5f 70 61 74 68 3c 2f 62 3e 20 28 3c 69 3e ls_path</b> (<i>
3e50: 3c 62 3e 6d 61 6e 64 61 74 6f 72 79 3c 2f 62 3e <b>mandatory</b>
3e60: 3c 2f 69 3e 29 3a 20 74 68 65 20 72 65 6c 61 74 </i>): the relat
3e70: 69 76 65 20 6f 72 20 61 62 73 6f 6c 75 74 65 20 ive or absolute
3e80: 70 61 74 68 6e 61 6d 65 20 6c 65 61 64 69 6e 67 pathname leading
3e90: 20 74 6f 20 74 68 65 20 65 78 74 65 72 6e 61 6c to the external
3ea0: 20 4d 53 20 45 78 63 65 6c 20 73 70 72 65 61 64 MS Excel spread
3eb0: 73 68 65 65 74 20 28 6f 6c 64 20 62 69 6e 61 72 sheet (old binar
3ec0: 79 20 66 6f 72 6d 61 74 20 3c 69 3e 2a 2e 78 6c y format <i>*.xl
3ed0: 73 3c 2f 69 3e 29 2e 3c 2f 6c 69 3e 0d 0a 3c 6c s</i>).</li>..<l
3ee0: 69 3e 3c 62 3e 77 6f 72 6b 73 68 65 65 74 5f 69 i><b>worksheet_i
3ef0: 6e 64 65 78 3c 2f 62 3e 20 28 3c 69 3e 3c 62 3e ndex</b> (<i><b>
3f00: 6f 70 74 69 6f 6e 61 6c 3c 2f 62 3e 3c 2f 69 3e optional</b></i>
3f10: 29 3a 20 74 68 65 20 69 6e 64 65 78 20 69 64 65 ): the index ide
3f20: 6e 74 69 66 79 69 6e 67 20 6f 6e 65 20 6f 66 20 ntifying one of
3f30: 74 68 65 20 77 6f 72 6b 73 68 65 65 74 73 20 77 the worksheets w
3f40: 69 74 68 69 6e 20 74 68 65 20 45 78 63 65 6c 20 ithin the Excel
3f50: 64 6f 63 75 6d 65 6e 74 2e 3c 62 72 3e 0d 0a 4d document.<br>..M
3f60: 53 20 45 78 63 65 6c 20 6d 61 79 20 63 6f 6e 74 S Excel may cont
3f70: 61 69 6e 20 6d 6f 72 65 20 74 68 61 6e 20 6f 6e ain more than on
3f80: 65 20 77 6f 72 6b 73 68 65 65 74 2c 20 61 6e 64 e worksheet, and
3f90: 20 65 61 63 68 20 69 6e 64 69 76 69 64 75 61 6c each individual
3fa0: 20 77 6f 72 6b 73 68 65 65 74 20 69 73 20 69 64 worksheet is id
3fb0: 65 6e 74 69 66 69 65 64 20 62 79 20 69 74 73 20 entified by its
3fc0: 6f 77 6e 20 69 6e 64 65 78 20 28 3c 62 3e 7a 65 own index (<b>ze
3fd0: 72 6f 2d 62 61 73 65 64 3c 2f 62 3e 20 69 6e 64 ro-based</b> ind
3fe0: 65 78 3b 20 74 68 65 20 66 69 72 73 74 20 77 6f ex; the first wo
3ff0: 72 6b 73 68 65 65 74 20 61 6c 77 61 79 73 20 68 rksheet always h
4000: 61 73 20 3c 62 3e 69 6e 64 65 78 3d 30 3c 2f 62 as <b>index=0</b
4010: 3e 29 2e 3c 62 72 3e 0d 0a 49 66 20 6e 6f 74 20 >).<br>..If not
4020: 65 78 70 6c 69 63 69 74 6c 79 20 73 70 65 63 69 explicitly speci
4030: 66 69 65 64 20 74 68 65 20 66 69 72 73 74 20 77 fied the first w
4040: 6f 72 6b 73 68 65 65 74 20 77 69 6c 6c 20 61 6c orksheet will al
4050: 77 61 79 73 20 62 65 20 61 73 73 75 6d 65 64 20 ways be assumed
4060: 28 64 65 66 61 75 6c 74 20 76 61 6c 75 65 29 2e (default value).
4070: 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e 3c 62 3e 66 69 </li>..<li><b>fi
4080: 72 73 74 5f 72 6f 77 5f 61 73 5f 74 69 74 6c 65 rst_row_as_title
4090: 73 3c 2f 62 3e 20 28 3c 69 3e 3c 62 3e 6f 70 74 s</b> (<i><b>opt
40a0: 69 6f 6e 61 6c 3c 2f 62 3e 3c 2f 69 3e 29 3a 20 ional</b></i>):
40b0: 74 68 69 73 20 69 73 20 61 20 3c 62 3e 42 4f 4f this is a <b>BOO
40c0: 4c 45 41 4e 3c 2f 62 3e 20 66 6c 61 67 3a 0d 0a LEAN</b> flag:..
40d0: 3c 75 6c 3e 0d 0a 3c 6c 69 3e 69 66 20 73 65 74 <ul>..<li>if set
40e0: 20 74 6f 20 3c 62 3e 30 3c 2f 62 3e 20 28 3c 62 to <b>0</b> (<b
40f0: 3e 46 41 4c 53 45 3c 2f 62 3e 29 20 61 6c 6c 20 >FALSE</b>) all
4100: 63 6f 6c 75 6d 6e 20 6e 61 6d 65 73 20 77 69 6c column names wil
4110: 6c 20 62 65 20 61 75 74 6f 6d 61 74 69 63 61 6c l be automatical
4120: 6c 79 20 73 65 74 20 62 79 20 75 73 69 6e 67 20 ly set by using
4130: 61 20 70 72 6f 67 72 65 73 73 69 76 65 20 73 65 a progressive se
4140: 71 75 65 6e 63 65 2e 3c 2f 6c 69 3e 0d 0a 3c 6c quence.</li>..<l
4150: 69 3e 69 66 20 73 65 74 20 74 6f 20 61 6e 79 20 i>if set to any
4160: 6f 74 68 65 72 20 69 6e 74 65 67 65 72 20 76 61 other integer va
4170: 6c 75 65 20 28 3c 62 3e 54 52 55 45 3c 2f 62 3e lue (<b>TRUE</b>
4180: 29 20 61 6c 6c 20 63 6f 6c 75 6d 6e 20 6e 61 6d ) all column nam
4190: 65 73 20 77 69 6c 6c 20 62 79 20 65 78 70 65 63 es will by expec
41a0: 74 65 64 20 74 6f 20 62 65 20 64 65 66 69 6e 65 ted to be define
41b0: 64 20 69 6e 20 74 68 65 20 76 65 72 79 20 66 69 d in the very fi
41c0: 72 73 74 20 72 6f 77 20 6f 66 20 74 68 65 20 53 rst row of the S
41d0: 70 72 65 61 64 73 68 65 65 74 2e 3c 2f 6c 69 3e preadsheet.</li>
41e0: 0d 0a 3c 6c 69 3e 69 66 20 6e 6f 74 20 65 78 70 ..<li>if not exp
41f0: 6c 69 63 69 74 6c 79 20 73 70 65 63 69 66 69 65 licitly specifie
4200: 64 2c 20 3c 62 3e 54 52 55 45 3c 2f 62 3e 20 77 d, <b>TRUE</b> w
4210: 69 6c 6c 20 61 6c 77 61 79 73 20 62 65 20 61 73 ill always be as
4220: 73 75 6d 65 64 20 28 64 65 66 61 75 6c 74 20 73 sumed (default s
4230: 65 74 74 69 6e 67 29 2e 3c 2f 6c 69 3e 0d 0a 3c etting).</li>..<
4240: 2f 75 6c 3e 3c 2f 6c 69 3e 0d 0a 3c 75 6c 3e 0d /ul></li>..<ul>.
4250: 0a 3c 2f 75 6c 3e 3c 2f 6c 69 3e 0d 0a 3c 2f 75 .</ul></li>..</u
4260: 6c 3e 3c 62 72 3e 0d 0a 3c 74 61 62 6c 65 20 62 l><br>..<table b
4270: 67 63 6f 6c 6f 72 3d 22 23 66 66 66 66 64 30 22 gcolor="#ffffd0"
4280: 20 63 65 6c 6c 70 61 64 64 69 6e 67 3d 22 31 38 cellpadding="18
4290: 22 3e 3c 74 72 3e 3c 74 64 3e 0d 0a 3c 62 3e 4e "><tr><td>..<b>N
42a0: 6f 74 65 3c 2f 62 3e 3a 20 71 75 6f 74 69 6e 67 ote</b>: quoting
42b0: 20 6f 72 20 6e 6f 74 20 61 6e 79 20 54 65 78 74 or not any Text
42c0: 20 53 74 72 69 6e 67 20 77 68 65 6e 20 69 74 20 String when it
42d0: 61 70 70 65 61 72 73 20 61 73 20 61 20 56 69 72 appears as a Vir
42e0: 74 75 61 6c 20 54 61 62 6c 65 20 61 72 67 75 6d tual Table argum
42f0: 65 6e 74 20 68 61 73 20 61 62 73 6f 6c 75 74 65 ent has absolute
4300: 6c 79 20 6e 6f 20 65 66 66 65 63 74 2e 0d 0a 3c ly no effect...<
4310: 76 65 72 62 61 74 69 6d 3e 0d 0a 53 45 4c 45 43 verbatim>..SELEC
4320: 54 20 43 52 45 41 54 45 20 56 49 52 54 55 41 4c T CREATE VIRTUAL
4330: 20 54 41 42 4c 45 20 6d 79 5f 74 61 62 6c 65 20 TABLE my_table
4340: 55 53 49 4e 47 20 56 69 72 74 75 61 6c 58 4c 28 USING VirtualXL(
4350: 20 2f 68 6f 6d 65 2f 73 61 6e 64 72 6f 2f 6d 79 /home/sandro/my
4360: 73 70 72 65 61 64 73 68 65 65 74 2e 78 6c 73 20 spreadsheet.xls
4370: 2c 20 33 2c 20 31 20 29 3b 0d 0a 6f 72 0d 0a 53 , 3, 1 );..or..S
4380: 45 4c 45 43 54 20 43 52 45 41 54 45 20 56 49 52 ELECT CREATE VIR
4390: 54 55 41 4c 20 54 41 42 4c 45 20 6d 79 5f 74 61 TUAL TABLE my_ta
43a0: 62 6c 65 20 55 53 49 4e 47 20 56 69 72 74 75 61 ble USING Virtua
43b0: 6c 58 4c 28 20 27 2f 68 6f 6d 65 2f 73 61 6e 64 lXL( '/home/sand
43c0: 72 6f 2f 6d 79 73 70 72 65 61 64 73 68 65 65 74 ro/myspreadsheet
43d0: 2e 78 6c 73 27 20 2c 20 33 2c 20 31 20 29 3b 0d .xls' , 3, 1 );.
43e0: 0a 3c 2f 76 65 72 62 61 74 69 6d 3e 0d 0a 42 6f .</verbatim>..Bo
43f0: 74 68 20 6e 6f 74 61 74 69 6f 6e 73 20 77 69 6c th notations wil
4400: 6c 20 70 72 6f 64 75 63 65 20 74 68 65 20 73 61 l produce the sa
4410: 6d 65 20 72 65 73 75 6c 74 2e 0d 0a 3c 2f 74 64 me result...</td
4420: 3e 3c 2f 74 72 3e 3c 2f 74 61 62 6c 65 3e 0d 0a ></tr></table>..
4430: 3c 62 72 3e 0d 0a 3c 74 61 62 6c 65 20 62 67 63 <br>..<table bgc
4440: 6f 6c 6f 72 3d 22 23 64 30 66 66 64 30 22 20 63 olor="#d0ffd0" c
4450: 65 6c 6c 70 61 64 64 69 6e 67 3d 22 31 38 22 3e ellpadding="18">
4460: 3c 74 72 3e 3c 74 64 3e 0d 0a 3c 68 33 3e 42 65 <tr><td>..<h3>Be
4470: 73 74 20 70 72 61 63 74 69 63 65 73 20 61 6e 64 st practices and
4480: 20 6b 6e 6f 77 6e 20 6c 69 6d 69 74 61 74 69 6f known limitatio
4490: 6e 73 3c 2f 68 33 3e 0d 0a 3c 75 6c 3e 0d 0a 3c ns</h3>..<ul>..<
44a0: 6c 69 3e 56 69 72 74 75 61 6c 20 54 61 62 6c 65 li>Virtual Table
44b0: 73 20 61 72 65 20 6e 6f 74 20 72 65 61 6c 6c 79 s are not really
44c0: 20 67 65 6e 75 69 6e 65 20 44 61 74 61 62 61 73 genuine Databas
44d0: 65 20 54 61 62 6c 65 73 2c 20 74 68 65 79 20 61 e Tables, they a
44e0: 72 65 20 6a 75 73 74 20 65 6d 75 6c 61 74 69 6e re just emulatin
44f0: 67 20 74 68 65 20 6f 72 69 67 69 6e 61 6c 20 73 g the original s
4500: 6f 75 72 63 65 20 61 73 20 61 20 44 61 74 61 62 ource as a Datab
4510: 61 73 65 20 54 61 62 6c 65 2e 3c 2f 6c 69 3e 0d ase Table.</li>.
4520: 0a 3c 6c 69 3e 56 69 72 74 75 61 6c 20 54 61 62 .<li>Virtual Tab
4530: 6c 65 73 20 68 61 76 65 20 76 65 72 79 20 70 6f les have very po
4540: 6f 72 20 73 70 65 65 64 20 70 65 72 66 6f 72 6d or speed perform
4550: 61 6e 63 65 73 2c 20 64 75 65 20 74 6f 20 74 68 ances, due to th
4560: 65 20 20 65 6d 75 6c 61 74 69 6f 6e 2c 20 61 73 e emulation, as
4570: 20 63 6f 6d 70 61 72 65 64 20 74 6f 20 67 65 6e compared to gen
4580: 75 69 6e 65 20 44 61 74 61 62 61 73 65 20 54 61 uine Database Ta
4590: 62 6c 65 73 2e 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e bles.</li>..<li>
45a0: 43 6f 6d 70 6c 65 78 20 53 51 4c 20 71 75 65 72 Complex SQL quer
45b0: 69 65 73 20 3c 62 3e 4a 4f 49 4e 3c 2f 62 3e 69 ies <b>JOIN</b>i
45c0: 6e 67 20 73 65 76 65 72 61 6c 20 54 61 62 6c 65 ng several Table
45d0: 73 20 63 61 6e 20 6f 66 74 65 6e 20 72 65 74 75 s can often retu
45e0: 72 6e 20 6f 64 64 20 61 6e 64 20 6d 69 73 6c 65 rn odd and misle
45f0: 61 64 69 6e 67 20 72 65 73 75 6c 74 73 65 74 73 ading resultsets
4600: 2c 20 77 68 65 6e 20 6f 6e 65 20 6f 72 20 6d 6f , when one or mo
4610: 72 65 20 6f 66 20 74 68 65 20 3c 62 3e 4a 4f 49 re of the <b>JOI
4620: 4e 3c 2f 62 3e 65 64 20 54 61 62 6c 65 73 20 61 N</b>ed Tables a
4630: 72 65 20 6f 66 20 74 68 65 20 56 69 72 74 75 61 re of the Virtua
4640: 6c 20 74 79 70 65 2e 3c 2f 6c 69 3e 0d 0a 3c 6c l type.</li>..<l
4650: 69 3e 54 68 65 20 62 65 73 74 20 75 73 65 20 6f i>The best use o
4660: 66 20 61 20 56 69 72 74 75 61 6c 20 54 61 62 6c f a Virtual Tabl
4670: 65 20 69 73 20 74 6f 20 70 72 65 66 6f 72 6d 20 e is to preform
4680: 61 20 62 61 73 69 63 20 64 61 74 61 20 69 6d 70 a basic data imp
4690: 6f 72 74 20 70 72 6f 63 65 73 73 2c 20 6f 72 20 ort process, or
46a0: 74 6f 20 71 75 69 63 6b 6c 79 20 67 65 74 20 61 to quickly get a
46b0: 6e 20 6f 76 65 72 61 6c 6c 20 67 6c 61 6e 63 65 n overall glance
46c0: 20 61 74 20 61 20 66 75 6c 6c 20 64 61 74 61 73 at a full datas
46d0: 65 74 20 77 69 74 68 6f 75 74 20 6e 65 63 65 73 et without neces
46e0: 73 61 72 69 6c 79 20 69 6d 70 6f 72 74 69 6e 67 sarily importing
46f0: 20 69 74 20 69 6e 74 6f 20 74 68 65 20 44 61 74 it into the Dat
4700: 61 62 61 73 65 2e 3c 2f 6c 69 3e 0d 0a 3c 6c 69 abase.</li>..<li
4710: 3e 50 72 65 74 65 6e 64 69 6e 67 20 74 6f 20 75 >Pretending to u
4720: 73 65 20 61 20 56 69 72 74 75 61 6c 20 54 61 62 se a Virtual Tab
4730: 6c 65 20 61 73 20 61 20 66 75 6c 6c 20 72 65 70 le as a full rep
4740: 6c 61 63 65 6d 65 6e 74 20 6f 66 20 69 6d 70 6f lacement of impo
4750: 72 74 69 6e 67 20 61 6c 6c 20 64 61 74 61 20 77 rting all data w
4760: 69 74 68 69 6e 20 61 20 67 65 6e 75 69 6e 65 20 ithin a genuine
4770: 44 61 74 61 62 61 73 65 20 54 61 62 6c 65 20 69 Database Table i
4780: 73 20 73 74 72 6f 6e 67 6c 79 20 64 69 73 63 6f s strongly disco
4790: 75 72 61 67 65 64 2c 20 61 6e 64 20 6e 65 76 65 uraged, and neve
47a0: 72 20 69 73 20 61 20 67 6f 6f 64 20 69 64 65 61 r is a good idea
47b0: 2e 3c 2f 6c 69 3e 0d 0a 3c 2f 75 6c 3e 3c 62 72 .</li>..</ul><br
47c0: 3e 0d 0a 3c 62 3e 57 61 72 6e 69 6e 67 3c 2f 62 >..<b>Warning</b
47d0: 3e 3a 20 56 69 72 74 75 61 6c 58 4c 20 54 61 62 >: VirtualXL Tab
47e0: 6c 65 73 20 61 72 65 20 61 6c 77 61 79 73 20 73 les are always s
47f0: 75 62 6a 65 63 74 20 74 6f 20 3c 62 3e 52 45 41 ubject to <b>REA
4800: 44 2d 4f 4e 4c 59 3c 2f 62 3e 20 72 65 73 74 72 D-ONLY</b> restr
4810: 69 63 74 69 6f 6e 73 2e 20 41 6e 79 20 61 74 74 ictions. Any att
4820: 65 6d 70 74 20 74 6f 20 74 6f 20 65 78 65 63 75 empt to to execu
4830: 74 65 20 61 6e 20 3c 62 3e 49 4e 53 45 52 54 3c te an <b>INSERT<
4840: 2f 62 3e 2c 20 3c 62 3e 55 50 44 41 54 45 3c 2f /b>, <b>UPDATE</
4850: 62 3e 20 6f 72 20 3c 62 3e 44 45 4c 45 54 45 3c b> or <b>DELETE<
4860: 2f 62 3e 20 73 74 61 74 65 6d 65 6e 74 20 77 69 /b> statement wi
4870: 6c 6c 20 61 6c 77 61 79 73 20 72 65 74 75 72 6e ll always return
4880: 20 61 6e 20 65 72 72 6f 72 2e 3c 62 72 3e 0d 0a an error.<br>..
4890: 3c 2f 74 64 3e 3c 2f 74 72 3e 3c 2f 74 61 62 6c </td></tr></tabl
48a0: 65 3e 0d 0a 3c 62 72 3e 0d 0a 3c 74 61 62 6c 65 e>..<br>..<table
48b0: 20 62 67 63 6f 6c 6f 72 3d 22 23 65 30 65 30 65 bgcolor="#e0e0e
48c0: 30 22 20 63 65 6c 6c 70 61 64 64 69 6e 67 3d 22 0" cellpadding="
48d0: 31 38 22 3e 3c 74 72 3e 3c 74 64 3e 0d 0a 3c 68 18"><tr><td>..<h
48e0: 33 3e 52 65 6c 61 74 65 64 20 54 6f 70 69 63 73 3>Related Topics
48f0: 3c 2f 68 33 3e 0d 0a 54 68 65 20 3c 62 3e 49 6d </h3>..The <b>Im
4900: 70 6f 72 74 58 4c 53 28 29 3c 2f 62 3e 20 53 51 portXLS()</b> SQ
4910: 4c 20 66 75 6e 63 74 69 6f 6e 20 61 6c 6c 6f 77 L function allow
4920: 73 20 74 6f 20 63 72 65 61 74 65 20 61 6e 64 20 s to create and
4930: 70 6f 70 75 6c 61 74 65 20 61 20 67 65 6e 75 69 populate a genui
4940: 6e 65 20 44 61 74 61 62 61 73 65 20 54 61 62 6c ne Database Tabl
4950: 65 20 62 79 20 69 6d 70 6f 72 74 69 6e 67 20 61 e by importing a
4960: 6e 20 65 78 74 65 72 6e 61 6c 20 4d 53 20 45 78 n external MS Ex
4970: 63 65 6c 20 73 70 72 65 61 64 73 68 65 65 74 2e cel spreadsheet.
4980: 0d 0a 3c 2f 74 64 3e 3c 2f 74 72 3e 3c 2f 74 61 ..</td></tr></ta
4990: 62 6c 65 3e 0d 0a 3c 62 72 3e 0d 0a 3c 68 72 3e ble>..<br>..<hr>
49a0: 0d 0a 3c 68 31 3e 3c 61 20 69 64 3d 22 56 69 72 ..<h1><a id="Vir
49b0: 74 75 61 6c 46 44 4f 22 3e 56 69 72 74 75 61 6c tualFDO">Virtual
49c0: 46 44 4f 3c 2f 61 3e 3c 2f 68 31 3e 0d 0a 54 68 FDO</a></h1>..Th
49d0: 65 20 3c 62 3e 56 69 72 74 75 61 6c 46 44 4f 3c e <b>VirtualFDO<
49e0: 2f 62 3e 20 49 6e 74 65 72 66 61 63 65 20 61 6c /b> Interface al
49f0: 6c 6f 77 73 20 74 6f 20 64 69 72 65 63 74 6c 79 lows to directly
4a00: 20 61 63 63 65 73 73 20 61 20 53 70 61 74 69 61 access a Spatia
4a10: 6c 20 54 61 62 6c 65 20 63 6f 6e 74 61 69 6e 69 l Table containi
4a20: 6e 67 20 3c 62 3e 46 44 4f 20 62 69 6e 61 72 79 ng <b>FDO binary
4a30: 20 47 65 6f 6d 65 74 72 69 65 73 3c 2f 62 3e 20 Geometries</b>
4a40: 65 78 61 63 74 6c 79 20 61 73 20 69 66 20 77 61 exactly as if wa
4a50: 73 20 61 20 53 70 61 74 69 61 4c 69 74 65 27 73 s a SpatiaLite's
4a60: 20 6f 77 6e 20 6e 61 74 69 76 65 20 54 61 62 6c own native Tabl
4a70: 65 2e 3c 62 72 3e 0d 0a 46 44 4f 20 69 73 20 61 e.<br>..FDO is a
4a80: 6e 20 61 6c 74 65 72 6e 61 74 69 76 65 20 62 69 n alternative bi
4a90: 6e 61 72 79 20 66 6f 72 6d 61 74 20 66 6f 72 20 nary format for
4aa0: 47 65 6f 6d 65 74 72 69 65 73 20 73 74 6f 72 65 Geometries store
4ab0: 64 20 77 69 74 68 69 6e 20 61 20 53 51 4c 69 74 d within a SQLit
4ac0: 65 20 44 61 74 61 62 61 73 65 3b 20 79 6f 75 20 e Database; you
4ad0: 63 61 6e 20 65 76 65 6e 74 75 61 6c 6c 79 20 72 can eventually r
4ae0: 65 61 64 20 74 68 65 20 3c 61 20 68 72 65 66 3d ead the <a href=
4af0: 22 68 74 74 70 73 3a 2f 2f 74 72 61 63 2e 6f 73 "https://trac.os
4b00: 67 65 6f 2e 6f 72 67 2f 66 64 6f 2f 77 69 6b 69 geo.org/fdo/wiki
4b10: 2f 46 44 4f 52 66 63 31 36 22 3e 52 46 43 20 31 /FDORfc16">RFC 1
4b20: 36 3c 2f 61 3e 20 73 70 65 63 69 66 69 63 61 74 6</a> specificat
4b30: 69 6f 6e 20 66 6f 72 20 6d 6f 72 65 20 64 65 74 ion for more det
4b40: 61 69 6c 73 2e 3c 62 72 3e 0d 0a 53 79 6e 74 61 ails.<br>..Synta
4b50: 78 20 66 6f 72 20 63 72 65 61 74 69 6e 67 20 61 x for creating a
4b60: 20 56 69 72 74 75 61 6c 46 44 4f 20 54 61 62 6c VirtualFDO Tabl
4b70: 65 3a 0d 0a 3c 76 65 72 62 61 74 69 6d 3e 0d 0a e:..<verbatim>..
4b80: 53 45 4c 45 43 54 20 43 52 45 41 54 45 20 56 49 SELECT CREATE VI
4b90: 52 54 55 41 4c 20 54 41 42 4c 45 20 6d 79 5f 74 RTUAL TABLE my_t
4ba0: 61 62 6c 65 20 55 53 49 4e 47 20 56 69 72 74 75 able USING Virtu
4bb0: 61 6c 46 64 6f 20 28 20 74 61 62 6c 65 5f 6e 61 alFdo ( table_na
4bc0: 6d 65 20 29 3b 0d 0a 3c 2f 76 65 72 62 61 74 69 me );..</verbati
4bd0: 6d 3e 0d 0a 53 75 70 70 6f 72 74 65 64 20 61 72 m>..Supported ar
4be0: 67 75 6d 65 6e 74 20 61 6e 64 20 69 74 73 20 69 gument and its i
4bf0: 6e 74 65 72 70 72 65 74 61 74 69 6f 6e 3a 0d 0a nterpretation:..
4c00: 3c 75 6c 3e 0d 0a 3c 6c 69 3e 3c 62 3e 74 61 62 <ul>..<li><b>tab
4c10: 6c 65 5f 6e 61 6d 65 3c 2f 62 3e 20 28 3c 69 3e le_name</b> (<i>
4c20: 3c 62 3e 6d 61 6e 64 61 74 6f 72 79 3c 2f 62 3e <b>mandatory</b>
4c30: 3c 2f 69 3e 29 3a 20 74 68 65 20 6e 61 6d 65 20 </i>): the name
4c40: 6f 66 20 74 68 65 20 54 61 62 6c 65 20 69 6e 20 of the Table in
4c50: 74 68 65 20 63 75 72 72 65 6e 74 20 44 61 74 61 the current Data
4c60: 62 61 73 65 20 63 6f 6e 74 61 69 6e 69 6e 67 20 base containing
4c70: 6f 6e 65 20 6f 72 20 6d 6f 72 65 20 46 44 4f 20 one or more FDO
4c80: 47 65 6f 6d 65 74 72 79 20 43 6f 6c 75 6d 6e 73 Geometry Columns
4c90: 20 74 6f 20 62 65 20 61 75 74 6f 6d 61 74 69 63 to be automatic
4ca0: 61 6c 6c 79 20 74 72 61 6e 73 6c 61 74 65 64 20 ally translated
4cb0: 74 6f 2f 66 72 6f 6d 20 53 70 61 74 69 61 4c 69 to/from SpatiaLi
4cc0: 74 65 27 73 20 6f 77 6e 20 6e 61 74 69 76 65 20 te's own native
4cd0: 62 69 6e 61 72 79 20 42 4c 4f 42 2d 66 6f 72 6d binary BLOB-form
4ce0: 61 74 2e 3c 2f 6c 69 3e 0d 0a 3c 2f 75 6c 3e 3c at.</li>..</ul><
4cf0: 62 72 3e 0d 0a 3c 74 61 62 6c 65 20 62 67 63 6f br>..<table bgco
4d00: 6c 6f 72 3d 22 23 66 66 66 66 64 30 22 20 63 65 lor="#ffffd0" ce
4d10: 6c 6c 70 61 64 64 69 6e 67 3d 22 31 38 22 3e 3c llpadding="18"><
4d20: 74 72 3e 3c 74 64 3e 0d 0a 3c 62 3e 4e 6f 74 65 tr><td>..<b>Note
4d30: 3c 2f 62 3e 3a 20 71 75 6f 74 69 6e 67 20 6f 72 </b>: quoting or
4d40: 20 6e 6f 74 20 61 6e 79 20 54 65 78 74 20 53 74 not any Text St
4d50: 72 69 6e 67 20 77 68 65 6e 20 69 74 20 61 70 70 ring when it app
4d60: 65 61 72 73 20 61 73 20 61 20 56 69 72 74 75 61 ears as a Virtua
4d70: 6c 20 54 61 62 6c 65 20 61 72 67 75 6d 65 6e 74 l Table argument
4d80: 20 68 61 73 20 61 62 73 6f 6c 75 74 65 6c 79 20 has absolutely
4d90: 6e 6f 20 65 66 66 65 63 74 2e 0d 0a 3c 76 65 72 no effect...<ver
4da0: 62 61 74 69 6d 3e 0d 0a 53 45 4c 45 43 54 20 43 batim>..SELECT C
4db0: 52 45 41 54 45 20 56 49 52 54 55 41 4c 20 54 41 REATE VIRTUAL TA
4dc0: 42 4c 45 20 6d 79 5f 74 61 62 6c 65 20 55 53 49 BLE my_table USI
4dd0: 4e 47 20 56 69 72 74 75 61 6c 46 64 6f 28 20 6d NG VirtualFdo( m
4de0: 79 5f 70 61 72 63 65 6c 73 20 29 3b 0d 0a 6f 72 y_parcels );..or
4df0: 0d 0a 53 45 4c 45 43 54 20 43 52 45 41 54 45 20 ..SELECT CREATE
4e00: 56 49 52 54 55 41 4c 20 54 41 42 4c 45 20 6d 79 VIRTUAL TABLE my
4e10: 5f 74 61 62 6c 65 20 55 53 49 4e 47 20 56 69 72 _table USING Vir
4e20: 74 75 61 6c 46 64 6f 28 20 27 6d 79 5f 70 61 72 tualFdo( 'my_par
4e30: 63 65 6c 73 27 20 29 3b 0d 0a 3c 2f 76 65 72 62 cels' );..</verb
4e40: 61 74 69 6d 3e 0d 0a 42 6f 74 68 20 6e 6f 74 61 atim>..Both nota
4e50: 74 69 6f 6e 73 20 77 69 6c 6c 20 70 72 6f 64 75 tions will produ
4e60: 63 65 20 74 68 65 20 73 61 6d 65 20 72 65 73 75 ce the same resu
4e70: 6c 74 2e 0d 0a 3c 2f 74 64 3e 3c 2f 74 72 3e 3c lt...</td></tr><
4e80: 2f 74 61 62 6c 65 3e 0d 0a 3c 62 72 3e 0d 0a 3c /table>..<br>..<
4e90: 74 61 62 6c 65 20 62 67 63 6f 6c 6f 72 3d 22 23 table bgcolor="#
4ea0: 64 30 66 66 64 30 22 20 63 65 6c 6c 70 61 64 64 d0ffd0" cellpadd
4eb0: 69 6e 67 3d 22 31 38 22 3e 3c 74 72 3e 3c 74 64 ing="18"><tr><td
4ec0: 3e 0d 0a 3c 68 33 3e 42 65 73 74 20 70 72 61 63 >..<h3>Best prac
4ed0: 74 69 63 65 73 20 61 6e 64 20 6b 6e 6f 77 6e 20 tices and known
4ee0: 6c 69 6d 69 74 61 74 69 6f 6e 73 3c 2f 68 33 3e limitations</h3>
4ef0: 0d 0a 3c 75 6c 3e 0d 0a 3c 6c 69 3e 56 69 72 74 ..<ul>..<li>Virt
4f00: 75 61 6c 20 54 61 62 6c 65 73 20 61 72 65 20 6e ual Tables are n
4f10: 6f 74 20 72 65 61 6c 6c 79 20 67 65 6e 75 69 6e ot really genuin
4f20: 65 20 44 61 74 61 62 61 73 65 20 54 61 62 6c 65 e Database Table
4f30: 73 2c 20 74 68 65 79 20 61 72 65 20 6a 75 73 74 s, they are just
4f40: 20 65 6d 75 6c 61 74 69 6e 67 20 74 68 65 20 6f emulating the o
4f50: 72 69 67 69 6e 61 6c 20 73 6f 75 72 63 65 20 61 riginal source a
4f60: 73 20 61 20 44 61 74 61 62 61 73 65 20 54 61 62 s a Database Tab
4f70: 6c 65 2e 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e 56 69 le.</li>..<li>Vi
4f80: 72 74 75 61 6c 20 54 61 62 6c 65 73 20 68 61 76 rtual Tables hav
4f90: 65 20 76 65 72 79 20 70 6f 6f 72 20 73 70 65 65 e very poor spee
4fa0: 64 20 70 65 72 66 6f 72 6d 61 6e 63 65 73 2c 20 d performances,
4fb0: 64 75 65 20 74 6f 20 74 68 65 20 20 65 6d 75 6c due to the emul
4fc0: 61 74 69 6f 6e 2c 20 61 73 20 63 6f 6d 70 61 72 ation, as compar
4fd0: 65 64 20 74 6f 20 67 65 6e 75 69 6e 65 20 44 61 ed to genuine Da
4fe0: 74 61 62 61 73 65 20 54 61 62 6c 65 73 2e 3c 2f tabase Tables.</
4ff0: 6c 69 3e 0d 0a 3c 6c 69 3e 43 6f 6d 70 6c 65 78 li>..<li>Complex
5000: 20 53 51 4c 20 71 75 65 72 69 65 73 20 3c 62 3e SQL queries <b>
5010: 4a 4f 49 4e 3c 2f 62 3e 69 6e 67 20 73 65 76 65 JOIN</b>ing seve
5020: 72 61 6c 20 54 61 62 6c 65 73 20 63 61 6e 20 6f ral Tables can o
5030: 66 74 65 6e 20 72 65 74 75 72 6e 20 6f 64 64 20 ften return odd
5040: 61 6e 64 20 6d 69 73 6c 65 61 64 69 6e 67 20 72 and misleading r
5050: 65 73 75 6c 74 73 65 74 73 2c 20 77 68 65 6e 20 esultsets, when
5060: 6f 6e 65 20 6f 72 20 6d 6f 72 65 20 6f 66 20 74 one or more of t
5070: 68 65 20 3c 62 3e 4a 4f 49 4e 3c 2f 62 3e 65 64 he <b>JOIN</b>ed
5080: 20 54 61 62 6c 65 73 20 61 72 65 20 6f 66 20 74 Tables are of t
5090: 68 65 20 56 69 72 74 75 61 6c 20 74 79 70 65 2e he Virtual type.
50a0: 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e 54 68 65 20 62 </li>..<li>The b
50b0: 65 73 74 20 75 73 65 20 6f 66 20 61 20 56 69 72 est use of a Vir
50c0: 74 75 61 6c 20 54 61 62 6c 65 20 69 73 20 74 6f tual Table is to
50d0: 20 70 72 65 66 6f 72 6d 20 61 20 62 61 73 69 63 preform a basic
50e0: 20 64 61 74 61 20 69 6d 70 6f 72 74 20 70 72 6f data import pro
50f0: 63 65 73 73 2c 20 6f 72 20 74 6f 20 71 75 69 63 cess, or to quic
5100: 6b 6c 79 20 67 65 74 20 61 6e 20 6f 76 65 72 61 kly get an overa
5110: 6c 6c 20 67 6c 61 6e 63 65 20 61 74 20 61 20 66 ll glance at a f
5120: 75 6c 6c 20 64 61 74 61 73 65 74 20 77 69 74 68 ull dataset with
5130: 6f 75 74 20 6e 65 63 65 73 73 61 72 69 6c 79 20 out necessarily
5140: 69 6d 70 6f 72 74 69 6e 67 20 69 74 20 69 6e 74 importing it int
5150: 6f 20 74 68 65 20 44 61 74 61 62 61 73 65 2e 3c o the Database.<
5160: 2f 6c 69 3e 0d 0a 3c 6c 69 3e 50 72 65 74 65 6e /li>..<li>Preten
5170: 64 69 6e 67 20 74 6f 20 75 73 65 20 61 20 56 69 ding to use a Vi
5180: 72 74 75 61 6c 20 54 61 62 6c 65 20 61 73 20 61 rtual Table as a
5190: 20 66 75 6c 6c 20 72 65 70 6c 61 63 65 6d 65 6e full replacemen
51a0: 74 20 6f 66 20 69 6d 70 6f 72 74 69 6e 67 20 61 t of importing a
51b0: 6c 6c 20 64 61 74 61 20 77 69 74 68 69 6e 20 61 ll data within a
51c0: 20 67 65 6e 75 69 6e 65 20 44 61 74 61 62 61 73 genuine Databas
51d0: 65 20 54 61 62 6c 65 20 69 73 20 73 74 72 6f 6e e Table is stron
51e0: 67 6c 79 20 64 69 73 63 6f 75 72 61 67 65 64 2c gly discouraged,
51f0: 20 61 6e 64 20 6e 65 76 65 72 20 69 73 20 61 20 and never is a
5200: 67 6f 6f 64 20 69 64 65 61 2e 3c 2f 6c 69 3e 0d good idea.</li>.
5210: 0a 3c 2f 75 6c 3e 3c 62 72 3e 0d 0a 3c 62 3e 4e .</ul><br>..<b>N
5220: 6f 74 65 3c 2f 62 3e 3a 20 56 69 72 74 75 61 6c ote</b>: Virtual
5230: 46 44 4f 20 54 61 62 6c 65 73 20 73 75 70 70 6f FDO Tables suppo
5240: 72 74 20 75 6e 72 65 73 74 72 69 63 74 65 64 20 rt unrestricted
5250: 3c 62 3e 52 45 41 44 2d 57 52 49 54 45 3c 2f 62 <b>READ-WRITE</b
5260: 3e 20 6f 70 65 72 61 74 69 6f 6e 73 2c 20 74 68 > operations, th
5270: 69 73 20 69 6e 63 6c 75 64 69 6e 67 20 65 78 65 is including exe
5280: 63 75 74 69 6e 67 20 3c 62 3e 49 4e 53 45 52 54 cuting <b>INSERT
5290: 3c 2f 62 3e 2c 20 3c 62 3e 55 50 44 41 54 45 3c </b>, <b>UPDATE<
52a0: 2f 62 3e 20 61 6e 64 20 3c 62 3e 44 45 4c 45 54 /b> and <b>DELET
52b0: 45 3c 2f 62 3e 20 73 74 61 74 65 6d 65 6e 74 73 E</b> statements
52c0: 2e 3c 62 72 3e 0d 0a 3c 2f 74 64 3e 3c 2f 74 72 .<br>..</td></tr
52d0: 3e 3c 2f 74 61 62 6c 65 3e 0d 0a 3c 62 72 3e 0d ></table>..<br>.
52e0: 0a 3c 68 72 3e 0d 0a 3c 68 31 3e 3c 61 20 69 64 .<hr>..<h1><a id
52f0: 3d 22 56 69 72 74 75 61 6c 47 50 4b 47 22 3e 56 ="VirtualGPKG">V
5300: 69 72 74 75 61 6c 47 50 4b 47 3c 2f 61 3e 3c 2f irtualGPKG</a></
5310: 68 31 3e 0d 0a 54 68 65 20 3c 62 3e 56 69 72 74 h1>..The <b>Virt
5320: 75 61 6c 47 50 4b 47 3c 2f 62 3e 20 49 6e 74 65 ualGPKG</b> Inte
5330: 72 66 61 63 65 20 61 6c 6c 6f 77 73 20 74 6f 20 rface allows to
5340: 64 69 72 65 63 74 6c 79 20 61 63 63 65 73 73 20 directly access
5350: 53 70 61 74 69 61 6c 20 54 61 62 6c 65 73 20 66 Spatial Tables f
5360: 72 6f 6d 20 61 20 3c 62 3e 47 65 6f 50 61 63 6b rom a <b>GeoPack
5370: 61 67 65 20 44 61 74 61 62 61 73 65 3c 2f 62 3e age Database</b>
5380: 20 65 78 61 63 74 6c 79 20 61 73 20 69 66 20 77 exactly as if w
5390: 61 73 20 61 20 53 70 61 74 69 61 4c 69 74 65 27 as a SpatiaLite'
53a0: 73 20 6f 77 6e 20 6e 61 74 69 76 65 20 44 61 74 s own native Dat
53b0: 61 62 61 73 65 2e 3c 62 72 3e 0d 0a 47 65 6f 50 abase.<br>..GeoP
53c0: 61 63 6b 61 67 65 20 28 3c 69 3e 61 6b 61 3c 2f ackage (<i>aka</
53d0: 69 3e 20 3c 62 3e 47 50 4b 47 3c 2f 62 3e 29 20 i> <b>GPKG</b>)
53e0: 69 73 20 61 6e 20 61 6c 74 65 72 6e 61 74 69 76 is an alternativ
53f0: 65 20 53 70 61 74 69 61 6c 20 44 61 74 61 62 61 e Spatial Databa
5400: 73 65 20 62 75 69 6c 74 20 6f 6e 20 74 68 65 20 se built on the
5410: 74 6f 70 20 6f 66 20 53 51 4c 69 74 65 3b 20 79 top of SQLite; y
5420: 6f 75 20 63 61 6e 20 65 76 65 6e 74 75 61 6c 6c ou can eventuall
5430: 79 20 72 65 61 64 20 74 68 65 20 3c 61 20 68 72 y read the <a hr
5440: 65 66 3d 22 68 74 74 70 3a 2f 2f 77 77 77 2e 67 ef="http://www.g
5450: 65 6f 70 61 63 6b 61 67 65 2e 6f 72 67 2f 67 75 eopackage.org/gu
5460: 69 64 61 6e 63 65 2f 67 65 74 74 69 6e 67 2d 73 idance/getting-s
5470: 74 61 72 74 65 64 2e 68 74 6d 6c 22 3e 6f 66 66 tarted.html">off
5480: 69 63 69 61 6c 20 73 70 65 63 69 66 69 63 61 74 icial specificat
5490: 69 6f 6e 3c 2f 61 3e 20 66 6f 72 20 6d 6f 72 65 ion</a> for more
54a0: 20 64 65 74 61 69 6c 73 2e 3c 62 72 3e 0d 0a 53 details.<br>..S
54b0: 79 6e 74 61 78 20 66 6f 72 20 63 72 65 61 74 69 yntax for creati
54c0: 6e 67 20 61 20 56 69 72 74 75 61 6c 46 44 4f 20 ng a VirtualFDO
54d0: 54 61 62 6c 65 3a 0d 0a 3c 76 65 72 62 61 74 69 Table:..<verbati
54e0: 6d 3e 0d 0a 53 45 4c 45 43 54 20 43 52 45 41 54 m>..SELECT CREAT
54f0: 45 20 56 49 52 54 55 41 4c 20 54 41 42 4c 45 20 E VIRTUAL TABLE
5500: 6d 79 5f 74 61 62 6c 65 20 55 53 49 4e 47 20 56 my_table USING V
5510: 69 72 74 75 61 6c 47 70 6b 67 20 28 20 74 61 62 irtualGpkg ( tab
5520: 6c 65 5f 6e 61 6d 65 20 29 3b 0d 0a 3c 2f 76 65 le_name );..</ve
5530: 72 62 61 74 69 6d 3e 0d 0a 53 75 70 70 6f 72 74 rbatim>..Support
5540: 65 64 20 61 72 67 75 6d 65 6e 74 20 61 6e 64 20 ed argument and
5550: 69 74 73 20 69 6e 74 65 72 70 72 65 74 61 74 69 its interpretati
5560: 6f 6e 3a 0d 0a 3c 75 6c 3e 0d 0a 3c 6c 69 3e 3c on:..<ul>..<li><
5570: 62 3e 74 61 62 6c 65 5f 6e 61 6d 65 3c 2f 62 3e b>table_name</b>
5580: 20 28 3c 69 3e 3c 62 3e 6d 61 6e 64 61 74 6f 72 (<i><b>mandator
5590: 79 3c 2f 62 3e 3c 2f 69 3e 29 3a 20 74 68 65 20 y</b></i>): the
55a0: 6e 61 6d 65 20 6f 66 20 74 68 65 20 54 61 62 6c name of the Tabl
55b0: 65 20 69 6e 20 74 68 65 20 63 75 72 72 65 6e 74 e in the current
55c0: 20 44 61 74 61 62 61 73 65 20 63 6f 6e 74 61 69 Database contai
55d0: 6e 69 6e 67 20 6f 6e 65 20 6f 72 20 6d 6f 72 65 ning one or more
55e0: 20 47 50 4b 47 20 47 65 6f 6d 65 74 72 79 20 43 GPKG Geometry C
55f0: 6f 6c 75 6d 6e 73 20 74 6f 20 62 65 20 61 75 74 olumns to be aut
5600: 6f 6d 61 74 69 63 61 6c 6c 79 20 74 72 61 6e 73 omatically trans
5610: 6c 61 74 65 64 20 74 6f 2f 66 72 6f 6d 20 53 70 lated to/from Sp
5620: 61 74 69 61 4c 69 74 65 27 73 20 6f 77 6e 20 6e atiaLite's own n
5630: 61 74 69 76 65 20 62 69 6e 61 72 79 20 42 4c 4f ative binary BLO
5640: 42 2d 66 6f 72 6d 61 74 2e 3c 2f 6c 69 3e 0d 0a B-format.</li>..
5650: 3c 2f 75 6c 3e 3c 62 72 3e 0d 0a 3c 74 61 62 6c </ul><br>..<tabl
5660: 65 20 62 67 63 6f 6c 6f 72 3d 22 23 66 66 66 66 e bgcolor="#ffff
5670: 64 30 22 20 63 65 6c 6c 70 61 64 64 69 6e 67 3d d0" cellpadding=
5680: 22 31 38 22 3e 3c 74 72 3e 3c 74 64 3e 0d 0a 3c "18"><tr><td>..<
5690: 62 3e 4e 6f 74 65 3c 2f 62 3e 3a 20 71 75 6f 74 b>Note</b>: quot
56a0: 69 6e 67 20 6f 72 20 6e 6f 74 20 61 6e 79 20 54 ing or not any T
56b0: 65 78 74 20 53 74 72 69 6e 67 20 77 68 65 6e 20 ext String when
56c0: 69 74 20 61 70 70 65 61 72 73 20 61 73 20 61 20 it appears as a
56d0: 56 69 72 74 75 61 6c 20 54 61 62 6c 65 20 61 72 Virtual Table ar
56e0: 67 75 6d 65 6e 74 20 68 61 73 20 61 62 73 6f 6c gument has absol
56f0: 75 74 65 6c 79 20 6e 6f 20 65 66 66 65 63 74 2e utely no effect.
5700: 0d 0a 3c 76 65 72 62 61 74 69 6d 3e 0d 0a 53 45 ..<verbatim>..SE
5710: 4c 45 43 54 20 43 52 45 41 54 45 20 56 49 52 54 LECT CREATE VIRT
5720: 55 41 4c 20 54 41 42 4c 45 20 6d 79 5f 74 61 62 UAL TABLE my_tab
5730: 6c 65 20 55 53 49 4e 47 20 56 69 72 74 75 61 6c le USING Virtual
5740: 47 70 6b 73 28 20 6d 79 5f 70 61 72 63 65 6c 73 Gpks( my_parcels
5750: 20 29 3b 0d 0a 6f 72 0d 0a 53 45 4c 45 43 54 20 );..or..SELECT
5760: 43 52 45 41 54 45 20 56 49 52 54 55 41 4c 20 54 CREATE VIRTUAL T
5770: 41 42 4c 45 20 6d 79 5f 74 61 62 6c 65 20 55 53 ABLE my_table US
5780: 49 4e 47 20 56 69 72 74 75 61 6c 47 70 6b 67 28 ING VirtualGpkg(
5790: 20 27 6d 79 5f 70 61 72 63 65 6c 73 27 20 29 3b 'my_parcels' );
57a0: 0d 0a 3c 2f 76 65 72 62 61 74 69 6d 3e 0d 0a 42 ..</verbatim>..B
57b0: 6f 74 68 20 6e 6f 74 61 74 69 6f 6e 73 20 77 69 oth notations wi
57c0: 6c 6c 20 70 72 6f 64 75 63 65 20 74 68 65 20 73 ll produce the s
57d0: 61 6d 65 20 72 65 73 75 6c 74 2e 0d 0a 3c 2f 74 ame result...</t
57e0: 64 3e 3c 2f 74 72 3e 3c 2f 74 61 62 6c 65 3e 0d d></tr></table>.
57f0: 0a 3c 62 72 3e 0d 0a 3c 74 61 62 6c 65 20 62 67 .<br>..<table bg
5800: 63 6f 6c 6f 72 3d 22 23 64 30 66 66 64 30 22 20 color="#d0ffd0"
5810: 63 65 6c 6c 70 61 64 64 69 6e 67 3d 22 31 38 22 cellpadding="18"
5820: 3e 3c 74 72 3e 3c 74 64 3e 0d 0a 3c 68 33 3e 42 ><tr><td>..<h3>B
5830: 65 73 74 20 70 72 61 63 74 69 63 65 73 20 61 6e est practices an
5840: 64 20 6b 6e 6f 77 6e 20 6c 69 6d 69 74 61 74 69 d known limitati
5850: 6f 6e 73 3c 2f 68 33 3e 0d 0a 3c 75 6c 3e 0d 0a ons</h3>..<ul>..
5860: 3c 6c 69 3e 56 69 72 74 75 61 6c 20 54 61 62 6c <li>Virtual Tabl
5870: 65 73 20 61 72 65 20 6e 6f 74 20 72 65 61 6c 6c es are not reall
5880: 79 20 67 65 6e 75 69 6e 65 20 44 61 74 61 62 61 y genuine Databa
5890: 73 65 20 54 61 62 6c 65 73 2c 20 74 68 65 79 20 se Tables, they
58a0: 61 72 65 20 6a 75 73 74 20 65 6d 75 6c 61 74 69 are just emulati
58b0: 6e 67 20 74 68 65 20 6f 72 69 67 69 6e 61 6c 20 ng the original
58c0: 73 6f 75 72 63 65 20 61 73 20 61 20 44 61 74 61 source as a Data
58d0: 62 61 73 65 20 54 61 62 6c 65 2e 3c 2f 6c 69 3e base Table.</li>
58e0: 0d 0a 3c 6c 69 3e 56 69 72 74 75 61 6c 20 54 61 ..<li>Virtual Ta
58f0: 62 6c 65 73 20 68 61 76 65 20 76 65 72 79 20 70 bles have very p
5900: 6f 6f 72 20 73 70 65 65 64 20 70 65 72 66 6f 72 oor speed perfor
5910: 6d 61 6e 63 65 73 2c 20 64 75 65 20 74 6f 20 74 mances, due to t
5920: 68 65 20 20 65 6d 75 6c 61 74 69 6f 6e 2c 20 61 he emulation, a
5930: 73 20 63 6f 6d 70 61 72 65 64 20 74 6f 20 67 65 s compared to ge
5940: 6e 75 69 6e 65 20 44 61 74 61 62 61 73 65 20 54 nuine Database T
5950: 61 62 6c 65 73 2e 3c 2f 6c 69 3e 0d 0a 3c 6c 69 ables.</li>..<li
5960: 3e 43 6f 6d 70 6c 65 78 20 53 51 4c 20 71 75 65 >Complex SQL que
5970: 72 69 65 73 20 3c 62 3e 4a 4f 49 4e 3c 2f 62 3e ries <b>JOIN</b>
5980: 69 6e 67 20 73 65 76 65 72 61 6c 20 54 61 62 6c ing several Tabl
5990: 65 73 20 63 61 6e 20 6f 66 74 65 6e 20 72 65 74 es can often ret
59a0: 75 72 6e 20 6f 64 64 20 61 6e 64 20 6d 69 73 6c urn odd and misl
59b0: 65 61 64 69 6e 67 20 72 65 73 75 6c 74 73 65 74 eading resultset
59c0: 73 2c 20 77 68 65 6e 20 6f 6e 65 20 6f 72 20 6d s, when one or m
59d0: 6f 72 65 20 6f 66 20 74 68 65 20 3c 62 3e 4a 4f ore of the <b>JO
59e0: 49 4e 3c 2f 62 3e 65 64 20 54 61 62 6c 65 73 20 IN</b>ed Tables
59f0: 61 72 65 20 6f 66 20 74 68 65 20 56 69 72 74 75 are of the Virtu
5a00: 61 6c 20 74 79 70 65 2e 3c 2f 6c 69 3e 0d 0a 3c al type.</li>..<
5a10: 6c 69 3e 54 68 65 20 62 65 73 74 20 75 73 65 20 li>The best use
5a20: 6f 66 20 61 20 56 69 72 74 75 61 6c 20 54 61 62 of a Virtual Tab
5a30: 6c 65 20 69 73 20 74 6f 20 70 72 65 66 6f 72 6d le is to preform
5a40: 20 61 20 62 61 73 69 63 20 64 61 74 61 20 69 6d a basic data im
5a50: 70 6f 72 74 20 70 72 6f 63 65 73 73 2c 20 6f 72 port process, or
5a60: 20 74 6f 20 71 75 69 63 6b 6c 79 20 67 65 74 20 to quickly get
5a70: 61 6e 20 6f 76 65 72 61 6c 6c 20 67 6c 61 6e 63 an overall glanc
5a80: 65 20 61 74 20 61 20 66 75 6c 6c 20 64 61 74 61 e at a full data
5a90: 73 65 74 20 77 69 74 68 6f 75 74 20 6e 65 63 65 set without nece
5aa0: 73 73 61 72 69 6c 79 20 69 6d 70 6f 72 74 69 6e ssarily importin
5ab0: 67 20 69 74 20 69 6e 74 6f 20 74 68 65 20 44 61 g it into the Da
5ac0: 74 61 62 61 73 65 2e 3c 2f 6c 69 3e 0d 0a 3c 6c tabase.</li>..<l
5ad0: 69 3e 50 72 65 74 65 6e 64 69 6e 67 20 74 6f 20 i>Pretending to
5ae0: 75 73 65 20 61 20 56 69 72 74 75 61 6c 20 54 61 use a Virtual Ta
5af0: 62 6c 65 20 61 73 20 61 20 66 75 6c 6c 20 72 65 ble as a full re
5b00: 70 6c 61 63 65 6d 65 6e 74 20 6f 66 20 69 6d 70 placement of imp
5b10: 6f 72 74 69 6e 67 20 61 6c 6c 20 64 61 74 61 20 orting all data
5b20: 77 69 74 68 69 6e 20 61 20 67 65 6e 75 69 6e 65 within a genuine
5b30: 20 44 61 74 61 62 61 73 65 20 54 61 62 6c 65 20 Database Table
5b40: 69 73 20 73 74 72 6f 6e 67 6c 79 20 64 69 73 63 is strongly disc
5b50: 6f 75 72 61 67 65 64 2c 20 61 6e 64 20 6e 65 76 ouraged, and nev
5b60: 65 72 20 69 73 20 61 20 67 6f 6f 64 20 69 64 65 er is a good ide
5b70: 61 2e 3c 2f 6c 69 3e 0d 0a 3c 2f 75 6c 3e 3c 62 a.</li>..</ul><b
5b80: 72 3e 0d 0a 3c 62 3e 4e 6f 74 65 3c 2f 62 3e 3a r>..<b>Note</b>:
5b90: 20 56 69 72 74 75 61 6c 47 50 4b 47 20 54 61 62 VirtualGPKG Tab
5ba0: 6c 65 73 20 73 75 70 70 6f 72 74 20 75 6e 72 65 les support unre
5bb0: 73 74 72 69 63 74 65 64 20 3c 62 3e 52 45 41 44 stricted <b>READ
5bc0: 2d 57 52 49 54 45 3c 2f 62 3e 20 6f 70 65 72 61 -WRITE</b> opera
5bd0: 74 69 6f 6e 73 2c 20 74 68 69 73 20 69 6e 63 6c tions, this incl
5be0: 75 64 69 6e 67 20 65 78 65 63 75 74 69 6e 67 20 uding executing
5bf0: 3c 62 3e 49 4e 53 45 52 54 3c 2f 62 3e 2c 20 3c <b>INSERT</b>, <
5c00: 62 3e 55 50 44 41 54 45 3c 2f 62 3e 20 61 6e 64 b>UPDATE</b> and
5c10: 20 3c 62 3e 44 45 4c 45 54 45 3c 2f 62 3e 20 73 <b>DELETE</b> s
5c20: 74 61 74 65 6d 65 6e 74 73 2e 3c 62 72 3e 0d 0a tatements.<br>..
5c30: 3c 2f 74 64 3e 3c 2f 74 72 3e 3c 2f 74 61 62 6c </td></tr></tabl
5c40: 65 3e 0d 0a 3c 62 72 3e 0d 0a 3c 68 72 3e 0d 0a e>..<br>..<hr>..
5c50: 3c 62 72 3e 0d 0a 3c 61 20 68 72 65 66 3d 22 68 <br>..<a href="h
5c60: 74 74 70 73 3a 2f 2f 77 77 77 2e 67 61 69 61 2d ttps://www.gaia-
5c70: 67 69 73 2e 69 74 2f 66 6f 73 73 69 6c 2f 6c 69 gis.it/fossil/li
5c80: 62 73 70 61 74 69 61 6c 69 74 65 2f 68 6f 6d 65 bspatialite/home
5c90: 22 3e 62 61 63 6b 20 74 6f 20 6d 61 69 6e 20 70 ">back to main p
5ca0: 61 67 65 3c 2f 61 3e 0a 5a 20 38 32 66 64 37 32 age</a>.Z 82fd72
5cb0: 66 36 62 39 33 37 63 66 35 39 37 63 61 66 31 62 f6b937cf597caf1b
5cc0: 61 64 33 39 62 34 32 61 32 36 0a ad39b42a26.