added Regexp operator compatibility for mysql and pgsql drivers
This commit is contained in:
parent
eacb78148e
commit
060739d72c
@ -126,6 +126,15 @@ abstract class Doctrine_Connection extends Doctrine_Configurable implements Coun
|
||||
public function getDBH() {
|
||||
return $this->dbh;
|
||||
}
|
||||
/**
|
||||
* returns the regular expression operator
|
||||
* (implemented by the connection drivers)
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getRegexpOperator() {
|
||||
throw new Doctrine_Connection_Exception('Regular expression operator is not supported by this database driver.');
|
||||
}
|
||||
/**
|
||||
* query
|
||||
* queries the database with Doctrine Query Language
|
||||
|
@ -14,10 +14,20 @@ class Doctrine_Connection_Mysql extends Doctrine_Connection_Common {
|
||||
$this->setAttribute(Doctrine::ATTR_QUERY_LIMIT, Doctrine::LIMIT_ROWS);
|
||||
parent::__construct($manager,$pdo);
|
||||
}
|
||||
/**
|
||||
* returns the regular expression operator
|
||||
* (implemented by the connection drivers)
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getRegexpOperator() {
|
||||
return 'RLIKE';
|
||||
}
|
||||
/**
|
||||
* deletes all data access object from the collection
|
||||
* @param Doctrine_Collection $coll
|
||||
*/
|
||||
|
||||
/**
|
||||
public function deleteCollection(Doctrine_Collection $coll) {
|
||||
|
||||
|
@ -14,5 +14,14 @@ class Doctrine_Connection_Pgsql extends Doctrine_Connection_Common {
|
||||
$data = $stmt->fetch(PDO::FETCH_NUM);
|
||||
return $data[0];
|
||||
}
|
||||
/**
|
||||
* returns the regular expression operator
|
||||
* (implemented by the connection drivers)
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getRegexpOperator() {
|
||||
return 'SIMILAR TO';
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -48,10 +48,11 @@ class Doctrine_Query_Where extends Doctrine_Query_Condition {
|
||||
$stack = $this->query->getTableStack();
|
||||
|
||||
switch($func) {
|
||||
case 'contains':
|
||||
|
||||
case 'similarTo':
|
||||
case 'isLike':
|
||||
case 'contains':
|
||||
$operator = ' = ';
|
||||
case 'regexp':
|
||||
$operator = ' RLIKE ';
|
||||
case 'like':
|
||||
if(empty($relation))
|
||||
throw new Doctrine_Query_Exception('DQL function contains can only be used for fields of related components');
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user