Since the upgrade to the latest dev version, I am now getting the following error when attempting to harvest records on the staging server:

mysql The used command is not allowed with this MySQL version query: LOAD DATA LOCAL INFILE

It happens about 5 times for different files on line 575 of xc_oaiharvester_bridge.module.

My version of MySQL (5.0) supports the command but it is disabled for security reasons (http://dev.mysql.com/doc/refman/5.0/en/load-data-local.html) and enabling it is not an option. Can you come up with an alternative to this implementation?

Comments

dayan’s picture

Hello stella,

I had the same problem and changed this line.

xc_oaiharvester_bridge.module

function xc_oaiharvester_bridge_load_csv
[Befor]
$sql = "LOAD DATA LOCAL INFILE '" . $path . "' INTO TABLE " . $table
. " CHARACTER SET utf8 FIELDS TERMINATED BY '\\0\\t' ESCAPED BY '' LINES TERMINATED BY '\\0\\n'";

[After]
$sql = "LOAD DATA INFILE '" . $path . "' INTO TABLE " . $table
. " CHARACTER SET utf8 FIELDS TERMINATED BY '\\0\\t' ESCAPED BY '' LINES TERMINATED BY '\\0\\n'";

Hope this helps.
Best wishes!

pkiraly’s picture

Hi,

it seems, that there are two different issues here:

1) LOAD needs special privilege in MySQL, which is a global privilege, and not a database specific one.
Stella has right, that ignored this when I found this solution. The reason was that according to benchmarks the LOAD DATA INFILE construction works much much more quicker than INSERT (see for example Kevin van Zonneveld's post at http://kevin.vanzonneveld.net/techblog/article/improve_mysql_insert_perf...). In the code there is a condition if it have to use INSERT or LOAD, but it is not driven by a user modifiable setting. Is it OK if I modify the code, that the admin is able to decide whether he wants to use LOAD DATA INFILE or INSERT command.

2) with/without the LOCAL keyword. When I introduce this in the systems I tested, it worked only rith LOCAL, and it doesn't worked without LOCAL. Maybe I should run another tests. This can be also a administer modifiable variable, because without local the CSV files have to located on the same server where MySQL operates, which is not always true.

pkiraly’s picture

I commited changes for solving the first issue. It needs an update (i.e. run update.php), because the database structure were changed. The admin can choose between LOAD DATA INFILE and INSERT in the second page of schedule editing form. I wrote the following text on the form, plase review it, and let me know whether it is understandable.

"Use MySQL INSERT method for creating records in batch mode instead of default LOAD DATA INFILE?:
* Use CSV file and the SQL command LOAD DATA INFILE
* Use SQL command INSERT
To import the harvested records into relational database the Toolkit can use CSV files, and LOAD DATA INFILE commands or the more traditionally INSERT command. The first is much more quicker, but it requires general (and not database) level privilege in MySQL, which is not available in all situation. If you chose this, be very careful with privilege settings. The INSERT is slower command, but it requires only database level privileges, so it is more secure. If you have millions of records, and time is an important factor, consider using LOAD DATA INFILE with carefully, if you don't have as many record, or time is not an important factor, use the INSERT command."

I need more tests, but the bulk of the solution has to work right now.

stella’s picture

Well that error is fixed. However, I always get an error during the patch harvesting. When I click down into the batch report, no error is displayed. From looking at the log files I can see the following error repeated lots:

Table "xc_sql_metadata&"doesn't exist query: DELETE FROM xc_sql_metadata WHERE metadata_id = 22 in sites/all/modules/contrib-patch/xc/xc_metadata/includes/xc_metadata.delete.inc on line 356.

I'm now using the Dublin Core to CCK, so I can see my nodes were created, so guessing it didn't stop the harvesting.

In addition, when I ran update.php I got the error:

Warning: Call-time pass-by-reference has been deprecated; If you would like to pass it by reference, modify the declaration of db_rename_table(). If you would like to enable call-time pass-by-reference, you can set allow_call_time_pass_reference to true in your INI file. in sites/all/modules/contrib-patch/xc/xc_oaiharvester_bridge/xc_oaiharvester_bridge.install on line 182