C API Function Descriptions
2185
The data-reading function. This is called repeatedly to read the data file.
buf
points to the buffer where
the read data is stored, and
buf_len
is the maximum number of bytes that the callback can read and
store in the buffer. (It can read fewer bytes, but should not read more.)
The return value is the number of bytes read, or zero when no more data could be read (this indicates
EOF). Return a value less than zero if an error occurs.
void
local_infile_end(void *ptr)
The termination function. This is called once after
local_infile_read()
has returned zero (EOF)
or an error. Within this function, deallocate any memory allocated by
local_infile_init()
and
perform any other cleanup necessary. It is invoked even if the initialization function returns an error.
int
local_infile_error(void *ptr,
char *error_msg,
unsigned int error_msg_len);
The error-handling function. This is called to get a textual error message to return to the user in case
any of your other functions returns an error.
error_msg
points to the buffer into which the message is
written, and
error_msg_len
is the length of the buffer. Write the message as a null-terminated string,
at most
error_msg_len
–1 bytes long.
The return value is the error number.
Typically, the other callbacks store the error message in the data structure pointed to by
ptr
, so that
local_infile_error()
can copy the message from there into
error_msg
.
After calling
mysql_set_local_infile_handler()
in your C code and passing pointers
to your callback functions, you can then issue a
LOAD DATA LOCAL INFILE
statement (for
example, by using
mysql_query()
). The client library automatically invokes your callbacks. The
file name specified in
LOAD DATA LOCAL INFILE
will be passed as the second parameter to the
local_infile_init()
callback.
Return Values
None.
Errors
None.
20.6.6.64.
mysql_set_server_option()
int mysql_set_server_option(MYSQL *mysql, enum enum_mysql_set_option option)
Description
Enables or disables an option for the connection.
option
can have one of the following values.
Option
Description
MYSQL_OPTION_MULTI_STATEMENTS_ON
Enable multiple-statement support
MYSQL_OPTION_MULTI_STATEMENTS_OFF
Disable multiple-statement support
If you enable multiple-statement support, you should retrieve results from calls to
mysql_query()
or
mysql_real_query()
by using a loop that calls
mysql_next_result()
to determine whether
there are more results. For an example, see
Section 20.6.15, “C API Support for Multiple Statement
Execution”
.
Enabling multiple-statement support with
MYSQL_OPTION_MULTI_STATEMENTS_ON
does not
have quite the same effect as enabling it by passing the
CLIENT_MULTI_STATEMENTS
flag to
Summary of Contents for 5.0
Page 1: ...MySQL 5 0 Reference Manual ...
Page 18: ...xviii ...
Page 60: ...40 ...
Page 396: ...376 ...
Page 578: ...558 ...
Page 636: ...616 ...
Page 844: ...824 ...
Page 1234: ...1214 ...
Page 1427: ...MySQL Proxy Scripting 1407 ...
Page 1734: ...1714 ...
Page 1752: ...1732 ...
Page 1783: ...Configuring Connector ODBC 1763 ...
Page 1793: ...Connector ODBC Examples 1773 ...
Page 1839: ...Connector Net Installation 1819 2 You must choose the type of installation to perform ...
Page 2850: ...2830 ...
Page 2854: ...2834 ...
Page 2928: ...2908 ...
Page 3000: ...2980 ...
Page 3122: ...3102 ...
Page 3126: ...3106 ...
Page 3174: ...3154 ...
Page 3232: ...3212 ...