C Api Prepared Statements; C Api Prepared Statement Data Structures - Oracle 5.0 Reference Manual

Table of Contents

Advertisement

CR_OUT_OF_MEMORY
Out of memory.
CR_SERVER_GONE_ERROR
The MySQL server has gone away.
CR_SERVER_LOST
The connection to the server was lost during the query.
CR_UNKNOWN_ERROR
An unknown error occurred.
20.6.6.72.
mysql_warning_count()
unsigned int mysql_warning_count(MYSQL *mysql)
Description
Returns the number of errors, warnings, and notes generated during execution of the previous SQL
statement.
Return Values
The warning count.
Errors
None.

20.6.7. C API Prepared Statements

The MySQL client/server protocol provides for the use of prepared statements. This capability uses
the
MYSQL_STMT
function. Prepared execution is an efficient way to execute a statement more than once. The statement
is first parsed to prepare it for execution. Then it is executed one or more times at a later time, using
the statement handle returned by the initialization function.
Prepared execution is faster than direct execution for statements executed more than once, primarily
because the query is parsed only once. In the case of direct execution, the query is parsed every time
it is executed. Prepared execution also can provide a reduction of network traffic because for each
execution of the prepared statement, it is necessary only to send the data for the parameters.
Prepared statements might not provide a performance increase in some situations. For best results,
test your application both with prepared and nonprepared statements and choose whichever yields
best performance.
Another advantage of prepared statements is that it uses a binary protocol that makes data transfer
between client and server more efficient.
For a list of SQL statements that can be used as prepared statements, see
for Prepared

20.6.8. C API Prepared Statement Data Structures

Prepared statements use several data structures:
• To obtain a statement handle, pass a
returns a pointer to a
C API Prepared Statements
[2942]
[2942]
[2942]
[2941]
statement handler data structure returned by the
Statements".
MYSQL_STMT
connection handler to mysql_stmt_init(), which
MYSQL
data structure. This structure is used for further operations with
2191
mysql_stmt_init()
Section 13.5, "SQL Syntax
initialization

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the 5.0 and is the answer not in the manual?

Questions and answers

This manual is also suitable for:

Mysql 5.0

Table of Contents