Navigation: Developing Apps > BINETIX® AGE™ API > Plugins > Database Drivers > ADO DB Driver > Functions
execute/6
Description
execute/6 is an Erlang function exported by "ado" module.
Prepares and executes a SQL query using an existing DB handle.
References
•open/3
•close/1
•connect/3
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.
Mode
Optional. Connection mode. Please refer to connect/3 for more details.
Timeout
Optional. Connection timeout in seconds. Defaults to 10 sec.
Result
Value or Type
{sql_result, []}
DB records.
Code Sample
> ado:execute(123456789, "select * from Table1 where age=? and name=?", [20, "Peter"], auto_close, 3, 15).