August 5, 201510 yr Wim - I got this from something you wrote. Where can I get information (Reading 101 type info - it seems to me that the FM Site has little in the way of worked examples - or im missing something) on the structure of this code? I understand SELECT * FROM myTable WHERE myField = something but what is the ? and later what is the ;"";""; ExecuteSQL( "SELECT id FROM myTable WHERE myField = ? and id <> ?" ; "" ; "" ; myTable::myField ; myTable::ID )
August 5, 201510 yr This would be a good place to start: http://www.filemaker.com/help/14/fmp/en/html/func_ref1.32.185.html and then: http://filemakerhacks.com/2012/10/19/the-missing-fm-12-executesql-reference/ In a nutshell: the empty quotes in the function's argument list is to signal that FM can use the default column and record delimiters. You can specify your own delimiters instead of the default ones. The "?" is a parameter placeholder. If you use it, you have to tag the parameter itself to the end of the arguments list. Using parameters solves two issues: - it protects against SQL injection mis-use of your query - FM will properly format and quote any data you pass as a parameter (single quotes for text, no quotes numbers, proper format for date, time and timestamps,...). If you don't use parameters you have to make sure your values are properly quotes and formatted.
Create an account or sign in to comment