Update to CodeIgniter 2.1.0
This commit is contained in:
0
system/database/drivers/mysqli/index.html
Executable file → Normal file
0
system/database/drivers/mysqli/index.html
Executable file → Normal file
33
system/database/drivers/mysqli/mysqli_driver.php
Executable file → Normal file
33
system/database/drivers/mysqli/mysqli_driver.php
Executable file → Normal file
@@ -54,6 +54,9 @@ class CI_DB_mysqli_driver extends CI_DB {
|
||||
*/
|
||||
var $delete_hack = TRUE;
|
||||
|
||||
// whether SET NAMES must be used to set the character set
|
||||
var $use_set_names;
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
@@ -132,15 +135,13 @@ class CI_DB_mysqli_driver extends CI_DB {
|
||||
*/
|
||||
function _db_set_charset($charset, $collation)
|
||||
{
|
||||
static $use_set_names;
|
||||
|
||||
if ( ! isset($use_set_names))
|
||||
if ( ! isset($this->use_set_names))
|
||||
{
|
||||
// mysqli_set_charset() requires MySQL >= 5.0.7, use SET NAMES as fallback
|
||||
$use_set_names = (version_compare(mysqli_get_server_info($this->conn_id), '5.0.7', '>=')) ? FALSE : TRUE;
|
||||
$this->use_set_names = (version_compare(mysqli_get_server_info($this->conn_id), '5.0.7', '>=')) ? FALSE : TRUE;
|
||||
}
|
||||
|
||||
if ($use_set_names)
|
||||
if ($this->use_set_names === TRUE)
|
||||
{
|
||||
return @mysqli_query($this->conn_id, "SET NAMES '".$this->escape_str($charset)."' COLLATE '".$this->escape_str($collation)."'");
|
||||
}
|
||||
@@ -385,6 +386,7 @@ class CI_DB_mysqli_driver extends CI_DB {
|
||||
}
|
||||
|
||||
$row = $query->row();
|
||||
$this->_reset_select();
|
||||
return (int) $row->numrows;
|
||||
}
|
||||
|
||||
@@ -440,7 +442,7 @@ class CI_DB_mysqli_driver extends CI_DB {
|
||||
*/
|
||||
function _field_data($table)
|
||||
{
|
||||
return "SELECT * FROM ".$table." LIMIT 1";
|
||||
return "DESCRIBE ".$table;
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
@@ -568,6 +570,25 @@ class CI_DB_mysqli_driver extends CI_DB {
|
||||
{
|
||||
return "INSERT INTO ".$table." (".implode(', ', $keys).") VALUES ".implode(', ', $values);
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
|
||||
/**
|
||||
* Replace statement
|
||||
*
|
||||
* Generates a platform-specific replace string from the supplied data
|
||||
*
|
||||
* @access public
|
||||
* @param string the table name
|
||||
* @param array the insert keys
|
||||
* @param array the insert values
|
||||
* @return string
|
||||
*/
|
||||
function _replace($table, $keys, $values)
|
||||
{
|
||||
return "REPLACE INTO ".$table." (".implode(', ', $keys).") VALUES (".implode(', ', $values).")";
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
|
||||
0
system/database/drivers/mysqli/mysqli_forge.php
Executable file → Normal file
0
system/database/drivers/mysqli/mysqli_forge.php
Executable file → Normal file
19
system/database/drivers/mysqli/mysqli_result.php
Executable file → Normal file
19
system/database/drivers/mysqli/mysqli_result.php
Executable file → Normal file
@@ -84,21 +84,26 @@ class CI_DB_mysqli_result extends CI_DB_result {
|
||||
function field_data()
|
||||
{
|
||||
$retval = array();
|
||||
while ($field = mysqli_fetch_field($this->result_id))
|
||||
while ($field = mysqli_fetch_object($this->result_id))
|
||||
{
|
||||
preg_match('/([a-zA-Z]+)(\(\d+\))?/', $field->Type, $matches);
|
||||
|
||||
$type = (array_key_exists(1, $matches)) ? $matches[1] : NULL;
|
||||
$length = (array_key_exists(2, $matches)) ? preg_replace('/[^\d]/', '', $matches[2]) : NULL;
|
||||
|
||||
$F = new stdClass();
|
||||
$F->name = $field->name;
|
||||
$F->type = $field->type;
|
||||
$F->default = $field->def;
|
||||
$F->max_length = $field->max_length;
|
||||
$F->primary_key = ($field->flags & MYSQLI_PRI_KEY_FLAG) ? 1 : 0;
|
||||
$F->name = $field->Field;
|
||||
$F->type = $type;
|
||||
$F->default = $field->Default;
|
||||
$F->max_length = $length;
|
||||
$F->primary_key = ( $field->Key == 'PRI' ? 1 : 0 );
|
||||
|
||||
$retval[] = $F;
|
||||
}
|
||||
|
||||
return $retval;
|
||||
}
|
||||
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
|
||||
0
system/database/drivers/mysqli/mysqli_utility.php
Executable file → Normal file
0
system/database/drivers/mysqli/mysqli_utility.php
Executable file → Normal file
Reference in New Issue
Block a user