Execute SQL code on a database
#include <qdb/qdb.h> int qdb_statement( qdb_hdt_t *db, const char *format, ... );
This function combines the formatting string in format with the values of the additional arguments to construct an SQL command string and then executes that string on the database referred to by db.
Individual statements within the command string must be completed with and separated by semicolons. There's no length restriction for the command string.
The formatting string and additional arguments work in the same way as with printf() (all the same conversion specifiers apply). There are additional conversion specifiers, %q and %Q, which in general should be used instead of %s for inserting text into a literal string. For information on these two additional specifiers, see qdb_mprintf().
To determine how many rows were affected by the SQL command string, you can call qdb_rowchanges() after executing the command string.
By default, the SQL code is executed on the database before qdb_statement() returns. However, if the connection is in asynchronous mode, the function might return before the SQL code completes execution but might not report errors. In this case, you must call qdb_getresult() to retrieve any errors.
QNX Neutrino
Safety: | |
---|---|
Interrupt handler | No |
Signal handler | No |
Thread | Yes |