Click here to view and discuss this page in DocCommentXchange. In the future, you will be sent there automatically.

SQL Anywhere 11.0.1 » SQL Anywhere Server - Programming » SQL Anywhere Data Access APIs » SQL Anywhere C API reference » sacapi.h


sqlany_execute_direct function

Executes the SQL statement specified by the string argument.

a_sqlany_stmt * sqlany_execute_direct( a_sqlany_connection * conn, const char * sql )
  • conn   A connection object with a connection established using sqlany_connect.

  • sql   A SQL string. The SQL string should not have parameters such as ?.


Use this function if you want to prepare and execute a statement, or instead of sqlany_prepare followed by sqlany_execute. Do not use this function to execute a SQL statement with parameters.


A statement handle when the function executes successfully, NULL when the function executes unsuccessfully.

See also
 stmt = sqlany_execute_direct( conn, "select * from employees" ) ) {
   if( stmt ) {
       while( sqlany_fetch_next( stmt ) ) {
           int i;
           for( i = 0; i < sqlany_num_cols( stmt ); i++ ) {
                // Get i'th column data
       sqlany_free_stmt( stmt  );