Navigation: Developing Apps > BINETIX® AGE™ API > Plugins > Database Drivers > TDS DB Driver > Functions
execute/4
Description
execute/4 is an Erlang function exported by "tds" module.
Prepares and executes a SQL query using an existing DB handle.
References
•open/1
•close/1
Parameters
Name
Type
Handle
integer()
Database handle.
SQL
string()
SQL statement.
Params
[]
Optional. List of substitution parameters within the SQL string. Defaults to [].
CloseFlag
atom()
Optional. This flag specifies how DB shall be managed after the SQL execution.
The flag values are:
•on_demand - default value;
•auto_close - automatically calls close/1 with Handle value.
Result
Value or Type
{sql_result, []}
DB records.
Code Sample
> tds:execute(123456789, "select * from Table1 where age=? and name=?", [20, "Peter"], auto_close).