MySQL - load data local infile?

From mysql-options:

[quote]7.8.7.50 mysql_options()

int mysql_options(MYSQL *mysql, enum mysql_option option, const void *arg)

Can be used to set extra connect options and affect behavior for a connection. This function may be called multiple times to set several options. (To retrieve option values, use mysql_get_option().)

Call mysql_options() after mysql_init() and before mysql_connect() or mysql_real_connect().

The option argument is the option that you want to set; the arg argument is the value for the option. If the option is an integer, specify a pointer to the value of the integer as the arg argument.

The following list describes the possible options, their effect, and how arg is used for each option. For option descriptions that indicate arg is unused, its value is irrelevant; it is conventional to pass 0. Several of the options apply only when the application is linked against the libmysqld embedded server library and are unused for applications linked against the libmysqlclient client library.

[…]

MYSQL_OPT_LOCAL_INFILE (argument type: optional pointer to unsigned int)

This option affects client-side LOCAL capability for LOAD DATA operations. By default, LOCAL capability is determined by the default compiled into the MySQL client library (see Section 13.2.6, “LOAD DATA INFILE Syntax”). To control this capability explicitly, invoke mysql_options() to set the MYSQL_OPT_LOCAL_INFILE option:

LOCAL is disabled if the pointer points to an unsigned int that has a zero value.
LOCAL is enabled if no pointer is given or if the pointer points to an unsigned int that has a nonzero value.

Successful use of a LOCAL load operation by a client also requires that the server permits it.[/quote]

Since Xojo’s MySQLCommunityServer source code is open source, you can change the code yourself to permit this command. In MySQLDatabase.cpp you would add something like this

mysql_options(db->fConnection, MYSQL_OPT_LOCAL_INFILE);

to the MySQLConnect function. Compile, create the plugin and copy it to the Plugins folder (and publish the changed source code of course to not violate the open source license).

Very interesting Eli. Seems simple enough…but that’s sometimes where the trouble starts. I may come back to this. I have to get what I got out the door. Thanks for chiming in on this!