summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--system/database/drivers/mysqli/mysqli_utility.php138
-rw-r--r--user_guide/changelog.html1
-rw-r--r--user_guide/database/utilities.html2
3 files changed, 5 insertions, 136 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
diff --git a/user_guide/changelog.html b/user_guide/changelog.html
index 645d5ae01..1ab6ac221 100644
--- a/user_guide/changelog.html
+++ b/user_guide/changelog.html
@@ -136,6 +136,7 @@ Change Log
<li>Added <kbd>quotes_to_entities()</kbd> function to <a href="./helpers/string_helper.html">string helper</a>.</li>
<li>Added <kbd>form_fieldset()</kbd>, <kbd>form_fieldset_close()</kbd>, <kbd>form_label()</kbd>, and <kbd>form_reset()</kbd> function to <a href="./helpers/form_helper.html">form helper</a>.</li>
<li>Added support for external urls in <kbd>form_open()</kbd>.</li>
+ <li>Removed support for db_backup in MySQLi due to incompatible functions.</li>
<li>Javascript Calendar plugin now uses the months and days from the calendar language file, instead of hard-coded values, internationalizing it.</li>
</ul>
</li>
diff --git a/user_guide/database/utilities.html b/user_guide/database/utilities.html
index cf0230dbb..9b5126490 100644
--- a/user_guide/database/utilities.html
+++ b/user_guide/database/utilities.html
@@ -206,7 +206,7 @@ If you need to write the file use the <a href="../helpers/file_helper.html">File
<p>Permits you to backup your full database or individual tables. The backup data can be compressed in either Zip or Gzip format.</p>
-<p class="important"><strong>Note:</strong>&nbsp; This features is only available for MySQL/MySQLi databases.</p>
+<p class="important"><strong>Note:</strong>&nbsp; This features is only available for MySQL databases.</p>
<p>Note: Due to the limited execution time and memory available to PHP, backing up very large
databases may not be possible. If your database is very large you might need to backup directly from your SQL server