Creating MySQL Databases

Peter Reid preid at reidit.co.uk
Mon Mar 21 07:09:28 EST 2005


Hi Mark

Just the job thanks!  I had assumed that revDataFromQuery had to be 
used with table results rather than for general purposes - my 
mistake!!

Cheers

Peter

>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.

-- 
Peter Reid
Reid-IT Limited, Loughborough, Leics., UK
E-mail: preid at reidit.co.uk


More information about the use-livecode mailing list