Oracle 5.0 Reference Manual page 2204

Table of Contents

Advertisement

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",
}
20.6.6.62.
mysql_set_local_infile_default()
void mysql_set_local_infile_default(MYSQL *mysql);
Description
Sets the
LOAD LOCAL DATA INFILE
used internally by the C client library. The library calls this function automatically if
mysql_set_local_infile_handler()
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
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
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
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);
C API Function Descriptions
mysql_character_set_name(&mysql));
handler callback functions to the defaults
has not been called or does not supply valid functions for
argument is a pointer to a pointer. You can set the
void**
2184
LOAD DATA LOCAL INFILE
argument is the
userdata

Advertisement

Table of Contents
loading

This manual is also suitable for:

Mysql 5.0

Table of Contents