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() {
|
public function getDBH() {
|
||||||
return $this->dbh;
|
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
|
* query
|
||||||
* queries the database with Doctrine Query Language
|
* 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);
|
$this->setAttribute(Doctrine::ATTR_QUERY_LIMIT, Doctrine::LIMIT_ROWS);
|
||||||
parent::__construct($manager,$pdo);
|
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
|
* deletes all data access object from the collection
|
||||||
* @param Doctrine_Collection $coll
|
* @param Doctrine_Collection $coll
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
public function deleteCollection(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);
|
$data = $stmt->fetch(PDO::FETCH_NUM);
|
||||||
return $data[0];
|
return $data[0];
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* returns the regular expression operator
|
||||||
|
* (implemented by the connection drivers)
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getRegexpOperator() {
|
||||||
|
return 'SIMILAR TO';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -49,9 +49,10 @@ class Doctrine_Query_Where extends Doctrine_Query_Condition {
|
|||||||
|
|
||||||
switch($func) {
|
switch($func) {
|
||||||
case 'contains':
|
case 'contains':
|
||||||
|
$operator = ' = ';
|
||||||
case 'similarTo':
|
case 'regexp':
|
||||||
case 'isLike':
|
$operator = ' RLIKE ';
|
||||||
|
case 'like':
|
||||||
if(empty($relation))
|
if(empty($relation))
|
||||||
throw new Doctrine_Query_Exception('DQL function contains can only be used for fields of related components');
|
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