Executes a prepared statement.
sacapi_bool sqlany_execute( a_sqlany_stmt * stmt )stmt A statement prepared successfully using sqlany_prepare.
1 on success or 0 on failure.
You can use sqlany_num_cols to verify if the statement returned a result set.
// This 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( 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 );
}
|
| Discuss this page in DocCommentXchange. Send feedback about this page using email. |
Copyright © 2009, iAnywhere Solutions, Inc. - SQL Anywhere 11.0.1 |