So today I wrote a few new plugin functions:
FM.SQL.Execute takes a SQL query and optional a file name and parameters. The query is executed and the function returns an error message or on success a reference number. This reference number can be used to query data from the result. FM.SQL.RowCount tells you the number of rows while FM.SQL.FieldCount tells you the number of fields in each row. FM.SQL.Field returns a field value and FM.SQL.FieldType the type of that field. Finally you use FM.SQL.Release to release the result from memory.
The great thing is that you can now use the plugin to run queries and get containers, dates, times and numbers back from the result without conversion to text. With next prerelease plugins we'll include an example database which shows this.