Update to CodeIgniter 2.1.0

This commit is contained in:
Karsten Heiken
2011-12-04 14:24:27 +01:00
parent fde35df5bd
commit 79c236dc49
149 changed files with 4384 additions and 590 deletions

0
system/database/drivers/mysql/index.html Executable file → Normal file
View File

14
system/database/drivers/mysql/mysql_driver.php Executable file → Normal file
View File

@@ -54,6 +54,9 @@ class CI_DB_mysql_driver extends CI_DB {
var $_count_string = 'SELECT COUNT(*) AS ';
var $_random_keyword = ' RAND()'; // database specific random keyword
// whether SET NAMES must be used to set the character set
var $use_set_names;
/**
* Non-persistent database connection
*
@@ -132,15 +135,13 @@ class CI_DB_mysql_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))
{
// mysql_set_charset() requires PHP >= 5.2.3 and MySQL >= 5.0.7, use SET NAMES as fallback
$use_set_names = (version_compare(PHP_VERSION, '5.2.3', '>=') && version_compare(mysql_get_server_info(), '5.0.7', '>=')) ? FALSE : TRUE;
$this->use_set_names = (version_compare(PHP_VERSION, '5.2.3', '>=') && version_compare(mysql_get_server_info(), '5.0.7', '>=')) ? FALSE : TRUE;
}
if ($use_set_names)
if ($this->use_set_names === TRUE)
{
return @mysql_query("SET NAMES '".$this->escape_str($charset)."' COLLATE '".$this->escape_str($collation)."'", $this->conn_id);
}
@@ -384,6 +385,7 @@ class CI_DB_mysql_driver extends CI_DB {
}
$row = $query->row();
$this->_reset_select();
return (int) $row->numrows;
}
@@ -439,7 +441,7 @@ class CI_DB_mysql_driver extends CI_DB {
*/
function _field_data($table)
{
return "SELECT * FROM ".$table." LIMIT 1";
return "DESCRIBE ".$table;
}
// --------------------------------------------------------------------

0
system/database/drivers/mysql/mysql_forge.php Executable file → Normal file
View File

17
system/database/drivers/mysql/mysql_result.php Executable file → Normal file
View File

@@ -84,14 +84,19 @@ class CI_DB_mysql_result extends CI_DB_result {
function field_data()
{
$retval = array();
while ($field = mysql_fetch_field($this->result_id))
while ($field = mysql_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->primary_key;
$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;
}

2
system/database/drivers/mysql/mysql_utility.php Executable file → Normal file
View File

@@ -96,7 +96,7 @@ class CI_DB_mysql_utility extends CI_DB_utility {
}
// Get the table schema
$query = $this->db->query("SHOW CREATE TABLE `".$this->db->database.'`.'.$table);
$query = $this->db->query("SHOW CREATE TABLE `".$this->db->database.'`.`'.$table.'`');
// No result means the table name was invalid
if ($query === FALSE)