SELECT FROM Db
Josh Mellicker
josh at dvcreators.net
Tue Aug 1 16:48:34 EDT 2006
I like using "replace()"
I find this very readable and simple to write:
put "DELETE FROM `tmySQLtableName` WHERE `tIDcolumnName` =
tRecordID" into theSQL
then, replacing the placeholders:
replace "tmySQLtableName" with "accounts" in theSQL
replace "tIDcolumnName" with "accountID" in theSQL
replace "tRecordID" with q(tRecordID) in theSQL
here's the actual handler from whence I draw the example:
ON jjSQLdelete tRecordID, tIDcolumnName, tmySQLtableName
put "DELETE FROM `tmySQLtableName` WHERE `tIDcolumnName` =
tRecordID" into theSQL
replace "tmySQLtableName" with tmySQLtableName in theSQL
replace "tIDcolumnName" with tIDcolumnName in theSQL
replace "tRecordID" with q(tRecordID) in theSQL
doThisSQL theSQL
END jjSQLdelete
FUNCTION q a
return quote & a & quote
END q
FUNCTION bq a
return "`" & a & "`"
END bq
More information about the use-livecode
mailing list