Executes a prepared statement.
public sacapi_bool sqlany_execute(a_sqlany_stmt * sqlany_stmt)
sqlany_stmt A statement prepared successfully using sqlany_prepare().
1 if the statement is executed successfully or 0 on failure.
You can use sqlany_num_cols() to verify if the executed statement returned a result set.
The following example shows how to execute a statement that does not return a result set:
a_sqlany_stmt * stmt; int i; a_sqlany_bind_param param; stmt = sqlany_prepare( sqlany_conn, "insert into moe(id,value) values( ?,? )" ); if( stmt ) { sqlany_describe_bind_param( stmt, 0, ¶m ); param.value.buffer = (char *)&i; param.value.type = A_VAL32; sqlany_bind_param( stmt, 0, ¶m ); sqlany_describe_bind_param( stmt, 1, ¶m ); param.value.buffer = (char *)&i; param.value.type = A_VAL32; sqlany_bind_param( stmt, 1, ¶m ); for( i = 0; i < 10; i++ ) { if( !sqlany_execute( stmt ) ) { // call sqlany_error() } } sqlany_free_stmt( stmt ); }