C API Function Descriptions
2184
Example
MYSQL mysql;
mysql_init(&mysql);
if (!mysql_real_connect(&mysql,"host","user","passwd","database",0,NULL,0))
{
fprintf(stderr, "Failed to connect to database: Error: %s\n",
mysql_error(&mysql));
}
if (!mysql_set_character_set(&mysql, "utf8"))
{
printf("New client character set: %s\n",
mysql_character_set_name(&mysql));
}
20.6.6.62.
mysql_set_local_infile_default()
void mysql_set_local_infile_default(MYSQL *mysql);
Description
Sets the
LOAD LOCAL DATA INFILE
handler callback functions to the defaults
used internally by the C client library. The library calls this function automatically if
mysql_set_local_infile_handler()
has not been called or does not supply valid functions for
each of its callbacks.
Return Values
None.
Errors
None.
20.6.6.63.
mysql_set_local_infile_handler()
void mysql_set_local_infile_handler(MYSQL *mysql, int (*local_infile_init)
(void **, const char *, void *), int (*local_infile_read)(void *, char *,
unsigned int), void (*local_infile_end)(void *), int (*local_infile_error)
(void *, char*, unsigned int), void *userdata);
Description
This function installs callbacks to be used during the execution of
LOAD DATA LOCAL INFILE
statements. It enables application programs to exert control over local (client-side) data file reading.
The arguments are the connection handler, a set of pointers to callback functions, and a pointer to a
data area that the callbacks can use to share information.
To use
mysql_set_local_infile_handler()
, you must write the following callback functions:
int
local_infile_init(void **ptr, const char *filename, void *userdata);
The initialization function. This is called once to do any setup necessary, open the data file, allocate
data structures, and so forth. The first
void**
argument is a pointer to a pointer. You can set the
pointer (that is,
*ptr
) to a value that will be passed to each of the other callbacks (as a
void*
). The
callbacks can use this pointed-to value to maintain state information. The
userdata
argument is the
same value that is passed to
mysql_set_local_infile_handler()
.
The initialization function should return zero for success, nonzero for an error.
int
local_infile_read(void *ptr, char *buf, unsigned int buf_len);
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 ...