Drupal 6 and LOAD DATA LOCAL INFILE

Even if the the remote MySQl server has the "local-infile    = 1" in my.cnf and "SHOW GLOBAL VARIABLES LIKE  'local_infile';"  shows local_infile = ON it can be cumbersome to run LOAD DATA LOCAL INFILE queries in Drupal 6.

I had to change to mysqli in the settings.php ($db_url = 'mysqli://....) and then modify database.mysqli.inc by adding the mysqli_option MYSQLI_OPT_LOCAL_INFILE.

This is in a closed environment so i did not have to think about the security issueshttp://dev.mysql.com/doc/refman/5.1/en/load-data-local.html

 

<?php
  $connection
= mysqli_init();
 
mysqli_options($connection, MYSQLI_OPT_LOCAL_INFILE, true); //added to be able to run LOAD DATA LOCAL INFILE
 
@mysqli_real_connect($connection, $url['host'], $url['user'], $url['pass'], substr($url['path'], 1), $url['port'], NULL, MYSQLI_CLIENT_FOUND_ROWS);
?>