C API Prepared Statement Function Descriptions
2219
parameter_number
indicates which parameter to associate the data with. Parameters are numbered
beginning with 0.
data
is a pointer to a buffer containing data to be sent, and
length
indicates the
number of bytes in the buffer.
Note
The next
mysql_stmt_execute()
call ignores the bind buffer for all
parameters that have been used with
mysql_stmt_send_long_data()
since last
mysql_stmt_execute()
or
mysql_stmt_reset()
.
If you want to reset/forget the sent data, you can do it with
mysql_stmt_reset()
. See
Section 20.6.10.21, “
mysql_stmt_reset()
”
.
Return Values
Zero if the data is sent successfully to server. Nonzero if an error occurred.
Errors
•
CR_INVALID_BUFFER_USE
[2944]
The parameter does not have a string or binary type.
•
CR_COMMANDS_OUT_OF_SYNC
[2942]
Commands were executed in an improper order.
•
CR_SERVER_GONE_ERROR
[2942]
The MySQL server has gone away.
•
CR_OUT_OF_MEMORY
[2942]
Out of memory.
•
CR_UNKNOWN_ERROR
[2941]
An unknown error occurred.
Example
The following example demonstrates how to send the data for a
TEXT
column in chunks. It inserts the
data value
'MySQL - The most popular Open Source database'
into the
text_column
column. The
mysql
variable is assumed to be a valid connection handle.
#define INSERT_QUERY "INSERT INTO \
test_long_data(text_column) VALUES(?)"
MYSQL_BIND bind[1];
long length;
stmt = mysql_stmt_init(mysql);
if (!stmt)
{
fprintf(stderr, " mysql_stmt_init(), out of memory\n");
exit(0);
}
if (mysql_stmt_prepare(stmt, INSERT_QUERY, strlen(INSERT_QUERY)))
{
fprintf(stderr, "\n mysql_stmt_prepare(), INSERT failed");
fprintf(stderr, "\n %s", mysql_stmt_error(stmt));
exit(0);
}
memset(bind, 0, sizeof(bind));
bind[0].buffer_type= MYSQL_TYPE_STRING;
Содержание 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 ...