![background image](http://html1.mh-extra.com/html/oracle/5-0/5-0_reference-manual_16461962223.webp)
C API Prepared Statement Function Descriptions
2203
Example
See the Example in
Section 20.6.10.10, “
mysql_stmt_execute()
”
.
20.6.10.5.
mysql_stmt_bind_result()
my_bool mysql_stmt_bind_result(MYSQL_STMT *stmt, MYSQL_BIND *bind)
Description
mysql_stmt_bind_result()
is used to associate (that is, bind) output columns in the result set
to data buffers and length buffers. When
mysql_stmt_fetch()
is called to fetch data, the MySQL
client/server protocol places the data for the bound columns into the specified buffers.
All columns must be bound to buffers prior to calling
mysql_stmt_fetch()
.
bind
is the
address of an array of
MYSQL_BIND
structures. The client library expects the array to contain one
element for each column of the result set. If you do not bind columns to
MYSQL_BIND
structures,
mysql_stmt_fetch()
simply ignores the data fetch. The buffers should be large enough to hold the
data values, because the protocol doesn't return data values in chunks.
A column can be bound or rebound at any time, even after a result set has been partially retrieved.
The new binding takes effect the next time
mysql_stmt_fetch()
is called. Suppose that an
application binds the columns in a result set and calls
mysql_stmt_fetch()
. The client/server
protocol returns data in the bound buffers. Then suppose that the application binds the columns to a
different set of buffers. The protocol places data into the newly bound buffers when the next call to
mysql_stmt_fetch()
occurs.
To bind a column, an application calls
mysql_stmt_bind_result()
and passes the type, address,
and length of the output buffer into which the value should be stored.
Section 20.6.8, “C API Prepared
Statement Data Structures”
, describes the members of each
MYSQL_BIND
element and how they
should be set to receive output values.
Return Values
Zero if the bind operation was successful. Nonzero if an error occurred.
Errors
•
CR_UNSUPPORTED_PARAM_TYPE
[2944]
The conversion is not supported. Possibly the
buffer_type
value is illegal or is not one of the
supported types.
•
CR_OUT_OF_MEMORY
[2942]
Out of memory.
•
CR_UNKNOWN_ERROR
[2941]
An unknown error occurred.
Example
See the Example in
Section 20.6.10.11, “
mysql_stmt_fetch()
”
.
20.6.10.6.
mysql_stmt_close()
my_bool mysql_stmt_close(MYSQL_STMT *)
Description
Closes the prepared statement.
mysql_stmt_close()
also deallocates the statement handle pointed
to by
stmt
.
Содержание 5.0
Страница 1: ...MySQL 5 0 Reference Manual ...
Страница 18: ...xviii ...
Страница 60: ...40 ...
Страница 396: ...376 ...
Страница 578: ...558 ...
Страница 636: ...616 ...
Страница 844: ...824 ...
Страница 1234: ...1214 ...
Страница 1426: ...MySQL Proxy Scripting 1406 The following diagram shows an overview of the classes exposed by MySQL Proxy ...
Страница 1427: ...MySQL Proxy Scripting 1407 ...
Страница 1734: ...1714 ...
Страница 1752: ...1732 ...
Страница 1783: ...Configuring Connector ODBC 1763 ...
Страница 1793: ...Connector ODBC Examples 1773 ...
Страница 1839: ...Connector Net Installation 1819 2 You must choose the type of installation to perform ...
Страница 1842: ...Connector Net Installation 1822 5 Once the installation has been completed click Finish to exit the installer ...
Страница 1864: ...Connector Net Visual Studio Integration 1844 Figure 20 24 Debug Stepping Figure 20 25 Function Stepping 1 of 2 ...
Страница 2850: ...2830 ...
Страница 2854: ...2834 ...
Страница 2928: ...2908 ...
Страница 3000: ...2980 ...
Страница 3122: ...3102 ...
Страница 3126: ...3106 ...
Страница 3174: ...3154 ...
Страница 3232: ...3212 ...