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