Commit 9e99dceb authored by David Weston's avatar David Weston

Speed fix

parent e7799144
...@@ -175,25 +175,23 @@ abstract class Zend_Db_Statement implements Zend_Db_Statement_Interface ...@@ -175,25 +175,23 @@ abstract class Zend_Db_Statement implements Zend_Db_Statement_Interface
// get the character for value quoting // get the character for value quoting
// this should be ' // this should be '
$q = $this->_adapter->quote('a'); $q = $this->_adapter->quote('a');
$q = $q[0]; $q = $q[0];
// get the value used as an escaped quote, // get the value used as an escaped quote,
// e.g. \' or '' // e.g. \' or ''
$qe = $this->_adapter->quote($q); $qe = $this->_adapter->quote($q);
$qe = substr($qe, 1, 2); $qe = substr($qe, 1, 2);
$qe = preg_quote($qe); $qe = preg_quote($qe);
$escapeChar = substr($qe, 0, 1);
// remove 'foo\'bar' // remove 'foo\'bar'
if (!empty($q)) { if (!empty($q)) {
$escapeChar = preg_quote($escapeChar); $sql = preg_replace("/$q($qe+|\\\\{2}+|[^$q]+|(?<=\\\\)$q)*$q/", '', $sql); # i3MEDIA fix for DB speed issues
// this segfaults only after 65,000 characters instead of 9,000
$sql = preg_replace("/$q([^$q{$escapeChar}]*|($qe)*)*$q/s", '', $sql);
} }
// get a version of the SQL statement with all quoted // get a version of the SQL statement with all quoted
// values and delimited identifiers stripped out // values and delimited identifiers stripped out
// remove "foo\"bar" // remove "foo\"bar"
$sql = preg_replace('/"(\\\\"|[^"])*"/Us', '', $sql); $sql = preg_replace("/\"(\\\\\"|[^\"])*\"/Us", '', $sql);
// get the character for delimited id quotes, // get the character for delimited id quotes,
// this is usually " but in MySQL is ` // this is usually " but in MySQL is `
$d = $this->_adapter->quoteIdentifier('a'); $d = $this->_adapter->quoteIdentifier('a');
...@@ -205,7 +203,6 @@ abstract class Zend_Db_Statement implements Zend_Db_Statement_Interface ...@@ -205,7 +203,6 @@ abstract class Zend_Db_Statement implements Zend_Db_Statement_Interface
$de = preg_quote($de); $de = preg_quote($de);
// Note: $de and $d where never used..., now they are: // Note: $de and $d where never used..., now they are:
$sql = preg_replace("/$d($de|\\\\{2}|[^$d])*$d/Us", '', $sql); $sql = preg_replace("/$d($de|\\\\{2}|[^$d])*$d/Us", '', $sql);
return $sql; return $sql;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment