fm_sql_execute_on_idle


int fm_sql_execute_on_idle ( string $sql_query [, string $file_name [, arguments... ]] )


 

Description


Allows you to perform SQL CREATE TABLE, ALTER TABLE, CREATE INDEX or DROP INDEX queries against a FileMaker file.

These special SQL statements must be executed while FileMaker is idle and thus will not be executed immediately. This function returns a query id which can then be used with fm_sql_get_query_status to find out if the query has been executed and if so whether or not it was successful.

See FileMaker’s SQL Reference for more info on SQL support in FileMaker.

 

Parameters


sql_query (required)
A valid SQL CREATE TABLE, ALTER TABLE, CREATE INDEX or DROP INDEX statement. The query must begin with “CREATE TABLE, ALTER TABLE, CREATE INDEX or DROP INDEX”.

file_name (optional) (only available in FileMaker 11 or higher)
Allows you to specify the name of the file in which to run the query. The current file will be used by default so this is only needed if the table(s) you’re querying are in a different file. Note that the file must be open.

arguments... (optional) (only available in FileMaker 11 or higher)
Any number of optional arguments corresponding to the dynamic parameters (?’s) in your query.

 

Return


Returns the query id.

 

Errors


There are no errors for this function but note that fm_get_last_error will return “106 Invalid parameter” if the query doesn’t begin with “CREATE TABLE, ALTER TABLE, CREATE INDEX or DROP INDEX”.

 

Example 1 - Concatenate 3 strings
// Todo

Change Log

VersionDescription
3.0.0New function – adds support for special SQL statements that must be performed while FileMaker is idle.