1
0
mirror of synced 2024-12-13 14:56:01 +03:00

Added contains() method which was introduced in the 0.9 branch.

This commit is contained in:
jwage 2008-01-22 17:00:48 +00:00
parent ec4ea31da8
commit 733eecbbc9

View File

@ -418,6 +418,19 @@ class Doctrine_Query extends Doctrine_Query_Abstract implements Countable, Seria
return $this->_dqlParts[$queryPart]; return $this->_dqlParts[$queryPart];
} }
/**
* contains
*
* Method to check if a arbitrary piece of dql exists
*
* @param string $dql Arbitrary piece of dql to check for
* @return boolean
*/
public function contains($dql)
{
return stripos($this->getDql(), $dql) === false ? false : true;
}
/** /**
* processPendingFields * processPendingFields
* the fields in SELECT clause cannot be parsed until the components * the fields in SELECT clause cannot be parsed until the components
@ -1122,7 +1135,7 @@ class Doctrine_Query extends Doctrine_Query_Abstract implements Countable, Seria
$subquery = $this->getLimitSubquery(); $subquery = $this->getLimitSubquery();
// what about composite keys? // what about composite keys?
$idColumnName = $table->getColumnName($table->getIdentifier()); $idColumnName = $table->getColumnName($table->getIdentifier());
switch (strtolower($this->_conn->getName())) { switch (strtolower($this->_conn->getDriverName())) {
case 'mysql': case 'mysql':
// mysql doesn't support LIMIT in subqueries // mysql doesn't support LIMIT in subqueries
$list = $this->_conn->execute($subquery, $params)->fetchAll(Doctrine::FETCH_COLUMN); $list = $this->_conn->execute($subquery, $params)->fetchAll(Doctrine::FETCH_COLUMN);