Creation of Database from Runrev

Jim Ault JimAultWins at yahoo.com
Thu Dec 7 11:26:21 EST 2006


On 12/7/06 7:55 AM, "jhonken" <jhonken at webdsp.com> wrote:

> My application has a Sqlite database that I'd like to create from
> Runrev.  The problem I've had in the past is that I can't execute a
> realllly long SQL statement within Rev.  Is there some trick to it or is
> there another way?  The limitations I've run into are:
>  
> 1.  It seems that the SQL statement likes to be on one line.
> 2.  I've tried to use the continuation character in the statement in the
> past but the statement is so long it seems to choke.
>  
> Does anyone have any ideas on how I can execute a long create statement?

If you mean build a long string in a variable then there are a few ways
Using the merge for SQL is my preference

Some readable ways for SQL
  --that  "do-it-all-in-one-line"
  --without using "replace"
  -- only one function call, merge()
  --   yet remain readable

------------------ one line  (watch word wrap)
  put merge("DELETE FROM [[tmysqltableName]] Where [[tIDcolumnName]] =
'[[tRecordID]]'") into theSQL

  -------------------- or another way = same result (watch word wrap)
  put merge("DELETE FROM [[tmysqltableName]] Where [[tIDcolumnName]] =
'[[tRecordID]]'") \
      into theSQL

  -------------------- yet another way = same result
  put merge("DELETE FROM [[tmysqltableName]] "  & \
  "Where [[tIDcolumnName]] = '[[tRecordID]]'") \
      into theSQL

  -------------------- or another way to get a COMPLEX result
  put tRecordID + 1 into tRecordID2

put merge("" & \
      "DELETE FROM [[tmysqltableName]] "& \
      "Where ([[tIDcolumnName]] = '[[tRecordID]]' "& \
      "OR  [[tIDcolumnName]] = '[[tRecordID-1]]') "& \
      "AND  [[tIDcolumnName]] = '[[tRecordID2]]'" & \
      "") into theSQL3

Fun with Rev  

Jim Ault
Las Vegas





More information about the use-livecode mailing list