GSAK (Geocaching Swiss Army Knife)
 

Contents - Index


SQL - Save Table


Allows you to save any open table to a file. This is a non-standard SQL statement.

Syntax:

  SAVE TABLE tablename

When tablename is not open, an error occurs. When you save an intermediate table (created with ASSIGN TO), the intermediate table becomes a persistent table (disk based) that is also saved with the COMMIT statement.

Example:
 

$status = sql("ASSIGN TO caches2 SELECT code,name FROM caches","")

# check for any error condition, stop immediately after showing the full error message
If left($status,7) = "*ERROR*"
  cancel msg=$status
Endif

# Now make this memory only table a disk based table for later use
$status = sql("Save table caches2","")


[1] The main quirk of the SQL engine is that it is memory based. The term "open" here really just means when you reference a table for the first time. You could reference a table using any of the SQL commands (SELECT is the most common). When you reference a table in any way (open it) for the first time, a copy of the table data is stored in memory. All further actions on that table are done from this memory table until you issue a RELEASE command. If you want to make sure any changes to the "memory" table are saved you must use COMMIT before you RELEASE the table


Notes
Once you have saved a memory only table with TABLE SAVE you can not ASSIGN TO this same table name anymore.

Copyright 2004-2008 CWE Computer Services  
Privacy Policy Contact