Commit 0985b38b authored by Benjamin Eberlei's avatar Benjamin Eberlei

Merge branch 'DBAL-12'

parents 1862f645 6e5f2278
...@@ -33,7 +33,6 @@ use PDO, Closure, Exception, ...@@ -33,7 +33,6 @@ use PDO, Closure, Exception,
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL * @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @link www.doctrine-project.org * @link www.doctrine-project.org
* @since 2.0 * @since 2.0
* @version $Revision: 3938 $
* @author Guilherme Blanco <guilhermeblanco@hotmail.com> * @author Guilherme Blanco <guilhermeblanco@hotmail.com>
* @author Jonathan Wage <jonwage@gmail.com> * @author Jonathan Wage <jonwage@gmail.com>
* @author Roman Borschel <roman@code-factory.org> * @author Roman Borschel <roman@code-factory.org>
...@@ -1093,4 +1092,14 @@ class Connection implements DriverConnection ...@@ -1093,4 +1092,14 @@ class Connection implements DriverConnection
} }
} }
} }
/**
* Create a new instance of a SQL query builder.
*
* @return Query\QueryBuilder
*/
public function createQueryBuilder()
{
return new Query\QueryBuilder($this);
}
} }
\ No newline at end of file
...@@ -24,7 +24,7 @@ namespace Doctrine\DBAL\Query\Expression; ...@@ -24,7 +24,7 @@ namespace Doctrine\DBAL\Query\Expression;
* *
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL * @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @link www.doctrine-project.org * @link www.doctrine-project.org
* @since 2.0 * @since 2.1
* @author Guilherme Blanco <guilhermeblanco@hotmail.com> * @author Guilherme Blanco <guilhermeblanco@hotmail.com>
* @author Benjamin Eberlei <kontakt@beberlei.de> * @author Benjamin Eberlei <kontakt@beberlei.de>
*/ */
...@@ -111,10 +111,20 @@ class CompositeExpression implements \Countable ...@@ -111,10 +111,20 @@ class CompositeExpression implements \Countable
*/ */
public function __toString() public function __toString()
{ {
if ($this->count() === 1) { if (count($this->parts) === 1) {
return (string) $this->parts[0]; return (string) $this->parts[0];
} }
return '(' . implode(') ' . $this->type . ' (', $this->parts) . ')'; return '(' . implode(') ' . $this->type . ' (', $this->parts) . ')';
} }
/**
* Return type of this composite expression (AND/OR)
*
* @return string
*/
public function getType()
{
return $this->type;
}
} }
\ No newline at end of file
...@@ -26,8 +26,7 @@ use Doctrine\DBAL\Connection; ...@@ -26,8 +26,7 @@ use Doctrine\DBAL\Connection;
* *
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL * @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @link www.doctrine-project.com * @link www.doctrine-project.com
* @since 1.0 * @since 2.1
* @version $Revision$
* @author Guilherme Blanco <guilhermeblanco@hotmail.com> * @author Guilherme Blanco <guilhermeblanco@hotmail.com>
* @author Benjamin Eberlei <kontakt@beberlei.de> * @author Benjamin Eberlei <kontakt@beberlei.de>
*/ */
......
This diff is collapsed.
...@@ -6,6 +6,9 @@ use Doctrine\DBAL\Query\Expression\CompositeExpression; ...@@ -6,6 +6,9 @@ use Doctrine\DBAL\Query\Expression\CompositeExpression;
require_once __DIR__ . '/../../../TestInit.php'; require_once __DIR__ . '/../../../TestInit.php';
/**
* @group DBAL-12
*/
class CompositeExpressionTest extends \Doctrine\Tests\DbalTestCase class CompositeExpressionTest extends \Doctrine\Tests\DbalTestCase
{ {
public function testCount() public function testCount()
......
...@@ -7,6 +7,9 @@ use Doctrine\DBAL\Query\Expression\ExpressionBuilder, ...@@ -7,6 +7,9 @@ use Doctrine\DBAL\Query\Expression\ExpressionBuilder,
require_once __DIR__ . '/../../../TestInit.php'; require_once __DIR__ . '/../../../TestInit.php';
/**
* @group DBAL-12
*/
class ExpressionBuilderTest extends \Doctrine\Tests\DbalTestCase class ExpressionBuilderTest extends \Doctrine\Tests\DbalTestCase
{ {
protected $expr; protected $expr;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment