[eluser]slackero[/eluser]
I have a project where MySQL server is different from webserver. So it's difficult to use MySQL LOAD DATA LOCAL INFILE because client side does not support local_infile by default. Here mysql_connect() 5th and mysql_pconnect() 4th parameter $client_flags are necessary. CodeIgniter does not support this by default. So I have it enhanced.
Enhanced in
mysql_driver.php
Code:
/**
* Non-persistent database connection
*
* @access private called by the base class
* @return resource
*/
function db_connect()
{
return @mysql_connect($this->hostname, $this->username, $this->password, TRUE, $this->client_flags);
}
// --------------------------------------------------------------------
/**
* Persistent database connection
*
* @access private called by the base class
* @return resource
*/
function db_pconnect()
{
return @mysql_pconnect($this->hostname, $this->username, $this->password, $this->client_flags);
}
Add additional default value to
DB_driver.php
Code:
$defaults = array(
'hostname' => '',
'username' => '',
'password' => '',
'database' => '',
'conn_id' => FALSE,
'dbdriver' => 'mysql',
'dbprefix' => '',
'port' => '',
'pconnect' => FALSE,
'db_debug' => FALSE,
'cachedir' => '',
'cache_on' => FALSE,
'client_flags' => NULL
);
And use setting in
config/database.php
Code:
$db['default']['client_flags'] = 128;
// default NULL, 128 enables support for client side local_infile
Oliver