sqlany_prepare( a_sqlany_connection *, const char *) method

Prepares a supplied SQL string.

Syntax

public a_sqlany_stmt * sqlany_prepare ( a_sqlany_connection * sqlany_conn, const char * sql_str)

Parameters

Returns

A handle to a SQL Anywhere statement object. The statement object can be used by sqlany_execute() to execute the statement.

Usage

Execution does not happen until sqlany_execute() is called. The returned statement object should be freed using sqlany_free_stmt().

The following statement demonstrates how to prepare a SELECT SQL string:

                 
char * str;
a_sqlany_stmt * stmt;
              


                  str = "select * from employees where salary >= ?";
stmt = sqlany_prepare( sqlany_conn, str );
if( stmt == NULL ) {
    // Failed to prepare statement, call sqlany_error() for more info
}