Add type 'ident' in quote() so we can quote identifiers (eg. column names) there.

Using array2list() for list of identifiers is now possible.
pull/60/head
Aleksander Machniak 12 years ago
parent cbe07532fa
commit ac37746c2a

@ -571,7 +571,7 @@ class rcube_db
* Formats input so it can be safely used in a query * Formats input so it can be safely used in a query
* *
* @param mixed $input Value to quote * @param mixed $input Value to quote
* @param string $type Type of data * @param string $type Type of data (integer, bool, ident)
* *
* @return string Quoted/converted string for use in query * @return string Quoted/converted string for use in query
*/ */
@ -586,6 +586,10 @@ class rcube_db
return 'NULL'; return 'NULL';
} }
if ($type == 'ident') {
return $this->quote_identifier($input);
}
// create DB handle if not available // create DB handle if not available
if (!$this->dbh) { if (!$this->dbh) {
$this->db_connect('r'); $this->db_connect('r');
@ -635,7 +639,7 @@ class rcube_db
$name[] = $start . $elem . $end; $name[] = $start . $elem . $end;
} }
return implode($name, '.'); return implode($name, '.');
} }
/** /**
@ -652,7 +656,7 @@ class rcube_db
* Return list of elements for use with SQL's IN clause * Return list of elements for use with SQL's IN clause
* *
* @param array $arr Input array * @param array $arr Input array
* @param string $type Type of data * @param string $type Type of data (integer, bool, ident)
* *
* @return string Comma-separated list of quoted values for use in query * @return string Comma-separated list of quoted values for use in query
*/ */

Loading…
Cancel
Save