diff options
author | Derek Allard <derek.allard@ellislab.com> | 2008-01-29 20:35:31 +0100 |
---|---|---|
committer | Derek Allard <derek.allard@ellislab.com> | 2008-01-29 20:35:31 +0100 |
commit | 11c75eab4d04b9c88b0096015fb3c0711555bf9a (patch) | |
tree | 6b58be246ff12d5615d4bc59347feafc1bf75b61 /system/database/drivers | |
parent | fecd4edd119d90659a753b19af81c2718f18cb6e (diff) |
Removed support for db_backup in MySQLi due to incompatible functions.
Diffstat (limited to 'system/database/drivers')
-rw-r--r-- | system/database/drivers/mysqli/mysqli_utility.php | 138 |
1 files changed, 3 insertions, 135 deletions
diff --git a/system/database/drivers/mysqli/mysqli_utility.php b/system/database/drivers/mysqli/mysqli_utility.php index bb1f6f917..4ab2bb1d1 100644 --- a/system/database/drivers/mysqli/mysqli_utility.php +++ b/system/database/drivers/mysqli/mysqli_utility.php @@ -78,143 +78,11 @@ class CI_DB_mysqli_utility extends CI_DB_utility { */
function _backup($params = array())
{
- if (count($params) == 0)
- {
- return FALSE;
- }
-
- // Extract the prefs for simplicity
- extract($params);
-
- // Build the output
- $output = '';
- foreach ((array)$tables as $table)
- {
- // Is the table in the "ignore" list?
- if (in_array($table, (array)$ignore, TRUE))
- {
- continue;
- }
-
- // Get the table schema
- $query = $this->db->query("SHOW CREATE TABLE `".$this->db->database.'`.'.$table);
-
- // No result means the table name was invalid
- if ($query === FALSE)
- {
- continue;
- }
-
- // Write out the table schema
- $output .= '#'.$newline.'# TABLE STRUCTURE FOR: '.$table.$newline.'#'.$newline.$newline;
-
- if ($add_drop == TRUE)
- {
- $output .= 'DROP TABLE IF EXISTS '.$table.';'.$newline.$newline;
- }
-
- $i = 0;
- $result = $query->result_array();
- foreach ($result[0] as $val)
- {
- if ($i++ % 2)
- {
- $output .= $val.';'.$newline.$newline;
- }
- }
-
- // If inserts are not needed we're done...
- if ($add_insert == FALSE)
- {
- continue;
- }
-
- // Grab all the data from the current table
- $query = $this->db->query("SELECT * FROM $table");
-
- if ($query->num_rows() == 0)
- {
- continue;
- }
-
- // Fetch the field names and determine if the field is an
- // integer type. We use this info to decide whether to
- // surround the data with quotes or not
-
- $i = 0;
- $field_str = '';
- $is_int = array();
- while ($field = mysqli_fetch_field($query->result_id))
- {
- // Most versions of MySQL store timestamp as a string
- $is_int[$i] = (in_array(
- strtolower(mysql_field_type($query->result_id, $i)),
- array('tinyint', 'smallint', 'mediumint', 'int', 'bigint'), // 'timestamp'),
- TRUE)
- ) ? TRUE : FALSE;
-
- // Create a string of field names
- $field_str .= $field->name.', ';
- $i++;
- }
-
- // Trim off the end comma
- $field_str = preg_replace( "/, $/" , "" , $field_str);
-
-
- // Build the insert string
- foreach ($query->result_array() as $row)
- {
- $val_str = '';
-
- $i = 0;
- foreach ($row as $v)
- {
- // Is the value NULL?
- if ($v === NULL)
- {
- $val_str .= 'NULL';
- }
- else
- {
- // Do a little formatting...
- $v = str_replace(array("\x00", "\x0a", "\x0d", "\x1a"), array('\0', '\n', '\r', '\Z'), $v);
- $v = str_replace(array("\n", "\r", "\t"), array('\n', '\r', '\t'), $v);
- $v = str_replace('\\', '\\\\', $v);
- $v = str_replace('\'', '\\\'', $v);
- $v = str_replace('\\\n', '\n', $v);
- $v = str_replace('\\\r', '\r', $v);
- $v = str_replace('\\\t', '\t', $v);
-
- // Escape the data if it's not an integer
- if ($is_int[$i] == FALSE)
- {
- $val_str .= $this->db->escape($v);
- }
- else
- {
- $val_str .= $v;
- }
- }
-
- // Append a comma
- $val_str .= ', ';
- $i++;
- }
-
- // Remove the comma at the end of the string
- $val_str = preg_replace( "/, $/" , "" , $val_str);
-
- // Build the INSERT string
- $output .= 'INSERT INTO '.$table.' ('.$field_str.') VALUES ('.$val_str.');'.$newline;
- }
-
- $output .= $newline.$newline;
- }
-
- return $output;
+ // Currently unsupported
+ return $this->db->display_error('db_unsuported_feature');
}
+
/**
*
* The functions below have been deprecated as of 1.6, and are only here for backwards
|