/**
  * Remove parts of a SQL string that contain quoted strings
  * of values or identifiers.
  *
  * @param string $sql
  * @return string
  */
 protected function _stripQuoted($sql)
 {
     // get the character for delimited id quotes,
     // this is usually " but in MySQL is `
     $d = $this->_adapter->quoteIdentifier('a');
     $d = $d[0];
     // get the value used as an escaped delimited id quote,
     // e.g. \" or "" or \`
     $de = $this->_adapter->quoteIdentifier($d);
     $de = substr($de, 1, 2);
     $de = str_replace('\\', '\\\\', $de);
     // get the character for value quoting
     // this should be '
     $q = $this->_adapter->quote('a');
     $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 = str_replace('\\', '\\\\', $qe);
     // get a version of the SQL statement with all quoted
     // values and delimited identifiers stripped out
     // remove "foo\"bar"
     $sql = preg_replace("/{$q}({$qe}|\\\\{2}|[^{$q}])*{$q}/", '', $sql);
     // remove 'foo\'bar'
     if (!empty($q)) {
         $sql = preg_replace("/{$q}({$qe}|[^{$q}])*{$q}/", '', $sql);
     }
     return $sql;
 }
 /**
  * Safely quotes a value for an SQL statement.
  *
  * If an array is passed as the value, the array values are quoted
  * and then returned as a comma-separated string.
  *
  * @param mixed $value
  *            The value to quote.
  * @param mixed $type
  *            OPTIONAL the SQL datatype name, or constant, or null.
  * @return mixed An SQL-safe quoted value (or string of separated values).
  */
 public function quote($value, $type = null)
 {
     return $this->adapter->quote($value, $type);
 }