执行预准备语句。
sacapi_bool sqlany_execute( a_sqlany_stmt * stmt )
stmt 使用 sqlany_prepare 成功预准备的语句。
成功则为 1,失败则为 0。
可使用 sqlany_num_cols 验证语句是否返回结果集。
// 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 ); } |
Copyright © 2009, iAnywhere Solutions, Inc. - SQL Anywhere 11.0.1 |