From 733eecbbc976d75cfc157e5e94179dc2dd1e6e78 Mon Sep 17 00:00:00 2001 From: jwage Date: Tue, 22 Jan 2008 17:00:48 +0000 Subject: [PATCH] Added contains() method which was introduced in the 0.9 branch. --- lib/Doctrine/Query.php | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/lib/Doctrine/Query.php b/lib/Doctrine/Query.php index 3422cc657..8ea4a1b52 100644 --- a/lib/Doctrine/Query.php +++ b/lib/Doctrine/Query.php @@ -418,6 +418,19 @@ class Doctrine_Query extends Doctrine_Query_Abstract implements Countable, Seria 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 * 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(); // what about composite keys? $idColumnName = $table->getColumnName($table->getIdentifier()); - switch (strtolower($this->_conn->getName())) { + switch (strtolower($this->_conn->getDriverName())) { case 'mysql': // mysql doesn't support LIMIT in subqueries $list = $this->_conn->execute($subquery, $params)->fetchAll(Doctrine::FETCH_COLUMN);