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

SQL Anywhere 11.0.1 (Français) » SQL Anywhere Server - Programming » SQL Anywhere Data Access APIs » SQL Anywhere for Ruby » SQL Anywhere Ruby API



Executes the SQL statement specified by the string argument.

sqlany_execute_direct ( $conn, $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 ?.


Returns a statement object or nil on failure.


Use this function if you want to prepare and execute a statement in one step. Do not use this function to execute a SQL statement with parameters.

See also
stmt = api.sqlany_execute_direct( conn, "SELECT * FROM Employees" )
rc = api.sqlany_fetch_next( stmt )
rc, employeeID = api.sqlany_get_column( stmt, 0 )
rc, managerID  = api.sqlany_get_column( stmt, 1 )
rc, surname = api.sqlany_get_column( stmt, 2 )
rc, givenName = api.sqlany_get_column( stmt, 3 )
rc, departmentID = api.sqlany_get_column( stmt, 4 )
print employeeID, ",", managerID, ",",
     surname, ",", givenName, ",", departmentID, "\n"