sqlany_execute( a_sqlany_stmt *) method

Executes a prepared statement.

Syntax

public sacapi_bool sqlany_execute ( a_sqlany_stmt * sqlany_stmt)

Parameters

Returns

1 if the statement is executed successfully or 0 on failure.

Usage

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, &param );
    param.value.buffer = (char *)&i;
    param.value.type   = A_VAL32;
    sqlany_bind_param( stmt, 0, &param );
              


                      sqlany_describe_bind_param( stmt, 1, &param );
    param.value.buffer = (char *)&i;
    param.value.type   = A_VAL32;
    sqlany_bind_param( stmt, 1, &param );
              


                      for( i = 0; i < 10; i++ ) {
        if( !sqlany_execute( stmt ) ) {	
	           // call sqlany_error()
	       }
    }
    sqlany_free_stmt( stmt );
}