Execute an SQL statement
#include <qdb/qdb.h> int qdb_statement( qdb_hdt_t *hdl, const char *format, ... );
This function executes against the database all statements in the string generated by the combination of format and any additional arguments. A statement must be completed with a semicolon. The string may contain multiple statements as long as they are separated by semicolons. There's no arbitrary restriction on the length of the command string.
The format string and additional arguments work in the same way as the arguments for printf(), and all the same conversion specifiers apply. There are additional conversion type specifiers, %q and %Q, which in general should be used instead of %s for inserting text into a literal string. The %q type specifier properly escapes special characters for SQL. For more information, see qdb_mprintf().
If you are passing in multiple statements, the function returns the number of affected rows only for the last statement.
|By default, the SQL statement is executed on the database before qdb_statement() returns. However, if the connection is in asynchronous mode, this function can return before the statement is executed, and it may not report errors. In this case, you need to call qdb_getresult() to retrieve any errors generated by the statement. For more information, see “Using asynchronous mode” in qdb_connect().|
qdb_mprintf(), qdb_vmprintf(), printf() in the Neutrino Library Reference