Skip to content

Commit

Permalink
Cql does not accept the table name prepended to *
Browse files Browse the repository at this point in the history
  • Loading branch information
Tom Kay committed Nov 20, 2014
1 parent 995216e commit 5ce7226
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/Assembler/CQL/CqlAssembler.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,17 @@
use Packaged\QueryBuilder\Predicate\GreaterThanOrEqualPredicate;
use Packaged\QueryBuilder\Predicate\LessThanOrEqualPredicate;
use Packaged\QueryBuilder\Predicate\PredicateSet;
use Packaged\QueryBuilder\SelectExpression\AllSelectExpression;

class CqlAssembler extends MySQLAssembler
{
public function assembleSegment($segment)
{
if($segment instanceof BetweenPredicate)
if($segment instanceof AllSelectExpression)
{
$segment->setTable(null);
}
else if($segment instanceof BetweenPredicate)
{
return $this->assembleBetween($segment);
}
Expand Down
9 changes: 9 additions & 0 deletions tests/Assembler/CQL/CqlAssemblerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
use Packaged\QueryBuilder\Expression\NumericExpression;
use Packaged\QueryBuilder\Expression\StringExpression;
use Packaged\QueryBuilder\Predicate\BetweenPredicate;
use Packaged\QueryBuilder\SelectExpression\AllSelectExpression;

class CqlAssemblerTest extends \PHPUnit_Framework_TestCase
{
Expand Down Expand Up @@ -43,6 +44,14 @@ public function testBetween()
);
}

public function testAllSelect()
{
$selector = new AllSelectExpression();
$this->assertEquals('*', CqlAssembler::stringify($selector));
$selector->setTable('test');
$this->assertEquals('*', CqlAssembler::stringify($selector));
}

public function testTableName()
{
$this->assertEquals(
Expand Down

0 comments on commit 5ce7226

Please sign in to comment.