Creating MySQL Databases

Mark Waddingham 36degrees at runrev.com
Mon Mar 21 07:01:48 EST 2005


Hi Peter,

revDB offers three methods of executing SQL commands:
  1) revExecuteSQL
  2) revQueryDatabase
  3) revDataFromQuery

revExecuteSQL should be used when the SQL statement you are executing
does not return any data - e.g. CREATE DATABASE, CREATE TABLE, UPDATE
etc. - in this case the value returned will be the number of rows
affected by the query (or zero, if this is not applicable).

revQueryDatabase creates a 'cursor' that allows you to iterate through
the result one by one and is best used when you are iterating through
large amounts of data, or data that contains arbitrary text or binary
data. (There are a number of commands/functions that operate on cursors
- have a look in the docs for more info).

revDataFromQuery returns all the data from a query as a string that you
can then process. It is ideal when you are requesting relatively small
amounts of data. The syntax is:
  revDataFromQuery(<columnDelimiter>, <rowDelimiter>, <id>, <SQL>)
And it returns a string in which each row is separated by <rowDelimiter>
and each column within each row is separated by <columnDelimiter>. For
example, the command you probably want to use is something like:

  put revDataFromQuery(tab, return, dbId, "SHOW DATABASES") \
    into sqlResult

Which should give you a returned-delimited list of databases :o)

Warmest Regards,

Mark.

------------------------------------------------------------------
 Mark Waddingham ~ 36degrees at runrev.com ~ http://www.runrev.com
       Runtime Revolution ~ User-Centric Development Tools



More information about the use-livecode mailing list