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

_______________________________________________
use-revolution mailing list
[email protected]
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution

Reply via email to