Author: paul
Date: 2006-04-21 00:11:52 +0200 (Fri, 21 Apr 2006)
New Revision: 1894
Log:
r9602@frost: paul | 2006-04-20 17:09:36 -0500
Document mysql_set_local_infile_handler(), mysql_set_local_infile_default().
(Bug#12407)
Modified:
trunk/
trunk/refman-4.1/apis.xml
trunk/refman-5.0/apis.xml
trunk/refman-5.1/apis.xml
trunk/refman-common/news-4.1.xml
trunk/refman-common/titles.en.ent
Property changes on: trunk
___________________________________________________________________
Name: svk:merge
- 4767c598-dc10-0410-bea0-d01b485662eb:/mysqldoc-local/mysqldoc/trunk:6782
b5ec3a16-e900-0410-9ad2-d183a3acac99:/mysqldoc-local/mysqldoc/trunk:9598
bf112a9c-6c03-0410-a055-ad865cd57414:/mysqldoc-local/mysqldoc/trunk:4590
+ 4767c598-dc10-0410-bea0-d01b485662eb:/mysqldoc-local/mysqldoc/trunk:6782
b5ec3a16-e900-0410-9ad2-d183a3acac99:/mysqldoc-local/mysqldoc/trunk:9602
bf112a9c-6c03-0410-a055-ad865cd57414:/mysqldoc-local/mysqldoc/trunk:4590
Modified: trunk/refman-4.1/apis.xml
===================================================================
--- trunk/refman-4.1/apis.xml 2006-04-20 21:18:49 UTC (rev 1893)
+++ trunk/refman-4.1/apis.xml 2006-04-20 22:11:52 UTC (rev 1894)
@@ -1589,6 +1589,16 @@
<entry>Initialize embedded server library.</entry>
</row>
<row>
+ <entry><emphasis role="bold"><link linkend="mysql-set-local-infile-default">mysql_set_local_infile_default()</link></emphasis></entry>
+ <entry>Set the <literal>LOAD DATA LOCAL INFILE</literal> handler callbacks to
+ their default values.</entry>
+ </row>
+ <row>
+ <entry><emphasis role="bold"><link linkend="mysql-set-local-infile-handler">mysql_set_local_infile_handler()</link></emphasis></entry>
+ <entry>Install application-specific <literal>LOAD DATA LOCAL INFILE</literal>
+ handler callbacks.</entry>
+ </row>
+ <row>
<entry><emphasis role="bold"><link linkend="mysql-set-server-option">mysql_set_server_option()</link></emphasis></entry>
<entry>Sets an option for the connection (like
<literal>multi-statements</literal>).</entry>
@@ -7103,7 +7113,216 @@
</programlisting>
</section>
+ <section id="mysql-set-local-infile-default">
+ <title>&title-mysql-set-local-infile-default;</title>
+
+ <indexterm type="function">
+ <primary><literal>mysql_set_local_infile_default()</literal></primary>
+ </indexterm>
+
+ <indexterm type="function">
+ <primary><literal>mysql_set_local_infile_default()</literal></primary>
+ </indexterm>
+
+<programlisting>
+void
+mysql_set_local_infile_default(MYSQL *mysql);
+</programlisting>
+
+ <para>
+ <emphasis role="bold">Description</emphasis>
+ </para>
+
+ <para>
+ Sets the <literal>LOAD LOCAL DATA INFILE</literal> handler
+ callback functions to the defaults used internally by the C client
+ library. The library calls this function automatically if
+ <literal>mysql_set_local_infile_handler()</literal> has not been
+ called or does not supply valid functions for each of its
+ callbacks.
+ </para>
+
+ <para>
+ The <literal>mysql_set_local_infile_default()</literal> function
+ was added in MySQL 4.1.2.
+ </para>
+
+ <para>
+ <emphasis role="bold">Return Values</emphasis>
+ </para>
+
+ <para>
+ None.
+ </para>
+
+ <para>
+ <emphasis role="bold">Errors</emphasis>
+ </para>
+
+ <remark role="todo">
+ Really non?
+ </remark>
+
+ <para>
+ None.
+ </para>
+
+ </section>
+
+ <section id="mysql-set-local-infile-handler">
+
+ <title>&title-mysql-set-local-infile-handler;</title>
+
+<programlisting>
+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);
+</programlisting>
+
+ <para>
+ <emphasis role="bold">Description</emphasis>
+ </para>
+
+ <para>
+ This function installs callbacks to be used during the execution
+ of <literal>LOAD DATA LOCAL INFILE</literal> statements. It
+ enables application programs to exert control over local
+ (client-side) datafile 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.
+ </para>
+
+ <para>
+ To use <literal>mysql_set_local_infile_handler()</literal>, you
+ must write the following callback functions:
+ </para>
+
+<programlisting>
+int
+local_infile_init(void **ptr, const char *filename, void *userdata);
+</programlisting>
+
+ <para>
+ The initialization function. This is called once to do any setup
+ necessary, open the datafile, allocate data structures, and so
+ forth. The first <literal>void**</literal> argument is a pointer
+ to a pointer. You can set the pointer (that is,
+ <literal>*ptr</literal>) to a value that will be passed to each of
+ the other callbacks (as a <literal>void*</literal>). The callbacks
+ can use this pointed-to value to maintain state information. The
+ <literal>userdata</literal> argument is the same value that is
+ passed to <literal>mysql_set_local_infile_handler()</literal>.
+ </para>
+
+ <para>
+ The initialization function should return zero for success,
+ non-zero for an error.
+ </para>
+
+<programlisting>
+int
+local_infile_read(void *ptr, char *buf, unsigned int buf_len);
+</programlisting>
+
+ <para>
+ The data-reading function. This is called repeatedly to read the
+ data file. <literal>buf</literal> points to the buffer where the
+ read data should be stored, and <literal>buf_len</literal> 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.)
+ </para>
+
+ <para>
+ 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.
+ </para>
+
+<programlisting>
+void
+local_infile_end(void *ptr)
+</programlisting>
+
+ <para>
+ The termination function. This is called once after
+ <literal>local_infile_read()</literal> has returned zero (EOF) or
+ an error. This function should deallocate any memory allocated by
+ <literal>local_infile_init()</literal> and perform any other
+ cleanup necessary. It is invoked even if the initalization
+ function returns an error.
+ </para>
+
+<programlisting>
+int
+local_infile_error(void *ptr, char *error_msg, unsigned int error_msg_len);
+</programlisting>
+
+ <para>
+ 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. <literal>error_msg</literal> points to the
+ buffer into which the message should be written, and
+ <literal>error_msg_len</literal> is the length of the buffer. The
+ message should be written as a null-terminated string, so the
+ message can be at most <literal>error_msg_len</literal>−1
+ bytes long.
+ </para>
+
+ <para>
+ The return value is the error number.
+ </para>
+
+ <para>
+ Typically, the other callbacks store the error message in the data
+ structure pointed to by <literal>ptr</literal>, so that
+ <literal>local_infile_error()</literal> can copy the message from
+ there into <literal>error_msg</literal>.
+ </para>
+
+ <para>
+ After calling <literal>mysql_set_local_infile_handler()</literal>
+ in your C code and passing pointers to your callback functions,
+ you can then issue a <literal>LOAD DATA LOCAL INFILE</literal>
+statement (for example, by using
+ <literal>mysql_query()</literal>). The client library automatically
+ invokes your callbacks. The
+ filename specified in <literal>LOAD DATA LOCAL INFILE</literal>
+ will be passed as the second parameter to the
+ <literal>local_infile_init()</literal> callback.
+ </para>
+
+ <para>
+ The <literal>mysql_set_local_infile_handler()</literal> function
+ was added in MySQL 4.1.2.
+ </para>
+
+ <para>
+ <emphasis role="bold">Return Values</emphasis>
+ </para>
+
+ <para>
+ None.
+ </para>
+
+ <para>
+ <emphasis role="bold">Errors</emphasis>
+ </para>
+
+ <remark role="todo">
+ Really non?
+ </remark>
+
+ <para>
+ None.
+ </para>
+
+ </section>
+
<section id="mysql-set-server-option">
<title>&title-mysql-set-server-option;</title>
Modified: trunk/refman-5.0/apis.xml
===================================================================
--- trunk/refman-5.0/apis.xml 2006-04-20 21:18:49 UTC (rev 1893)
+++ trunk/refman-5.0/apis.xml 2006-04-20 22:11:52 UTC (rev 1894)
@@ -1388,408 +1388,295 @@
<entry><emphasis role="bold">Description</emphasis></entry>
</row>
<row>
- <entry><emphasis role="bold">
- <link linkend="mysql-affected-rows">mysql_affected_rows()</link>
- </emphasis></entry>
+ <entry><emphasis role="bold"><link linkend="mysql-affected-rows">mysql_affected_rows()</link></emphasis></entry>
<entry>Returns the number of rows changed/deleted/inserted by the last
<literal>UPDATE</literal>, <literal>DELETE</literal>, or
<literal>INSERT</literal> query.</entry>
</row>
<row>
- <entry><emphasis role="bold">
- <link linkend="mysql-autocommit">mysql_autocommit()</link>
- </emphasis></entry>
+ <entry><emphasis role="bold"><link linkend="mysql-autocommit">mysql_autocommit()</link></emphasis></entry>
<entry>Toggles autocommit mode on/off.</entry>
</row>
<row>
- <entry><emphasis role="bold">
- <link linkend="mysql-change-user">mysql_change_user()</link>
- </emphasis></entry>
+ <entry><emphasis role="bold"><link linkend="mysql-change-user">mysql_change_user()</link></emphasis></entry>
<entry>Changes user and database on an open connection.</entry>
</row>
<row>
- <entry><emphasis role="bold"> <link linkend="mysql-close">mysql_close()</link>
- </emphasis></entry>
+ <entry><emphasis role="bold"><link linkend="mysql-close">mysql_close()</link></emphasis></entry>
<entry>Closes a server connection.</entry>
</row>
<row>
- <entry><emphasis role="bold">
- <link linkend="mysql-commit">mysql_commit()</link>
- </emphasis></entry>
+ <entry><emphasis role="bold"><link linkend="mysql-commit">mysql_commit()</link></emphasis></entry>
<entry>Commits the transaction.</entry>
</row>
<row>
- <entry><emphasis role="bold">
- <link linkend="mysql-connect">mysql_connect()</link>
- </emphasis></entry>
+ <entry><emphasis role="bold"><link linkend="mysql-connect">mysql_connect()</link></emphasis></entry>
<entry>Connects to a MySQL server. This function is deprecated; use
<literal>mysql_real_connect()</literal> instead.</entry>
</row>
<row>
- <entry><emphasis role="bold">
- <link linkend="mysql-create-db">mysql_create_db()</link>
- </emphasis></entry>
+ <entry><emphasis role="bold"><link linkend="mysql-create-db">mysql_create_db()</link></emphasis></entry>
<entry>Creates a database. This function is deprecated; use the SQL statement
<literal>CREATE DATABASE</literal> instead.</entry>
</row>
<row>
- <entry><emphasis role="bold">
- <link linkend="mysql-data-seek">mysql_data_seek()</link>
- </emphasis></entry>
+ <entry><emphasis role="bold"><link linkend="mysql-data-seek">mysql_data_seek()</link></emphasis></entry>
<entry>Seeks to an arbitrary row number in a query result set.</entry>
</row>
<row>
- <entry><emphasis role="bold"> <link linkend="mysql-debug">mysql_debug()</link>
- </emphasis></entry>
+ <entry><emphasis role="bold"><link linkend="mysql-debug">mysql_debug()</link></emphasis></entry>
<entry>Does a <literal>DBUG_PUSH</literal> with the given string.</entry>
</row>
<row>
- <entry><emphasis role="bold">
- <link linkend="mysql-drop-db">mysql_drop_db()</link>
- </emphasis></entry>
+ <entry><emphasis role="bold"><link linkend="mysql-drop-db">mysql_drop_db()</link></emphasis></entry>
<entry>Drops a database. This function is deprecated; use the SQL statement
<literal>DROP DATABASE</literal> instead.</entry>
</row>
<row>
- <entry><emphasis role="bold">
- <link linkend="mysql-dump-debug-info">mysql_dump_debug_info()</link>
- </emphasis></entry>
+ <entry><emphasis role="bold"><link linkend="mysql-dump-debug-info">mysql_dump_debug_info()</link></emphasis></entry>
<entry>Makes the server write debug information to the log.</entry>
</row>
<row>
- <entry><emphasis role="bold"> <link linkend="mysql-eof">mysql_eof()</link>
- </emphasis></entry>
+ <entry><emphasis role="bold"><link linkend="mysql-eof">mysql_eof()</link></emphasis></entry>
<entry>Determines whether the last row of a result set has been read. This
function is deprecated; <literal>mysql_errno()</literal>
or <literal>mysql_error()</literal> may be used instead.</entry>
</row>
<row>
- <entry><emphasis role="bold"> <link linkend="mysql-errno">mysql_errno()</link>
- </emphasis></entry>
+ <entry><emphasis role="bold"><link linkend="mysql-errno">mysql_errno()</link></emphasis></entry>
<entry>Returns the error number for the most recently invoked MySQL function.</entry>
</row>
<row>
- <entry><emphasis role="bold"> <link linkend="mysql-error">mysql_error()</link>
- </emphasis></entry>
+ <entry><emphasis role="bold"><link linkend="mysql-error">mysql_error()</link></emphasis></entry>
<entry>Returns the error message for the most recently invoked MySQL function.</entry>
</row>
<row>
- <entry><emphasis role="bold">
- <link linkend="mysql-escape-string">mysql_escape_string()</link>
- </emphasis></entry>
+ <entry><emphasis role="bold"><link linkend="mysql-escape-string">mysql_escape_string()</link></emphasis></entry>
<entry>Escapes special characters in a string for use in an SQL statement.</entry>
</row>
<row>
- <entry><emphasis role="bold">
- <link linkend="mysql-fetch-field">mysql_fetch_field()</link>
- </emphasis></entry>
+ <entry><emphasis role="bold"><link linkend="mysql-fetch-field">mysql_fetch_field()</link></emphasis></entry>
<entry>Returns the type of the next table field.</entry>
</row>
<row>
- <entry><emphasis role="bold">
- <link linkend="mysql-fetch-field-direct">mysql_fetch_field_direct()</link>
- </emphasis></entry>
+ <entry><emphasis role="bold"><link linkend="mysql-fetch-field-direct">mysql_fetch_field_direct()</link></emphasis></entry>
<entry>Returns the type of a table field, given a field number.</entry>
</row>
<row>
- <entry><emphasis role="bold">
- <link linkend="mysql-fetch-fields">mysql_fetch_fields()</link>
- </emphasis></entry>
+ <entry><emphasis role="bold"><link linkend="mysql-fetch-fields">mysql_fetch_fields()</link></emphasis></entry>
<entry>Returns an array of all field structures.</entry>
</row>
<row>
- <entry><emphasis role="bold">
- <link linkend="mysql-fetch-lengths">mysql_fetch_lengths()</link>
- </emphasis></entry>
+ <entry><emphasis role="bold"><link linkend="mysql-fetch-lengths">mysql_fetch_lengths()</link></emphasis></entry>
<entry>Returns the lengths of all columns in the current row.</entry>
</row>
<row>
- <entry><emphasis role="bold">
- <link linkend="mysql-fetch-row">mysql_fetch_row()</link>
- </emphasis></entry>
+ <entry><emphasis role="bold"><link linkend="mysql-fetch-row">mysql_fetch_row()</link></emphasis></entry>
<entry>Fetches the next row from the result set.</entry>
</row>
<row>
- <entry><emphasis role="bold">
- <link linkend="mysql-field-seek">mysql_field_seek()</link>
- </emphasis></entry>
+ <entry><emphasis role="bold"><link linkend="mysql-field-seek">mysql_field_seek()</link></emphasis></entry>
<entry>Puts the column cursor on a specified column.</entry>
</row>
<row>
- <entry><emphasis role="bold">
- <link linkend="mysql-field-count">mysql_field_count()</link>
- </emphasis></entry>
+ <entry><emphasis role="bold"><link linkend="mysql-field-count">mysql_field_count()</link></emphasis></entry>
<entry>Returns the number of result columns for the most recent statement.</entry>
</row>
<row>
- <entry><emphasis role="bold">
- <link linkend="mysql-field-tell">mysql_field_tell()</link>
- </emphasis></entry>
+ <entry><emphasis role="bold"><link linkend="mysql-field-tell">mysql_field_tell()</link></emphasis></entry>
<entry>Returns the position of the field cursor used for the last
<literal>mysql_fetch_field()</literal>.</entry>
</row>
<row>
- <entry><emphasis role="bold">
- <link linkend="mysql-free-result">mysql_free_result()</link>
- </emphasis></entry>
+ <entry><emphasis role="bold"><link linkend="mysql-free-result">mysql_free_result()</link></emphasis></entry>
<entry>Frees memory used by a result set.</entry>
</row>
<row>
- <entry><emphasis role="bold">
- <link linkend="mysql-get-client-info">mysql_get_client_info()</link>
- </emphasis></entry>
+ <entry><emphasis role="bold"><link linkend="mysql-get-client-info">mysql_get_client_info()</link></emphasis></entry>
<entry>Returns client version information as a string.</entry>
</row>
<row>
- <entry><emphasis role="bold">
- <link linkend="mysql-get-client-version">mysql_get_client_version()</link>
- </emphasis></entry>
+ <entry><emphasis role="bold"><link linkend="mysql-get-client-version">mysql_get_client_version()</link></emphasis></entry>
<entry>Returns client version information as an integer.</entry>
</row>
<row>
- <entry><emphasis role="bold">
- <link linkend="mysql-get-host-info">mysql_get_host_info()</link>
- </emphasis></entry>
+ <entry><emphasis role="bold"><link linkend="mysql-get-host-info">mysql_get_host_info()</link></emphasis></entry>
<entry>Returns a string describing the connection.</entry>
</row>
<row>
- <entry><emphasis role="bold">
- <link linkend="mysql-get-server-version">mysql_get_server_version()</link>
- </emphasis></entry>
+ <entry><emphasis role="bold"><link linkend="mysql-get-server-version">mysql_get_server_version()</link></emphasis></entry>
<entry>Returns version number of server as an integer.</entry>
</row>
<row>
- <entry><emphasis role="bold">
- <link linkend="mysql-get-proto-info">mysql_get_proto_info()</link>
- </emphasis></entry>
+ <entry><emphasis role="bold"><link linkend="mysql-get-proto-info">mysql_get_proto_info()</link></emphasis></entry>
<entry>Returns the protocol version used by the connection.</entry>
</row>
<row>
- <entry><emphasis role="bold">
- <link linkend="mysql-get-server-info">mysql_get_server_info()</link>
- </emphasis></entry>
+ <entry><emphasis role="bold"><link linkend="mysql-get-server-info">mysql_get_server_info()</link></emphasis></entry>
<entry>Returns the server version number.</entry>
</row>
<row>
- <entry><emphasis role="bold"> <link linkend="mysql-info">mysql_info()</link>
- </emphasis></entry>
+ <entry><emphasis role="bold"><link linkend="mysql-info">mysql_info()</link></emphasis></entry>
<entry>Returns information about the most recently executed query.</entry>
</row>
<row>
- <entry><emphasis role="bold"> <link linkend="mysql-init">mysql_init()</link>
- </emphasis></entry>
+ <entry><emphasis role="bold"><link linkend="mysql-init">mysql_init()</link></emphasis></entry>
<entry>Gets or initializes a <literal>MYSQL</literal> structure.</entry>
</row>
<row>
- <entry><emphasis role="bold">
- <link linkend="mysql-insert-id">mysql_insert_id()</link>
- </emphasis></entry>
+ <entry><emphasis role="bold"><link linkend="mysql-insert-id">mysql_insert_id()</link></emphasis></entry>
<entry>Returns the ID generated for an <literal>AUTO_INCREMENT</literal> column
by the previous query.</entry>
</row>
<row>
- <entry><emphasis role="bold"> <link linkend="mysql-kill">mysql_kill()</link>
- </emphasis></entry>
+ <entry><emphasis role="bold"><link linkend="mysql-kill">mysql_kill()</link></emphasis></entry>
<entry>Kills a given thread.</entry>
</row>
<row>
- <entry><emphasis role="bold">
- <link linkend="mysql-library-end">mysql_library_end()</link>
- </emphasis></entry>
+ <entry><emphasis role="bold"><link linkend="mysql-library-end">mysql_library_end()</link></emphasis></entry>
<entry>Finalize MySQL C API library.</entry>
</row>
<row>
- <entry><emphasis role="bold">
- <link linkend="mysql-library-init">mysql_library_init()</link>
- </emphasis></entry>
+ <entry><emphasis role="bold"><link linkend="mysql-library-init">mysql_library_init()</link></emphasis></entry>
<entry>Initialize MySQL C API library.</entry>
</row>
<row>
- <entry><emphasis role="bold">
- <link linkend="mysql-list-dbs">mysql_list_dbs()</link>
- </emphasis></entry>
+ <entry><emphasis role="bold"><link linkend="mysql-list-dbs">mysql_list_dbs()</link></emphasis></entry>
<entry>Returns database names matching a simple regular expression.</entry>
</row>
<row>
- <entry><emphasis role="bold">
- <link linkend="mysql-list-fields">mysql_list_fields()</link>
- </emphasis></entry>
+ <entry><emphasis role="bold"><link linkend="mysql-list-fields">mysql_list_fields()</link></emphasis></entry>
<entry>Returns field names matching a simple regular expression.</entry>
</row>
<row>
- <entry><emphasis role="bold">
- <link linkend="mysql-list-processes">mysql_list_processes()</link>
- </emphasis></entry>
+ <entry><emphasis role="bold"><link linkend="mysql-list-processes">mysql_list_processes()</link></emphasis></entry>
<entry>Returns a list of the current server threads.</entry>
</row>
<row>
- <entry><emphasis role="bold">
- <link linkend="mysql-list-tables">mysql_list_tables()</link>
- </emphasis></entry>
+ <entry><emphasis role="bold"><link linkend="mysql-list-tables">mysql_list_tables()</link></emphasis></entry>
<entry>Returns table names matching a simple regular expression.</entry>
</row>
<row>
- <entry><emphasis role="bold">
- <link linkend="mysql-more-results">mysql_more_results()</link>
- </emphasis></entry>
+ <entry><emphasis role="bold"><link linkend="mysql-more-results">mysql_more_results()</link></emphasis></entry>
<entry>Checks whether any more results exist.</entry>
</row>
<row>
- <entry><emphasis role="bold">
- <link linkend="mysql-next-result">mysql_next_result()</link>
- </emphasis></entry>
+ <entry><emphasis role="bold"><link linkend="mysql-next-result">mysql_next_result()</link></emphasis></entry>
<entry>Returns/initiates the next result in multiple-statement executions.</entry>
</row>
<row>
- <entry><emphasis role="bold">
- <link linkend="mysql-num-fields">mysql_num_fields()</link>
- </emphasis></entry>
+ <entry><emphasis role="bold"><link linkend="mysql-num-fields">mysql_num_fields()</link></emphasis></entry>
<entry>Returns the number of columns in a result set.</entry>
</row>
<row>
- <entry><emphasis role="bold">
- <link linkend="mysql-num-rows">mysql_num_rows()</link>
- </emphasis></entry>
+ <entry><emphasis role="bold"><link linkend="mysql-num-rows">mysql_num_rows()</link></emphasis></entry>
<entry>Returns the number of rows in a result set.</entry>
</row>
<row>
- <entry><emphasis role="bold">
- <link linkend="mysql-options">mysql_options()</link>
- </emphasis></entry>
+ <entry><emphasis role="bold"><link linkend="mysql-options">mysql_options()</link></emphasis></entry>
<entry>Sets connect options for <literal>mysql_connect()</literal>.</entry>
</row>
<row>
- <entry><emphasis role="bold"> <link linkend="mysql-ping">mysql_ping()</link>
- </emphasis></entry>
+ <entry><emphasis role="bold"><link linkend="mysql-ping">mysql_ping()</link></emphasis></entry>
<entry>Checks whether the connection to the server is working, reconnecting as
necessary.</entry>
</row>
<row>
- <entry><emphasis role="bold"> <link linkend="mysql-query">mysql_query()</link>
- </emphasis></entry>
+ <entry><emphasis role="bold"><link linkend="mysql-query">mysql_query()</link></emphasis></entry>
<entry>Executes an SQL query specified as a null-terminated string.</entry>
</row>
<row>
- <entry><emphasis role="bold">
- <link linkend="mysql-real-connect">mysql_real_connect()</link>
- </emphasis></entry>
+ <entry><emphasis role="bold"><link linkend="mysql-real-connect">mysql_real_connect()</link></emphasis></entry>
<entry>Connects to a MySQL server.</entry>
</row>
<row>
- <entry><emphasis role="bold">
- <link linkend="mysql-real-escape-string">mysql_real_escape_string()</link>
- </emphasis></entry>
+ <entry><emphasis role="bold"><link linkend="mysql-real-escape-string">mysql_real_escape_string()</link></emphasis></entry>
<entry>Escapes special characters in a string for use in an SQL statement,
taking into account the current character set of the
connection.</entry>
</row>
<row>
- <entry><emphasis role="bold">
- <link linkend="mysql-real-query">mysql_real_query()</link>
- </emphasis></entry>
+ <entry><emphasis role="bold"><link linkend="mysql-real-query">mysql_real_query()</link></emphasis></entry>
<entry>Executes an SQL query specified as a counted string.</entry>
</row>
<row>
- <entry><emphasis role="bold">
- <link linkend="mysql-refresh">mysql_refresh()</link>
- </emphasis></entry>
+ <entry><emphasis role="bold"><link linkend="mysql-refresh">mysql_refresh()</link></emphasis></entry>
<entry>Flush or reset tables and caches.</entry>
</row>
<row>
- <entry><emphasis role="bold">
- <link linkend="mysql-reload">mysql_reload()</link>
- </emphasis></entry>
+ <entry><emphasis role="bold"><link linkend="mysql-reload">mysql_reload()</link></emphasis></entry>
<entry>Tells the server to reload the grant tables.</entry>
</row>
<row>
- <entry><emphasis role="bold">
- <link linkend="mysql-rollback">mysql_rollback()</link>
- </emphasis></entry>
+ <entry><emphasis role="bold"><link linkend="mysql-rollback">mysql_rollback()</link></emphasis></entry>
<entry>Rolls back the transaction.</entry>
</row>
<row>
- <entry><emphasis role="bold">
- <link linkend="mysql-row-seek">mysql_row_seek()</link>
- </emphasis></entry>
+ <entry><emphasis role="bold"><link linkend="mysql-row-seek">mysql_row_seek()</link></emphasis></entry>
<entry>Seeks to a row offset in a result set, using value returned from
<literal>mysql_row_tell()</literal>.</entry>
</row>
<row>
- <entry><emphasis role="bold">
- <link linkend="mysql-row-tell">mysql_row_tell()</link>
- </emphasis></entry>
+ <entry><emphasis role="bold"><link linkend="mysql-row-tell">mysql_row_tell()</link></emphasis></entry>
<entry>Returns the row cursor position.</entry>
</row>
<row>
- <entry><emphasis role="bold">
- <link linkend="mysql-select-db">mysql_select_db()</link>
- </emphasis></entry>
+ <entry><emphasis role="bold"><link linkend="mysql-select-db">mysql_select_db()</link></emphasis></entry>
<entry>Selects a database.</entry>
</row>
<row>
- <entry><emphasis role="bold">
- <link linkend="mysql-server-end">mysql_server_end()</link>
- </emphasis></entry>
+ <entry><emphasis role="bold"><link linkend="mysql-server-end">mysql_server_end()</link></emphasis></entry>
<entry>Finalize embedded server library.</entry>
</row>
<row>
- <entry><emphasis role="bold">
- <link linkend="mysql-server-init">mysql_server_init()</link>
- </emphasis></entry>
+ <entry><emphasis role="bold"><link linkend="mysql-server-init">mysql_server_init()</link></emphasis></entry>
<entry>Initialize embedded server library.</entry>
</row>
<row>
- <entry><emphasis role="bold">
- <link linkend="mysql-set-server-option">mysql_set_server_option()</link>
- </emphasis></entry>
+ <entry><emphasis role="bold"><link linkend="mysql-set-local-infile-default">mysql_set_local_infile_default()</link></emphasis></entry>
+ <entry>Set the <literal>LOAD DATA LOCAL INFILE</literal> handler callbacks to
+ their default values.</entry>
+ </row>
+ <row>
+ <entry><emphasis role="bold"><link linkend="mysql-set-local-infile-handler">mysql_set_local_infile_handler()</link></emphasis></entry>
+ <entry>Install application-specific <literal>LOAD DATA LOCAL INFILE</literal>
+ handler callbacks.</entry>
+ </row>
+ <row>
+ <entry><emphasis role="bold"><link linkend="mysql-set-server-option">mysql_set_server_option()</link></emphasis></entry>
<entry>Sets an option for the connection (like
<literal>multi-statements</literal>).</entry>
</row>
<row>
- <entry><emphasis role="bold">
- <link linkend="mysql-sqlstate">mysql_sqlstate()</link>
- </emphasis></entry>
+ <entry><emphasis role="bold"><link linkend="mysql-sqlstate">mysql_sqlstate()</link></emphasis></entry>
<entry>Returns the SQLSTATE error code for the last error.</entry>
</row>
<row>
- <entry><emphasis role="bold">
- <link linkend="mysql-shutdown">mysql_shutdown()</link>
- </emphasis></entry>
+ <entry><emphasis role="bold"><link linkend="mysql-shutdown">mysql_shutdown()</link></emphasis></entry>
<entry>Shuts down the database server.</entry>
</row>
<row>
- <entry><emphasis role="bold"> <link linkend="mysql-stat">mysql_stat()</link>
- </emphasis></entry>
+ <entry><emphasis role="bold"><link linkend="mysql-stat">mysql_stat()</link></emphasis></entry>
<entry>Returns the server status as a string.</entry>
</row>
<row>
- <entry><emphasis role="bold">
- <link linkend="mysql-store-result">mysql_store_result()</link>
- </emphasis></entry>
+ <entry><emphasis role="bold"><link linkend="mysql-store-result">mysql_store_result()</link></emphasis></entry>
<entry>Retrieves a complete result set to the client.</entry>
</row>
<row>
- <entry><emphasis role="bold">
- <link linkend="mysql-thread-id">mysql_thread_id()</link>
- </emphasis></entry>
+ <entry><emphasis role="bold"><link linkend="mysql-thread-id">mysql_thread_id()</link></emphasis></entry>
<entry>Returns the current thread ID.</entry>
</row>
<row>
- <entry><emphasis role="bold">
- <link linkend="mysql-thread-safe">mysql_thread_safe()</link>
- </emphasis></entry>
+ <entry><emphasis role="bold"><link linkend="mysql-thread-safe">mysql_thread_safe()</link></emphasis></entry>
<entry>Returns 1 if the clients are compiled as thread-safe.</entry>
</row>
<row>
- <entry><emphasis role="bold">
- <link linkend="mysql-use-result">mysql_use_result()</link>
- </emphasis></entry>
+ <entry><emphasis role="bold"><link linkend="mysql-use-result">mysql_use_result()</link></emphasis></entry>
<entry>Initiates a row-by-row result set retrieval.</entry>
</row>
<row>
- <entry><emphasis role="bold">
- <link linkend="mysql-warning-count">mysql_warning_count()</link>
- </emphasis></entry>
+ <entry><emphasis role="bold"><link linkend="mysql-warning-count">mysql_warning_count()</link></emphasis></entry>
<entry>Returns the warning count for the previous SQL statement.</entry>
</row>
</tbody>
@@ -7280,6 +7167,220 @@
</section>
+ <section id="mysql-set-local-infile-default">
+
+ <title>&title-mysql-set-local-infile-default;</title>
+
+ <indexterm type="function">
+ <primary><literal>mysql_set_local_infile_default()</literal></primary>
+ </indexterm>
+
+ <indexterm type="function">
+ <primary><literal>mysql_set_local_infile_default()</literal></primary>
+ </indexterm>
+
+<programlisting>
+void
+mysql_set_local_infile_default(MYSQL *mysql);
+</programlisting>
+
+ <para>
+ <emphasis role="bold">Description</emphasis>
+ </para>
+
+ <para>
+ Sets the <literal>LOAD LOCAL DATA INFILE</literal> handler
+ callback functions to the defaults used internally by the C
+ client library. The library calls this function automatically
+ if <literal>mysql_set_local_infile_handler()</literal> has not
+ been called or does not supply valid functions for each of its
+ callbacks.
+ </para>
+
+ <para>
+ The <literal>mysql_set_local_infile_default()</literal>
+ function was added in MySQL 4.1.2.
+ </para>
+
+ <para>
+ <emphasis role="bold">Return Values</emphasis>
+ </para>
+
+ <para>
+ None.
+ </para>
+
+ <para>
+ <emphasis role="bold">Errors</emphasis>
+ </para>
+
+ <remark role="todo">
+ Really non?
+ </remark>
+
+ <para>
+ None.
+ </para>
+
+ </section>
+
+ <section id="mysql-set-local-infile-handler">
+
+ <title>&title-mysql-set-local-infile-handler;</title>
+
+<programlisting>
+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);
+</programlisting>
+
+ <para>
+ <emphasis role="bold">Description</emphasis>
+ </para>
+
+ <para>
+ This function installs callbacks to be used during the
+ execution of <literal>LOAD DATA LOCAL INFILE</literal>
+ statements. It enables application programs to exert control
+ over local (client-side) datafile 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.
+ </para>
+
+ <para>
+ To use <literal>mysql_set_local_infile_handler()</literal>,
+ you must write the following callback functions:
+ </para>
+
+<programlisting>
+int
+local_infile_init(void **ptr, const char *filename, void *userdata);
+</programlisting>
+
+ <para>
+ The initialization function. This is called once to do any
+ setup necessary, open the datafile, allocate data structures,
+ and so forth. The first <literal>void**</literal> argument is
+ a pointer to a pointer. You can set the pointer (that is,
+ <literal>*ptr</literal>) to a value that will be passed to
+ each of the other callbacks (as a <literal>void*</literal>).
+ The callbacks can use this pointed-to value to maintain state
+ information. The <literal>userdata</literal> argument is the
+ same value that is passed to
+ <literal>mysql_set_local_infile_handler()</literal>.
+ </para>
+
+ <para>
+ The initialization function should return zero for success,
+ non-zero for an error.
+ </para>
+
+<programlisting>
+int
+local_infile_read(void *ptr, char *buf, unsigned int buf_len);
+</programlisting>
+
+ <para>
+ The data-reading function. This is called repeatedly to read
+ the data file. <literal>buf</literal> points to the buffer
+ where the read data should be stored, and
+ <literal>buf_len</literal> 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.)
+ </para>
+
+ <para>
+ 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.
+ </para>
+
+<programlisting>
+void
+local_infile_end(void *ptr)
+</programlisting>
+
+ <para>
+ The termination function. This is called once after
+ <literal>local_infile_read()</literal> has returned zero (EOF)
+ or an error. This function should deallocate any memory
+ allocated by <literal>local_infile_init()</literal> and
+ perform any other cleanup necessary. It is invoked even if the
+ initalization function returns an error.
+ </para>
+
+<programlisting>
+int
+local_infile_error(void *ptr, char *error_msg, unsigned int error_msg_len);
+</programlisting>
+
+ <para>
+ 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. <literal>error_msg</literal>
+ points to the buffer into which the message should be written,
+ and <literal>error_msg_len</literal> is the length of the
+ buffer. The message should be written as a null-terminated
+ string, so the message can be at most
+ <literal>error_msg_len</literal>−1 bytes long.
+ </para>
+
+ <para>
+ The return value is the error number.
+ </para>
+
+ <para>
+ Typically, the other callbacks store the error message in the
+ data structure pointed to by <literal>ptr</literal>, so that
+ <literal>local_infile_error()</literal> can copy the message
+ from there into <literal>error_msg</literal>.
+ </para>
+
+ <para>
+ After calling
+ <literal>mysql_set_local_infile_handler()</literal> in your C
+ code and passing pointers to your callback functions, you can
+ then issue a <literal>LOAD DATA LOCAL INFILE</literal>
+ statement (for example, by using
+ <literal>mysql_query()</literal>). The client library
+ automatically invokes your callbacks. The filename specified
+ in <literal>LOAD DATA LOCAL INFILE</literal> will be passed as
+ the second parameter to the
+ <literal>local_infile_init()</literal> callback.
+ </para>
+
+ <para>
+ The <literal>mysql_set_local_infile_handler()</literal>
+ function was added in MySQL 4.1.2.
+ </para>
+
+ <para>
+ <emphasis role="bold">Return Values</emphasis>
+ </para>
+
+ <para>
+ None.
+ </para>
+
+ <para>
+ <emphasis role="bold">Errors</emphasis>
+ </para>
+
+ <remark role="todo">
+ Really non?
+ </remark>
+
+ <para>
+ None.
+ </para>
+
+ </section>
+
<section id="mysql-set-server-option">
<title>&title-mysql-set-server-option;</title>
Modified: trunk/refman-5.1/apis.xml
===================================================================
--- trunk/refman-5.1/apis.xml 2006-04-20 21:18:49 UTC (rev 1893)
+++ trunk/refman-5.1/apis.xml 2006-04-20 22:11:52 UTC (rev 1894)
@@ -1618,6 +1618,16 @@
<entry>Initialize embedded server library.</entry>
</row>
<row>
+ <entry><emphasis role="bold"><link linkend="mysql-set-local-infile-default">mysql_set_local_infile_default()</link></emphasis></entry>
+ <entry>Set the <literal>LOAD DATA LOCAL INFILE</literal> handler callbacks to
+ their default values.</entry>
+ </row>
+ <row>
+ <entry><emphasis role="bold"><link linkend="mysql-set-local-infile-handler">mysql_set_local_infile_handler()</link></emphasis></entry>
+ <entry>Install application-specific <literal>LOAD DATA LOCAL INFILE</literal>
+ handler callbacks.</entry>
+ </row>
+ <row>
<entry><emphasis role="bold"><link linkend="mysql-set-server-option">mysql_set_server_option()</link></emphasis></entry>
<entry>Sets an option for the connection (like
<literal>multi-statements</literal>).</entry>
@@ -7142,6 +7152,220 @@
</section>
+ <section id="mysql-set-local-infile-default">
+
+ <title>&title-mysql-set-local-infile-default;</title>
+
+ <indexterm type="function">
+ <primary><literal>mysql_set_local_infile_default()</literal></primary>
+ </indexterm>
+
+ <indexterm type="function">
+ <primary><literal>mysql_set_local_infile_default()</literal></primary>
+ </indexterm>
+
+<programlisting>
+void
+mysql_set_local_infile_default(MYSQL *mysql);
+</programlisting>
+
+ <para>
+ <emphasis role="bold">Description</emphasis>
+ </para>
+
+ <para>
+ Sets the <literal>LOAD LOCAL DATA INFILE</literal> handler
+ callback functions to the defaults used internally by the C
+ client library. The library calls this function automatically
+ if <literal>mysql_set_local_infile_handler()</literal> has not
+ been called or does not supply valid functions for each of its
+ callbacks.
+ </para>
+
+ <para>
+ The <literal>mysql_set_local_infile_default()</literal>
+ function was added in MySQL 4.1.2.
+ </para>
+
+ <para>
+ <emphasis role="bold">Return Values</emphasis>
+ </para>
+
+ <para>
+ None.
+ </para>
+
+ <para>
+ <emphasis role="bold">Errors</emphasis>
+ </para>
+
+ <remark role="todo">
+ Really non?
+ </remark>
+
+ <para>
+ None.
+ </para>
+
+ </section>
+
+ <section id="mysql-set-local-infile-handler">
+
+ <title>&title-mysql-set-local-infile-handler;</title>
+
+<programlisting>
+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);
+</programlisting>
+
+ <para>
+ <emphasis role="bold">Description</emphasis>
+ </para>
+
+ <para>
+ This function installs callbacks to be used during the
+ execution of <literal>LOAD DATA LOCAL INFILE</literal>
+ statements. It enables application programs to exert control
+ over local (client-side) datafile 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.
+ </para>
+
+ <para>
+ To use <literal>mysql_set_local_infile_handler()</literal>,
+ you must write the following callback functions:
+ </para>
+
+<programlisting>
+int
+local_infile_init(void **ptr, const char *filename, void *userdata);
+</programlisting>
+
+ <para>
+ The initialization function. This is called once to do any
+ setup necessary, open the datafile, allocate data structures,
+ and so forth. The first <literal>void**</literal> argument is
+ a pointer to a pointer. You can set the pointer (that is,
+ <literal>*ptr</literal>) to a value that will be passed to
+ each of the other callbacks (as a <literal>void*</literal>).
+ The callbacks can use this pointed-to value to maintain state
+ information. The <literal>userdata</literal> argument is the
+ same value that is passed to
+ <literal>mysql_set_local_infile_handler()</literal>.
+ </para>
+
+ <para>
+ The initialization function should return zero for success,
+ non-zero for an error.
+ </para>
+
+<programlisting>
+int
+local_infile_read(void *ptr, char *buf, unsigned int buf_len);
+</programlisting>
+
+ <para>
+ The data-reading function. This is called repeatedly to read
+ the data file. <literal>buf</literal> points to the buffer
+ where the read data should be stored, and
+ <literal>buf_len</literal> 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.)
+ </para>
+
+ <para>
+ 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.
+ </para>
+
+<programlisting>
+void
+local_infile_end(void *ptr)
+</programlisting>
+
+ <para>
+ The termination function. This is called once after
+ <literal>local_infile_read()</literal> has returned zero (EOF)
+ or an error. This function should deallocate any memory
+ allocated by <literal>local_infile_init()</literal> and
+ perform any other cleanup necessary. It is invoked even if the
+ initalization function returns an error.
+ </para>
+
+<programlisting>
+int
+local_infile_error(void *ptr, char *error_msg, unsigned int error_msg_len);
+</programlisting>
+
+ <para>
+ 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. <literal>error_msg</literal>
+ points to the buffer into which the message should be written,
+ and <literal>error_msg_len</literal> is the length of the
+ buffer. The message should be written as a null-terminated
+ string, so the message can be at most
+ <literal>error_msg_len</literal>−1 bytes long.
+ </para>
+
+ <para>
+ The return value is the error number.
+ </para>
+
+ <para>
+ Typically, the other callbacks store the error message in the
+ data structure pointed to by <literal>ptr</literal>, so that
+ <literal>local_infile_error()</literal> can copy the message
+ from there into <literal>error_msg</literal>.
+ </para>
+
+ <para>
+ After calling
+ <literal>mysql_set_local_infile_handler()</literal> in your C
+ code and passing pointers to your callback functions, you can
+ then issue a <literal>LOAD DATA LOCAL INFILE</literal>
+ statement (for example, by using
+ <literal>mysql_query()</literal>). The client library
+ automatically invokes your callbacks. The filename specified
+ in <literal>LOAD DATA LOCAL INFILE</literal> will be passed as
+ the second parameter to the
+ <literal>local_infile_init()</literal> callback.
+ </para>
+
+ <para>
+ The <literal>mysql_set_local_infile_handler()</literal>
+ function was added in MySQL 4.1.2.
+ </para>
+
+ <para>
+ <emphasis role="bold">Return Values</emphasis>
+ </para>
+
+ <para>
+ None.
+ </para>
+
+ <para>
+ <emphasis role="bold">Errors</emphasis>
+ </para>
+
+ <remark role="todo">
+ Really non?
+ </remark>
+
+ <para>
+ None.
+ </para>
+
+ </section>
+
<section id="mysql-set-server-option">
<title>&title-mysql-set-server-option;</title>
Modified: trunk/refman-common/news-4.1.xml
===================================================================
--- trunk/refman-common/news-4.1.xml 2006-04-20 21:18:49 UTC (rev 1893)
+++ trunk/refman-common/news-4.1.xml 2006-04-20 22:11:52 UTC (rev 1894)
@@ -9401,6 +9401,14 @@
</para>
</listitem>
+ <listitem>
+ <para>
+ Added the <literal>mysql_set_local_infile_handler()</literal>
+ and <literal>mysql_set_local_infile_default()</literal> C API
+ functions.
+ </para>
+ </listitem>
+
</itemizedlist>
<para>
Modified: trunk/refman-common/titles.en.ent
===================================================================
--- trunk/refman-common/titles.en.ent 2006-04-20 21:18:49 UTC (rev 1893)
+++ trunk/refman-common/titles.en.ent 2006-04-20 22:11:52 UTC (rev 1894)
@@ -1032,6 +1032,8 @@
<!ENTITY title-mysql-server-for-manual "MySQL Server Startup Script">
<!ENTITY title-mysql-server-init "<literal>mysql_server_init()</literal>">
<!ENTITY title-mysql-set-character-set "<literal>mysql_set_character_set()</literal>">
+<!ENTITY title-mysql-set-local-infile-default "<literal>mysql_set_local_infile_default()</literal>">
+<!ENTITY title-mysql-set-local-infile-handler "<literal>mysql_set_local_infile_handler()</literal>">
<!ENTITY title-mysql-set-server-option "<literal>mysql_set_server_option()</literal>">
<!ENTITY title-mysql-shutdown "<literal>mysql_shutdown()</literal>">
<!ENTITY title-mysql-spatial-datatypes "MySQL Spatial Data Types">
| Thread |
|---|
| • svn commit - mysqldoc@docsrva: r1894 - in trunk: . refman-4.1 refman-5.0 refman-5.1 refman-common | paul | 21 Apr |