sqlany_execute function

Executes a prepared statement.

Syntax
sacapi_bool sqlany_execute( a_sqlany_stmt * stmt )
Parameters
  • stmt   A statement prepared successfully using sqlany_prepare.

Returns

1 on success or 0 on failure.

Remarks

You can use sqlany_num_cols to verify if the statement returned a result set.

See also
Example
// 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, &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 );
   }