You can call the mysql_query() function to execute the SQL statement to which the null-terminated string stmt_str points.
Syntax
int
mysql_query(MYSQL *mysql,
const char *stmt_str)
Return values
0 is returned for an execution success, and a non-zero value is returned if an error occurred.
Errors
CR_COMMANDS_OUT_OF_SYNC: Commands were executed in an improper order.CR_SERVER_GONE_ERROR: The connection to the OBServer was disconnected.CR_SERVER_LOST: The connection to the server was lost during the query.CR_UNKNOWN_ERROR: An unknown error occurred.
Notes
Generally, a string must consist of a single SQL statement without a terminating semicolon (;) or \g. If multi-statement execution is enabled, a string can contain multiple statements separated with semicolons (;).
You cannot use the mysql_query() function to execute statements that contain binary data. Instead, you must use the mysql_real_query() function. Binary data may contain the \0 character. The mysql_query() function parses this character as the end of a statement string. To execute a statement that contains binary data, use the mysql_real_query() function.
Call the mysql_field_count() function to check whether the statement returns a result set.