protected function extractMatchingConditions($method, $condition)
{
$table = $this->getTableInfo();
$columns = $table->getLowerCaseColumnNames();
$regexp = '/(' . implode('|', array_keys($columns)) . ')(and|_and_|or|_or_)?/i';
$matches = array();
if (!preg_match_all($regexp, strtolower($condition), $matches, PREG_SET_ORDER)) {
throw new TDbException('dbtablegateway_mismatch_column_name', $method, implode(', ', $columns), $table->getTableFullName());
}
$fields = array();
foreach ($matches as $match) {
$key = $columns[$match[1]];
$column = $table->getColumn($key)->getColumnName();
$sql = $column . ' = ? ';
if (count($match) > 2) {
$sql .= strtoupper(str_replace('_', '', $match[2]));
}
$fields[] = $sql;
}
return $fields;
}