Hex Artifact Content
Not logged in

Artifact fd73f8e7d8513dac8e35dc3e9ec052e1fb0fa3fd:

Wiki page [Virtual Tables (misc)] by sandro 2018-08-26 09:05:59.
0000: 44 20 32 30 31 38 2d 30 38 2d 32 36 54 30 39 3a  D 2018-08-26T09:
0010: 30 35 3a 35 39 2e 35 30 39 0a 4c 20 56 69 72 74  05:59.509.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 64 32 62 62 66 36 39 62 66 66  sc).P d2bbf69bff
0040: 31 66 65 39 38 37 65 35 63 62 30 31 62 62 36 38  1fe987e5cb01bb68
0050: 32 37 62 36 61 62 32 62 30 31 35 32 37 66 0a 55  27b6ab2b01527f.U
0060: 20 73 61 6e 64 72 6f 0a 57 20 32 37 31 34 33 0a   sandro.W 27143.
0070: 3c 61 20 68 72 65 66 3d 22 68 74 74 70 73 3a 2f  <a href="https:/
0080: 2f 77 77 77 2e 67 61 69 61 2d 67 69 73 2e 69 74  /www.gaia-gis.it
0090: 2f 66 6f 73 73 69 6c 2f 6c 69 62 73 70 61 74 69  /fossil/libspati
00a0: 61 6c 69 74 65 2f 68 6f 6d 65 22 3e 62 61 63 6b  alite/home">back
00b0: 20 74 6f 20 6d 61 69 6e 20 70 61 67 65 3c 2f 61   to main page</a
00c0: 3e 0d 0a 3c 62 72 3e 3c 68 72 3e 0d 0a 3c 68 31  >..<br><hr>..<h1
00d0: 3e 4c 69 73 74 20 6f 66 20 74 6f 70 69 63 73 3c  >List of topics<
00e0: 2f 68 31 3e 0d 0a 3c 75 6c 3e 0d 0a 3c 6c 69 3e  /h1>..<ul>..<li>
00f0: 3c 61 20 68 72 65 66 3d 22 23 56 69 72 74 75 61  <a href="#Virtua
0100: 6c 53 68 61 70 65 22 3e 3c 62 3e 56 69 72 74 75  lShape"><b>Virtu
0110: 61 6c 53 68 61 70 65 20 2d 20 45 6d 75 6c 61 74  alShape - Emulat
0120: 69 6f 6e 20 6f 66 20 53 68 61 70 65 2d 46 69 6c  ion of Shape-Fil
0130: 65 73 3c 2f 62 3e 3c 2f 61 3e 3c 2f 6c 69 3e 0d  es</b></a></li>.
0140: 0a 3c 6c 69 3e 3c 61 20 68 72 65 66 3d 22 23 56  .<li><a href="#V
0150: 69 72 74 75 61 6c 44 42 46 22 3e 3c 62 3e 56 69  irtualDBF"><b>Vi
0160: 72 74 75 61 6c 44 42 46 20 2d 20 45 6d 75 6c 61  rtualDBF - Emula
0170: 74 69 6f 6e 20 6f 66 20 44 42 46 20 54 61 62 6c  tion of DBF Tabl
0180: 65 73 3c 2f 61 3e 3c 2f 6c 69 3e 0d 0a 3c 6c 69  es</a></li>..<li
0190: 3e 3c 61 20 68 72 65 66 3d 22 23 56 69 72 74 75  ><a href="#Virtu
01a0: 61 6c 54 65 78 74 22 3e 3c 62 3e 56 69 72 74 75  alText"><b>Virtu
01b0: 61 6c 54 65 78 74 20 2d 20 45 6d 75 6c 61 74 69  alText - Emulati
01c0: 6f 6e 20 6f 66 20 54 58 54 2f 43 53 56 2d 46 69  on of TXT/CSV-Fi
01d0: 6c 65 73 3c 2f 61 3e 3c 2f 6c 69 3e 0d 0a 3c 6c  les</a></li>..<l
01e0: 69 3e 3c 61 20 68 72 65 66 3d 22 23 56 69 72 74  i><a href="#Virt
01f0: 75 61 6c 58 4c 22 3e 3c 62 3e 56 69 72 74 75 61  ualXL"><b>Virtua
0200: 6c 58 4c 20 2d 20 45 6d 75 6c 61 74 69 6f 6e 20  lXL - Emulation 
0210: 6f 66 20 4d 53 20 45 78 63 65 6c 20 73 70 72 65  of MS Excel spre
0220: 61 64 73 68 65 65 74 73 3c 2f 61 3e 3c 2f 6c 69  adsheets</a></li
0230: 3e 0d 0a 3c 6c 69 3e 3c 61 20 68 72 65 66 3d 22  >..<li><a href="
0240: 23 56 69 72 74 75 61 6c 46 44 4f 22 3e 3c 62 3e  #VirtualFDO"><b>
0250: 56 69 72 74 75 61 6c 46 44 4f 20 2d 20 45 6d 75  VirtualFDO - Emu
0260: 6c 61 74 69 6f 6e 20 6f 66 20 46 44 4f 20 62 69  lation of FDO bi
0270: 6e 61 72 79 20 47 65 6f 6d 65 74 72 69 65 73 20  nary Geometries 
0280: 28 47 44 41 4c 29 3c 2f 61 3e 3c 2f 6c 69 3e 0d  (GDAL)</a></li>.
0290: 0a 3c 6c 69 3e 3c 61 20 68 72 65 66 3d 22 23 56  .<li><a href="#V
02a0: 69 72 74 75 61 6c 47 50 4b 47 22 3e 3c 62 3e 56  irtualGPKG"><b>V
02b0: 69 72 74 75 61 6c 47 50 4b 47 20 2d 20 45 6d 75  irtualGPKG - Emu
02c0: 6c 61 74 69 6f 6e 20 6f 66 20 47 65 6f 50 61 63  lation of GeoPac
02d0: 6b 61 67 65 2d 44 61 74 61 62 61 73 65 73 3c 2f  kage-Databases</
02e0: 61 3e 3c 2f 6c 69 3e 0d 0a 3c 2f 75 6c 3e 0d 0a  a></li>..</ul>..
02f0: 3c 62 72 3e 3c 68 72 3e 0d 0a 3c 68 31 3e 3c 61  <br><hr>..<h1><a
0300: 20 69 64 3d 22 56 69 72 74 75 61 6c 53 68 61 70   id="VirtualShap
0310: 65 22 3e 56 69 72 74 75 61 6c 53 68 61 70 65 3c  e">VirtualShape<
0320: 2f 61 3e 3c 2f 68 31 3e 0d 0a 54 68 65 20 3c 62  /a></h1>..The <b
0330: 3e 56 69 72 74 75 61 6c 53 68 61 70 65 3c 2f 62  >VirtualShape</b
0340: 3e 20 49 6e 74 65 72 66 61 63 65 20 61 6c 6c 6f  > Interface allo
0350: 77 73 20 74 6f 20 64 69 72 65 63 74 6c 79 20 61  ws to directly a
0360: 63 63 65 73 73 20 61 6e 20 65 78 74 65 72 6e 61  ccess an externa
0370: 6c 20 53 68 61 70 65 46 69 6c 65 20 62 79 20 75  l ShapeFile by u
0380: 73 69 6e 67 20 73 74 61 6e 64 61 72 64 20 53 70  sing standard Sp
0390: 61 74 69 61 6c 20 53 51 4c 20 71 75 65 72 69 65  atial SQL querie
03a0: 73 2e 3c 62 72 3e 0d 0a 53 79 6e 74 61 78 20 66  s.<br>..Syntax f
03b0: 6f 72 20 63 72 65 61 74 69 6e 67 20 61 20 56 69  or creating a Vi
03c0: 72 74 75 61 6c 53 68 61 70 65 20 54 61 62 6c 65  rtualShape Table
03d0: 3a 0d 0a 3c 76 65 72 62 61 74 69 6d 3e 0d 0a 53  :..<verbatim>..S
03e0: 45 4c 45 43 54 20 43 52 45 41 54 45 20 56 49 52  ELECT CREATE VIR
03f0: 54 55 41 4c 20 54 41 42 4c 45 20 6d 79 5f 74 61  TUAL TABLE my_ta
0400: 62 6c 65 20 55 53 49 4e 47 20 56 69 72 74 75 61  ble USING Virtua
0410: 6c 53 68 61 70 65 20 28 20 73 68 70 5f 70 61 74  lShape ( shp_pat
0420: 68 20 2c 20 63 68 61 72 73 65 74 5f 65 6e 63 6f  h , charset_enco
0430: 64 69 6e 67 20 2c 20 73 72 69 64 20 29 3b 0d 0a  ding , srid );..
0440: 0d 0a 53 45 4c 45 43 54 20 43 52 45 41 54 45 20  ..SELECT CREATE 
0450: 56 49 52 54 55 41 4c 20 54 41 42 4c 45 20 6d 79  VIRTUAL TABLE my
0460: 5f 74 61 62 6c 65 20 55 53 49 4e 47 20 56 69 72  _table USING Vir
0470: 74 75 61 6c 53 68 61 70 65 20 28 20 73 68 70 5f  tualShape ( shp_
0480: 70 61 74 68 20 2c 20 63 68 61 72 73 65 74 5f 65  path , charset_e
0490: 6e 63 6f 64 69 6e 67 20 2c 20 73 72 69 64 20 2c  ncoding , srid ,
04a0: 20 74 65 78 74 5f 64 61 74 65 73 20 29 3b 0d 0a   text_dates );..
04b0: 0d 0a 53 45 4c 45 43 54 20 43 52 45 41 54 45 20  ..SELECT CREATE 
04c0: 56 49 52 54 55 41 4c 20 54 41 42 4c 45 20 6d 79  VIRTUAL TABLE my
04d0: 5f 74 61 62 6c 65 20 55 53 49 4e 47 20 56 69 72  _table USING Vir
04e0: 74 75 61 6c 53 68 61 70 65 20 28 20 73 68 70 5f  tualShape ( shp_
04f0: 70 61 74 68 20 2c 20 63 68 61 72 73 65 74 5f 65  path , charset_e
0500: 6e 63 6f 64 69 6e 67 20 2c 20 73 72 69 64 20 2c  ncoding , srid ,
0510: 20 74 65 78 74 5f 64 61 74 65 73 20 2c 20 63 6f   text_dates , co
0520: 6c 6e 61 6d 65 5f 63 61 73 65 20 29 3b 0d 0a 3c  lname_case );..<
0530: 2f 76 65 72 62 61 74 69 6d 3e 0d 0a 53 75 70 70  /verbatim>..Supp
0540: 6f 72 74 65 64 20 61 72 67 75 6d 65 6e 74 73 20  orted arguments 
0550: 61 6e 64 20 74 68 65 69 72 20 69 6e 74 65 72 70  and their interp
0560: 72 65 74 61 74 69 6f 6e 3a 0d 0a 3c 75 6c 3e 0d  retation:..<ul>.
0570: 0a 3c 6c 69 3e 3c 62 3e 73 68 70 5f 70 61 74 68  .<li><b>shp_path
0580: 3c 2f 62 3e 20 28 3c 69 3e 3c 62 3e 6d 61 6e 64  </b> (<i><b>mand
0590: 61 74 6f 72 79 3c 2f 62 3e 3c 2f 69 3e 29 3a 20  atory</b></i>): 
05a0: 74 68 65 20 72 65 6c 61 74 69 76 65 20 6f 72 20  the relative or 
05b0: 61 62 73 6f 6c 75 74 65 20 70 61 74 68 6e 61 6d  absolute pathnam
05c0: 65 20 6c 65 61 64 69 6e 67 20 74 6f 20 74 68 65  e leading to the
05d0: 20 65 78 74 65 72 6e 61 6c 20 53 68 61 70 65 66   external Shapef
05e0: 69 6c 65 2e 0d 0a 3c 75 6c 3e 0d 0a 3c 6c 69 3e  ile...<ul>..<li>
05f0: 3c 62 3e 4e 6f 74 65 3c 2f 62 3e 3a 20 61 6e 79  <b>Note</b>: any
0600: 20 53 68 61 70 65 66 69 6c 65 20 72 65 71 75 69   Shapefile requi
0610: 72 65 73 20 61 74 20 6c 65 61 73 74 20 74 68 72  res at least thr
0620: 65 65 20 69 6e 64 69 76 69 64 75 61 6c 20 6d 65  ee individual me
0630: 6d 62 65 72 73 20 73 68 61 72 69 6e 67 20 74 68  mbers sharing th
0640: 65 20 73 61 6d 65 20 62 61 73 65 20 6e 61 6d 65  e same base name
0650: 20 62 75 74 20 77 69 74 68 20 64 69 66 66 65 72   but with differ
0660: 65 6e 74 20 73 75 66 66 69 78 65 73 20 28 3c 69  ent suffixes (<i
0670: 3e 2a 2e 73 68 70 3c 2f 69 3e 2c 20 3c 69 3e 2a  >*.shp</i>, <i>*
0680: 2e 73 68 78 3c 2f 69 3e 20 61 6e 64 20 3c 69 3e  .shx</i> and <i>
0690: 2a 2e 64 62 66 3c 2f 69 3e 29 2e 3c 62 72 3e 0d  *.dbf</i>).<br>.
06a0: 0a 41 6c 6c 20 73 75 66 66 69 78 65 73 20 77 69  .All suffixes wi
06b0: 6c 6c 20 62 65 20 61 75 74 6f 6d 61 74 69 63 61  ll be automatica
06c0: 6c 6c 79 20 68 61 6e 64 6c 65 64 20 62 79 20 56  lly handled by V
06d0: 69 72 74 75 61 6c 53 68 61 70 65 2c 20 61 6e 64  irtualShape, and
06e0: 20 63 6f 6e 73 65 71 75 65 6e 74 6c 79 20 74 68   consequently th
06f0: 65 20 3c 62 3e 73 68 70 5f 70 61 74 68 3c 2f 62  e <b>shp_path</b
0700: 3e 20 61 72 67 75 6d 65 6e 74 20 3c 62 3e 3c 75  > argument <b><u
0710: 3e 3c 69 3e 6d 75 73 74 20 6e 6f 74 20 73 70 65  ><i>must not spe
0720: 63 69 66 79 20 61 6e 79 20 73 75 66 66 69 78 3c  cify any suffix<
0730: 2f 69 3e 3c 2f 75 3e 3c 2f 62 3e 2c 20 6a 75 73  /i></u></b>, jus
0740: 74 20 74 68 65 20 62 61 72 65 20 62 61 73 65 20  t the bare base 
0750: 70 61 74 68 20 6d 75 73 74 20 62 65 20 70 61 73  path must be pas
0760: 73 65 64 2e 3c 2f 6c 69 3e 0d 0a 3c 2f 75 6c 3e  sed.</li>..</ul>
0770: 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e 3c 62 3e 63 68  </li>..<li><b>ch
0780: 61 72 73 65 74 5f 65 6e 63 6f 64 69 6e 67 3c 2f  arset_encoding</
0790: 62 3e 20 28 3c 69 3e 3c 62 3e 6d 61 6e 64 61 74  b> (<i><b>mandat
07a0: 6f 72 79 3c 2f 62 3e 3c 2f 69 3e 29 3a 20 63 61  ory</b></i>): ca
07b0: 6e 6f 6e 69 63 61 6c 20 6e 61 6d 65 20 6f 66 20  nonical name of 
07c0: 74 68 65 20 63 68 61 72 73 65 74 20 65 6e 63 6f  the charset enco
07d0: 64 69 6e 67 20 61 64 6f 70 74 65 64 20 62 79 20  ding adopted by 
07e0: 74 68 65 20 3c 62 3e 44 42 46 3c 2f 62 3e 20 6d  the <b>DBF</b> m
07f0: 65 6d 62 65 72 2e 0d 0a 3c 75 6c 3e 0d 0a 3c 6c  ember...<ul>..<l
0800: 69 3e 45 78 61 6d 70 6c 65 73 20 6f 66 20 76 61  i>Examples of va
0810: 6c 69 64 20 6e 61 6d 65 73 20 61 72 65 3a 20 3c  lid names are: <
0820: 62 3e 41 53 43 49 49 3c 2f 62 3e 2c 20 3c 62 3e  b>ASCII</b>, <b>
0830: 55 54 46 2d 38 3c 2f 62 3e 2c 20 3c 62 3e 43 50  UTF-8</b>, <b>CP
0840: 38 35 30 3c 2f 62 3e 2c 20 3c 62 3e 43 50 31 32  850</b>, <b>CP12
0850: 35 32 3c 2f 62 3e 2c 20 3c 62 3e 49 53 4f 2d 38  52</b>, <b>ISO-8
0860: 38 34 39 2d 31 3c 2f 62 3e 3c 2f 6c 69 3e 0d 0a  849-1</b></li>..
0870: 3c 6c 69 3e 59 6f 75 20 63 61 6e 20 63 68 65 63  <li>You can chec
0880: 6b 20 74 68 65 20 66 75 6c 6c 20 6c 69 73 74 20  k the full list 
0890: 6f 66 20 73 75 70 70 6f 72 74 65 64 20 63 68 61  of supported cha
08a0: 72 73 65 74 20 65 6e 63 6f 64 69 6e 67 73 20 3c  rset encodings <
08b0: 61 20 68 72 65 66 3d 22 68 74 74 70 73 3a 2f 2f  a href="https://
08c0: 77 77 77 2e 67 6e 75 2e 6f 72 67 2f 73 6f 66 74  www.gnu.org/soft
08d0: 77 61 72 65 2f 6c 69 62 69 63 6f 6e 76 2f 22 3e  ware/libiconv/">
08e0: 68 65 72 65 3c 2f 61 3e 2e 3c 2f 6c 69 3e 0d 0a  here</a>.</li>..
08f0: 3c 2f 75 6c 3e 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e  </ul></li>..<li>
0900: 3c 62 3e 73 72 69 64 3c 2f 62 3e 20 28 3c 69 3e  <b>srid</b> (<i>
0910: 3c 62 3e 6d 61 6e 64 61 74 6f 72 79 3c 2f 62 3e  <b>mandatory</b>
0920: 3c 2f 69 3e 29 3a 20 74 68 65 20 53 52 49 44 20  </i>): the SRID 
0930: 76 61 6c 75 65 20 6f 66 20 61 6c 6c 20 47 65 6f  value of all Geo
0940: 6d 65 74 72 69 65 73 20 77 69 74 68 69 6e 20 74  metries within t
0950: 68 65 20 53 68 61 70 65 66 69 6c 65 2e 0d 0a 3c  he Shapefile...<
0960: 75 6c 3e 0d 0a 3c 6c 69 3e 45 78 61 6d 70 6c 65  ul>..<li>Example
0970: 73 20 6f 66 20 76 61 6c 69 64 20 53 52 49 44 20  s of valid SRID 
0980: 76 61 6c 75 65 73 20 61 72 65 3a 20 3c 62 3e 34  values are: <b>4
0990: 33 32 36 3c 2f 62 3e 2c 20 3c 62 3e 33 30 30 33  326</b>, <b>3003
09a0: 3c 2f 62 3e 2c 20 3c 62 3e 33 32 36 33 32 3c 2f  </b>, <b>32632</
09b0: 62 3e 3c 2f 6c 69 3e 0d 0a 3c 2f 75 6c 3e 3c 2f  b></li>..</ul></
09c0: 6c 69 3e 0d 0a 3c 6c 69 3e 3c 62 3e 74 65 78 74  li>..<li><b>text
09d0: 5f 64 61 74 65 73 3c 2f 62 3e 20 28 3c 69 3e 3c  _dates</b> (<i><
09e0: 62 3e 6f 70 74 69 6f 6e 61 6c 3c 2f 62 3e 3c 2f  b>optional</b></
09f0: 69 3e 29 3a 20 74 68 69 73 20 69 73 20 61 20 3c  i>): this is a <
0a00: 62 3e 42 4f 4f 4c 45 41 4e 3c 2f 62 3e 20 66 6c  b>BOOLEAN</b> fl
0a10: 61 67 3a 0d 0a 3c 75 6c 3e 0d 0a 3c 6c 69 3e 69  ag:..<ul>..<li>i
0a20: 66 20 73 65 74 20 74 6f 20 3c 62 3e 30 3c 2f 62  f set to <b>0</b
0a30: 3e 20 28 3c 62 3e 46 41 4c 53 45 3c 2f 62 3e 29  > (<b>FALSE</b>)
0a40: 20 61 6c 6c 20 66 69 65 6c 64 73 20 6f 66 20 74   all fields of t
0a50: 68 65 20 3c 62 3e 44 41 54 45 3c 2f 62 3e 20 74  he <b>DATE</b> t
0a60: 79 70 65 20 77 69 6c 6c 20 62 65 20 72 65 70 72  ype will be repr
0a70: 65 73 65 6e 74 65 64 20 61 73 20 3c 61 20 68 72  esented as <a hr
0a80: 65 66 3d 22 68 74 74 70 73 3a 2f 2f 77 77 77 2e  ef="https://www.
0a90: 73 71 6c 69 74 65 2e 6f 72 67 2f 6c 61 6e 67 5f  sqlite.org/lang_
0aa0: 64 61 74 65 66 75 6e 63 2e 68 74 6d 6c 22 3e 6a  datefunc.html">j
0ab0: 75 6c 69 61 6e 20 64 61 74 65 73 3c 2f 61 3e 3c  ulian dates</a><
0ac0: 2f 6c 69 3e 0d 0a 3c 6c 69 3e 69 66 20 73 65 74  /li>..<li>if set
0ad0: 20 74 6f 20 61 6e 79 20 6f 74 68 65 72 20 69 6e   to any other in
0ae0: 74 65 67 65 72 20 76 61 6c 75 65 20 28 3c 62 3e  teger value (<b>
0af0: 54 52 55 45 3c 2f 62 3e 29 20 61 6c 6c 20 66 69  TRUE</b>) all fi
0b00: 65 6c 64 73 20 6f 66 20 74 68 65 20 3c 62 3e 44  elds of the <b>D
0b10: 41 54 45 3c 2f 62 3e 20 74 79 70 65 20 77 69 6c  ATE</b> type wil
0b20: 6c 20 62 65 20 72 65 70 72 65 73 65 6e 74 65 64  l be represented
0b30: 20 61 73 20 54 65 78 74 20 53 74 72 69 6e 67 73   as Text Strings
0b40: 20 61 73 20 65 2e 67 2e 20 3c 62 3e 32 30 31 38   as e.g. <b>2018
0b50: 2d 30 38 2d 32 31 3c 2f 62 3e 3c 2f 6c 69 3e 0d  -08-21</b></li>.
0b60: 0a 3c 6c 69 3e 69 66 20 6e 6f 74 20 65 78 70 6c  .<li>if not expl
0b70: 69 63 69 74 6c 79 20 73 70 65 63 69 66 69 65 64  icitly specified
0b80: 2c 20 3c 62 3e 54 52 55 45 3c 2f 62 3e 20 77 69  , <b>TRUE</b> wi
0b90: 6c 6c 20 61 6c 77 61 79 73 20 62 65 20 61 73 73  ll always be ass
0ba0: 75 6d 65 64 20 28 64 65 66 61 75 6c 74 20 73 65  umed (default se
0bb0: 74 74 69 6e 67 29 2e 3c 2f 6c 69 3e 0d 0a 3c 2f  tting).</li>..</
0bc0: 75 6c 3e 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e 3c 62  ul></li>..<li><b
0bd0: 3e 63 6f 6c 6e 61 6d 65 5f 63 61 73 65 3c 2f 62  >colname_case</b
0be0: 3e 20 28 3c 69 3e 3c 62 3e 6f 70 74 69 6f 6e 61  > (<i><b>optiona
0bf0: 6c 3c 2f 62 3e 3c 2f 69 3e 29 3a 20 74 68 69 73  l</b></i>): this
0c00: 20 61 72 67 75 6d 65 6e 74 20 73 70 65 63 69 66   argument specif
0c10: 69 65 73 20 69 66 20 61 6c 6c 20 63 6f 6c 75 6d  ies if all colum
0c20: 6e 20 6e 61 6d 65 73 20 73 68 6f 75 6c 64 20 62  n names should b
0c30: 65 20 63 6f 6e 73 69 64 65 72 65 64 20 75 70 70  e considered upp
0c40: 65 72 63 61 73 65 20 6f 72 20 6c 6f 77 65 72 63  ercase or lowerc
0c50: 61 73 65 2e 3c 62 72 3e 0d 0a 56 61 6c 69 64 20  ase.<br>..Valid 
0c60: 73 65 74 74 69 6e 67 73 20 61 72 65 3a 0d 0a 3c  settings are:..<
0c70: 75 6c 3e 0d 0a 3c 6c 69 3e 3c 62 3e 75 70 70 65  ul>..<li><b>uppe
0c80: 72 63 61 73 65 3c 2f 62 3e 20 6f 72 20 3c 62 3e  rcase</b> or <b>
0c90: 75 70 70 65 72 3c 2f 62 3e 3a 20 61 6c 6c 20 63  upper</b>: all c
0ca0: 6f 6c 75 6d 6e 20 6e 61 6d 65 73 20 77 69 6c 6c  olumn names will
0cb0: 20 62 65 20 66 75 6c 6c 79 20 63 61 70 69 74 61   be fully capita
0cc0: 6c 69 7a 65 64 2e 3c 2f 6c 69 3e 0d 0a 3c 6c 69  lized.</li>..<li
0cd0: 3e 3c 62 3e 6c 6f 77 65 72 63 61 73 65 3c 2f 62  ><b>lowercase</b
0ce0: 3e 20 6f 72 20 3c 62 3e 6c 6f 77 65 72 3c 2f 62  > or <b>lower</b
0cf0: 3e 3a 20 61 6c 6c 20 63 6f 6c 75 6d 6e 20 6e 61  >: all column na
0d00: 6d 65 73 20 77 69 6c 6c 20 62 65 20 66 75 6c 6c  mes will be full
0d10: 20 6c 6f 77 65 72 63 61 73 65 2e 3c 2f 6c 69 3e   lowercase.</li>
0d20: 0d 0a 3c 6c 69 3e 3c 62 3e 73 61 6d 65 63 61 73  ..<li><b>samecas
0d30: 65 3c 2f 62 3e 20 6f 72 20 3c 62 3e 73 61 6d 65  e</b> or <b>same
0d40: 3c 2f 62 3e 3a 20 61 6c 6c 20 63 6f 6c 75 6d 6e  </b>: all column
0d50: 20 6e 61 6d 65 73 20 77 69 6c 6c 20 62 65 20 65   names will be e
0d60: 78 61 63 74 6c 79 20 70 72 65 73 65 72 76 65 64  xactly preserved
0d70: 20 61 73 20 74 68 65 79 20 61 72 65 20 64 65 66   as they are def
0d80: 69 6e 65 64 20 69 6e 74 6f 20 74 68 65 20 44 42  ined into the DB
0d90: 46 20 6d 65 6d 62 65 72 2e 3c 2f 6c 69 3e 0d 0a  F member.</li>..
0da0: 3c 6c 69 3e 69 66 20 6e 6f 74 20 73 70 65 63 69  <li>if not speci
0db0: 66 69 65 64 2c 20 6f 72 20 69 66 20 61 6e 79 20  fied, or if any 
0dc0: 6f 74 68 65 72 20 64 65 66 69 6e 69 74 69 6f 6e  other definition
0dd0: 20 64 65 66 69 6e 69 74 69 6f 6e 20 69 73 20 66   definition is f
0de0: 6f 75 6e 64 2c 20 3c 62 3e 6c 6f 77 65 72 63 61  ound, <b>lowerca
0df0: 73 65 3c 2f 62 3e 20 77 69 6c 6c 20 61 6c 77 61  se</b> will alwa
0e00: 79 73 20 62 65 20 61 73 73 75 6d 65 64 20 28 64  ys be assumed (d
0e10: 65 66 61 75 6c 74 20 73 65 74 74 69 6e 67 29 2e  efault setting).
0e20: 3c 2f 6c 69 3e 0d 0a 3c 2f 75 6c 3e 3c 2f 6c 69  </li>..</ul></li
0e30: 3e 0d 0a 3c 2f 75 6c 3e 3c 62 72 3e 0d 0a 3c 74  >..</ul><br>..<t
0e40: 61 62 6c 65 20 62 67 63 6f 6c 6f 72 3d 22 23 66  able bgcolor="#f
0e50: 66 66 66 64 30 22 20 63 65 6c 6c 70 61 64 64 69  fffd0" cellpaddi
0e60: 6e 67 3d 22 31 38 22 3e 3c 74 72 3e 3c 74 64 3e  ng="18"><tr><td>
0e70: 0d 0a 3c 62 3e 4e 6f 74 65 3c 2f 62 3e 3a 20 61  ..<b>Note</b>: a
0e80: 6e 79 20 54 65 78 74 20 53 74 72 69 6e 67 2c 20  ny Text String, 
0e90: 71 75 6f 74 65 64 20 6f 72 20 6e 6f 74 2c 20 77  quoted or not, w
0ea0: 68 65 6e 20 69 74 20 61 70 70 65 61 72 73 20 61  hen it appears a
0eb0: 73 20 61 20 56 69 72 74 75 61 6c 20 54 61 62 6c  s a Virtual Tabl
0ec0: 65 20 61 72 67 75 6d 65 6e 74 20 68 61 73 20 74  e argument has t
0ed0: 68 65 20 73 61 6d 65 20 65 66 66 65 63 74 2e 0d  he same effect..
0ee0: 0a 3c 76 65 72 62 61 74 69 6d 3e 0d 0a 53 45 4c  .<verbatim>..SEL
0ef0: 45 43 54 20 43 52 45 41 54 45 20 56 49 52 54 55  ECT CREATE VIRTU
0f00: 41 4c 20 54 41 42 4c 45 20 6d 79 5f 74 61 62 6c  AL TABLE my_tabl
0f10: 65 20 55 53 49 4e 47 20 56 69 72 74 75 61 6c 53  e USING VirtualS
0f20: 68 61 70 65 28 20 2f 68 6f 6d 65 2f 73 61 6e 64  hape( /home/sand
0f30: 72 6f 2f 6d 79 73 68 70 20 2c 20 43 50 31 32 35  ro/myshp , CP125
0f40: 32 20 2c 20 33 30 30 33 20 2c 20 31 20 2c 20 6c  2 , 3003 , 1 , l
0f50: 6f 77 65 72 20 29 3b 0d 0a 6f 72 0d 0a 53 45 4c  ower );..or..SEL
0f60: 45 43 54 20 43 52 45 41 54 45 20 56 49 52 54 55  ECT CREATE VIRTU
0f70: 41 4c 20 54 41 42 4c 45 20 6d 79 5f 74 61 62 6c  AL TABLE my_tabl
0f80: 65 20 55 53 49 4e 47 20 56 69 72 74 75 61 6c 53  e USING VirtualS
0f90: 68 61 70 65 28 20 27 2f 68 6f 6d 65 2f 73 61 6e  hape( '/home/san
0fa0: 64 72 6f 2f 6d 79 73 68 70 27 20 2c 20 27 43 50  dro/myshp' , 'CP
0fb0: 31 32 35 32 27 20 2c 20 33 30 30 33 20 2c 20 31  1252' , 3003 , 1
0fc0: 20 2c 20 27 6c 6f 77 65 72 27 20 29 3b 0d 0a 3c   , 'lower' );..<
0fd0: 2f 76 65 72 62 61 74 69 6d 3e 0d 0a 42 6f 74 68  /verbatim>..Both
0fe0: 20 6e 6f 74 61 74 69 6f 6e 73 20 77 69 6c 6c 20   notations will 
0ff0: 70 72 6f 64 75 63 65 20 74 68 65 20 73 61 6d 65  produce the same
1000: 20 72 65 73 75 6c 74 2e 0d 0a 3c 2f 74 64 3e 3c   result...</td><
1010: 2f 74 72 3e 3c 2f 74 61 62 6c 65 3e 0d 0a 3c 62  /tr></table>..<b
1020: 72 3e 0d 0a 3c 74 61 62 6c 65 20 62 67 63 6f 6c  r>..<table bgcol
1030: 6f 72 3d 22 23 64 30 66 66 64 30 22 20 63 65 6c  or="#d0ffd0" cel
1040: 6c 70 61 64 64 69 6e 67 3d 22 31 38 22 3e 3c 74  lpadding="18"><t
1050: 72 3e 3c 74 64 3e 0d 0a 3c 68 33 3e 42 65 73 74  r><td>..<h3>Best
1060: 20 70 72 61 63 74 69 63 65 73 20 61 6e 64 20 6b   practices and k
1070: 6e 6f 77 6e 20 6c 69 6d 69 74 61 74 69 6f 6e 73  nown limitations
1080: 3c 2f 68 33 3e 0d 0a 3c 75 6c 3e 0d 0a 3c 6c 69  </h3>..<ul>..<li
1090: 3e 56 69 72 74 75 61 6c 20 54 61 62 6c 65 73 20  >Virtual Tables 
10a0: 61 72 65 20 6e 6f 74 20 72 65 61 6c 6c 79 20 67  are not really g
10b0: 65 6e 75 69 6e 65 20 44 61 74 61 62 61 73 65 20  enuine Database 
10c0: 54 61 62 6c 65 73 2c 20 74 68 65 79 20 61 72 65  Tables, they are
10d0: 20 6a 75 73 74 20 65 6d 75 6c 61 74 69 6e 67 20   just emulating 
10e0: 74 68 65 20 6f 72 69 67 69 6e 61 6c 20 73 6f 75  the original sou
10f0: 72 63 65 20 61 73 20 61 20 44 61 74 61 62 61 73  rce as a Databas
1100: 65 20 54 61 62 6c 65 2e 3c 2f 6c 69 3e 0d 0a 3c  e Table.</li>..<
1110: 6c 69 3e 56 69 72 74 75 61 6c 20 54 61 62 6c 65  li>Virtual Table
1120: 73 20 68 61 76 65 20 76 65 72 79 20 70 6f 6f 72  s have very poor
1130: 20 73 70 65 65 64 20 70 65 72 66 6f 72 6d 61 6e   speed performan
1140: 63 65 73 2c 20 64 75 65 20 74 6f 20 74 68 65 20  ces, due to the 
1150: 20 65 6d 75 6c 61 74 69 6f 6e 2c 20 61 73 20 63   emulation, as c
1160: 6f 6d 70 61 72 65 64 20 74 6f 20 67 65 6e 75 69  ompared to genui
1170: 6e 65 20 44 61 74 61 62 61 73 65 20 54 61 62 6c  ne Database Tabl
1180: 65 73 2e 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e 43 6f  es.</li>..<li>Co
1190: 6d 70 6c 65 78 20 53 51 4c 20 71 75 65 72 69 65  mplex SQL querie
11a0: 73 20 3c 62 3e 4a 4f 49 4e 3c 2f 62 3e 69 6e 67  s <b>JOIN</b>ing
11b0: 20 73 65 76 65 72 61 6c 20 54 61 62 6c 65 73 20   several Tables 
11c0: 63 61 6e 20 6f 66 74 65 6e 20 72 65 74 75 72 6e  can often return
11d0: 20 6f 64 64 20 61 6e 64 20 6d 69 73 6c 65 61 64   odd and mislead
11e0: 69 6e 67 20 72 65 73 75 6c 74 73 65 74 73 2c 20  ing resultsets, 
11f0: 77 68 65 6e 20 6f 6e 65 20 6f 72 20 6d 6f 72 65  when one or more
1200: 20 6f 66 20 74 68 65 20 3c 62 3e 4a 4f 49 4e 3c   of the <b>JOIN<
1210: 2f 62 3e 65 64 20 54 61 62 6c 65 73 20 61 72 65  /b>ed Tables are
1220: 20 6f 66 20 74 68 65 20 56 69 72 74 75 61 6c 20   of the Virtual 
1230: 74 79 70 65 2e 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e  type.</li>..<li>
1240: 54 68 65 20 62 65 73 74 20 75 73 65 20 6f 66 20  The best use of 
1250: 61 20 56 69 72 74 75 61 6c 20 54 61 62 6c 65 20  a Virtual Table 
1260: 69 73 20 74 6f 20 70 72 65 66 6f 72 6d 20 61 20  is to preform a 
1270: 62 61 73 69 63 20 64 61 74 61 20 69 6d 70 6f 72  basic data impor
1280: 74 20 70 72 6f 63 65 73 73 2c 20 6f 72 20 74 6f  t process, or to
1290: 20 71 75 69 63 6b 6c 79 20 67 65 74 20 61 6e 20   quickly get an 
12a0: 6f 76 65 72 61 6c 6c 20 67 6c 61 6e 63 65 20 61  overall glance a
12b0: 74 20 61 20 66 75 6c 6c 20 64 61 74 61 73 65 74  t a full dataset
12c0: 20 77 69 74 68 6f 75 74 20 6e 65 63 65 73 73 61   without necessa
12d0: 72 69 6c 79 20 69 6d 70 6f 72 74 69 6e 67 20 69  rily importing i
12e0: 74 20 69 6e 74 6f 20 74 68 65 20 44 61 74 61 62  t into the Datab
12f0: 61 73 65 2e 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e 50  ase.</li>..<li>P
1300: 72 65 74 65 6e 64 69 6e 67 20 74 6f 20 75 73 65  retending to use
1310: 20 61 20 56 69 72 74 75 61 6c 20 54 61 62 6c 65   a Virtual Table
1320: 20 61 73 20 61 20 66 75 6c 6c 20 72 65 70 6c 61   as a full repla
1330: 63 65 6d 65 6e 74 20 6f 66 20 69 6d 70 6f 72 74  cement of import
1340: 69 6e 67 20 61 6c 6c 20 64 61 74 61 20 77 69 74  ing all data wit
1350: 68 69 6e 20 61 20 67 65 6e 75 69 6e 65 20 44 61  hin a genuine Da
1360: 74 61 62 61 73 65 20 54 61 62 6c 65 20 69 73 20  tabase Table is 
1370: 73 74 72 6f 6e 67 6c 79 20 64 69 73 63 6f 75 72  strongly discour
1380: 61 67 65 64 2c 20 61 6e 64 20 6e 65 76 65 72 20  aged, and never 
1390: 69 73 20 61 20 67 6f 6f 64 20 69 64 65 61 2e 3c  is a good idea.<
13a0: 2f 6c 69 3e 0d 0a 3c 2f 75 6c 3e 3c 62 72 3e 0d  /li>..</ul><br>.
13b0: 0a 3c 62 3e 57 61 72 6e 69 6e 67 3c 2f 62 3e 3a  .<b>Warning</b>:
13c0: 20 56 69 72 74 75 61 6c 53 68 61 70 65 20 54 61   VirtualShape Ta
13d0: 62 6c 65 73 20 61 72 65 20 61 6c 77 61 79 73 20  bles are always 
13e0: 73 75 62 6a 65 63 74 20 74 6f 20 3c 62 3e 52 45  subject to <b>RE
13f0: 41 44 2d 4f 4e 4c 59 3c 2f 62 3e 20 72 65 73 74  AD-ONLY</b> rest
1400: 72 69 63 74 69 6f 6e 73 2e 20 41 6e 79 20 61 74  rictions. Any at
1410: 74 65 6d 70 74 20 74 6f 20 74 6f 20 65 78 65 63  tempt to to exec
1420: 75 74 65 20 61 6e 20 3c 62 3e 49 4e 53 45 52 54  ute an <b>INSERT
1430: 3c 2f 62 3e 2c 20 3c 62 3e 55 50 44 41 54 45 3c  </b>, <b>UPDATE<
1440: 2f 62 3e 20 6f 72 20 3c 62 3e 44 45 4c 45 54 45  /b> or <b>DELETE
1450: 3c 2f 62 3e 20 73 74 61 74 65 6d 65 6e 74 20 77  </b> statement w
1460: 69 6c 6c 20 61 6c 77 61 79 73 20 72 65 74 75 72  ill always retur
1470: 6e 20 61 6e 20 65 72 72 6f 72 2e 3c 62 72 3e 0d  n an error.<br>.
1480: 0a 3c 2f 74 64 3e 3c 2f 74 72 3e 3c 2f 74 61 62  .</td></tr></tab
1490: 6c 65 3e 0d 0a 3c 62 72 3e 0d 0a 3c 74 61 62 6c  le>..<br>..<tabl
14a0: 65 20 62 67 63 6f 6c 6f 72 3d 22 23 65 30 65 30  e bgcolor="#e0e0
14b0: 65 30 22 20 63 65 6c 6c 70 61 64 64 69 6e 67 3d  e0" cellpadding=
14c0: 22 31 38 22 3e 3c 74 72 3e 3c 74 64 3e 0d 0a 3c  "18"><tr><td>..<
14d0: 68 33 3e 52 65 6c 61 74 65 64 20 54 6f 70 69 63  h3>Related Topic
14e0: 73 3c 2f 68 33 3e 0d 0a 3c 75 6c 3e 0d 0a 3c 6c  s</h3>..<ul>..<l
14f0: 69 3e 54 68 65 20 3c 62 3e 49 6d 70 6f 72 74 53  i>The <b>ImportS
1500: 48 50 28 29 3c 2f 62 3e 20 53 51 4c 20 66 75 6e  HP()</b> SQL fun
1510: 63 74 69 6f 6e 20 61 6c 6c 6f 77 73 20 74 6f 20  ction allows to 
1520: 63 72 65 61 74 65 20 61 6e 64 20 70 6f 70 75 6c  create and popul
1530: 61 74 65 20 61 20 67 65 6e 75 69 6e 65 20 53 70  ate a genuine Sp
1540: 61 74 69 61 6c 20 54 61 62 6c 65 20 62 79 20 69  atial Table by i
1550: 6d 70 6f 72 74 69 6e 67 20 61 6e 20 65 78 74 65  mporting an exte
1560: 72 6e 61 6c 20 53 68 61 70 65 66 69 6c 65 2e 3c  rnal Shapefile.<
1570: 2f 6c 69 3e 0d 0a 3c 6c 69 3e 41 6e 64 20 74 68  /li>..<li>And th
1580: 65 20 3c 62 3e 45 78 70 6f 72 74 53 48 50 28 29  e <b>ExportSHP()
1590: 3c 2f 62 3e 20 73 69 73 74 65 72 20 66 75 6e 63  </b> sister func
15a0: 74 69 6f 6e 20 61 6c 6c 6f 77 73 20 74 68 65 20  tion allows the 
15b0: 65 78 70 6f 72 74 61 74 69 6f 6e 20 61 20 77 68  exportation a wh
15c0: 6f 6c 65 20 53 70 61 74 69 61 6c 20 54 61 62 6c  ole Spatial Tabl
15d0: 65 20 69 6e 74 6f 20 61 6e 20 65 78 74 65 72 6e  e into an extern
15e0: 61 6c 20 53 68 61 70 65 66 69 6c 65 2e 3c 2f 6c  al Shapefile.</l
15f0: 69 3e 0d 0a 3c 2f 75 6c 3e 0d 0a 3c 2f 74 64 3e  i>..</ul>..</td>
1600: 3c 2f 74 72 3e 3c 2f 74 61 62 6c 65 3e 0d 0a 3c  </tr></table>..<
1610: 62 72 3e 0d 0a 3c 68 72 3e 0d 0a 3c 68 31 3e 3c  br>..<hr>..<h1><
1620: 61 20 69 64 3d 22 56 69 72 74 75 61 6c 44 42 46  a id="VirtualDBF
1630: 22 3e 56 69 72 74 75 61 6c 44 42 46 3c 2f 61 3e  ">VirtualDBF</a>
1640: 3c 2f 68 31 3e 0d 0a 54 68 65 20 3c 62 3e 56 69  </h1>..The <b>Vi
1650: 72 74 75 61 6c 44 42 46 3c 2f 62 3e 20 49 6e 74  rtualDBF</b> Int
1660: 65 72 66 61 63 65 20 61 6c 6c 6f 77 73 20 74 6f  erface allows to
1670: 20 64 69 72 65 63 74 6c 79 20 61 63 63 65 73 73   directly access
1680: 20 61 6e 20 65 78 74 65 72 6e 61 6c 20 44 42 46   an external DBF
1690: 20 74 61 62 6c 65 20 62 79 20 75 73 69 6e 67 20   table by using 
16a0: 73 74 61 6e 64 61 72 64 20 53 70 61 74 69 61 6c  standard Spatial
16b0: 20 53 51 4c 20 71 75 65 72 69 65 73 2e 3c 62 72   SQL queries.<br
16c0: 3e 0d 0a 53 79 6e 74 61 78 20 66 6f 72 20 63 72  >..Syntax for cr
16d0: 65 61 74 69 6e 67 20 61 20 56 69 72 74 75 61 6c  eating a Virtual
16e0: 44 62 66 20 54 61 62 6c 65 3a 0d 0a 3c 76 65 72  Dbf Table:..<ver
16f0: 62 61 74 69 6d 3e 0d 0a 53 45 4c 45 43 54 20 43  batim>..SELECT C
1700: 52 45 41 54 45 20 56 49 52 54 55 41 4c 20 54 41  REATE VIRTUAL TA
1710: 42 4c 45 20 6d 79 5f 74 61 62 6c 65 20 55 53 49  BLE my_table USI
1720: 4e 47 20 56 69 72 74 75 61 6c 44 62 66 20 28 20  NG VirtualDbf ( 
1730: 64 62 66 5f 70 61 74 68 20 2c 20 63 68 61 72 73  dbf_path , chars
1740: 65 74 5f 65 6e 63 6f 64 69 6e 67 20 29 3b 0d 0a  et_encoding );..
1750: 0d 0a 53 45 4c 45 43 54 20 43 52 45 41 54 45 20  ..SELECT CREATE 
1760: 56 49 52 54 55 41 4c 20 54 41 42 4c 45 20 6d 79  VIRTUAL TABLE my
1770: 5f 74 61 62 6c 65 20 55 53 49 4e 47 20 56 69 72  _table USING Vir
1780: 74 75 61 6c 44 62 66 20 28 20 64 62 66 5f 70 61  tualDbf ( dbf_pa
1790: 74 68 20 2c 20 63 68 61 72 73 65 74 5f 65 6e 63  th , charset_enc
17a0: 6f 64 69 6e 67 20 2c 20 74 65 78 74 5f 64 61 74  oding , text_dat
17b0: 65 73 20 29 3b 0d 0a 0d 0a 53 45 4c 45 43 54 20  es );....SELECT 
17c0: 43 52 45 41 54 45 20 56 49 52 54 55 41 4c 20 54  CREATE VIRTUAL T
17d0: 41 42 4c 45 20 6d 79 5f 74 61 62 6c 65 20 55 53  ABLE my_table US
17e0: 49 4e 47 20 56 69 72 74 75 61 6c 44 62 66 20 28  ING VirtualDbf (
17f0: 20 64 62 66 5f 70 61 74 68 20 2c 20 63 68 61 72   dbf_path , char
1800: 73 65 74 5f 65 6e 63 6f 64 69 6e 67 20 2c 20 74  set_encoding , t
1810: 65 78 74 5f 64 61 74 65 73 20 2c 20 63 6f 6c 6e  ext_dates , coln
1820: 61 6d 65 5f 63 61 73 65 20 29 3b 0d 0a 3c 2f 76  ame_case );..</v
1830: 65 72 62 61 74 69 6d 3e 0d 0a 53 75 70 70 6f 72  erbatim>..Suppor
1840: 74 65 64 20 61 72 67 75 6d 65 6e 74 73 20 61 6e  ted arguments an
1850: 64 20 74 68 65 69 72 20 69 6e 74 65 72 70 72 65  d their interpre
1860: 74 61 74 69 6f 6e 3a 0d 0a 3c 75 6c 3e 0d 0a 3c  tation:..<ul>..<
1870: 6c 69 3e 3c 62 3e 64 62 66 5f 70 61 74 68 3c 2f  li><b>dbf_path</
1880: 62 3e 20 28 3c 69 3e 3c 62 3e 6d 61 6e 64 61 74  b> (<i><b>mandat
1890: 6f 72 79 3c 2f 62 3e 3c 2f 69 3e 29 3a 20 74 68  ory</b></i>): th
18a0: 65 20 72 65 6c 61 74 69 76 65 20 6f 72 20 61 62  e relative or ab
18b0: 73 6f 6c 75 74 65 20 70 61 74 68 6e 61 6d 65 20  solute pathname 
18c0: 6c 65 61 64 69 6e 67 20 74 6f 20 74 68 65 20 65  leading to the e
18d0: 78 74 65 72 6e 61 6c 20 44 42 46 20 66 69 6c 65  xternal DBF file
18e0: 2e 0d 0a 3c 75 6c 3e 0d 0a 3c 6c 69 3e 3c 62 3e  ...<ul>..<li><b>
18f0: 4e 6f 74 65 3c 2f 62 3e 3a 20 74 68 65 20 66 75  Note</b>: the fu
1900: 6c 6c 20 70 61 74 68 6e 61 6d 65 20 6d 75 73 74  ll pathname must
1910: 20 62 65 20 70 61 73 73 65 64 2c 20 69 6e 63 6c   be passed, incl
1920: 75 64 69 6e 67 20 74 68 65 20 66 69 6e 61 6c 20  uding the final 
1930: 3c 69 3e 2a 2e 64 62 66 3c 2f 69 3e 20 73 75 66  <i>*.dbf</i> suf
1940: 66 69 78 2e 3c 2f 6c 69 3e 0d 0a 3c 2f 75 6c 3e  fix.</li>..</ul>
1950: 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e 3c 62 3e 63 68  </li>..<li><b>ch
1960: 61 72 73 65 74 5f 65 6e 63 6f 64 69 6e 67 3c 2f  arset_encoding</
1970: 62 3e 20 28 3c 69 3e 3c 62 3e 6d 61 6e 64 61 74  b> (<i><b>mandat
1980: 6f 72 79 3c 2f 62 3e 3c 2f 69 3e 29 3a 20 63 61  ory</b></i>): ca
1990: 6e 6f 6e 69 63 61 6c 20 6e 61 6d 65 20 6f 66 20  nonical name of 
19a0: 74 68 65 20 63 68 61 72 73 65 74 20 65 6e 63 6f  the charset enco
19b0: 64 69 6e 67 20 61 64 6f 70 74 65 64 20 62 79 20  ding adopted by 
19c0: 74 68 65 20 3c 62 3e 44 42 46 3c 2f 62 3e 20 6d  the <b>DBF</b> m
19d0: 65 6d 62 65 72 2e 0d 0a 3c 75 6c 3e 0d 0a 3c 6c  ember...<ul>..<l
19e0: 69 3e 45 78 61 6d 70 6c 65 73 20 6f 66 20 76 61  i>Examples of va
19f0: 6c 69 64 20 6e 61 6d 65 73 20 61 72 65 3a 20 3c  lid names are: <
1a00: 62 3e 41 53 43 49 49 3c 2f 62 3e 2c 20 3c 62 3e  b>ASCII</b>, <b>
1a10: 55 54 46 2d 38 3c 2f 62 3e 2c 20 3c 62 3e 43 50  UTF-8</b>, <b>CP
1a20: 38 35 30 3c 2f 62 3e 2c 20 3c 62 3e 43 50 31 32  850</b>, <b>CP12
1a30: 35 32 3c 2f 62 3e 2c 20 3c 62 3e 49 53 4f 2d 38  52</b>, <b>ISO-8
1a40: 38 34 39 2d 31 3c 2f 62 3e 3c 2f 6c 69 3e 0d 0a  849-1</b></li>..
1a50: 3c 6c 69 3e 59 6f 75 20 63 61 6e 20 63 68 65 63  <li>You can chec
1a60: 6b 20 74 68 65 20 66 75 6c 6c 20 6c 69 73 74 20  k the full list 
1a70: 6f 66 20 73 75 70 70 6f 72 74 65 64 20 63 68 61  of supported cha
1a80: 72 73 65 74 20 65 6e 63 6f 64 69 6e 67 73 20 3c  rset encodings <
1a90: 61 20 68 72 65 66 3d 22 68 74 74 70 73 3a 2f 2f  a href="https://
1aa0: 77 77 77 2e 67 6e 75 2e 6f 72 67 2f 73 6f 66 74  www.gnu.org/soft
1ab0: 77 61 72 65 2f 6c 69 62 69 63 6f 6e 76 2f 22 3e  ware/libiconv/">
1ac0: 68 65 72 65 3c 2f 61 3e 2e 3c 2f 6c 69 3e 0d 0a  here</a>.</li>..
1ad0: 3c 2f 75 6c 3e 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e  </ul></li>..<li>
1ae0: 3c 62 3e 74 65 78 74 5f 64 61 74 65 73 3c 2f 62  <b>text_dates</b
1af0: 3e 20 28 3c 69 3e 3c 62 3e 6f 70 74 69 6f 6e 61  > (<i><b>optiona
1b00: 6c 3c 2f 62 3e 3c 2f 69 3e 29 3a 20 74 68 69 73  l</b></i>): this
1b10: 20 69 73 20 61 20 3c 62 3e 42 4f 4f 4c 45 41 4e   is a <b>BOOLEAN
1b20: 3c 2f 62 3e 20 66 6c 61 67 3a 0d 0a 3c 75 6c 3e  </b> flag:..<ul>
1b30: 0d 0a 3c 6c 69 3e 69 66 20 73 65 74 20 74 6f 20  ..<li>if set to 
1b40: 3c 62 3e 30 3c 2f 62 3e 20 28 3c 62 3e 46 41 4c  <b>0</b> (<b>FAL
1b50: 53 45 3c 2f 62 3e 29 20 61 6c 6c 20 66 69 65 6c  SE</b>) all fiel
1b60: 64 73 20 6f 66 20 74 68 65 20 3c 62 3e 44 41 54  ds of the <b>DAT
1b70: 45 3c 2f 62 3e 20 74 79 70 65 20 77 69 6c 6c 20  E</b> type will 
1b80: 62 65 20 72 65 70 72 65 73 65 6e 74 65 64 20 61  be represented a
1b90: 73 20 3c 61 20 68 72 65 66 3d 22 68 74 74 70 73  s <a href="https
1ba0: 3a 2f 2f 77 77 77 2e 73 71 6c 69 74 65 2e 6f 72  ://www.sqlite.or
1bb0: 67 2f 6c 61 6e 67 5f 64 61 74 65 66 75 6e 63 2e  g/lang_datefunc.
1bc0: 68 74 6d 6c 22 3e 6a 75 6c 69 61 6e 20 64 61 74  html">julian dat
1bd0: 65 73 3c 2f 61 3e 3c 2f 6c 69 3e 0d 0a 3c 6c 69  es</a></li>..<li
1be0: 3e 69 66 20 73 65 74 20 74 6f 20 61 6e 79 20 6f  >if set to any o
1bf0: 74 68 65 72 20 69 6e 74 65 67 65 72 20 76 61 6c  ther integer val
1c00: 75 65 20 28 3c 62 3e 54 52 55 45 3c 2f 62 3e 29  ue (<b>TRUE</b>)
1c10: 20 61 6c 6c 20 66 69 65 6c 64 73 20 6f 66 20 74   all fields of t
1c20: 68 65 20 3c 62 3e 44 41 54 45 3c 2f 62 3e 20 74  he <b>DATE</b> t
1c30: 79 70 65 20 77 69 6c 6c 20 62 65 20 72 65 70 72  ype will be repr
1c40: 65 73 65 6e 74 65 64 20 61 73 20 54 65 78 74 20  esented as Text 
1c50: 53 74 72 69 6e 67 73 20 61 73 20 65 2e 67 2e 20  Strings as e.g. 
1c60: 3c 62 3e 32 30 31 38 2d 30 38 2d 32 31 3c 2f 62  <b>2018-08-21</b
1c70: 3e 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e 69 66 20 6e  ></li>..<li>if n
1c80: 6f 74 20 65 78 70 6c 69 63 69 74 6c 79 20 73 70  ot explicitly sp
1c90: 65 63 69 66 69 65 64 2c 20 3c 62 3e 54 52 55 45  ecified, <b>TRUE
1ca0: 3c 2f 62 3e 20 77 69 6c 6c 20 61 6c 77 61 79 73  </b> will always
1cb0: 20 62 65 20 61 73 73 75 6d 65 64 20 28 64 65 66   be assumed (def
1cc0: 61 75 6c 74 20 73 65 74 74 69 6e 67 29 2e 3c 2f  ault setting).</
1cd0: 6c 69 3e 0d 0a 3c 2f 75 6c 3e 3c 2f 6c 69 3e 0d  li>..</ul></li>.
1ce0: 0a 3c 6c 69 3e 3c 62 3e 63 6f 6c 6e 61 6d 65 5f  .<li><b>colname_
1cf0: 63 61 73 65 3c 2f 62 3e 20 28 3c 69 3e 3c 62 3e  case</b> (<i><b>
1d00: 6f 70 74 69 6f 6e 61 6c 3c 2f 62 3e 3c 2f 69 3e  optional</b></i>
1d10: 29 3a 20 74 68 69 73 20 61 72 67 75 6d 65 6e 74  ): this argument
1d20: 20 73 70 65 63 69 66 69 65 73 20 69 66 20 61 6c   specifies if al
1d30: 6c 20 63 6f 6c 75 6d 6e 20 6e 61 6d 65 73 20 73  l column names s
1d40: 68 6f 75 6c 64 20 62 65 20 63 6f 6e 73 69 64 65  hould be conside
1d50: 72 65 64 20 75 70 70 65 72 63 61 73 65 20 6f 72  red uppercase or
1d60: 20 6c 6f 77 65 72 63 61 73 65 2e 3c 62 72 3e 0d   lowercase.<br>.
1d70: 0a 56 61 6c 69 64 20 73 65 74 74 69 6e 67 73 20  .Valid settings 
1d80: 61 72 65 3a 0d 0a 3c 75 6c 3e 0d 0a 3c 6c 69 3e  are:..<ul>..<li>
1d90: 3c 62 3e 75 70 70 65 72 63 61 73 65 3c 2f 62 3e  <b>uppercase</b>
1da0: 20 6f 72 20 3c 62 3e 75 70 70 65 72 3c 2f 62 3e   or <b>upper</b>
1db0: 3a 20 61 6c 6c 20 63 6f 6c 75 6d 6e 20 6e 61 6d  : all column nam
1dc0: 65 73 20 77 69 6c 6c 20 62 65 20 66 75 6c 6c 79  es will be fully
1dd0: 20 63 61 70 69 74 61 6c 69 7a 65 64 2e 3c 2f 6c   capitalized.</l
1de0: 69 3e 0d 0a 3c 6c 69 3e 3c 62 3e 6c 6f 77 65 72  i>..<li><b>lower
1df0: 63 61 73 65 3c 2f 62 3e 20 6f 72 20 3c 62 3e 6c  case</b> or <b>l
1e00: 6f 77 65 72 3c 2f 62 3e 3a 20 61 6c 6c 20 63 6f  ower</b>: all co
1e10: 6c 75 6d 6e 20 6e 61 6d 65 73 20 77 69 6c 6c 20  lumn names will 
1e20: 62 65 20 66 75 6c 6c 20 6c 6f 77 65 72 63 61 73  be full lowercas
1e30: 65 2e 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e 3c 62 3e  e.</li>..<li><b>
1e40: 73 61 6d 65 63 61 73 65 3c 2f 62 3e 20 6f 72 20  samecase</b> or 
1e50: 3c 62 3e 73 61 6d 65 3c 2f 62 3e 3a 20 61 6c 6c  <b>same</b>: all
1e60: 20 63 6f 6c 75 6d 6e 20 6e 61 6d 65 73 20 77 69   column names wi
1e70: 6c 6c 20 62 65 20 65 78 61 63 74 6c 79 20 70 72  ll be exactly pr
1e80: 65 73 65 72 76 65 64 20 61 73 20 74 68 65 79 20  eserved as they 
1e90: 61 72 65 20 64 65 66 69 6e 65 64 20 69 6e 74 6f  are defined into
1ea0: 20 74 68 65 20 44 42 46 20 6d 65 6d 62 65 72 2e   the DBF member.
1eb0: 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e 69 66 20 6e 6f  </li>..<li>if no
1ec0: 74 20 73 70 65 63 69 66 69 65 64 2c 20 6f 72 20  t specified, or 
1ed0: 69 66 20 61 6e 79 20 6f 74 68 65 72 20 64 65 66  if any other def
1ee0: 69 6e 69 74 69 6f 6e 20 64 65 66 69 6e 69 74 69  inition definiti
1ef0: 6f 6e 20 69 73 20 66 6f 75 6e 64 2c 20 3c 62 3e  on is found, <b>
1f00: 6c 6f 77 65 72 63 61 73 65 3c 2f 62 3e 20 77 69  lowercase</b> wi
1f10: 6c 6c 20 61 6c 77 61 79 73 20 62 65 20 61 73 73  ll always be ass
1f20: 75 6d 65 64 20 28 64 65 66 61 75 6c 74 20 73 65  umed (default se
1f30: 74 74 69 6e 67 29 2e 3c 2f 6c 69 3e 0d 0a 3c 2f  tting).</li>..</
1f40: 75 6c 3e 3c 2f 6c 69 3e 0d 0a 3c 2f 75 6c 3e 3c  ul></li>..</ul><
1f50: 62 72 3e 0d 0a 3c 74 61 62 6c 65 20 62 67 63 6f  br>..<table bgco
1f60: 6c 6f 72 3d 22 23 66 66 66 66 64 30 22 20 63 65  lor="#ffffd0" ce
1f70: 6c 6c 70 61 64 64 69 6e 67 3d 22 31 38 22 3e 3c  llpadding="18"><
1f80: 74 72 3e 3c 74 64 3e 0d 0a 3c 62 3e 4e 6f 74 65  tr><td>..<b>Note
1f90: 3c 2f 62 3e 3a 20 61 6e 79 20 54 65 78 74 20 53  </b>: any Text S
1fa0: 74 72 69 6e 67 2c 20 71 75 6f 74 65 64 20 6f 72  tring, quoted or
1fb0: 20 6e 6f 74 2c 20 77 68 65 6e 20 69 74 20 61 70   not, when it ap
1fc0: 70 65 61 72 73 20 61 73 20 61 20 56 69 72 74 75  pears as a Virtu
1fd0: 61 6c 20 54 61 62 6c 65 20 61 72 67 75 6d 65 6e  al Table argumen
1fe0: 74 20 68 61 73 20 74 68 65 20 73 61 6d 65 20 65  t has the same e
1ff0: 66 66 65 63 74 2e 0d 0a 3c 76 65 72 62 61 74 69  ffect...<verbati
2000: 6d 3e 0d 0a 53 45 4c 45 43 54 20 43 52 45 41 54  m>..SELECT CREAT
2010: 45 20 56 49 52 54 55 41 4c 20 54 41 42 4c 45 20  E VIRTUAL TABLE 
2020: 6d 79 5f 74 61 62 6c 65 20 55 53 49 4e 47 20 56  my_table USING V
2030: 69 72 74 75 61 6c 44 62 66 28 20 2f 68 6f 6d 65  irtualDbf( /home
2040: 2f 73 61 6e 64 72 6f 2f 6d 79 73 68 70 20 2c 20  /sandro/myshp , 
2050: 43 50 31 32 35 32 20 2c 20 31 20 2c 20 6c 6f 77  CP1252 , 1 , low
2060: 65 72 20 29 3b 0d 0a 6f 72 0d 0a 53 45 4c 45 43  er );..or..SELEC
2070: 54 20 43 52 45 41 54 45 20 56 49 52 54 55 41 4c  T CREATE VIRTUAL
2080: 20 54 41 42 4c 45 20 6d 79 5f 74 61 62 6c 65 20   TABLE my_table 
2090: 55 53 49 4e 47 20 56 69 72 74 75 61 6c 44 62 66  USING VirtualDbf
20a0: 28 20 27 2f 68 6f 6d 65 2f 73 61 6e 64 72 6f 2f  ( '/home/sandro/
20b0: 6d 79 73 68 70 27 20 2c 20 27 43 50 31 32 35 32  myshp' , 'CP1252
20c0: 27 20 2c 20 31 20 2c 20 27 6c 6f 77 65 72 27 20  ' , 1 , 'lower' 
20d0: 29 3b 0d 0a 3c 2f 76 65 72 62 61 74 69 6d 3e 0d  );..</verbatim>.
20e0: 0a 42 6f 74 68 20 6e 6f 74 61 74 69 6f 6e 73 20  .Both notations 
20f0: 77 69 6c 6c 20 70 72 6f 64 75 63 65 20 74 68 65  will produce the
2100: 20 73 61 6d 65 20 72 65 73 75 6c 74 2e 0d 0a 3c   same result...<
2110: 2f 74 64 3e 3c 2f 74 72 3e 3c 2f 74 61 62 6c 65  /td></tr></table
2120: 3e 0d 0a 3c 62 72 3e 0d 0a 3c 74 61 62 6c 65 20  >..<br>..<table 
2130: 62 67 63 6f 6c 6f 72 3d 22 23 64 30 66 66 64 30  bgcolor="#d0ffd0
2140: 22 20 63 65 6c 6c 70 61 64 64 69 6e 67 3d 22 31  " cellpadding="1
2150: 38 22 3e 3c 74 72 3e 3c 74 64 3e 0d 0a 3c 68 33  8"><tr><td>..<h3
2160: 3e 42 65 73 74 20 70 72 61 63 74 69 63 65 73 20  >Best practices 
2170: 61 6e 64 20 6b 6e 6f 77 6e 20 6c 69 6d 69 74 61  and known limita
2180: 74 69 6f 6e 73 3c 2f 68 33 3e 0d 0a 3c 75 6c 3e  tions</h3>..<ul>
2190: 0d 0a 3c 6c 69 3e 56 69 72 74 75 61 6c 20 54 61  ..<li>Virtual Ta
21a0: 62 6c 65 73 20 61 72 65 20 6e 6f 74 20 72 65 61  bles are not rea
21b0: 6c 6c 79 20 67 65 6e 75 69 6e 65 20 44 61 74 61  lly genuine Data
21c0: 62 61 73 65 20 54 61 62 6c 65 73 2c 20 74 68 65  base Tables, the
21d0: 79 20 61 72 65 20 6a 75 73 74 20 65 6d 75 6c 61  y are just emula
21e0: 74 69 6e 67 20 74 68 65 20 6f 72 69 67 69 6e 61  ting the origina
21f0: 6c 20 73 6f 75 72 63 65 20 61 73 20 61 20 44 61  l source as a Da
2200: 74 61 62 61 73 65 20 54 61 62 6c 65 2e 3c 2f 6c  tabase Table.</l
2210: 69 3e 0d 0a 3c 6c 69 3e 56 69 72 74 75 61 6c 20  i>..<li>Virtual 
2220: 54 61 62 6c 65 73 20 68 61 76 65 20 76 65 72 79  Tables have very
2230: 20 70 6f 6f 72 20 73 70 65 65 64 20 70 65 72 66   poor speed perf
2240: 6f 72 6d 61 6e 63 65 73 2c 20 64 75 65 20 74 6f  ormances, due to
2250: 20 74 68 65 20 20 65 6d 75 6c 61 74 69 6f 6e 2c   the  emulation,
2260: 20 61 73 20 63 6f 6d 70 61 72 65 64 20 74 6f 20   as compared to 
2270: 67 65 6e 75 69 6e 65 20 44 61 74 61 62 61 73 65  genuine Database
2280: 20 54 61 62 6c 65 73 2e 3c 2f 6c 69 3e 0d 0a 3c   Tables.</li>..<
2290: 6c 69 3e 43 6f 6d 70 6c 65 78 20 53 51 4c 20 71  li>Complex SQL q
22a0: 75 65 72 69 65 73 20 3c 62 3e 4a 4f 49 4e 3c 2f  ueries <b>JOIN</
22b0: 62 3e 69 6e 67 20 73 65 76 65 72 61 6c 20 54 61  b>ing several Ta
22c0: 62 6c 65 73 20 63 61 6e 20 6f 66 74 65 6e 20 72  bles can often r
22d0: 65 74 75 72 6e 20 6f 64 64 20 61 6e 64 20 6d 69  eturn odd and mi
22e0: 73 6c 65 61 64 69 6e 67 20 72 65 73 75 6c 74 73  sleading results
22f0: 65 74 73 2c 20 77 68 65 6e 20 6f 6e 65 20 6f 72  ets, when one or
2300: 20 6d 6f 72 65 20 6f 66 20 74 68 65 20 3c 62 3e   more of the <b>
2310: 4a 4f 49 4e 3c 2f 62 3e 65 64 20 54 61 62 6c 65  JOIN</b>ed Table
2320: 73 20 61 72 65 20 6f 66 20 74 68 65 20 56 69 72  s are of the Vir
2330: 74 75 61 6c 20 74 79 70 65 2e 3c 2f 6c 69 3e 0d  tual type.</li>.
2340: 0a 3c 6c 69 3e 54 68 65 20 62 65 73 74 20 75 73  .<li>The best us
2350: 65 20 6f 66 20 61 20 56 69 72 74 75 61 6c 20 54  e of a Virtual T
2360: 61 62 6c 65 20 69 73 20 74 6f 20 70 72 65 66 6f  able is to prefo
2370: 72 6d 20 61 20 62 61 73 69 63 20 64 61 74 61 20  rm a basic data 
2380: 69 6d 70 6f 72 74 20 70 72 6f 63 65 73 73 2c 20  import process, 
2390: 6f 72 20 74 6f 20 71 75 69 63 6b 6c 79 20 67 65  or to quickly ge
23a0: 74 20 61 6e 20 6f 76 65 72 61 6c 6c 20 67 6c 61  t an overall gla
23b0: 6e 63 65 20 61 74 20 61 20 66 75 6c 6c 20 64 61  nce at a full da
23c0: 74 61 73 65 74 20 77 69 74 68 6f 75 74 20 6e 65  taset without ne
23d0: 63 65 73 73 61 72 69 6c 79 20 69 6d 70 6f 72 74  cessarily import
23e0: 69 6e 67 20 69 74 20 69 6e 74 6f 20 74 68 65 20  ing it into the 
23f0: 44 61 74 61 62 61 73 65 2e 3c 2f 6c 69 3e 0d 0a  Database.</li>..
2400: 3c 6c 69 3e 50 72 65 74 65 6e 64 69 6e 67 20 74  <li>Pretending t
2410: 6f 20 75 73 65 20 61 20 56 69 72 74 75 61 6c 20  o use a Virtual 
2420: 54 61 62 6c 65 20 61 73 20 61 20 66 75 6c 6c 20  Table as a full 
2430: 72 65 70 6c 61 63 65 6d 65 6e 74 20 6f 66 20 69  replacement of i
2440: 6d 70 6f 72 74 69 6e 67 20 61 6c 6c 20 64 61 74  mporting all dat
2450: 61 20 77 69 74 68 69 6e 20 61 20 67 65 6e 75 69  a within a genui
2460: 6e 65 20 44 61 74 61 62 61 73 65 20 54 61 62 6c  ne Database Tabl
2470: 65 20 69 73 20 73 74 72 6f 6e 67 6c 79 20 64 69  e is strongly di
2480: 73 63 6f 75 72 61 67 65 64 2c 20 61 6e 64 20 6e  scouraged, and n
2490: 65 76 65 72 20 69 73 20 61 20 67 6f 6f 64 20 69  ever is a good i
24a0: 64 65 61 2e 3c 2f 6c 69 3e 0d 0a 3c 2f 75 6c 3e  dea.</li>..</ul>
24b0: 3c 62 72 3e 0d 0a 3c 62 3e 57 61 72 6e 69 6e 67  <br>..<b>Warning
24c0: 3c 2f 62 3e 3a 20 56 69 72 74 75 61 6c 44 42 46  </b>: VirtualDBF
24d0: 20 54 61 62 6c 65 73 20 61 72 65 20 61 6c 77 61   Tables are alwa
24e0: 79 73 20 73 75 62 6a 65 63 74 20 74 6f 20 3c 62  ys subject to <b
24f0: 3e 52 45 41 44 2d 4f 4e 4c 59 3c 2f 62 3e 20 72  >READ-ONLY</b> r
2500: 65 73 74 72 69 63 74 69 6f 6e 73 2e 20 41 6e 79  estrictions. Any
2510: 20 61 74 74 65 6d 70 74 20 74 6f 20 74 6f 20 65   attempt to to e
2520: 78 65 63 75 74 65 20 61 6e 20 3c 62 3e 49 4e 53  xecute an <b>INS
2530: 45 52 54 3c 2f 62 3e 2c 20 3c 62 3e 55 50 44 41  ERT</b>, <b>UPDA
2540: 54 45 3c 2f 62 3e 20 6f 72 20 3c 62 3e 44 45 4c  TE</b> or <b>DEL
2550: 45 54 45 3c 2f 62 3e 20 73 74 61 74 65 6d 65 6e  ETE</b> statemen
2560: 74 20 77 69 6c 6c 20 61 6c 77 61 79 73 20 72 65  t will always re
2570: 74 75 72 6e 20 61 6e 20 65 72 72 6f 72 2e 3c 62  turn an error.<b
2580: 72 3e 0d 0a 3c 2f 74 64 3e 3c 2f 74 72 3e 3c 2f  r>..</td></tr></
2590: 74 61 62 6c 65 3e 0d 0a 3c 62 72 3e 0d 0a 3c 74  table>..<br>..<t
25a0: 61 62 6c 65 20 62 67 63 6f 6c 6f 72 3d 22 23 65  able bgcolor="#e
25b0: 30 65 30 65 30 22 20 63 65 6c 6c 70 61 64 64 69  0e0e0" cellpaddi
25c0: 6e 67 3d 22 31 38 22 3e 3c 74 72 3e 3c 74 64 3e  ng="18"><tr><td>
25d0: 0d 0a 3c 68 33 3e 52 65 6c 61 74 65 64 20 54 6f  ..<h3>Related To
25e0: 70 69 63 73 3c 2f 68 33 3e 0d 0a 3c 75 6c 3e 0d  pics</h3>..<ul>.
25f0: 0a 3c 6c 69 3e 54 68 65 20 3c 62 3e 49 6d 70 6f  .<li>The <b>Impo
2600: 72 74 44 42 46 28 29 3c 2f 62 3e 20 53 51 4c 20  rtDBF()</b> SQL 
2610: 66 75 6e 63 74 69 6f 6e 20 61 6c 6c 6f 77 73 20  function allows 
2620: 74 6f 20 63 72 65 61 74 65 20 61 6e 64 20 70 6f  to create and po
2630: 70 75 6c 61 74 65 20 61 20 67 65 6e 75 69 6e 65  pulate a genuine
2640: 20 44 61 74 61 62 61 73 65 20 54 61 62 6c 65 20   Database Table 
2650: 62 79 20 69 6d 70 6f 72 74 69 6e 67 20 61 6e 20  by importing an 
2660: 65 78 74 65 72 6e 61 6c 20 44 42 46 20 66 69 6c  external DBF fil
2670: 65 2e 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e 41 6e 64  e.</li>..<li>And
2680: 20 74 68 65 20 3c 62 3e 45 78 70 6f 72 74 44 42   the <b>ExportDB
2690: 46 28 29 3c 2f 62 3e 20 73 69 73 74 65 72 20 66  F()</b> sister f
26a0: 75 6e 63 74 69 6f 6e 20 61 6c 6c 6f 77 73 20 74  unction allows t
26b0: 6f 20 64 69 72 65 63 74 6c 79 20 65 78 70 6f 72  o directly expor
26c0: 74 20 61 20 77 68 6f 6c 65 20 44 61 74 61 62 61  t a whole Databa
26d0: 73 65 20 54 61 62 6c 65 20 69 6e 74 6f 20 61 6e  se Table into an
26e0: 20 65 78 74 65 72 6e 61 6c 20 44 42 46 20 66 69   external DBF fi
26f0: 6c 65 2e 3c 2f 6c 69 3e 0d 0a 3c 2f 75 6c 3e 0d  le.</li>..</ul>.
2700: 0a 3c 2f 74 64 3e 3c 2f 74 72 3e 3c 2f 74 61 62  .</td></tr></tab
2710: 6c 65 3e 0d 0a 3c 62 72 3e 0d 0a 3c 68 72 3e 0d  le>..<br>..<hr>.
2720: 0a 3c 68 31 3e 3c 61 20 69 64 3d 22 56 69 72 74  .<h1><a id="Virt
2730: 75 61 6c 54 65 78 74 22 3e 56 69 72 74 75 61 6c  ualText">Virtual
2740: 54 65 78 74 3c 2f 61 3e 3c 2f 68 31 3e 0d 0a 54  Text</a></h1>..T
2750: 68 65 20 3c 62 3e 56 69 72 74 75 61 6c 54 65 78  he <b>VirtualTex
2760: 74 3c 2f 62 3e 20 49 6e 74 65 72 66 61 63 65 20  t</b> Interface 
2770: 61 6c 6c 6f 77 73 20 74 6f 20 64 69 72 65 63 74  allows to direct
2780: 6c 79 20 61 63 63 65 73 73 20 61 6e 20 65 78 74  ly access an ext
2790: 65 72 6e 61 6c 20 54 65 78 74 20 66 69 6c 65 20  ernal Text file 
27a0: 62 79 20 75 73 69 6e 67 20 73 74 61 6e 64 61 72  by using standar
27b0: 64 20 53 70 61 74 69 61 6c 20 53 51 4c 20 71 75  d Spatial SQL qu
27c0: 65 72 69 65 73 2e 3c 62 72 3e 0d 0a 54 68 65 20  eries.<br>..The 
27d0: 54 65 78 74 20 46 69 6c 65 20 69 73 20 65 78 70  Text File is exp
27e0: 65 63 74 65 64 20 74 6f 20 63 6f 6e 74 61 69 6e  ected to contain
27f0: 20 61 20 70 72 6f 70 65 72 6c 79 20 66 6f 72 6d   a properly form
2800: 61 74 74 65 64 20 54 61 62 6c 65 20 61 63 63 6f  atted Table acco
2810: 72 64 69 6e 67 6c 79 20 74 6f 20 73 6f 6d 65 20  rdingly to some 
2820: 3c 62 3e 44 65 6c 69 6d 69 74 65 72 2d 53 65 70  <b>Delimiter-Sep
2830: 61 72 61 74 65 64 2d 56 61 6c 75 65 73 3c 2f 62  arated-Values</b
2840: 3e 20 66 6f 72 6d 61 74 20 28 63 6f 6d 6d 61 20  > format (comma 
2850: 73 65 70 61 72 61 74 65 64 20 76 61 6c 75 65 73  separated values
2860: 20 3c 69 3e 2a 2e 63 73 76 3c 2f 69 3e 2c 20 74   <i>*.csv</i>, t
2870: 61 62 20 73 65 70 61 72 61 74 65 64 20 76 61 6c  ab separated val
2880: 75 65 73 20 3c 69 3e 2a 2e 74 78 74 3c 2f 69 3e  ues <i>*.txt</i>
2890: 20 61 6e 64 20 61 6c 69 6b 65 29 2e 3c 62 72 3e   and alike).<br>
28a0: 0d 0a 53 79 6e 74 61 78 20 66 6f 72 20 63 72 65  ..Syntax for cre
28b0: 61 74 69 6e 67 20 61 20 56 69 72 74 75 61 6c 54  ating a VirtualT
28c0: 65 78 74 20 54 61 62 6c 65 3a 0d 0a 3c 76 65 72  ext Table:..<ver
28d0: 62 61 74 69 6d 3e 0d 0a 53 45 4c 45 43 54 20 43  batim>..SELECT C
28e0: 52 45 41 54 45 20 56 49 52 54 55 41 4c 20 54 41  REATE VIRTUAL TA
28f0: 42 4c 45 20 6d 79 5f 74 61 62 6c 65 20 55 53 49  BLE my_table USI
2900: 4e 47 20 56 69 72 74 75 61 6c 54 65 78 74 20 28  NG VirtualText (
2910: 20 74 65 78 74 66 69 6c 65 5f 70 61 74 68 20 2c   textfile_path ,
2920: 20 63 68 61 72 73 65 74 5f 65 6e 63 6f 64 69 6e   charset_encodin
2930: 67 20 29 3b 0d 0a 0d 0a 53 45 4c 45 43 54 20 43  g );....SELECT C
2940: 52 45 41 54 45 20 56 49 52 54 55 41 4c 20 54 41  REATE VIRTUAL TA
2950: 42 4c 45 20 6d 79 5f 74 61 62 6c 65 20 55 53 49  BLE my_table USI
2960: 4e 47 20 56 69 72 74 75 61 6c 54 65 78 74 20 28  NG VirtualText (
2970: 20 74 65 78 74 66 69 6c 65 5f 70 61 74 68 20 2c   textfile_path ,
2980: 20 63 68 61 72 73 65 74 5f 65 6e 63 6f 64 69 6e   charset_encodin
2990: 67 20 2c 20 66 69 72 73 74 5f 72 6f 77 5f 61 73  g , first_row_as
29a0: 5f 74 69 74 6c 65 73 20 29 3b 0d 0a 0d 0a 53 45  _titles );....SE
29b0: 4c 45 43 54 20 43 52 45 41 54 45 20 56 49 52 54  LECT CREATE VIRT
29c0: 55 41 4c 20 54 41 42 4c 45 20 6d 79 5f 74 61 62  UAL TABLE my_tab
29d0: 6c 65 20 55 53 49 4e 47 20 56 69 72 74 75 61 6c  le USING Virtual
29e0: 54 65 78 74 20 28 20 74 65 78 74 66 69 6c 65 5f  Text ( textfile_
29f0: 70 61 74 68 20 2c 20 63 68 61 72 73 65 74 5f 65  path , charset_e
2a00: 6e 63 6f 64 69 6e 67 20 2c 20 66 69 72 73 74 5f  ncoding , first_
2a10: 72 6f 77 5f 61 73 5f 74 69 74 6c 65 73 20 2c 20  row_as_titles , 
2a20: 64 65 63 69 6d 61 6c 5f 73 65 70 61 72 61 74 6f  decimal_separato
2a30: 72 20 29 3b 0d 0a 0d 0a 53 45 4c 45 43 54 20 43  r );....SELECT C
2a40: 52 45 41 54 45 20 56 49 52 54 55 41 4c 20 54 41  REATE VIRTUAL TA
2a50: 42 4c 45 20 6d 79 5f 74 61 62 6c 65 20 55 53 49  BLE my_table USI
2a60: 4e 47 20 56 69 72 74 75 61 6c 54 65 78 74 20 28  NG VirtualText (
2a70: 20 74 65 78 74 66 69 6c 65 5f 70 61 74 68 20 2c   textfile_path ,
2a80: 20 63 68 61 72 73 65 74 5f 65 6e 63 6f 64 69 6e   charset_encodin
2a90: 67 20 2c 20 66 69 72 73 74 5f 72 6f 77 5f 61 73  g , first_row_as
2aa0: 5f 74 69 74 6c 65 73 20 2c 20 64 65 63 69 6d 61  _titles , decima
2ab0: 6c 5f 73 65 70 61 72 61 74 6f 72 20 2c 20 74 65  l_separator , te
2ac0: 78 74 5f 73 65 70 61 72 61 74 6f 72 20 29 3b 0d  xt_separator );.
2ad0: 0a 0d 0a 53 45 4c 45 43 54 20 43 52 45 41 54 45  ...SELECT CREATE
2ae0: 20 56 49 52 54 55 41 4c 20 54 41 42 4c 45 20 6d   VIRTUAL TABLE m
2af0: 79 5f 74 61 62 6c 65 20 55 53 49 4e 47 20 56 69  y_table USING Vi
2b00: 72 74 75 61 6c 54 65 78 74 20 28 20 74 65 78 74  rtualText ( text
2b10: 66 69 6c 65 5f 70 61 74 68 20 2c 20 63 68 61 72  file_path , char
2b20: 73 65 74 5f 65 6e 63 6f 64 69 6e 67 20 2c 20 66  set_encoding , f
2b30: 69 72 73 74 5f 72 6f 77 5f 61 73 5f 74 69 74 6c  irst_row_as_titl
2b40: 65 73 20 2c 20 64 65 63 69 6d 61 6c 5f 73 65 70  es , decimal_sep
2b50: 61 72 61 74 6f 72 20 2c 20 74 65 78 74 5f 73 65  arator , text_se
2b60: 70 61 72 61 74 6f 72 20 2c 20 66 69 65 6c 64 5f  parator , field_
2b70: 73 65 70 61 72 61 74 6f 72 20 29 3b 0d 0a 3c 2f  separator );..</
2b80: 76 65 72 62 61 74 69 6d 3e 0d 0a 53 75 70 70 6f  verbatim>..Suppo
2b90: 72 74 65 64 20 61 72 67 75 6d 65 6e 74 73 20 61  rted arguments a
2ba0: 6e 64 20 74 68 65 69 72 20 69 6e 74 65 72 70 72  nd their interpr
2bb0: 65 74 61 74 69 6f 6e 3a 0d 0a 3c 75 6c 3e 0d 0a  etation:..<ul>..
2bc0: 3c 6c 69 3e 3c 62 3e 74 65 78 74 66 69 6c 65 5f  <li><b>textfile_
2bd0: 70 61 74 68 3c 2f 62 3e 20 28 3c 69 3e 3c 62 3e  path</b> (<i><b>
2be0: 6d 61 6e 64 61 74 6f 72 79 3c 2f 62 3e 3c 2f 69  mandatory</b></i
2bf0: 3e 29 3a 20 74 68 65 20 72 65 6c 61 74 69 76 65  >): the relative
2c00: 20 6f 72 20 61 62 73 6f 6c 75 74 65 20 70 61 74   or absolute pat
2c10: 68 6e 61 6d 65 20 6c 65 61 64 69 6e 67 20 74 6f  hname leading to
2c20: 20 74 68 65 20 65 78 74 65 72 6e 61 6c 20 54 65   the external Te
2c30: 78 74 20 66 69 6c 65 2e 0d 0a 3c 75 6c 3e 0d 0a  xt file...<ul>..
2c40: 3c 6c 69 3e 3c 62 3e 4e 6f 74 65 3c 2f 62 3e 3a  <li><b>Note</b>:
2c50: 20 74 68 65 20 66 75 6c 6c 20 70 61 74 68 6e 61   the full pathna
2c60: 6d 65 20 6d 75 73 74 20 62 65 20 70 61 73 73 65  me must be passe
2c70: 64 2c 20 69 6e 63 6c 75 64 69 6e 67 20 61 6e 20  d, including an 
2c80: 65 76 65 6e 74 75 61 6c 20 66 69 6e 61 6c 20 73  eventual final s
2c90: 75 66 66 69 78 20 28 3c 69 3e 2a 2e 74 78 74 3c  uffix (<i>*.txt<
2ca0: 2f 69 3e 2c 20 3c 69 3e 2a 2e 63 73 76 3c 2f 69  /i>, <i>*.csv</i
2cb0: 3e 20 61 6e 64 20 61 6c 69 6b 65 29 2e 3c 2f 6c  > and alike).</l
2cc0: 69 3e 0d 0a 3c 2f 75 6c 3e 3c 2f 6c 69 3e 0d 0a  i>..</ul></li>..
2cd0: 3c 6c 69 3e 3c 62 3e 63 68 61 72 73 65 74 5f 65  <li><b>charset_e
2ce0: 6e 63 6f 64 69 6e 67 3c 2f 62 3e 20 28 3c 69 3e  ncoding</b> (<i>
2cf0: 3c 62 3e 6d 61 6e 64 61 74 6f 72 79 3c 2f 62 3e  <b>mandatory</b>
2d00: 3c 2f 69 3e 29 3a 20 63 61 6e 6f 6e 69 63 61 6c  </i>): canonical
2d10: 20 6e 61 6d 65 20 6f 66 20 74 68 65 20 63 68 61   name of the cha
2d20: 72 73 65 74 20 65 6e 63 6f 64 69 6e 67 20 61 64  rset encoding ad
2d30: 6f 70 74 65 64 20 62 79 20 74 68 65 20 54 65 78  opted by the Tex
2d40: 74 20 66 69 6c 65 2e 0d 0a 3c 75 6c 3e 0d 0a 3c  t file...<ul>..<
2d50: 6c 69 3e 45 78 61 6d 70 6c 65 73 20 6f 66 20 76  li>Examples of v
2d60: 61 6c 69 64 20 6e 61 6d 65 73 20 61 72 65 3a 20  alid names are: 
2d70: 3c 62 3e 41 53 43 49 49 3c 2f 62 3e 2c 20 3c 62  <b>ASCII</b>, <b
2d80: 3e 55 54 46 2d 38 3c 2f 62 3e 2c 20 3c 62 3e 43  >UTF-8</b>, <b>C
2d90: 50 38 35 30 3c 2f 62 3e 2c 20 3c 62 3e 43 50 31  P850</b>, <b>CP1
2da0: 32 35 32 3c 2f 62 3e 2c 20 3c 62 3e 49 53 4f 2d  252</b>, <b>ISO-
2db0: 38 38 34 39 2d 31 3c 2f 62 3e 3c 2f 6c 69 3e 0d  8849-1</b></li>.
2dc0: 0a 3c 6c 69 3e 59 6f 75 20 63 61 6e 20 63 68 65  .<li>You can che
2dd0: 63 6b 20 74 68 65 20 66 75 6c 6c 20 6c 69 73 74  ck the full list
2de0: 20 6f 66 20 73 75 70 70 6f 72 74 65 64 20 63 68   of supported ch
2df0: 61 72 73 65 74 20 65 6e 63 6f 64 69 6e 67 73 20  arset encodings 
2e00: 3c 61 20 68 72 65 66 3d 22 68 74 74 70 73 3a 2f  <a href="https:/
2e10: 2f 77 77 77 2e 67 6e 75 2e 6f 72 67 2f 73 6f 66  /www.gnu.org/sof
2e20: 74 77 61 72 65 2f 6c 69 62 69 63 6f 6e 76 2f 22  tware/libiconv/"
2e30: 3e 68 65 72 65 3c 2f 61 3e 2e 3c 2f 6c 69 3e 0d  >here</a>.</li>.
2e40: 0a 3c 2f 75 6c 3e 3c 2f 6c 69 3e 0d 0a 3c 6c 69  .</ul></li>..<li
2e50: 3e 3c 62 3e 66 69 72 73 74 5f 72 6f 77 5f 61 73  ><b>first_row_as
2e60: 5f 74 69 74 6c 65 73 3c 2f 62 3e 20 28 3c 69 3e  _titles</b> (<i>
2e70: 3c 62 3e 6f 70 74 69 6f 6e 61 6c 3c 2f 62 3e 3c  <b>optional</b><
2e80: 2f 69 3e 29 3a 20 74 68 69 73 20 69 73 20 61 20  /i>): this is a 
2e90: 3c 62 3e 42 4f 4f 4c 45 41 4e 3c 2f 62 3e 20 66  <b>BOOLEAN</b> f
2ea0: 6c 61 67 3a 0d 0a 3c 75 6c 3e 0d 0a 3c 6c 69 3e  lag:..<ul>..<li>
2eb0: 69 66 20 73 65 74 20 74 6f 20 3c 62 3e 30 3c 2f  if set to <b>0</
2ec0: 62 3e 20 28 3c 62 3e 46 41 4c 53 45 3c 2f 62 3e  b> (<b>FALSE</b>
2ed0: 29 20 61 6c 6c 20 63 6f 6c 75 6d 6e 20 6e 61 6d  ) all column nam
2ee0: 65 73 20 77 69 6c 6c 20 62 65 20 61 75 74 6f 6d  es will be autom
2ef0: 61 74 69 63 61 6c 6c 79 20 73 65 74 20 62 79 20  atically set by 
2f00: 75 73 69 6e 67 20 61 20 70 72 6f 67 72 65 73 73  using a progress
2f10: 69 76 65 20 73 65 71 75 65 6e 63 65 2e 3c 2f 6c  ive sequence.</l
2f20: 69 3e 0d 0a 3c 6c 69 3e 69 66 20 73 65 74 20 74  i>..<li>if set t
2f30: 6f 20 61 6e 79 20 6f 74 68 65 72 20 69 6e 74 65  o any other inte
2f40: 67 65 72 20 76 61 6c 75 65 20 28 3c 62 3e 54 52  ger value (<b>TR
2f50: 55 45 3c 2f 62 3e 29 20 61 6c 6c 20 63 6f 6c 75  UE</b>) all colu
2f60: 6d 6e 20 6e 61 6d 65 73 20 77 69 6c 6c 20 62 79  mn names will by
2f70: 20 65 78 70 65 63 74 65 64 20 74 6f 20 62 65 20   expected to be 
2f80: 64 65 66 69 6e 65 64 20 69 6e 20 74 68 65 20 76  defined in the v
2f90: 65 72 79 20 66 69 72 73 74 20 72 6f 77 20 6f 66  ery first row of
2fa0: 20 74 68 65 20 54 65 78 74 20 66 69 6c 65 2e 3c   the Text file.<
2fb0: 2f 6c 69 3e 0d 0a 3c 6c 69 3e 69 66 20 6e 6f 74  /li>..<li>if not
2fc0: 20 65 78 70 6c 69 63 69 74 6c 79 20 73 70 65 63   explicitly spec
2fd0: 69 66 69 65 64 2c 20 3c 62 3e 54 52 55 45 3c 2f  ified, <b>TRUE</
2fe0: 62 3e 20 77 69 6c 6c 20 61 6c 77 61 79 73 20 62  b> will always b
2ff0: 65 20 61 73 73 75 6d 65 64 20 28 64 65 66 61 75  e assumed (defau
3000: 6c 74 20 73 65 74 74 69 6e 67 29 2e 3c 2f 6c 69  lt setting).</li
3010: 3e 0d 0a 3c 2f 75 6c 3e 3c 2f 6c 69 3e 0d 0a 3c  >..</ul></li>..<
3020: 75 6c 3e 0d 0a 3c 2f 75 6c 3e 3c 2f 6c 69 3e 0d  ul>..</ul></li>.
3030: 0a 3c 6c 69 3e 3c 62 3e 64 65 63 69 6d 61 6c 5f  .<li><b>decimal_
3040: 73 65 70 61 72 61 74 6f 72 3c 2f 62 3e 20 28 3c  separator</b> (<
3050: 69 3e 3c 62 3e 6f 70 74 69 6f 6e 61 6c 3c 2f 62  i><b>optional</b
3060: 3e 3c 2f 69 3e 29 3a 20 74 68 65 20 63 68 61 72  ></i>): the char
3070: 61 63 74 65 72 20 61 63 74 69 6e 67 20 61 73 20  acter acting as 
3080: 61 20 73 65 70 61 72 61 74 6f 72 20 62 65 74 77  a separator betw
3090: 65 65 6e 20 74 68 65 20 69 6e 74 65 67 65 72 20  een the integer 
30a0: 61 6e 64 20 64 65 63 69 6d 61 6c 20 70 61 72 74  and decimal part
30b0: 73 20 6f 66 20 61 20 6e 75 6d 62 65 72 2e 3c 62  s of a number.<b
30c0: 72 3e 0d 0a 56 61 6c 69 64 20 76 61 6c 75 65 73  r>..Valid values
30d0: 20 61 72 65 20 61 6e 79 20 70 72 69 6e 74 61 62   are any printab
30e0: 6c 65 20 63 68 61 72 61 63 74 65 72 20 6f 72 20  le character or 
30f0: 74 68 65 20 73 70 65 63 69 61 6c 20 6d 6e 65 6d  the special mnem
3100: 6f 6e 69 63 20 6e 6f 74 61 74 69 6f 6e 73 20 3c  onic notations <
3110: 62 3e 50 4f 49 4e 54 3c 2f 62 3e 20 6f 72 20 3c  b>POINT</b> or <
3120: 62 3e 43 4f 4d 4d 41 3c 2f 62 3e 2e 3c 62 72 3e  b>COMMA</b>.<br>
3130: 0d 0a 49 66 20 6e 6f 74 20 65 78 70 6c 69 63 69  ..If not explici
3140: 74 6c 79 20 73 70 65 63 69 66 69 65 64 2c 20 3c  tly specified, <
3150: 62 3e 50 4f 49 4e 54 3c 2f 62 3e 20 77 69 6c 6c  b>POINT</b> will
3160: 20 61 6c 77 61 79 73 20 62 65 20 61 73 73 75 6d   always be assum
3170: 65 64 20 28 64 65 66 61 75 6c 74 20 73 65 74 74  ed (default sett
3180: 69 6e 67 29 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e 3c  ing)</li>..<li><
3190: 62 3e 74 65 78 74 5f 73 65 70 61 72 61 74 6f 72  b>text_separator
31a0: 3c 2f 62 3e 20 28 3c 69 3e 3c 62 3e 6f 70 74 69  </b> (<i><b>opti
31b0: 6f 6e 61 6c 3c 2f 62 3e 3c 2f 69 3e 29 3a 20 74  onal</b></i>): t
31c0: 68 65 20 63 68 61 72 61 63 74 65 72 20 61 63 74  he character act
31d0: 69 6e 67 20 61 73 20 61 20 73 74 72 69 6e 67 20  ing as a string 
31e0: 64 65 6c 69 6d 69 74 65 72 2e 3c 62 72 3e 0d 0a  delimiter.<br>..
31f0: 56 61 6c 69 64 20 76 61 6c 75 65 73 20 61 72 65  Valid values are
3200: 20 61 6e 79 20 70 72 69 6e 74 61 62 6c 65 20 63   any printable c
3210: 68 61 72 61 63 74 65 72 20 6f 72 20 74 68 65 20  haracter or the 
3220: 73 70 65 63 69 61 6c 20 6d 6e 65 6d 6f 6e 69 63  special mnemonic
3230: 20 6e 6f 74 61 74 69 6f 6e 73 20 3c 62 3e 53 49   notations <b>SI
3240: 4e 47 4c 45 51 55 4f 54 45 3c 2f 62 3e 2c 20 3c  NGLEQUOTE</b>, <
3250: 62 3e 44 4f 55 42 4c 45 51 55 4f 54 45 3c 2f 62  b>DOUBLEQUOTE</b
3260: 3e 20 6f 72 20 3c 62 3e 4e 4f 4e 45 3c 2f 62 3e  > or <b>NONE</b>
3270: 2e 3c 62 72 3e 0d 0a 49 66 20 6e 6f 74 20 65 78  .<br>..If not ex
3280: 70 6c 69 63 69 74 6c 79 20 73 70 65 63 69 66 69  plicitly specifi
3290: 65 64 2c 20 3c 62 3e 44 4f 55 42 4c 45 51 55 4f  ed, <b>DOUBLEQUO
32a0: 54 45 3c 2f 62 3e 20 77 69 6c 6c 20 61 6c 77 61  TE</b> will alwa
32b0: 79 73 20 62 65 20 61 73 73 75 6d 65 64 20 28 64  ys be assumed (d
32c0: 65 66 61 75 6c 74 20 73 65 74 74 69 6e 67 29 3c  efault setting)<
32d0: 2f 6c 69 3e 0d 0a 3c 6c 69 3e 3c 62 3e 66 69 65  /li>..<li><b>fie
32e0: 6c 64 5f 73 65 70 61 72 61 74 6f 72 3c 2f 62 3e  ld_separator</b>
32f0: 20 28 3c 69 3e 3c 62 3e 6f 70 74 69 6f 6e 61 6c   (<i><b>optional
3300: 3c 2f 62 3e 3c 2f 69 3e 29 3a 20 74 68 65 20 63  </b></i>): the c
3310: 68 61 72 61 63 74 65 72 20 61 63 74 69 6e 67 20  haracter acting 
3320: 61 73 20 61 20 64 65 6c 69 6d 69 74 65 72 20 62  as a delimiter b
3330: 65 74 77 65 65 6e 20 63 6f 6e 73 65 63 75 74 69  etween consecuti
3340: 76 65 20 66 69 65 6c 64 73 2e 3c 62 72 3e 0d 0a  ve fields.<br>..
3350: 56 61 6c 69 64 20 76 61 6c 75 65 73 20 61 72 65  Valid values are
3360: 20 61 6e 79 20 70 72 69 6e 74 61 62 6c 65 20 63   any printable c
3370: 68 61 72 61 63 74 65 72 20 6f 72 20 74 68 65 20  haracter or the 
3380: 73 70 65 63 69 61 6c 20 6d 6e 65 6d 6f 6e 69 63  special mnemonic
3390: 20 6e 6f 74 61 74 69 6f 6e 73 20 3c 62 3e 54 41   notations <b>TA
33a0: 42 3c 2f 62 3e 2e 3c 62 72 3e 0d 0a 49 66 20 6e  B</b>.<br>..If n
33b0: 6f 74 20 65 78 70 6c 69 63 69 74 6c 79 20 73 70  ot explicitly sp
33c0: 65 63 69 66 69 65 64 2c 20 3c 62 3e 54 41 42 3c  ecified, <b>TAB<
33d0: 2f 62 3e 20 77 69 6c 6c 20 61 6c 77 61 79 73 20  /b> will always 
33e0: 62 65 20 61 73 73 75 6d 65 64 20 28 64 65 66 61  be assumed (defa
33f0: 75 6c 74 20 73 65 74 74 69 6e 67 29 3c 2f 6c 69  ult setting)</li
3400: 3e 0d 0a 3c 2f 75 6c 3e 3c 62 72 3e 0d 0a 3c 74  >..</ul><br>..<t
3410: 61 62 6c 65 20 62 67 63 6f 6c 6f 72 3d 22 23 66  able bgcolor="#f
3420: 66 66 66 64 30 22 20 63 65 6c 6c 70 61 64 64 69  fffd0" cellpaddi
3430: 6e 67 3d 22 31 38 22 3e 3c 74 72 3e 3c 74 64 3e  ng="18"><tr><td>
3440: 0d 0a 3c 62 3e 4e 6f 74 65 3c 2f 62 3e 3a 20 61  ..<b>Note</b>: a
3450: 6e 79 20 54 65 78 74 20 53 74 72 69 6e 67 2c 20  ny Text String, 
3460: 71 75 6f 74 65 64 20 6f 72 20 6e 6f 74 2c 20 77  quoted or not, w
3470: 68 65 6e 20 69 74 20 61 70 70 65 61 72 73 20 61  hen it appears a
3480: 73 20 61 20 56 69 72 74 75 61 6c 20 54 61 62 6c  s a Virtual Tabl
3490: 65 20 61 72 67 75 6d 65 6e 74 20 68 61 73 20 74  e argument has t
34a0: 68 65 20 73 61 6d 65 20 65 66 66 65 63 74 2e 0d  he same effect..
34b0: 0a 3c 76 65 72 62 61 74 69 6d 3e 0d 0a 53 45 4c  .<verbatim>..SEL
34c0: 45 43 54 20 43 52 45 41 54 45 20 56 49 52 54 55  ECT CREATE VIRTU
34d0: 41 4c 20 54 41 42 4c 45 20 6d 79 5f 74 61 62 6c  AL TABLE my_tabl
34e0: 65 20 55 53 49 4e 47 20 56 69 72 74 75 61 6c 54  e USING VirtualT
34f0: 65 78 74 28 20 2f 68 6f 6d 65 2f 73 61 6e 64 72  ext( /home/sandr
3500: 6f 2f 6d 79 66 69 6c 65 2e 74 78 74 20 2c 20 43  o/myfile.txt , C
3510: 50 31 32 35 32 20 2c 20 31 20 2c 20 50 4f 49 4e  P1252 , 1 , POIN
3520: 54 20 2c 20 4e 4f 4e 45 20 2c 20 54 41 42 20 29  T , NONE , TAB )
3530: 3b 0d 0a 6f 72 0d 0a 53 45 4c 45 43 54 20 43 52  ;..or..SELECT CR
3540: 45 41 54 45 20 56 49 52 54 55 41 4c 20 54 41 42  EATE VIRTUAL TAB
3550: 4c 45 20 6d 79 5f 74 61 62 6c 65 20 55 53 49 4e  LE my_table USIN
3560: 47 20 56 69 72 74 75 61 6c 54 65 78 74 28 20 27  G VirtualText( '
3570: 2f 68 6f 6d 65 2f 73 61 6e 64 72 6f 2f 6d 79 66  /home/sandro/myf
3580: 69 6c 65 2e 74 78 74 27 20 2c 20 27 43 50 31 32  ile.txt' , 'CP12
3590: 35 32 27 20 2c 20 31 20 2c 20 27 50 4f 49 4e 54  52' , 1 , 'POINT
35a0: 27 20 2c 20 27 4e 4f 4e 45 27 20 2c 20 27 54 41  ' , 'NONE' , 'TA
35b0: 42 27 20 29 3b 0d 0a 3c 2f 76 65 72 62 61 74 69  B' );..</verbati
35c0: 6d 3e 0d 0a 42 6f 74 68 20 6e 6f 74 61 74 69 6f  m>..Both notatio
35d0: 6e 73 20 77 69 6c 6c 20 70 72 6f 64 75 63 65 20  ns will produce 
35e0: 74 68 65 20 73 61 6d 65 20 72 65 73 75 6c 74 2e  the same result.
35f0: 0d 0a 3c 2f 74 64 3e 3c 2f 74 72 3e 3c 2f 74 61  ..</td></tr></ta
3600: 62 6c 65 3e 0d 0a 3c 62 72 3e 0d 0a 3c 74 61 62  ble>..<br>..<tab
3610: 6c 65 20 62 67 63 6f 6c 6f 72 3d 22 23 64 30 66  le bgcolor="#d0f
3620: 66 64 30 22 20 63 65 6c 6c 70 61 64 64 69 6e 67  fd0" cellpadding
3630: 3d 22 31 38 22 3e 3c 74 72 3e 3c 74 64 3e 0d 0a  ="18"><tr><td>..
3640: 3c 68 33 3e 42 65 73 74 20 70 72 61 63 74 69 63  <h3>Best practic
3650: 65 73 20 61 6e 64 20 6b 6e 6f 77 6e 20 6c 69 6d  es and known lim
3660: 69 74 61 74 69 6f 6e 73 3c 2f 68 33 3e 0d 0a 3c  itations</h3>..<
3670: 75 6c 3e 0d 0a 3c 6c 69 3e 3c 62 3e 42 65 20 61  ul>..<li><b>Be a
3680: 77 61 72 65 3c 2f 62 3e 3a 20 6f 70 65 6e 69 6e  ware</b>: openin
3690: 67 20 62 69 67 20 6f 72 20 68 75 67 65 20 74 65  g big or huge te
36a0: 78 74 20 66 69 6c 65 73 20 63 6f 75 6c 64 20 65  xt files could e
36b0: 61 73 69 6c 79 20 72 65 71 75 69 72 65 20 6d 61  asily require ma
36c0: 73 73 69 76 65 20 52 41 4d 20 61 6c 6c 6f 63 61  ssive RAM alloca
36d0: 74 69 6f 6e 73 2e 3c 2f 6c 69 3e 0d 0a 3c 6c 69  tions.</li>..<li
36e0: 3e 3c 62 3e 57 61 72 6e 69 6e 67 3c 2f 62 3e 3a  ><b>Warning</b>:
36f0: 20 61 74 74 65 6d 70 74 69 6e 67 20 74 6f 20 61   attempting to a
3700: 63 63 65 73 73 20 61 6e 20 65 78 74 65 72 6e 61  ccess an externa
3710: 6c 20 54 65 78 74 20 66 69 6c 65 20 62 79 20 62  l Text file by b
3720: 6c 69 6e 64 6c 79 20 73 70 65 63 69 66 79 69 6e  lindly specifyin
3730: 67 20 72 61 6e 64 6f 6d 6c 79 20 63 68 6f 73 65  g randomly chose
3740: 6e 20 64 65 6c 69 6d 69 74 65 72 73 20 6f 72 20  n delimiters or 
3750: 73 65 70 61 72 61 74 6f 72 73 20 6d 61 79 20 65  separators may e
3760: 61 73 69 6c 79 20 68 61 76 65 20 63 61 74 61 73  asily have catas
3770: 74 72 6f 70 68 69 63 20 65 66 66 65 63 74 73 2e  trophic effects.
3780: 3c 62 72 3e 0d 0a 41 6c 77 61 79 73 20 63 61 72  <br>..Always car
3790: 65 66 75 6c 6c 79 20 63 68 65 63 6b 20 74 68 65  efully check the
37a0: 20 61 63 74 75 61 6c 20 73 74 72 75 63 74 75 72   actual structur
37b0: 65 20 6f 66 20 74 68 65 20 54 65 78 74 20 66 69  e of the Text fi
37c0: 6c 65 20 62 65 66 6f 72 65 20 61 74 74 65 6d 70  le before attemp
37d0: 74 69 6e 67 20 74 6f 20 61 63 63 65 73 73 20 69  ting to access i
37e0: 74 2e 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e 56 69 72  t.</li>..<li>Vir
37f0: 74 75 61 6c 20 54 61 62 6c 65 73 20 61 72 65 20  tual Tables are 
3800: 6e 6f 74 20 72 65 61 6c 6c 79 20 67 65 6e 75 69  not really genui
3810: 6e 65 20 44 61 74 61 62 61 73 65 20 54 61 62 6c  ne Database Tabl
3820: 65 73 2c 20 74 68 65 79 20 61 72 65 20 6a 75 73  es, they are jus
3830: 74 20 65 6d 75 6c 61 74 69 6e 67 20 74 68 65 20  t emulating the 
3840: 6f 72 69 67 69 6e 61 6c 20 73 6f 75 72 63 65 20  original source 
3850: 61 73 20 61 20 44 61 74 61 62 61 73 65 20 54 61  as a Database Ta
3860: 62 6c 65 2e 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e 56  ble.</li>..<li>V
3870: 69 72 74 75 61 6c 20 54 61 62 6c 65 73 20 68 61  irtual Tables ha
3880: 76 65 20 76 65 72 79 20 70 6f 6f 72 20 73 70 65  ve very poor spe
3890: 65 64 20 70 65 72 66 6f 72 6d 61 6e 63 65 73 2c  ed performances,
38a0: 20 64 75 65 20 74 6f 20 74 68 65 20 20 65 6d 75   due to the  emu
38b0: 6c 61 74 69 6f 6e 2c 20 61 73 20 63 6f 6d 70 61  lation, as compa
38c0: 72 65 64 20 74 6f 20 67 65 6e 75 69 6e 65 20 44  red to genuine D
38d0: 61 74 61 62 61 73 65 20 54 61 62 6c 65 73 2e 3c  atabase Tables.<
38e0: 2f 6c 69 3e 0d 0a 3c 6c 69 3e 43 6f 6d 70 6c 65  /li>..<li>Comple
38f0: 78 20 53 51 4c 20 71 75 65 72 69 65 73 20 3c 62  x SQL queries <b
3900: 3e 4a 4f 49 4e 3c 2f 62 3e 69 6e 67 20 73 65 76  >JOIN</b>ing sev
3910: 65 72 61 6c 20 54 61 62 6c 65 73 20 63 61 6e 20  eral Tables can 
3920: 6f 66 74 65 6e 20 72 65 74 75 72 6e 20 6f 64 64  often return odd
3930: 20 61 6e 64 20 6d 69 73 6c 65 61 64 69 6e 67 20   and misleading 
3940: 72 65 73 75 6c 74 73 65 74 73 2c 20 77 68 65 6e  resultsets, when
3950: 20 6f 6e 65 20 6f 72 20 6d 6f 72 65 20 6f 66 20   one or more of 
3960: 74 68 65 20 3c 62 3e 4a 4f 49 4e 3c 2f 62 3e 65  the <b>JOIN</b>e
3970: 64 20 54 61 62 6c 65 73 20 61 72 65 20 6f 66 20  d Tables are of 
3980: 74 68 65 20 56 69 72 74 75 61 6c 20 74 79 70 65  the Virtual type
3990: 2e 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e 54 68 65 20  .</li>..<li>The 
39a0: 62 65 73 74 20 75 73 65 20 6f 66 20 61 20 56 69  best use of a Vi
39b0: 72 74 75 61 6c 20 54 61 62 6c 65 20 69 73 20 74  rtual Table is t
39c0: 6f 20 70 72 65 66 6f 72 6d 20 61 20 62 61 73 69  o preform a basi
39d0: 63 20 64 61 74 61 20 69 6d 70 6f 72 74 20 70 72  c data import pr
39e0: 6f 63 65 73 73 2c 20 6f 72 20 74 6f 20 71 75 69  ocess, or to qui
39f0: 63 6b 6c 79 20 67 65 74 20 61 6e 20 6f 76 65 72  ckly get an over
3a00: 61 6c 6c 20 67 6c 61 6e 63 65 20 61 74 20 61 20  all glance at a 
3a10: 66 75 6c 6c 20 64 61 74 61 73 65 74 20 77 69 74  full dataset wit
3a20: 68 6f 75 74 20 6e 65 63 65 73 73 61 72 69 6c 79  hout necessarily
3a30: 20 69 6d 70 6f 72 74 69 6e 67 20 69 74 20 69 6e   importing it in
3a40: 74 6f 20 74 68 65 20 44 61 74 61 62 61 73 65 2e  to the Database.
3a50: 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e 50 72 65 74 65  </li>..<li>Prete
3a60: 6e 64 69 6e 67 20 74 6f 20 75 73 65 20 61 20 56  nding to use a V
3a70: 69 72 74 75 61 6c 20 54 61 62 6c 65 20 61 73 20  irtual Table as 
3a80: 61 20 66 75 6c 6c 20 72 65 70 6c 61 63 65 6d 65  a full replaceme
3a90: 6e 74 20 6f 66 20 69 6d 70 6f 72 74 69 6e 67 20  nt of importing 
3aa0: 61 6c 6c 20 64 61 74 61 20 77 69 74 68 69 6e 20  all data within 
3ab0: 61 20 67 65 6e 75 69 6e 65 20 44 61 74 61 62 61  a genuine Databa
3ac0: 73 65 20 54 61 62 6c 65 20 69 73 20 73 74 72 6f  se Table is stro
3ad0: 6e 67 6c 79 20 64 69 73 63 6f 75 72 61 67 65 64  ngly discouraged
3ae0: 2c 20 61 6e 64 20 6e 65 76 65 72 20 69 73 20 61  , and never is a
3af0: 20 67 6f 6f 64 20 69 64 65 61 2e 3c 2f 6c 69 3e   good idea.</li>
3b00: 0d 0a 3c 2f 75 6c 3e 3c 62 72 3e 0d 0a 3c 62 3e  ..</ul><br>..<b>
3b10: 57 61 72 6e 69 6e 67 3c 2f 62 3e 3a 20 56 69 72  Warning</b>: Vir
3b20: 74 75 61 6c 54 65 78 74 20 54 61 62 6c 65 73 20  tualText Tables 
3b30: 61 72 65 20 61 6c 77 61 79 73 20 73 75 62 6a 65  are always subje
3b40: 63 74 20 74 6f 20 3c 62 3e 52 45 41 44 2d 4f 4e  ct to <b>READ-ON
3b50: 4c 59 3c 2f 62 3e 20 72 65 73 74 72 69 63 74 69  LY</b> restricti
3b60: 6f 6e 73 2e 20 41 6e 79 20 61 74 74 65 6d 70 74  ons. Any attempt
3b70: 20 74 6f 20 74 6f 20 65 78 65 63 75 74 65 20 61   to to execute a
3b80: 6e 20 3c 62 3e 49 4e 53 45 52 54 3c 2f 62 3e 2c  n <b>INSERT</b>,
3b90: 20 3c 62 3e 55 50 44 41 54 45 3c 2f 62 3e 20 6f   <b>UPDATE</b> o
3ba0: 72 20 3c 62 3e 44 45 4c 45 54 45 3c 2f 62 3e 20  r <b>DELETE</b> 
3bb0: 73 74 61 74 65 6d 65 6e 74 20 77 69 6c 6c 20 61  statement will a
3bc0: 6c 77 61 79 73 20 72 65 74 75 72 6e 20 61 6e 20  lways return an 
3bd0: 65 72 72 6f 72 2e 3c 62 72 3e 0d 0a 3c 2f 74 64  error.<br>..</td
3be0: 3e 3c 2f 74 72 3e 3c 2f 74 61 62 6c 65 3e 0d 0a  ></tr></table>..
3bf0: 3c 62 72 3e 0d 0a 3c 74 61 62 6c 65 20 62 67 63  <br>..<table bgc
3c00: 6f 6c 6f 72 3d 22 23 65 30 65 30 65 30 22 20 63  olor="#e0e0e0" c
3c10: 65 6c 6c 70 61 64 64 69 6e 67 3d 22 31 38 22 3e  ellpadding="18">
3c20: 3c 74 72 3e 3c 74 64 3e 0d 0a 3c 68 33 3e 52 65  <tr><td>..<h3>Re
3c30: 6c 61 74 65 64 20 54 6f 70 69 63 3c 2f 68 33 3e  lated Topic</h3>
3c40: 0d 0a 52 65 61 73 6f 6e 73 20 66 6f 72 20 6c 61  ..Reasons for la
3c50: 63 6b 20 6f 66 20 61 20 3c 69 3e 49 6d 70 6f 72  ck of a <i>Impor
3c60: 74 43 53 56 28 29 3c 2f 69 3e 20 66 75 6e 63 74  tCSV()</i> funct
3c70: 69 6f 6e 3a 0d 0a 3c 75 6c 3e 0d 0a 3c 6c 69 3e  ion:..<ul>..<li>
3c80: 42 61 73 65 64 20 6f 6e 20 74 68 65 20 66 61 63  Based on the fac
3c90: 74 20 74 68 61 74 20 43 53 56 20 61 6e 64 20 54  t that CSV and T
3ca0: 58 54 2f 54 41 42 20 61 72 65 20 76 65 72 79 20  XT/TAB are very 
3cb0: 6c 6f 6f 73 65 20 61 6e 64 20 76 61 72 69 61 62  loose and variab
3cc0: 6c 65 20 64 65 66 69 6e 65 64 20 66 6f 72 6d 61  le defined forma
3cd0: 74 2c 20 73 75 63 63 65 73 73 66 75 6c 6c 79 20  t, successfully 
3ce0: 6f 70 65 6e 69 6e 67 20 61 6e 64 20 72 65 61 64  opening and read
3cf0: 69 6e 67 20 61 20 54 65 78 74 20 66 69 6c 65 20  ing a Text file 
3d00: 75 73 75 61 6c 6c 79 20 72 65 71 75 69 72 65 73  usually requires
3d10: 20 73 65 76 65 72 61 6c 20 61 74 74 65 6d 70 74   several attempt
3d20: 73 20 62 65 66 6f 72 65 20 79 6f 75 20 66 69 6e  s before you fin
3d30: 61 6c 6c 79 20 22 67 75 65 73 73 22 20 74 68 65  ally "guess" the
3d40: 20 6d 6f 73 74 20 61 70 70 72 6f 70 72 69 61 74   most appropriat
3d50: 65 20 63 6f 6d 62 69 6e 61 74 69 6f 6e 20 6f 66  e combination of
3d60: 20 64 65 6c 69 6d 69 74 65 72 73 2f 73 65 70 61   delimiters/sepa
3d70: 72 61 74 6f 72 73 2e 3c 2f 6c 69 3e 0d 0a 3c 6c  rators.</li>..<l
3d80: 69 3e 54 68 65 72 65 66 6f 72 65 20 61 20 32 20  i>Therefore a 2 
3d90: 73 74 65 70 20 69 6d 70 6f 72 74 20 70 72 6f 63  step import proc
3da0: 65 73 73 20 69 73 20 61 64 76 69 73 65 64 3a 3c  ess is advised:<
3db0: 2f 6c 69 3e 0d 0a 3c 2f 75 6c 3e 0d 0a 3c 76 65  /li>..</ul>..<ve
3dc0: 72 62 61 74 69 6d 3e 0d 0a 2d 2d 2d 2d 2d 2d 2d  rbatim>..-------
3dd0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
3de0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
3df0: 2d 0d 0a 2d 2d 20 53 74 65 70 20 31 3a 20 63 72  -..-- Step 1: cr
3e00: 65 61 74 65 20 61 20 76 69 72 74 75 61 6c 20 74  eate a virtual t
3e10: 61 62 6c 65 20 75 73 69 6e 67 20 56 69 72 74 75  able using Virtu
3e20: 61 6c 54 65 78 74 0d 0a 2d 2d 2d 2d 2d 2d 2d 2d  alText..--------
3e30: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
3e40: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
3e50: 0d 0a 43 52 45 41 54 45 20 56 49 52 54 55 41 4c  ..CREATE VIRTUAL
3e60: 20 54 41 42 4c 45 20 76 69 72 74 75 61 6c 5f 63   TABLE virtual_c
3e70: 69 74 69 65 73 31 30 30 30 20 55 53 49 4e 47 20  ities1000 USING 
3e80: 56 69 72 74 75 61 6c 54 65 78 74 0d 0a 28 0d 0a  VirtualText..(..
3e90: 20 20 20 20 27 63 69 74 69 65 73 31 30 30 30 2e      'cities1000.
3ea0: 74 78 74 27 2c 20 20 20 2d 2d 20 61 62 73 6f 6c  txt',   -- absol
3eb0: 75 74 65 20 6f 72 20 72 65 6c 61 74 69 76 65 20  ute or relative 
3ec0: 70 61 74 68 20 6c 65 61 64 69 6e 67 20 74 6f 20  path leading to 
3ed0: 74 68 65 20 74 65 78 74 66 69 6c 65 20 0d 0a 20  the textfile .. 
3ee0: 20 20 20 27 55 54 46 2d 38 27 2c 20 20 20 20 20     'UTF-8',     
3ef0: 20 20 20 20 20 20 20 2d 2d 20 63 68 61 72 73 65         -- charse
3f00: 74 20 65 6e 63 6f 64 69 6e 67 20 75 73 65 64 20  t encoding used 
3f10: 62 79 20 74 68 65 20 74 65 78 74 66 69 6c 65 0d  by the textfile.
3f20: 0a 20 20 20 20 30 2c 20 20 20 20 20 20 20 20 20  .    0,         
3f30: 20 20 20 20 20 20 20 20 20 2d 2d 20 64 6f 65 73           -- does
3f40: 20 74 68 65 20 66 69 72 73 74 20 6c 69 6e 65 20   the first line 
3f50: 63 6f 6e 74 61 69 6e 73 20 63 6f 6c 75 6d 6e 20  contains column 
3f60: 6e 61 6d 65 73 20 5b 30 3d 6e 6f 2c 20 31 3d 79  names [0=no, 1=y
3f70: 65 73 5d 0d 0a 20 20 20 20 50 4f 49 4e 54 2c 20  es]..    POINT, 
3f80: 20 20 20 20 20 20 20 20 20 20 20 20 20 2d 2d 20               -- 
3f90: 74 68 65 20 64 65 63 69 6d 61 6c 20 73 65 70 61  the decimal sepa
3fa0: 72 61 74 6f 72 20 5b 50 4f 49 4e 54 20 6f 72 20  rator [POINT or 
3fb0: 43 4f 4d 4d 41 5d 0d 0a 20 20 20 20 4e 4f 4e 45  COMMA]..    NONE
3fc0: 2c 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20  ,               
3fd0: 2d 2d 20 74 68 65 20 74 65 78 74 20 73 65 70 61  -- the text sepa
3fe0: 72 61 74 6f 72 20 5b 4e 4f 4e 45 2c 20 53 49 4e  rator [NONE, SIN
3ff0: 47 4c 45 51 55 4f 54 45 20 6f 72 20 44 4f 55 42  GLEQUOTE or DOUB
4000: 4c 45 51 55 4f 54 45 5d 0d 0a 20 20 20 20 54 41  LEQUOTE]..    TA
4010: 42 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20  B               
4020: 20 20 2d 2d 20 74 68 65 20 66 69 65 6c 64 20 73    -- the field s
4030: 65 70 61 72 61 74 6f 72 20 5b 54 41 42 2c 20 27  eparator [TAB, '
4040: 2c 27 2c 20 27 3a 27 20 6f 72 20 6f 74 68 65 72  ,', ':' or other
4050: 20 63 68 61 72 61 74 65 72 5d 0d 0a 29 3b 0d 0a   charater]..);..
4060: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
4070: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
4080: 2d 2d 2d 2d 2d 2d 2d 2d 0d 0a 3c 2f 76 65 72 62  --------..</verb
4090: 61 74 69 6d 3e 0d 0a 41 74 20 74 68 69 73 20 70  atim>..At this p
40a0: 6f 69 6e 74 2c 20 61 20 3c 62 3e 74 68 6f 72 6f  oint, a <b>thoro
40b0: 75 67 68 20 63 68 65 63 6b 3c 2f 62 3e 20 6f 66  ugh check</b> of
40c0: 20 74 68 65 20 72 65 73 75 6c 74 73 20 69 73 20   the results is 
40d0: 6e 65 65 64 65 64 3a 0d 0a 3c 75 6c 3e 0d 0a 3c  needed:..<ul>..<
40e0: 6c 69 3e 64 6f 20 74 68 65 20 63 6f 6c 75 6d 6e  li>do the column
40f0: 20 6e 61 6d 65 73 20 6d 61 6b 65 20 73 65 6e 73   names make sens
4100: 65 3f 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e 61 72 65  e?</li>..<li>are
4110: 20 74 68 65 20 64 61 74 65 73 20 63 6f 72 72 65   the dates corre
4120: 63 74 3f 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e 61 72  ct?</li>..<li>ar
4130: 65 20 74 68 65 20 73 70 65 63 69 61 6c 20 63 68  e the special ch
4140: 61 72 61 63 74 65 72 73 20 63 6f 72 72 65 63 74  aracters correct
4150: 20 3f 20 28 6e 65 65 64 65 64 20 63 6f 72 72 65   ? (needed corre
4160: 63 74 69 6f 6e 20 6f 66 20 63 68 61 72 73 65 74  ction of charset
4170: 20 65 6e 63 6f 64 69 6e 67 29 3c 2f 6c 69 3e 0d   encoding)</li>.
4180: 0a 3c 6c 69 3e 69 73 20 61 6c 6c 20 74 68 65 20  .<li>is all the 
4190: 64 61 74 61 20 72 65 61 6c 6c 79 20 6e 65 65 64  data really need
41a0: 65 64 20 3f 0d 0a 3c 75 6c 3e 0d 0a 3c 6c 69 3e  ed ?..<ul>..<li>
41b0: 77 68 61 74 20 66 69 6c 74 65 72 73 20 61 72 65  what filters are
41c0: 20 6e 65 65 64 65 64 20 74 6f 20 69 6d 70 6f 72   needed to impor
41d0: 74 20 74 68 65 20 6e 65 65 64 65 64 20 64 61 74  t the needed dat
41e0: 61 20 3f 3c 2f 6c 69 3e 0d 0a 3c 2f 75 6c 3e 3c  a ?</li>..</ul><
41f0: 2f 6c 69 3e 0d 0a 3c 2f 75 6c 3e 0d 0a 3c 76 65  /li>..</ul>..<ve
4200: 72 62 61 74 69 6d 3e 0d 0a 2d 2d 2d 2d 2d 2d 2d  rbatim>..-------
4210: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
4220: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
4230: 2d 0d 0a 2d 2d 20 53 74 65 70 20 32 3a 20 63 72  -..-- Step 2: cr
4240: 65 61 74 65 20 61 20 66 69 6e 61 6c 20 54 41 42  eate a final TAB
4250: 4c 45 20 75 73 69 6e 67 20 74 68 65 20 76 69 72  LE using the vir
4260: 74 75 61 6c 20 74 61 62 6c 65 20 73 6f 75 72 63  tual table sourc
4270: 65 0d 0a 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  e..-------------
4280: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
4290: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0d 0a 43 52 45  -----------..CRE
42a0: 41 54 45 20 54 41 42 4c 45 20 63 69 74 69 65 73  ATE TABLE cities
42b0: 5f 69 74 61 6c 79 20 41 53 20 53 45 4c 45 43 54  _italy AS SELECT
42c0: 0d 0a 20 20 20 20 43 4f 4c 30 30 32 20 41 53 20  ..    COL002 AS 
42d0: 6e 61 6d 65 2c 0d 0a 20 20 20 20 43 4f 4c 30 30  name,..    COL00
42e0: 36 20 41 53 20 6c 6f 6e 67 69 74 75 64 65 2c 0d  6 AS longitude,.
42f0: 0a 20 20 20 20 43 4f 4c 30 30 35 20 41 53 20 6c  .    COL005 AS l
4300: 61 74 69 74 75 64 65 2c 0d 0a 20 20 20 20 4d 61  atitude,..    Ma
4310: 6b 65 50 6f 69 6e 74 28 43 4f 4c 30 30 36 2c 20  kePoint(COL006, 
4320: 43 4f 4c 30 30 35 2c 20 34 33 32 36 29 20 41 53  COL005, 4326) AS
4330: 20 67 65 6f 6d 5f 77 73 67 38 34 2c 20 20 20 20   geom_wsg84,    
4340: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
4350: 20 20 20 20 20 20 2d 2d 20 63 72 65 61 74 65 20        -- create 
4360: 74 68 65 20 6f 72 69 67 69 6e 61 6c 20 50 4f 49  the original POI
4370: 4e 54 20 61 73 20 57 67 73 38 34 0d 0a 20 20 20  NT as Wgs84..   
4380: 20 53 54 5f 54 72 61 6e 73 66 6f 72 6d 28 4d 61   ST_Transform(Ma
4390: 6b 65 50 6f 69 6e 74 28 43 4f 4c 30 30 36 2c 20  kePoint(COL006, 
43a0: 43 4f 4c 30 30 35 2c 20 34 33 32 36 29 2c 33 32  COL005, 4326),32
43b0: 36 33 32 29 20 41 53 20 67 65 6f 6d 5f 75 74 6d  632) AS geom_utm
43c0: 5f 31 39 6e 20 20 20 20 20 2d 2d 20 63 72 65 61  _19n     -- crea
43d0: 74 65 20 74 68 65 20 20 50 4f 49 4e 54 20 61 73  te the  POINT as
43e0: 20 57 47 53 20 38 34 20 2f 20 55 54 4d 20 7a 6f   WGS 84 / UTM zo
43f0: 6e 65 20 33 32 4e 2c 20 77 68 69 63 68 20 74 68  ne 32N, which th
4400: 65 20 6f 74 68 65 72 20 74 61 62 6c 65 73 20 75  e other tables u
4410: 73 65 0d 0a 46 52 4f 4d 20 76 69 72 74 75 61 6c  se..FROM virtual
4420: 5f 63 69 74 69 65 73 31 30 30 30 20 57 48 45 52  _cities1000 WHER
4430: 45 20 43 4f 4c 30 30 39 20 3d 20 27 49 54 27 20  E COL009 = 'IT' 
4440: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
4450: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
4460: 2d 2d 20 66 69 6c 74 65 72 20 6f 75 74 20 61 6c  -- filter out al
4470: 6c 20 6e 6f 6e 2d 69 74 61 6c 69 65 6e 20 63 69  l non-italien ci
4480: 74 69 65 73 0d 0a 3b 0d 0a 0d 0a 2d 2d 2d 2d 2d  ties..;....-----
4490: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
44a0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
44b0: 2d 2d 2d 0d 0a 2d 2d 20 73 75 63 68 20 47 65 6f  ---..-- such Geo
44c0: 6d 65 74 72 69 65 73 2c 20 63 72 65 61 74 65 64  metries, created
44d0: 20 6f 6e 20 74 68 65 20 66 6c 79 2c 20 6d 75 73   on the fly, mus
44e0: 74 20 62 65 20 72 65 67 69 73 74 65 72 65 64 3a  t be registered:
44f0: 0d 0a 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ..--------------
4500: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
4510: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0d 0a 53 45 4c 45  ----------..SELE
4520: 43 54 20 52 65 63 6f 76 65 72 47 65 6f 6d 65 74  CT RecoverGeomet
4530: 72 79 43 6f 6c 75 6d 6e 0d 0a 28 0d 0a 20 20 20  ryColumn..(..   
4540: 20 27 63 69 74 69 65 73 5f 69 74 61 6c 79 27 2c   'cities_italy',
4550: 20 20 20 20 20 20 20 20 20 2d 2d 20 74 61 62 6c           -- tabl
4560: 65 2d 6e 61 6d 65 0d 0a 20 20 20 20 27 67 65 6f  e-name..    'geo
4570: 6d 5f 77 73 67 38 34 27 2c 20 20 20 20 20 20 20  m_wsg84',       
4580: 20 20 20 20 2d 2d 20 67 65 6f 6d 65 74 72 79 20      -- geometry 
4590: 63 6f 6c 75 6d 6e 2d 6e 61 6d 65 0d 0a 20 20 20  column-name..   
45a0: 20 34 33 32 36 2c 20 20 20 20 20 20 20 20 20 20   4326,          
45b0: 20 20 20 20 20 20 20 20 20 2d 2d 20 73 72 69 64           -- srid
45c0: 20 6f 66 20 67 65 6f 6d 65 74 72 79 0d 0a 20 20   of geometry..  
45d0: 20 20 27 50 4f 49 4e 54 27 2c 20 20 20 20 20 20    'POINT',      
45e0: 20 20 20 20 20 20 20 20 20 20 2d 2d 20 67 65 6f            -- geo
45f0: 6d 65 74 72 79 2d 74 79 70 65 0d 0a 29 3b 0d 0a  metry-type..);..
4600: 53 45 4c 45 43 54 20 52 65 63 6f 76 65 72 47 65  SELECT RecoverGe
4610: 6f 6d 65 74 72 79 43 6f 6c 75 6d 6e 28 27 63 69  ometryColumn('ci
4620: 74 69 65 73 5f 69 74 61 6c 79 27 2c 27 67 65 6f  ties_italy','geo
4630: 6d 5f 75 74 6d 5f 31 39 6e 27 2c 33 32 36 33 32  m_utm_19n',32632
4640: 2c 27 50 4f 49 4e 54 27 29 3b 0d 0a 0d 0a 2d 2d  ,'POINT');....--
4650: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
4660: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
4670: 2d 2d 2d 2d 2d 2d 0d 0a 2d 2d 20 43 72 65 61 74  ------..-- Creat
4680: 65 20 61 20 53 70 61 74 69 61 6c 2d 49 6e 64 65  e a Spatial-Inde
4690: 78 20 66 6f 72 20 74 68 65 20 47 65 6f 6d 65 74  x for the Geomet
46a0: 72 69 65 73 0d 0a 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ries..----------
46b0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
46c0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0d 0a  --------------..
46d0: 53 45 4c 45 43 54 20 43 72 65 61 74 65 53 70 61  SELECT CreateSpa
46e0: 74 69 61 6c 49 6e 64 65 78 0d 0a 28 0d 0a 20 20  tialIndex..(..  
46f0: 20 20 27 63 69 74 69 65 73 5f 69 74 61 6c 79 27    'cities_italy'
4700: 2c 20 20 20 20 20 20 20 20 20 2d 2d 20 74 61 62  ,         -- tab
4710: 6c 65 2d 6e 61 6d 65 0d 0a 20 20 20 20 27 67 65  le-name..    'ge
4720: 6f 6d 5f 77 73 67 38 34 27 20 20 20 20 20 20 20  om_wsg84'       
4730: 20 20 20 20 20 2d 2d 20 67 65 6f 6d 65 74 72 79       -- geometry
4740: 20 63 6f 6c 75 6d 6e 2d 6e 61 6d 65 0d 0a 29 3b   column-name..);
4750: 0d 0a 53 45 4c 45 43 54 20 43 72 65 61 74 65 53  ..SELECT CreateS
4760: 70 61 74 69 61 6c 49 6e 64 65 78 28 27 63 69 74  patialIndex('cit
4770: 69 65 73 5f 69 74 61 6c 79 27 2c 27 67 65 6f 6d  ies_italy','geom
4780: 5f 75 74 6d 5f 31 39 6e 27 29 3b 0d 0a 0d 0a 2d  _utm_19n');....-
4790: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
47a0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
47b0: 2d 2d 2d 2d 2d 2d 2d 0d 0a 2d 2d 20 55 70 64 61  -------..-- Upda
47c0: 74 65 20 74 68 65 20 6d 65 74 61 64 61 74 61 20  te the metadata 
47d0: 66 6f 72 20 74 68 65 20 44 61 74 61 62 61 73 65  for the Database
47e0: 0d 0a 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ..--------------
47f0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
4800: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0d 0a 53 45 4c 45  ----------..SELE
4810: 43 54 20 55 70 64 61 74 65 4c 61 79 65 72 53 74  CT UpdateLayerSt
4820: 61 74 69 73 74 69 63 73 0d 0a 28 0d 0a 20 20 20  atistics..(..   
4830: 20 27 63 69 74 69 65 73 5f 69 74 61 6c 79 27 2c   'cities_italy',
4840: 20 20 20 20 20 20 20 20 20 2d 2d 20 74 61 62 6c           -- tabl
4850: 65 2d 6e 61 6d 65 0d 0a 20 20 20 20 27 67 65 6f  e-name..    'geo
4860: 6d 5f 77 73 67 38 34 27 20 20 20 20 20 20 20 20  m_wsg84'        
4870: 20 20 20 20 2d 2d 20 67 65 6f 6d 65 74 72 79 20      -- geometry 
4880: 63 6f 6c 75 6d 6e 2d 6e 61 6d 65 0d 0a 29 3b 0d  column-name..);.
4890: 0a 53 45 4c 45 43 54 20 55 70 64 61 74 65 4c 61  .SELECT UpdateLa
48a0: 79 65 72 53 74 61 74 69 73 74 69 63 73 28 27 63  yerStatistics('c
48b0: 69 74 69 65 73 5f 69 74 61 6c 79 27 2c 27 67 65  ities_italy','ge
48c0: 6f 6d 5f 75 74 6d 5f 31 39 6e 27 29 3b 0d 0a 0d  om_utm_19n');...
48d0: 0a 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  .---------------
48e0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
48f0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 0d 0a 44 52 4f 50 20  ---------..DROP 
4900: 54 41 42 4c 45 20 49 46 20 45 58 49 53 54 53 20  TABLE IF EXISTS 
4910: 76 69 72 74 75 61 6c 5f 63 69 74 69 65 73 31 30  virtual_cities10
4920: 30 30 20 3b 0d 0a 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  00 ;..----------
4930: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
4940: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0d 0a  --------------..
4950: 3c 2f 76 65 72 62 61 74 69 6d 3e 0d 0a 3c 2f 74  </verbatim>..</t
4960: 64 3e 3c 2f 74 72 3e 3c 2f 74 61 62 6c 65 3e 0d  d></tr></table>.
4970: 0a 3c 62 72 3e 0d 0a 3c 68 72 3e 0d 0a 3c 68 31  .<br>..<hr>..<h1
4980: 3e 3c 61 20 69 64 3d 22 56 69 72 74 75 61 6c 58  ><a id="VirtualX
4990: 4c 22 3e 56 69 72 74 75 61 6c 58 4c 3c 2f 61 3e  L">VirtualXL</a>
49a0: 3c 2f 68 31 3e 0d 0a 54 68 65 20 3c 62 3e 56 69  </h1>..The <b>Vi
49b0: 72 74 75 61 6c 58 4c 3c 2f 62 3e 20 49 6e 74 65  rtualXL</b> Inte
49c0: 72 66 61 63 65 20 61 6c 6c 6f 77 73 20 74 6f 20  rface allows to 
49d0: 64 69 72 65 63 74 6c 79 20 61 63 63 65 73 73 20  directly access 
49e0: 61 6e 20 65 78 74 65 72 6e 61 6c 20 4d 53 20 45  an external MS E
49f0: 78 63 65 6c 20 73 70 72 65 61 64 73 68 65 65 74  xcel spreadsheet
4a00: 20 28 4c 65 67 61 63 79 20 62 69 6e 61 72 79 20   (Legacy binary 
4a10: 66 6f 72 6d 61 74 20 3c 62 3e 2a 2e 78 6c 73 3c  format <b>*.xls<
4a20: 2f 62 3e 2c 20 69 2e 65 2e 20 6e 6f 74 20 20 3c  /b>, i.e. not  <
4a30: 62 3e 2a 2e 78 6c 73 6d 3c 2f 62 3e 20 6f 72 20  b>*.xlsm</b> or 
4a40: 27 4c 69 62 72 65 4f 66 66 69 63 65 20 43 61 6c  'LibreOffice Cal
4a50: 63 27 20 3c 62 3e 2a 2e 6f 64 73 3c 2f 62 3e 20  c' <b>*.ods</b> 
4a60: 66 69 6c 65 73 29 20 20 62 79 20 75 73 69 6e 67  files)  by using
4a70: 20 73 74 61 6e 64 61 72 64 20 53 70 61 74 69 61   standard Spatia
4a80: 6c 20 53 51 4c 20 71 75 65 72 69 65 73 2e 3c 62  l SQL queries.<b
4a90: 72 3e 0d 0a 53 79 6e 74 61 78 20 66 6f 72 20 63  r>..Syntax for c
4aa0: 72 65 61 74 69 6e 67 20 61 20 56 69 72 74 75 61  reating a Virtua
4ab0: 6c 58 4c 20 54 61 62 6c 65 3a 0d 0a 3c 76 65 72  lXL Table:..<ver
4ac0: 62 61 74 69 6d 3e 0d 0a 53 45 4c 45 43 54 20 43  batim>..SELECT C
4ad0: 52 45 41 54 45 20 56 49 52 54 55 41 4c 20 54 41  REATE VIRTUAL TA
4ae0: 42 4c 45 20 6d 79 5f 74 61 62 6c 65 20 55 53 49  BLE my_table USI
4af0: 4e 47 20 56 69 72 74 75 61 6c 58 4c 20 28 20 78  NG VirtualXL ( x
4b00: 6c 73 5f 70 61 74 68 20 29 3b 0d 0a 0d 0a 53 45  ls_path );....SE
4b10: 4c 45 43 54 20 43 52 45 41 54 45 20 56 49 52 54  LECT CREATE VIRT
4b20: 55 41 4c 20 54 41 42 4c 45 20 6d 79 5f 74 61 62  UAL TABLE my_tab
4b30: 6c 65 20 55 53 49 4e 47 20 56 69 72 74 75 61 6c  le USING Virtual
4b40: 58 4c 20 28 20 78 6c 73 5f 70 61 74 68 20 2c 20  XL ( xls_path , 
4b50: 77 6f 72 6b 73 68 65 65 74 5f 69 6e 64 65 78 20  worksheet_index 
4b60: 29 3b 0d 0a 0d 0a 53 45 4c 45 43 54 20 43 52 45  );....SELECT CRE
4b70: 41 54 45 20 56 49 52 54 55 41 4c 20 54 41 42 4c  ATE VIRTUAL TABL
4b80: 45 20 6d 79 5f 74 61 62 6c 65 20 55 53 49 4e 47  E my_table USING
4b90: 20 56 69 72 74 75 61 6c 58 4c 20 28 20 78 6c 73   VirtualXL ( xls
4ba0: 5f 70 61 74 68 20 2c 20 77 6f 72 6b 73 68 65 65  _path , workshee
4bb0: 74 5f 69 6e 64 65 78 20 2c 20 66 69 72 73 74 5f  t_index , first_
4bc0: 72 6f 77 5f 61 73 5f 74 69 74 6c 65 73 20 29 3b  row_as_titles );
4bd0: 0d 0a 3c 2f 76 65 72 62 61 74 69 6d 3e 0d 0a 53  ..</verbatim>..S
4be0: 75 70 70 6f 72 74 65 64 20 61 72 67 75 6d 65 6e  upported argumen
4bf0: 74 73 20 61 6e 64 20 74 68 65 69 72 20 69 6e 74  ts and their int
4c00: 65 72 70 72 65 74 61 74 69 6f 6e 3a 0d 0a 3c 75  erpretation:..<u
4c10: 6c 3e 0d 0a 3c 6c 69 3e 3c 62 3e 78 6c 73 5f 70  l>..<li><b>xls_p
4c20: 61 74 68 3c 2f 62 3e 20 28 3c 69 3e 3c 62 3e 6d  ath</b> (<i><b>m
4c30: 61 6e 64 61 74 6f 72 79 3c 2f 62 3e 3c 2f 69 3e  andatory</b></i>
4c40: 29 3a 20 74 68 65 20 72 65 6c 61 74 69 76 65 20  ): the relative 
4c50: 6f 72 20 61 62 73 6f 6c 75 74 65 20 70 61 74 68  or absolute path
4c60: 6e 61 6d 65 20 6c 65 61 64 69 6e 67 20 74 6f 20  name leading to 
4c70: 74 68 65 20 65 78 74 65 72 6e 61 6c 20 4d 53 20  the external MS 
4c80: 45 78 63 65 6c 20 73 70 72 65 61 64 73 68 65 65  Excel spreadshee
4c90: 74 20 28 6f 6c 64 20 62 69 6e 61 72 79 20 66 6f  t (old binary fo
4ca0: 72 6d 61 74 20 3c 69 3e 2a 2e 78 6c 73 3c 2f 69  rmat <i>*.xls</i
4cb0: 3e 29 2e 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e 3c 62  >).</li>..<li><b
4cc0: 3e 77 6f 72 6b 73 68 65 65 74 5f 69 6e 64 65 78  >worksheet_index
4cd0: 3c 2f 62 3e 20 28 3c 69 3e 3c 62 3e 6f 70 74 69  </b> (<i><b>opti
4ce0: 6f 6e 61 6c 3c 2f 62 3e 3c 2f 69 3e 29 3a 20 74  onal</b></i>): t
4cf0: 68 65 20 69 6e 64 65 78 20 69 64 65 6e 74 69 66  he index identif
4d00: 79 69 6e 67 20 6f 6e 65 20 6f 66 20 74 68 65 20  ying one of the 
4d10: 77 6f 72 6b 73 68 65 65 74 73 20 77 69 74 68 69  worksheets withi
4d20: 6e 20 74 68 65 20 45 78 63 65 6c 20 64 6f 63 75  n the Excel docu
4d30: 6d 65 6e 74 2e 3c 62 72 3e 0d 0a 4d 53 20 45 78  ment.<br>..MS Ex
4d40: 63 65 6c 20 6d 61 79 20 63 6f 6e 74 61 69 6e 20  cel may contain 
4d50: 6d 6f 72 65 20 74 68 61 6e 20 6f 6e 65 20 77 6f  more than one wo
4d60: 72 6b 73 68 65 65 74 2c 20 61 6e 64 20 65 61 63  rksheet, and eac
4d70: 68 20 69 6e 64 69 76 69 64 75 61 6c 20 77 6f 72  h individual wor
4d80: 6b 73 68 65 65 74 20 69 73 20 69 64 65 6e 74 69  ksheet is identi
4d90: 66 69 65 64 20 62 79 20 69 74 73 20 6f 77 6e 20  fied by its own 
4da0: 69 6e 64 65 78 20 28 3c 62 3e 7a 65 72 6f 2d 62  index (<b>zero-b
4db0: 61 73 65 64 3c 2f 62 3e 20 69 6e 64 65 78 3b 20  ased</b> index; 
4dc0: 74 68 65 20 66 69 72 73 74 20 77 6f 72 6b 73 68  the first worksh
4dd0: 65 65 74 20 61 6c 77 61 79 73 20 68 61 73 20 3c  eet always has <
4de0: 62 3e 69 6e 64 65 78 3d 30 3c 2f 62 3e 29 2e 3c  b>index=0</b>).<
4df0: 62 72 3e 0d 0a 49 66 20 6e 6f 74 20 65 78 70 6c  br>..If not expl
4e00: 69 63 69 74 6c 79 20 73 70 65 63 69 66 69 65 64  icitly specified
4e10: 20 74 68 65 20 66 69 72 73 74 20 77 6f 72 6b 73   the first works
4e20: 68 65 65 74 20 77 69 6c 6c 20 61 6c 77 61 79 73  heet will always
4e30: 20 62 65 20 61 73 73 75 6d 65 64 20 28 64 65 66   be assumed (def
4e40: 61 75 6c 74 20 76 61 6c 75 65 29 2e 3c 2f 6c 69  ault value).</li
4e50: 3e 0d 0a 3c 6c 69 3e 3c 62 3e 66 69 72 73 74 5f  >..<li><b>first_
4e60: 72 6f 77 5f 61 73 5f 74 69 74 6c 65 73 3c 2f 62  row_as_titles</b
4e70: 3e 20 28 3c 69 3e 3c 62 3e 6f 70 74 69 6f 6e 61  > (<i><b>optiona
4e80: 6c 3c 2f 62 3e 3c 2f 69 3e 29 3a 20 74 68 69 73  l</b></i>): this
4e90: 20 69 73 20 61 20 3c 62 3e 42 4f 4f 4c 45 41 4e   is a <b>BOOLEAN
4ea0: 3c 2f 62 3e 20 66 6c 61 67 3a 0d 0a 3c 75 6c 3e  </b> flag:..<ul>
4eb0: 0d 0a 3c 6c 69 3e 69 66 20 73 65 74 20 74 6f 20  ..<li>if set to 
4ec0: 3c 62 3e 30 3c 2f 62 3e 20 28 3c 62 3e 46 41 4c  <b>0</b> (<b>FAL
4ed0: 53 45 3c 2f 62 3e 29 20 61 6c 6c 20 63 6f 6c 75  SE</b>) all colu
4ee0: 6d 6e 20 6e 61 6d 65 73 20 77 69 6c 6c 20 62 65  mn names will be
4ef0: 20 61 75 74 6f 6d 61 74 69 63 61 6c 6c 79 20 73   automatically s
4f00: 65 74 20 62 79 20 75 73 69 6e 67 20 61 20 70 72  et by using a pr
4f10: 6f 67 72 65 73 73 69 76 65 20 73 65 71 75 65 6e  ogressive sequen
4f20: 63 65 2e 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e 69 66  ce.</li>..<li>if
4f30: 20 73 65 74 20 74 6f 20 61 6e 79 20 6f 74 68 65   set to any othe
4f40: 72 20 69 6e 74 65 67 65 72 20 76 61 6c 75 65 20  r integer value 
4f50: 28 3c 62 3e 54 52 55 45 3c 2f 62 3e 29 20 61 6c  (<b>TRUE</b>) al
4f60: 6c 20 63 6f 6c 75 6d 6e 20 6e 61 6d 65 73 20 77  l column names w
4f70: 69 6c 6c 20 62 79 20 65 78 70 65 63 74 65 64 20  ill by expected 
4f80: 74 6f 20 62 65 20 64 65 66 69 6e 65 64 20 69 6e  to be defined in
4f90: 20 74 68 65 20 76 65 72 79 20 66 69 72 73 74 20   the very first 
4fa0: 72 6f 77 20 6f 66 20 74 68 65 20 53 70 72 65 61  row of the Sprea
4fb0: 64 73 68 65 65 74 2e 3c 2f 6c 69 3e 0d 0a 3c 6c  dsheet.</li>..<l
4fc0: 69 3e 69 66 20 6e 6f 74 20 65 78 70 6c 69 63 69  i>if not explici
4fd0: 74 6c 79 20 73 70 65 63 69 66 69 65 64 2c 20 3c  tly specified, <
4fe0: 62 3e 54 52 55 45 3c 2f 62 3e 20 77 69 6c 6c 20  b>TRUE</b> will 
4ff0: 61 6c 77 61 79 73 20 62 65 20 61 73 73 75 6d 65  always be assume
5000: 64 20 28 64 65 66 61 75 6c 74 20 73 65 74 74 69  d (default setti
5010: 6e 67 29 2e 3c 2f 6c 69 3e 0d 0a 3c 2f 75 6c 3e  ng).</li>..</ul>
5020: 3c 2f 6c 69 3e 0d 0a 3c 75 6c 3e 0d 0a 3c 2f 75  </li>..<ul>..</u
5030: 6c 3e 3c 2f 6c 69 3e 0d 0a 3c 2f 75 6c 3e 3c 62  l></li>..</ul><b
5040: 72 3e 0d 0a 3c 74 61 62 6c 65 20 62 67 63 6f 6c  r>..<table bgcol
5050: 6f 72 3d 22 23 66 66 66 66 64 30 22 20 63 65 6c  or="#ffffd0" cel
5060: 6c 70 61 64 64 69 6e 67 3d 22 31 38 22 3e 3c 74  lpadding="18"><t
5070: 72 3e 3c 74 64 3e 0d 0a 3c 62 3e 4e 6f 74 65 3c  r><td>..<b>Note<
5080: 2f 62 3e 3a 20 61 6e 79 20 54 65 78 74 20 53 74  /b>: any Text St
5090: 72 69 6e 67 2c 20 71 75 6f 74 65 64 20 6f 72 20  ring, quoted or 
50a0: 6e 6f 74 2c 20 77 68 65 6e 20 69 74 20 61 70 70  not, when it app
50b0: 65 61 72 73 20 61 73 20 61 20 56 69 72 74 75 61  ears as a Virtua
50c0: 6c 20 54 61 62 6c 65 20 61 72 67 75 6d 65 6e 74  l Table argument
50d0: 20 68 61 73 20 74 68 65 20 73 61 6d 65 20 65 66   has the same ef
50e0: 66 65 63 74 2e 0d 0a 3c 76 65 72 62 61 74 69 6d  fect...<verbatim
50f0: 3e 0d 0a 53 45 4c 45 43 54 20 43 52 45 41 54 45  >..SELECT CREATE
5100: 20 56 49 52 54 55 41 4c 20 54 41 42 4c 45 20 6d   VIRTUAL TABLE m
5110: 79 5f 74 61 62 6c 65 20 55 53 49 4e 47 20 56 69  y_table USING Vi
5120: 72 74 75 61 6c 58 4c 28 20 2f 68 6f 6d 65 2f 73  rtualXL( /home/s
5130: 61 6e 64 72 6f 2f 6d 79 73 70 72 65 61 64 73 68  andro/myspreadsh
5140: 65 65 74 2e 78 6c 73 20 2c 20 33 2c 20 31 20 29  eet.xls , 3, 1 )
5150: 3b 0d 0a 6f 72 0d 0a 53 45 4c 45 43 54 20 43 52  ;..or..SELECT CR
5160: 45 41 54 45 20 56 49 52 54 55 41 4c 20 54 41 42  EATE VIRTUAL TAB
5170: 4c 45 20 6d 79 5f 74 61 62 6c 65 20 55 53 49 4e  LE my_table USIN
5180: 47 20 56 69 72 74 75 61 6c 58 4c 28 20 27 2f 68  G VirtualXL( '/h
5190: 6f 6d 65 2f 73 61 6e 64 72 6f 2f 6d 79 73 70 72  ome/sandro/myspr
51a0: 65 61 64 73 68 65 65 74 2e 78 6c 73 27 20 2c 20  eadsheet.xls' , 
51b0: 33 2c 20 31 20 29 3b 0d 0a 3c 2f 76 65 72 62 61  3, 1 );..</verba
51c0: 74 69 6d 3e 0d 0a 42 6f 74 68 20 6e 6f 74 61 74  tim>..Both notat
51d0: 69 6f 6e 73 20 77 69 6c 6c 20 70 72 6f 64 75 63  ions will produc
51e0: 65 20 74 68 65 20 73 61 6d 65 20 72 65 73 75 6c  e the same resul
51f0: 74 2e 0d 0a 3c 2f 74 64 3e 3c 2f 74 72 3e 3c 2f  t...</td></tr></
5200: 74 61 62 6c 65 3e 0d 0a 3c 62 72 3e 0d 0a 3c 74  table>..<br>..<t
5210: 61 62 6c 65 20 62 67 63 6f 6c 6f 72 3d 22 23 64  able bgcolor="#d
5220: 30 66 66 64 30 22 20 63 65 6c 6c 70 61 64 64 69  0ffd0" cellpaddi
5230: 6e 67 3d 22 31 38 22 3e 3c 74 72 3e 3c 74 64 3e  ng="18"><tr><td>
5240: 0d 0a 3c 68 33 3e 42 65 73 74 20 70 72 61 63 74  ..<h3>Best pract
5250: 69 63 65 73 20 61 6e 64 20 6b 6e 6f 77 6e 20 6c  ices and known l
5260: 69 6d 69 74 61 74 69 6f 6e 73 3c 2f 68 33 3e 0d  imitations</h3>.
5270: 0a 3c 75 6c 3e 0d 0a 3c 6c 69 3e 56 69 72 74 75  .<ul>..<li>Virtu
5280: 61 6c 20 54 61 62 6c 65 73 20 61 72 65 20 6e 6f  al Tables are no
5290: 74 20 72 65 61 6c 6c 79 20 67 65 6e 75 69 6e 65  t really genuine
52a0: 20 44 61 74 61 62 61 73 65 20 54 61 62 6c 65 73   Database Tables
52b0: 2c 20 74 68 65 79 20 61 72 65 20 6a 75 73 74 20  , they are just 
52c0: 65 6d 75 6c 61 74 69 6e 67 20 74 68 65 20 6f 72  emulating the or
52d0: 69 67 69 6e 61 6c 20 73 6f 75 72 63 65 20 61 73  iginal source as
52e0: 20 61 20 44 61 74 61 62 61 73 65 20 54 61 62 6c   a Database Tabl
52f0: 65 2e 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e 56 69 72  e.</li>..<li>Vir
5300: 74 75 61 6c 20 54 61 62 6c 65 73 20 68 61 76 65  tual Tables have
5310: 20 76 65 72 79 20 70 6f 6f 72 20 73 70 65 65 64   very poor speed
5320: 20 70 65 72 66 6f 72 6d 61 6e 63 65 73 2c 20 64   performances, d
5330: 75 65 20 74 6f 20 74 68 65 20 20 65 6d 75 6c 61  ue to the  emula
5340: 74 69 6f 6e 2c 20 61 73 20 63 6f 6d 70 61 72 65  tion, as compare
5350: 64 20 74 6f 20 67 65 6e 75 69 6e 65 20 44 61 74  d to genuine Dat
5360: 61 62 61 73 65 20 54 61 62 6c 65 73 2e 3c 2f 6c  abase Tables.</l
5370: 69 3e 0d 0a 3c 6c 69 3e 43 6f 6d 70 6c 65 78 20  i>..<li>Complex 
5380: 53 51 4c 20 71 75 65 72 69 65 73 20 3c 62 3e 4a  SQL queries <b>J
5390: 4f 49 4e 3c 2f 62 3e 69 6e 67 20 73 65 76 65 72  OIN</b>ing sever
53a0: 61 6c 20 54 61 62 6c 65 73 20 63 61 6e 20 6f 66  al Tables can of
53b0: 74 65 6e 20 72 65 74 75 72 6e 20 6f 64 64 20 61  ten return odd a
53c0: 6e 64 20 6d 69 73 6c 65 61 64 69 6e 67 20 72 65  nd misleading re
53d0: 73 75 6c 74 73 65 74 73 2c 20 77 68 65 6e 20 6f  sultsets, when o
53e0: 6e 65 20 6f 72 20 6d 6f 72 65 20 6f 66 20 74 68  ne or more of th
53f0: 65 20 3c 62 3e 4a 4f 49 4e 3c 2f 62 3e 65 64 20  e <b>JOIN</b>ed 
5400: 54 61 62 6c 65 73 20 61 72 65 20 6f 66 20 74 68  Tables are of th
5410: 65 20 56 69 72 74 75 61 6c 20 74 79 70 65 2e 3c  e Virtual type.<
5420: 2f 6c 69 3e 0d 0a 3c 6c 69 3e 54 68 65 20 62 65  /li>..<li>The be
5430: 73 74 20 75 73 65 20 6f 66 20 61 20 56 69 72 74  st use of a Virt
5440: 75 61 6c 20 54 61 62 6c 65 20 69 73 20 74 6f 20  ual Table is to 
5450: 70 72 65 66 6f 72 6d 20 61 20 62 61 73 69 63 20  preform a basic 
5460: 64 61 74 61 20 69 6d 70 6f 72 74 20 70 72 6f 63  data import proc
5470: 65 73 73 2c 20 6f 72 20 74 6f 20 71 75 69 63 6b  ess, or to quick
5480: 6c 79 20 67 65 74 20 61 6e 20 6f 76 65 72 61 6c  ly get an overal
5490: 6c 20 67 6c 61 6e 63 65 20 61 74 20 61 20 66 75  l glance at a fu
54a0: 6c 6c 20 64 61 74 61 73 65 74 20 77 69 74 68 6f  ll dataset witho
54b0: 75 74 20 6e 65 63 65 73 73 61 72 69 6c 79 20 69  ut necessarily i
54c0: 6d 70 6f 72 74 69 6e 67 20 69 74 20 69 6e 74 6f  mporting it into
54d0: 20 74 68 65 20 44 61 74 61 62 61 73 65 2e 3c 2f   the Database.</
54e0: 6c 69 3e 0d 0a 3c 6c 69 3e 50 72 65 74 65 6e 64  li>..<li>Pretend
54f0: 69 6e 67 20 74 6f 20 75 73 65 20 61 20 56 69 72  ing to use a Vir
5500: 74 75 61 6c 20 54 61 62 6c 65 20 61 73 20 61 20  tual Table as a 
5510: 66 75 6c 6c 20 72 65 70 6c 61 63 65 6d 65 6e 74  full replacement
5520: 20 6f 66 20 69 6d 70 6f 72 74 69 6e 67 20 61 6c   of importing al
5530: 6c 20 64 61 74 61 20 77 69 74 68 69 6e 20 61 20  l data within a 
5540: 67 65 6e 75 69 6e 65 20 44 61 74 61 62 61 73 65  genuine Database
5550: 20 54 61 62 6c 65 20 69 73 20 73 74 72 6f 6e 67   Table is strong
5560: 6c 79 20 64 69 73 63 6f 75 72 61 67 65 64 2c 20  ly discouraged, 
5570: 61 6e 64 20 6e 65 76 65 72 20 69 73 20 61 20 67  and never is a g
5580: 6f 6f 64 20 69 64 65 61 2e 3c 2f 6c 69 3e 0d 0a  ood idea.</li>..
5590: 3c 2f 75 6c 3e 3c 62 72 3e 0d 0a 3c 62 3e 57 61  </ul><br>..<b>Wa
55a0: 72 6e 69 6e 67 3c 2f 62 3e 3a 20 56 69 72 74 75  rning</b>: Virtu
55b0: 61 6c 58 4c 20 54 61 62 6c 65 73 20 61 72 65 20  alXL Tables are 
55c0: 61 6c 77 61 79 73 20 73 75 62 6a 65 63 74 20 74  always subject t
55d0: 6f 20 3c 62 3e 52 45 41 44 2d 4f 4e 4c 59 3c 2f  o <b>READ-ONLY</
55e0: 62 3e 20 72 65 73 74 72 69 63 74 69 6f 6e 73 2e  b> restrictions.
55f0: 20 41 6e 79 20 61 74 74 65 6d 70 74 20 74 6f 20   Any attempt to 
5600: 74 6f 20 65 78 65 63 75 74 65 20 61 6e 20 3c 62  to execute an <b
5610: 3e 49 4e 53 45 52 54 3c 2f 62 3e 2c 20 3c 62 3e  >INSERT</b>, <b>
5620: 55 50 44 41 54 45 3c 2f 62 3e 20 6f 72 20 3c 62  UPDATE</b> or <b
5630: 3e 44 45 4c 45 54 45 3c 2f 62 3e 20 73 74 61 74  >DELETE</b> stat
5640: 65 6d 65 6e 74 20 77 69 6c 6c 20 61 6c 77 61 79  ement will alway
5650: 73 20 72 65 74 75 72 6e 20 61 6e 20 65 72 72 6f  s return an erro
5660: 72 2e 3c 62 72 3e 0d 0a 3c 2f 74 64 3e 3c 2f 74  r.<br>..</td></t
5670: 72 3e 3c 2f 74 61 62 6c 65 3e 0d 0a 3c 62 72 3e  r></table>..<br>
5680: 0d 0a 3c 74 61 62 6c 65 20 62 67 63 6f 6c 6f 72  ..<table bgcolor
5690: 3d 22 23 65 30 65 30 65 30 22 20 63 65 6c 6c 70  ="#e0e0e0" cellp
56a0: 61 64 64 69 6e 67 3d 22 31 38 22 3e 3c 74 72 3e  adding="18"><tr>
56b0: 3c 74 64 3e 0d 0a 3c 68 33 3e 52 65 6c 61 74 65  <td>..<h3>Relate
56c0: 64 20 54 6f 70 69 63 73 3c 2f 68 33 3e 0d 0a 54  d Topics</h3>..T
56d0: 68 65 20 3c 62 3e 49 6d 70 6f 72 74 58 4c 53 28  he <b>ImportXLS(
56e0: 29 3c 2f 62 3e 20 53 51 4c 20 66 75 6e 63 74 69  )</b> SQL functi
56f0: 6f 6e 20 61 6c 6c 6f 77 73 20 74 6f 20 63 72 65  on allows to cre
5700: 61 74 65 20 61 6e 64 20 70 6f 70 75 6c 61 74 65  ate and populate
5710: 20 61 20 67 65 6e 75 69 6e 65 20 44 61 74 61 62   a genuine Datab
5720: 61 73 65 20 54 61 62 6c 65 20 62 79 20 69 6d 70  ase Table by imp
5730: 6f 72 74 69 6e 67 20 61 6e 20 65 78 74 65 72 6e  orting an extern
5740: 61 6c 20 4d 53 20 45 78 63 65 6c 20 73 70 72 65  al MS Excel spre
5750: 61 64 73 68 65 65 74 2e 0d 0a 3c 2f 74 64 3e 3c  adsheet...</td><
5760: 2f 74 72 3e 3c 2f 74 61 62 6c 65 3e 0d 0a 3c 62  /tr></table>..<b
5770: 72 3e 0d 0a 3c 68 72 3e 0d 0a 3c 68 31 3e 3c 61  r>..<hr>..<h1><a
5780: 20 69 64 3d 22 56 69 72 74 75 61 6c 46 44 4f 22   id="VirtualFDO"
5790: 3e 56 69 72 74 75 61 6c 46 44 4f 3c 2f 61 3e 3c  >VirtualFDO</a><
57a0: 2f 68 31 3e 0d 0a 54 68 65 20 3c 62 3e 56 69 72  /h1>..The <b>Vir
57b0: 74 75 61 6c 46 44 4f 3c 2f 62 3e 20 49 6e 74 65  tualFDO</b> Inte
57c0: 72 66 61 63 65 20 61 6c 6c 6f 77 73 20 74 6f 20  rface allows to 
57d0: 64 69 72 65 63 74 6c 79 20 61 63 63 65 73 73 20  directly access 
57e0: 61 20 53 70 61 74 69 61 6c 20 54 61 62 6c 65 20  a Spatial Table 
57f0: 63 6f 6e 74 61 69 6e 69 6e 67 20 3c 62 3e 46 44  containing <b>FD
5800: 4f 20 62 69 6e 61 72 79 20 47 65 6f 6d 65 74 72  O binary Geometr
5810: 69 65 73 3c 2f 62 3e 20 65 78 61 63 74 6c 79 20  ies</b> exactly 
5820: 61 73 20 69 66 20 77 61 73 20 61 20 53 70 61 74  as if was a Spat
5830: 69 61 4c 69 74 65 27 73 20 6f 77 6e 20 6e 61 74  iaLite's own nat
5840: 69 76 65 20 54 61 62 6c 65 2e 3c 62 72 3e 0d 0a  ive Table.<br>..
5850: 46 44 4f 20 69 73 20 61 6e 20 61 6c 74 65 72 6e  FDO is an altern
5860: 61 74 69 76 65 20 62 69 6e 61 72 79 20 66 6f 72  ative binary for
5870: 6d 61 74 20 66 6f 72 20 47 65 6f 6d 65 74 72 69  mat for Geometri
5880: 65 73 20 73 74 6f 72 65 64 20 77 69 74 68 69 6e  es stored within
5890: 20 61 20 53 51 4c 69 74 65 20 44 61 74 61 62 61   a SQLite Databa
58a0: 73 65 3b 20 79 6f 75 20 63 61 6e 20 65 76 65 6e  se; you can even
58b0: 74 75 61 6c 6c 79 20 72 65 61 64 20 74 68 65 20  tually read the 
58c0: 3c 61 20 68 72 65 66 3d 22 68 74 74 70 73 3a 2f  <a href="https:/
58d0: 2f 74 72 61 63 2e 6f 73 67 65 6f 2e 6f 72 67 2f  /trac.osgeo.org/
58e0: 66 64 6f 2f 77 69 6b 69 2f 46 44 4f 52 66 63 31  fdo/wiki/FDORfc1
58f0: 36 22 3e 52 46 43 20 31 36 3c 2f 61 3e 20 73 70  6">RFC 16</a> sp
5900: 65 63 69 66 69 63 61 74 69 6f 6e 20 66 6f 72 20  ecification for 
5910: 6d 6f 72 65 20 64 65 74 61 69 6c 73 2e 3c 62 72  more details.<br
5920: 3e 0d 0a 53 79 6e 74 61 78 20 66 6f 72 20 63 72  >..Syntax for cr
5930: 65 61 74 69 6e 67 20 61 20 56 69 72 74 75 61 6c  eating a Virtual
5940: 46 44 4f 20 54 61 62 6c 65 3a 0d 0a 3c 76 65 72  FDO Table:..<ver
5950: 62 61 74 69 6d 3e 0d 0a 53 45 4c 45 43 54 20 43  batim>..SELECT C
5960: 52 45 41 54 45 20 56 49 52 54 55 41 4c 20 54 41  REATE VIRTUAL TA
5970: 42 4c 45 20 6d 79 5f 74 61 62 6c 65 20 55 53 49  BLE my_table USI
5980: 4e 47 20 56 69 72 74 75 61 6c 46 64 6f 20 28 20  NG VirtualFdo ( 
5990: 74 61 62 6c 65 5f 6e 61 6d 65 20 29 3b 0d 0a 3c  table_name );..<
59a0: 2f 76 65 72 62 61 74 69 6d 3e 0d 0a 53 75 70 70  /verbatim>..Supp
59b0: 6f 72 74 65 64 20 61 72 67 75 6d 65 6e 74 20 61  orted argument a
59c0: 6e 64 20 69 74 73 20 69 6e 74 65 72 70 72 65 74  nd its interpret
59d0: 61 74 69 6f 6e 3a 0d 0a 3c 75 6c 3e 0d 0a 3c 6c  ation:..<ul>..<l
59e0: 69 3e 3c 62 3e 74 61 62 6c 65 5f 6e 61 6d 65 3c  i><b>table_name<
59f0: 2f 62 3e 20 28 3c 69 3e 3c 62 3e 6d 61 6e 64 61  /b> (<i><b>manda
5a00: 74 6f 72 79 3c 2f 62 3e 3c 2f 69 3e 29 3a 20 74  tory</b></i>): t
5a10: 68 65 20 6e 61 6d 65 20 6f 66 20 74 68 65 20 54  he name of the T
5a20: 61 62 6c 65 20 69 6e 20 74 68 65 20 63 75 72 72  able in the curr
5a30: 65 6e 74 20 44 61 74 61 62 61 73 65 20 63 6f 6e  ent Database con
5a40: 74 61 69 6e 69 6e 67 20 6f 6e 65 20 6f 72 20 6d  taining one or m
5a50: 6f 72 65 20 46 44 4f 20 47 65 6f 6d 65 74 72 79  ore FDO Geometry
5a60: 20 43 6f 6c 75 6d 6e 73 20 74 6f 20 62 65 20 61   Columns to be a
5a70: 75 74 6f 6d 61 74 69 63 61 6c 6c 79 20 74 72 61  utomatically tra
5a80: 6e 73 6c 61 74 65 64 20 74 6f 2f 66 72 6f 6d 20  nslated to/from 
5a90: 53 70 61 74 69 61 4c 69 74 65 27 73 20 6f 77 6e  SpatiaLite's own
5aa0: 20 6e 61 74 69 76 65 20 62 69 6e 61 72 79 20 42   native binary B
5ab0: 4c 4f 42 2d 66 6f 72 6d 61 74 2e 3c 2f 6c 69 3e  LOB-format.</li>
5ac0: 0d 0a 3c 2f 75 6c 3e 3c 62 72 3e 0d 0a 3c 74 61  ..</ul><br>..<ta
5ad0: 62 6c 65 20 62 67 63 6f 6c 6f 72 3d 22 23 66 66  ble bgcolor="#ff
5ae0: 66 66 64 30 22 20 63 65 6c 6c 70 61 64 64 69 6e  ffd0" cellpaddin
5af0: 67 3d 22 31 38 22 3e 3c 74 72 3e 3c 74 64 3e 0d  g="18"><tr><td>.
5b00: 0a 3c 62 3e 4e 6f 74 65 3c 2f 62 3e 3a 20 61 6e  .<b>Note</b>: an
5b10: 79 20 54 65 78 74 20 53 74 72 69 6e 67 2c 20 71  y Text String, q
5b20: 75 6f 74 65 64 20 6f 72 20 6e 6f 74 2c 20 77 68  uoted or not, wh
5b30: 65 6e 20 69 74 20 61 70 70 65 61 72 73 20 61 73  en it appears as
5b40: 20 61 20 56 69 72 74 75 61 6c 20 54 61 62 6c 65   a Virtual Table
5b50: 20 61 72 67 75 6d 65 6e 74 20 68 61 73 20 74 68   argument has th
5b60: 65 20 73 61 6d 65 20 65 66 66 65 63 74 2e 0d 0a  e same effect...
5b70: 3c 76 65 72 62 61 74 69 6d 3e 0d 0a 53 45 4c 45  <verbatim>..SELE
5b80: 43 54 20 43 52 45 41 54 45 20 56 49 52 54 55 41  CT CREATE VIRTUA
5b90: 4c 20 54 41 42 4c 45 20 6d 79 5f 74 61 62 6c 65  L TABLE my_table
5ba0: 20 55 53 49 4e 47 20 56 69 72 74 75 61 6c 46 64   USING VirtualFd
5bb0: 6f 28 20 6d 79 5f 70 61 72 63 65 6c 73 20 29 3b  o( my_parcels );
5bc0: 0d 0a 6f 72 0d 0a 53 45 4c 45 43 54 20 43 52 45  ..or..SELECT CRE
5bd0: 41 54 45 20 56 49 52 54 55 41 4c 20 54 41 42 4c  ATE VIRTUAL TABL
5be0: 45 20 6d 79 5f 74 61 62 6c 65 20 55 53 49 4e 47  E my_table USING
5bf0: 20 56 69 72 74 75 61 6c 46 64 6f 28 20 27 6d 79   VirtualFdo( 'my
5c00: 5f 70 61 72 63 65 6c 73 27 20 29 3b 0d 0a 3c 2f  _parcels' );..</
5c10: 76 65 72 62 61 74 69 6d 3e 0d 0a 42 6f 74 68 20  verbatim>..Both 
5c20: 6e 6f 74 61 74 69 6f 6e 73 20 77 69 6c 6c 20 70  notations will p
5c30: 72 6f 64 75 63 65 20 74 68 65 20 73 61 6d 65 20  roduce the same 
5c40: 72 65 73 75 6c 74 2e 0d 0a 3c 2f 74 64 3e 3c 2f  result...</td></
5c50: 74 72 3e 3c 2f 74 61 62 6c 65 3e 0d 0a 3c 62 72  tr></table>..<br
5c60: 3e 0d 0a 3c 74 61 62 6c 65 20 62 67 63 6f 6c 6f  >..<table bgcolo
5c70: 72 3d 22 23 64 30 66 66 64 30 22 20 63 65 6c 6c  r="#d0ffd0" cell
5c80: 70 61 64 64 69 6e 67 3d 22 31 38 22 3e 3c 74 72  padding="18"><tr
5c90: 3e 3c 74 64 3e 0d 0a 3c 68 33 3e 42 65 73 74 20  ><td>..<h3>Best 
5ca0: 70 72 61 63 74 69 63 65 73 20 61 6e 64 20 6b 6e  practices and kn
5cb0: 6f 77 6e 20 6c 69 6d 69 74 61 74 69 6f 6e 73 3c  own limitations<
5cc0: 2f 68 33 3e 0d 0a 3c 75 6c 3e 0d 0a 3c 6c 69 3e  /h3>..<ul>..<li>
5cd0: 56 69 72 74 75 61 6c 20 54 61 62 6c 65 73 20 61  Virtual Tables a
5ce0: 72 65 20 6e 6f 74 20 72 65 61 6c 6c 79 20 67 65  re not really ge
5cf0: 6e 75 69 6e 65 20 44 61 74 61 62 61 73 65 20 54  nuine Database T
5d00: 61 62 6c 65 73 2c 20 74 68 65 79 20 61 72 65 20  ables, they are 
5d10: 6a 75 73 74 20 65 6d 75 6c 61 74 69 6e 67 20 74  just emulating t
5d20: 68 65 20 6f 72 69 67 69 6e 61 6c 20 73 6f 75 72  he original sour
5d30: 63 65 20 61 73 20 61 20 44 61 74 61 62 61 73 65  ce as a Database
5d40: 20 54 61 62 6c 65 2e 3c 2f 6c 69 3e 0d 0a 3c 6c   Table.</li>..<l
5d50: 69 3e 56 69 72 74 75 61 6c 20 54 61 62 6c 65 73  i>Virtual Tables
5d60: 20 68 61 76 65 20 76 65 72 79 20 70 6f 6f 72 20   have very poor 
5d70: 73 70 65 65 64 20 70 65 72 66 6f 72 6d 61 6e 63  speed performanc
5d80: 65 73 2c 20 64 75 65 20 74 6f 20 74 68 65 20 20  es, due to the  
5d90: 65 6d 75 6c 61 74 69 6f 6e 2c 20 61 73 20 63 6f  emulation, as co
5da0: 6d 70 61 72 65 64 20 74 6f 20 67 65 6e 75 69 6e  mpared to genuin
5db0: 65 20 44 61 74 61 62 61 73 65 20 54 61 62 6c 65  e Database Table
5dc0: 73 2e 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e 43 6f 6d  s.</li>..<li>Com
5dd0: 70 6c 65 78 20 53 51 4c 20 71 75 65 72 69 65 73  plex SQL queries
5de0: 20 3c 62 3e 4a 4f 49 4e 3c 2f 62 3e 69 6e 67 20   <b>JOIN</b>ing 
5df0: 73 65 76 65 72 61 6c 20 54 61 62 6c 65 73 20 63  several Tables c
5e00: 61 6e 20 6f 66 74 65 6e 20 72 65 74 75 72 6e 20  an often return 
5e10: 6f 64 64 20 61 6e 64 20 6d 69 73 6c 65 61 64 69  odd and misleadi
5e20: 6e 67 20 72 65 73 75 6c 74 73 65 74 73 2c 20 77  ng resultsets, w
5e30: 68 65 6e 20 6f 6e 65 20 6f 72 20 6d 6f 72 65 20  hen one or more 
5e40: 6f 66 20 74 68 65 20 3c 62 3e 4a 4f 49 4e 3c 2f  of the <b>JOIN</
5e50: 62 3e 65 64 20 54 61 62 6c 65 73 20 61 72 65 20  b>ed Tables are 
5e60: 6f 66 20 74 68 65 20 56 69 72 74 75 61 6c 20 74  of the Virtual t
5e70: 79 70 65 2e 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e 54  ype.</li>..<li>T
5e80: 68 65 20 62 65 73 74 20 75 73 65 20 6f 66 20 61  he best use of a
5e90: 20 56 69 72 74 75 61 6c 20 54 61 62 6c 65 20 69   Virtual Table i
5ea0: 73 20 74 6f 20 70 72 65 66 6f 72 6d 20 61 20 62  s to preform a b
5eb0: 61 73 69 63 20 64 61 74 61 20 69 6d 70 6f 72 74  asic data import
5ec0: 20 70 72 6f 63 65 73 73 2c 20 6f 72 20 74 6f 20   process, or to 
5ed0: 71 75 69 63 6b 6c 79 20 67 65 74 20 61 6e 20 6f  quickly get an o
5ee0: 76 65 72 61 6c 6c 20 67 6c 61 6e 63 65 20 61 74  verall glance at
5ef0: 20 61 20 66 75 6c 6c 20 64 61 74 61 73 65 74 20   a full dataset 
5f00: 77 69 74 68 6f 75 74 20 6e 65 63 65 73 73 61 72  without necessar
5f10: 69 6c 79 20 69 6d 70 6f 72 74 69 6e 67 20 69 74  ily importing it
5f20: 20 69 6e 74 6f 20 74 68 65 20 44 61 74 61 62 61   into the Databa
5f30: 73 65 2e 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e 50 72  se.</li>..<li>Pr
5f40: 65 74 65 6e 64 69 6e 67 20 74 6f 20 75 73 65 20  etending to use 
5f50: 61 20 56 69 72 74 75 61 6c 20 54 61 62 6c 65 20  a Virtual Table 
5f60: 61 73 20 61 20 66 75 6c 6c 20 72 65 70 6c 61 63  as a full replac
5f70: 65 6d 65 6e 74 20 6f 66 20 69 6d 70 6f 72 74 69  ement of importi
5f80: 6e 67 20 61 6c 6c 20 64 61 74 61 20 77 69 74 68  ng all data with
5f90: 69 6e 20 61 20 67 65 6e 75 69 6e 65 20 44 61 74  in a genuine Dat
5fa0: 61 62 61 73 65 20 54 61 62 6c 65 20 69 73 20 73  abase Table is s
5fb0: 74 72 6f 6e 67 6c 79 20 64 69 73 63 6f 75 72 61  trongly discoura
5fc0: 67 65 64 2c 20 61 6e 64 20 6e 65 76 65 72 20 69  ged, and never i
5fd0: 73 20 61 20 67 6f 6f 64 20 69 64 65 61 2e 3c 2f  s a good idea.</
5fe0: 6c 69 3e 0d 0a 3c 2f 75 6c 3e 3c 62 72 3e 0d 0a  li>..</ul><br>..
5ff0: 3c 62 3e 4e 6f 74 65 3c 2f 62 3e 3a 20 56 69 72  <b>Note</b>: Vir
6000: 74 75 61 6c 46 44 4f 20 54 61 62 6c 65 73 20 73  tualFDO Tables s
6010: 75 70 70 6f 72 74 20 75 6e 72 65 73 74 72 69 63  upport unrestric
6020: 74 65 64 20 3c 62 3e 52 45 41 44 2d 57 52 49 54  ted <b>READ-WRIT
6030: 45 3c 2f 62 3e 20 6f 70 65 72 61 74 69 6f 6e 73  E</b> operations
6040: 2c 20 74 68 69 73 20 69 6e 63 6c 75 64 69 6e 67  , this including
6050: 20 65 78 65 63 75 74 69 6e 67 20 3c 62 3e 49 4e   executing <b>IN
6060: 53 45 52 54 3c 2f 62 3e 2c 20 3c 62 3e 55 50 44  SERT</b>, <b>UPD
6070: 41 54 45 3c 2f 62 3e 20 61 6e 64 20 3c 62 3e 44  ATE</b> and <b>D
6080: 45 4c 45 54 45 3c 2f 62 3e 20 73 74 61 74 65 6d  ELETE</b> statem
6090: 65 6e 74 73 2e 3c 62 72 3e 0d 0a 3c 2f 74 64 3e  ents.<br>..</td>
60a0: 3c 2f 74 72 3e 3c 2f 74 61 62 6c 65 3e 0d 0a 3c  </tr></table>..<
60b0: 62 72 3e 0d 0a 3c 68 72 3e 0d 0a 3c 68 31 3e 3c  br>..<hr>..<h1><
60c0: 61 20 69 64 3d 22 56 69 72 74 75 61 6c 47 50 4b  a id="VirtualGPK
60d0: 47 22 3e 56 69 72 74 75 61 6c 47 50 4b 47 3c 2f  G">VirtualGPKG</
60e0: 61 3e 3c 2f 68 31 3e 0d 0a 54 68 65 20 3c 62 3e  a></h1>..The <b>
60f0: 56 69 72 74 75 61 6c 47 50 4b 47 3c 2f 62 3e 20  VirtualGPKG</b> 
6100: 49 6e 74 65 72 66 61 63 65 20 61 6c 6c 6f 77 73  Interface allows
6110: 20 74 6f 20 64 69 72 65 63 74 6c 79 20 61 63 63   to directly acc
6120: 65 73 73 20 53 70 61 74 69 61 6c 20 54 61 62 6c  ess Spatial Tabl
6130: 65 73 20 66 72 6f 6d 20 61 20 3c 62 3e 47 65 6f  es from a <b>Geo
6140: 50 61 63 6b 61 67 65 20 44 61 74 61 62 61 73 65  Package Database
6150: 3c 2f 62 3e 20 65 78 61 63 74 6c 79 20 61 73 20  </b> exactly as 
6160: 69 66 20 77 61 73 20 61 20 53 70 61 74 69 61 4c  if was a SpatiaL
6170: 69 74 65 27 73 20 6f 77 6e 20 6e 61 74 69 76 65  ite's own native
6180: 20 44 61 74 61 62 61 73 65 2e 3c 62 72 3e 0d 0a   Database.<br>..
6190: 47 65 6f 50 61 63 6b 61 67 65 20 28 3c 69 3e 61  GeoPackage (<i>a
61a0: 6b 61 3c 2f 69 3e 20 3c 62 3e 47 50 4b 47 3c 2f  ka</i> <b>GPKG</
61b0: 62 3e 29 20 69 73 20 61 6e 20 61 6c 74 65 72 6e  b>) is an altern
61c0: 61 74 69 76 65 20 53 70 61 74 69 61 6c 20 44 61  ative Spatial Da
61d0: 74 61 62 61 73 65 20 62 75 69 6c 74 20 6f 6e 20  tabase built on 
61e0: 74 68 65 20 74 6f 70 20 6f 66 20 53 51 4c 69 74  the top of SQLit
61f0: 65 3b 20 79 6f 75 20 63 61 6e 20 65 76 65 6e 74  e; you can event
6200: 75 61 6c 6c 79 20 72 65 61 64 20 74 68 65 20 3c  ually read the <
6210: 61 20 68 72 65 66 3d 22 68 74 74 70 3a 2f 2f 77  a href="http://w
6220: 77 77 2e 67 65 6f 70 61 63 6b 61 67 65 2e 6f 72  ww.geopackage.or
6230: 67 2f 67 75 69 64 61 6e 63 65 2f 67 65 74 74 69  g/guidance/getti
6240: 6e 67 2d 73 74 61 72 74 65 64 2e 68 74 6d 6c 22  ng-started.html"
6250: 3e 6f 66 66 69 63 69 61 6c 20 73 70 65 63 69 66  >official specif
6260: 69 63 61 74 69 6f 6e 3c 2f 61 3e 20 66 6f 72 20  ication</a> for 
6270: 6d 6f 72 65 20 64 65 74 61 69 6c 73 2e 3c 62 72  more details.<br
6280: 3e 0d 0a 53 79 6e 74 61 78 20 66 6f 72 20 63 72  >..Syntax for cr
6290: 65 61 74 69 6e 67 20 61 20 56 69 72 74 75 61 6c  eating a Virtual
62a0: 46 44 4f 20 54 61 62 6c 65 3a 0d 0a 3c 76 65 72  FDO Table:..<ver
62b0: 62 61 74 69 6d 3e 0d 0a 53 45 4c 45 43 54 20 43  batim>..SELECT C
62c0: 52 45 41 54 45 20 56 49 52 54 55 41 4c 20 54 41  REATE VIRTUAL TA
62d0: 42 4c 45 20 6d 79 5f 74 61 62 6c 65 20 55 53 49  BLE my_table USI
62e0: 4e 47 20 56 69 72 74 75 61 6c 47 70 6b 67 20 28  NG VirtualGpkg (
62f0: 20 74 61 62 6c 65 5f 6e 61 6d 65 20 29 3b 0d 0a   table_name );..
6300: 3c 2f 76 65 72 62 61 74 69 6d 3e 0d 0a 53 75 70  </verbatim>..Sup
6310: 70 6f 72 74 65 64 20 61 72 67 75 6d 65 6e 74 20  ported argument 
6320: 61 6e 64 20 69 74 73 20 69 6e 74 65 72 70 72 65  and its interpre
6330: 74 61 74 69 6f 6e 3a 0d 0a 3c 75 6c 3e 0d 0a 3c  tation:..<ul>..<
6340: 6c 69 3e 3c 62 3e 74 61 62 6c 65 5f 6e 61 6d 65  li><b>table_name
6350: 3c 2f 62 3e 20 28 3c 69 3e 3c 62 3e 6d 61 6e 64  </b> (<i><b>mand
6360: 61 74 6f 72 79 3c 2f 62 3e 3c 2f 69 3e 29 3a 20  atory</b></i>): 
6370: 74 68 65 20 6e 61 6d 65 20 6f 66 20 74 68 65 20  the name of the 
6380: 54 61 62 6c 65 20 69 6e 20 74 68 65 20 63 75 72  Table in the cur
6390: 72 65 6e 74 20 44 61 74 61 62 61 73 65 20 63 6f  rent Database co
63a0: 6e 74 61 69 6e 69 6e 67 20 6f 6e 65 20 6f 72 20  ntaining one or 
63b0: 6d 6f 72 65 20 47 50 4b 47 20 47 65 6f 6d 65 74  more GPKG Geomet
63c0: 72 79 20 43 6f 6c 75 6d 6e 73 20 74 6f 20 62 65  ry Columns to be
63d0: 20 61 75 74 6f 6d 61 74 69 63 61 6c 6c 79 20 74   automatically t
63e0: 72 61 6e 73 6c 61 74 65 64 20 74 6f 2f 66 72 6f  ranslated to/fro
63f0: 6d 20 53 70 61 74 69 61 4c 69 74 65 27 73 20 6f  m SpatiaLite's o
6400: 77 6e 20 6e 61 74 69 76 65 20 62 69 6e 61 72 79  wn native binary
6410: 20 42 4c 4f 42 2d 66 6f 72 6d 61 74 2e 3c 2f 6c   BLOB-format.</l
6420: 69 3e 0d 0a 3c 2f 75 6c 3e 3c 62 72 3e 0d 0a 3c  i>..</ul><br>..<
6430: 74 61 62 6c 65 20 62 67 63 6f 6c 6f 72 3d 22 23  table bgcolor="#
6440: 66 66 66 66 64 30 22 20 63 65 6c 6c 70 61 64 64  ffffd0" cellpadd
6450: 69 6e 67 3d 22 31 38 22 3e 3c 74 72 3e 3c 74 64  ing="18"><tr><td
6460: 3e 0d 0a 3c 62 3e 4e 6f 74 65 3c 2f 62 3e 3a 20  >..<b>Note</b>: 
6470: 61 6e 79 20 54 65 78 74 20 53 74 72 69 6e 67 2c  any Text String,
6480: 20 71 75 6f 74 65 64 20 6f 72 20 6e 6f 74 2c 20   quoted or not, 
6490: 77 68 65 6e 20 69 74 20 61 70 70 65 61 72 73 20  when it appears 
64a0: 61 73 20 61 20 56 69 72 74 75 61 6c 20 54 61 62  as a Virtual Tab
64b0: 6c 65 20 61 72 67 75 6d 65 6e 74 20 68 61 73 20  le argument has 
64c0: 74 68 65 20 73 61 6d 65 20 65 66 66 65 63 74 2e  the same effect.
64d0: 0d 0a 3c 76 65 72 62 61 74 69 6d 3e 0d 0a 53 45  ..<verbatim>..SE
64e0: 4c 45 43 54 20 43 52 45 41 54 45 20 56 49 52 54  LECT CREATE VIRT
64f0: 55 41 4c 20 54 41 42 4c 45 20 6d 79 5f 74 61 62  UAL TABLE my_tab
6500: 6c 65 20 55 53 49 4e 47 20 56 69 72 74 75 61 6c  le USING Virtual
6510: 47 70 6b 73 28 20 6d 79 5f 70 61 72 63 65 6c 73  Gpks( my_parcels
6520: 20 29 3b 0d 0a 6f 72 0d 0a 53 45 4c 45 43 54 20   );..or..SELECT 
6530: 43 52 45 41 54 45 20 56 49 52 54 55 41 4c 20 54  CREATE VIRTUAL T
6540: 41 42 4c 45 20 6d 79 5f 74 61 62 6c 65 20 55 53  ABLE my_table US
6550: 49 4e 47 20 56 69 72 74 75 61 6c 47 70 6b 67 28  ING VirtualGpkg(
6560: 20 27 6d 79 5f 70 61 72 63 65 6c 73 27 20 29 3b   'my_parcels' );
6570: 0d 0a 3c 2f 76 65 72 62 61 74 69 6d 3e 0d 0a 42  ..</verbatim>..B
6580: 6f 74 68 20 6e 6f 74 61 74 69 6f 6e 73 20 77 69  oth notations wi
6590: 6c 6c 20 70 72 6f 64 75 63 65 20 74 68 65 20 73  ll produce the s
65a0: 61 6d 65 20 72 65 73 75 6c 74 2e 0d 0a 3c 2f 74  ame result...</t
65b0: 64 3e 3c 2f 74 72 3e 3c 2f 74 61 62 6c 65 3e 0d  d></tr></table>.
65c0: 0a 3c 62 72 3e 0d 0a 3c 74 61 62 6c 65 20 62 67  .<br>..<table bg
65d0: 63 6f 6c 6f 72 3d 22 23 64 30 66 66 64 30 22 20  color="#d0ffd0" 
65e0: 63 65 6c 6c 70 61 64 64 69 6e 67 3d 22 31 38 22  cellpadding="18"
65f0: 3e 3c 74 72 3e 3c 74 64 3e 0d 0a 3c 68 33 3e 42  ><tr><td>..<h3>B
6600: 65 73 74 20 70 72 61 63 74 69 63 65 73 20 61 6e  est practices an
6610: 64 20 6b 6e 6f 77 6e 20 6c 69 6d 69 74 61 74 69  d known limitati
6620: 6f 6e 73 3c 2f 68 33 3e 0d 0a 3c 75 6c 3e 0d 0a  ons</h3>..<ul>..
6630: 3c 6c 69 3e 56 69 72 74 75 61 6c 20 54 61 62 6c  <li>Virtual Tabl
6640: 65 73 20 61 72 65 20 6e 6f 74 20 72 65 61 6c 6c  es are not reall
6650: 79 20 67 65 6e 75 69 6e 65 20 44 61 74 61 62 61  y genuine Databa
6660: 73 65 20 54 61 62 6c 65 73 2c 20 74 68 65 79 20  se Tables, they 
6670: 61 72 65 20 6a 75 73 74 20 65 6d 75 6c 61 74 69  are just emulati
6680: 6e 67 20 74 68 65 20 6f 72 69 67 69 6e 61 6c 20  ng the original 
6690: 73 6f 75 72 63 65 20 61 73 20 61 20 44 61 74 61  source as a Data
66a0: 62 61 73 65 20 54 61 62 6c 65 2e 3c 2f 6c 69 3e  base Table.</li>
66b0: 0d 0a 3c 6c 69 3e 56 69 72 74 75 61 6c 20 54 61  ..<li>Virtual Ta
66c0: 62 6c 65 73 20 68 61 76 65 20 76 65 72 79 20 70  bles have very p
66d0: 6f 6f 72 20 73 70 65 65 64 20 70 65 72 66 6f 72  oor speed perfor
66e0: 6d 61 6e 63 65 73 2c 20 64 75 65 20 74 6f 20 74  mances, due to t
66f0: 68 65 20 20 65 6d 75 6c 61 74 69 6f 6e 2c 20 61  he  emulation, a
6700: 73 20 63 6f 6d 70 61 72 65 64 20 74 6f 20 67 65  s compared to ge
6710: 6e 75 69 6e 65 20 44 61 74 61 62 61 73 65 20 54  nuine Database T
6720: 61 62 6c 65 73 2e 3c 2f 6c 69 3e 0d 0a 3c 6c 69  ables.</li>..<li
6730: 3e 43 6f 6d 70 6c 65 78 20 53 51 4c 20 71 75 65  >Complex SQL que
6740: 72 69 65 73 20 3c 62 3e 4a 4f 49 4e 3c 2f 62 3e  ries <b>JOIN</b>
6750: 69 6e 67 20 73 65 76 65 72 61 6c 20 54 61 62 6c  ing several Tabl
6760: 65 73 20 63 61 6e 20 6f 66 74 65 6e 20 72 65 74  es can often ret
6770: 75 72 6e 20 6f 64 64 20 61 6e 64 20 6d 69 73 6c  urn odd and misl
6780: 65 61 64 69 6e 67 20 72 65 73 75 6c 74 73 65 74  eading resultset
6790: 73 2c 20 77 68 65 6e 20 6f 6e 65 20 6f 72 20 6d  s, when one or m
67a0: 6f 72 65 20 6f 66 20 74 68 65 20 3c 62 3e 4a 4f  ore of the <b>JO
67b0: 49 4e 3c 2f 62 3e 65 64 20 54 61 62 6c 65 73 20  IN</b>ed Tables 
67c0: 61 72 65 20 6f 66 20 74 68 65 20 56 69 72 74 75  are of the Virtu
67d0: 61 6c 20 74 79 70 65 2e 3c 2f 6c 69 3e 0d 0a 3c  al type.</li>..<
67e0: 6c 69 3e 54 68 65 20 62 65 73 74 20 75 73 65 20  li>The best use 
67f0: 6f 66 20 61 20 56 69 72 74 75 61 6c 20 54 61 62  of a Virtual Tab
6800: 6c 65 20 69 73 20 74 6f 20 70 72 65 66 6f 72 6d  le is to preform
6810: 20 61 20 62 61 73 69 63 20 64 61 74 61 20 69 6d   a basic data im
6820: 70 6f 72 74 20 70 72 6f 63 65 73 73 2c 20 6f 72  port process, or
6830: 20 74 6f 20 71 75 69 63 6b 6c 79 20 67 65 74 20   to quickly get 
6840: 61 6e 20 6f 76 65 72 61 6c 6c 20 67 6c 61 6e 63  an overall glanc
6850: 65 20 61 74 20 61 20 66 75 6c 6c 20 64 61 74 61  e at a full data
6860: 73 65 74 20 77 69 74 68 6f 75 74 20 6e 65 63 65  set without nece
6870: 73 73 61 72 69 6c 79 20 69 6d 70 6f 72 74 69 6e  ssarily importin
6880: 67 20 69 74 20 69 6e 74 6f 20 74 68 65 20 44 61  g it into the Da
6890: 74 61 62 61 73 65 2e 3c 2f 6c 69 3e 0d 0a 3c 6c  tabase.</li>..<l
68a0: 69 3e 50 72 65 74 65 6e 64 69 6e 67 20 74 6f 20  i>Pretending to 
68b0: 75 73 65 20 61 20 56 69 72 74 75 61 6c 20 54 61  use a Virtual Ta
68c0: 62 6c 65 20 61 73 20 61 20 66 75 6c 6c 20 72 65  ble as a full re
68d0: 70 6c 61 63 65 6d 65 6e 74 20 6f 66 20 69 6d 70  placement of imp
68e0: 6f 72 74 69 6e 67 20 61 6c 6c 20 64 61 74 61 20  orting all data 
68f0: 77 69 74 68 69 6e 20 61 20 67 65 6e 75 69 6e 65  within a genuine
6900: 20 44 61 74 61 62 61 73 65 20 54 61 62 6c 65 20   Database Table 
6910: 69 73 20 73 74 72 6f 6e 67 6c 79 20 64 69 73 63  is strongly disc
6920: 6f 75 72 61 67 65 64 2c 20 61 6e 64 20 6e 65 76  ouraged, and nev
6930: 65 72 20 69 73 20 61 20 67 6f 6f 64 20 69 64 65  er is a good ide
6940: 61 2e 3c 2f 6c 69 3e 0d 0a 3c 2f 75 6c 3e 3c 62  a.</li>..</ul><b
6950: 72 3e 0d 0a 3c 62 3e 4e 6f 74 65 3c 2f 62 3e 3a  r>..<b>Note</b>:
6960: 20 56 69 72 74 75 61 6c 47 50 4b 47 20 54 61 62   VirtualGPKG Tab
6970: 6c 65 73 20 73 75 70 70 6f 72 74 20 75 6e 72 65  les support unre
6980: 73 74 72 69 63 74 65 64 20 3c 62 3e 52 45 41 44  stricted <b>READ
6990: 2d 57 52 49 54 45 3c 2f 62 3e 20 6f 70 65 72 61  -WRITE</b> opera
69a0: 74 69 6f 6e 73 2c 20 74 68 69 73 20 69 6e 63 6c  tions, this incl
69b0: 75 64 69 6e 67 20 65 78 65 63 75 74 69 6e 67 20  uding executing 
69c0: 3c 62 3e 49 4e 53 45 52 54 3c 2f 62 3e 2c 20 3c  <b>INSERT</b>, <
69d0: 62 3e 55 50 44 41 54 45 3c 2f 62 3e 20 61 6e 64  b>UPDATE</b> and
69e0: 20 3c 62 3e 44 45 4c 45 54 45 3c 2f 62 3e 20 73   <b>DELETE</b> s
69f0: 74 61 74 65 6d 65 6e 74 73 2e 3c 62 72 3e 0d 0a  tatements.<br>..
6a00: 3c 2f 74 64 3e 3c 2f 74 72 3e 3c 2f 74 61 62 6c  </td></tr></tabl
6a10: 65 3e 0d 0a 3c 62 72 3e 0d 0a 3c 68 72 3e 0d 0a  e>..<br>..<hr>..
6a20: 3c 62 72 3e 0d 0a 3c 61 20 68 72 65 66 3d 22 68  <br>..<a href="h
6a30: 74 74 70 73 3a 2f 2f 77 77 77 2e 67 61 69 61 2d  ttps://www.gaia-
6a40: 67 69 73 2e 69 74 2f 66 6f 73 73 69 6c 2f 6c 69  gis.it/fossil/li
6a50: 62 73 70 61 74 69 61 6c 69 74 65 2f 68 6f 6d 65  bspatialite/home
6a60: 22 3e 62 61 63 6b 20 74 6f 20 6d 61 69 6e 20 70  ">back to main p
6a70: 61 67 65 3c 2f 61 3e 0a 5a 20 30 34 31 35 64 66  age</a>.Z 0415df
6a80: 36 38 38 36 34 66 30 63 63 37 32 62 30 63 35 64  68864f0cc72b0c5d
6a90: 32 34 38 66 39 30 38 39 34 61 0a                 248f90894a.