diff --git a/src/Illuminate/Database/Query/Builder.php b/src/Illuminate/Database/Query/Builder.php index 6a9b6db0dc6..2d2d96ff76b 100755 --- a/src/Illuminate/Database/Query/Builder.php +++ b/src/Illuminate/Database/Query/Builder.php @@ -203,15 +203,6 @@ class Builder 'not similar to', 'not ilike', '~~*', '!~~*', ]; - /** - * All of the available bit operators. - * - * @var string[] - */ - public $bitOperators = [ - '&', '|', '^', '<<', '>>', '&~', - ]; - /** * Whether to use write pdo for the select. * @@ -763,10 +754,6 @@ public function where($column, $operator = null, $value = null, $boolean = 'and' } } - if ($this->isBitOperator($operator)) { - $type = 'Bit'; - } - // Now that we are working with just a simple query we can put the elements // in our array and add the query binding to our array of bindings that // will be bound to each SQL statements when it is finally executed. @@ -850,18 +837,6 @@ protected function invalidOperator($operator) ! in_array(strtolower($operator), $this->grammar->getOperators(), true); } - /** - * Determine if the operator is a bit operator. - * - * @param string $operator - * @return bool - */ - protected function isBitOperator($operator) - { - return in_array(strtolower($operator), $this->bitOperators, true) || - in_array(strtolower($operator), $this->grammar->getBitOperators(), true); - } - /** * Add an "or where" clause to the query. * @@ -1940,10 +1915,6 @@ public function having($column, $operator = null, $value = null, $boolean = 'and [$value, $operator] = [$operator, '=']; } - if ($this->isBitOperator($operator)) { - $type = 'bit'; - } - $this->havings[] = compact('type', 'column', 'operator', 'value', 'boolean'); if (! $value instanceof Expression) { diff --git a/src/Illuminate/Database/Query/Grammars/Grammar.php b/src/Illuminate/Database/Query/Grammars/Grammar.php index 740769436ad..77472f088e0 100755 --- a/src/Illuminate/Database/Query/Grammars/Grammar.php +++ b/src/Illuminate/Database/Query/Grammars/Grammar.php @@ -18,13 +18,6 @@ class Grammar extends BaseGrammar */ protected $operators = []; - /** - * The grammar specific bit operators. - * - * @var array - */ - protected $bitOperators = []; - /** * The components that make up a select clause. * @@ -262,22 +255,6 @@ protected function whereBasic(Builder $query, $where) return $this->wrap($where['column']).' '.$operator.' '.$value; } - /** - * Compile a bit operator where clause. - * - * @param \Illuminate\Database\Query\Builder $query - * @param array $where - * @return string - */ - protected function whereBit(Builder $query, $where) - { - $value = $this->parameter($where['value']); - - $operator = str_replace('?', '??', $where['operator']); - - return '('.$this->wrap($where['column']).' '.$operator.' '.$value.') != 0'; - } - /** * Compile a "where in" clause. * @@ -708,8 +685,6 @@ protected function compileHaving(array $having) return $having['boolean'].' '.$having['sql']; } elseif ($having['type'] === 'between') { return $this->compileHavingBetween($having); - } elseif ($having['type'] === 'bit') { - return $this->compileHavingBit($having); } return $this->compileBasicHaving($having); @@ -749,21 +724,6 @@ protected function compileHavingBetween($having) return $having['boolean'].' '.$column.' '.$between.' '.$min.' and '.$max; } - /** - * Compile a having clause involving a bit operator. - * - * @param array $having - * @return string - */ - protected function compileHavingBit($having) - { - $column = $this->wrap($having['column']); - - $parameter = $this->parameter($having['value']); - - return $having['boolean'].' ('.$column.' '.$having['operator'].' '.$parameter.') != 0'; - } - /** * Compile the "order by" portions of the query. * @@ -1339,14 +1299,4 @@ public function getOperators() { return $this->operators; } - - /** - * Get the grammar specific bit operators. - * - * @return array - */ - public function getBitOperators() - { - return $this->bitOperators; - } } diff --git a/src/Illuminate/Database/Query/Grammars/PostgresGrammar.php b/src/Illuminate/Database/Query/Grammars/PostgresGrammar.php index 17a306edf63..47f498e5470 100755 --- a/src/Illuminate/Database/Query/Grammars/PostgresGrammar.php +++ b/src/Illuminate/Database/Query/Grammars/PostgresGrammar.php @@ -21,15 +21,6 @@ class PostgresGrammar extends Grammar 'is distinct from', 'is not distinct from', ]; - /** - * The grammar specific bit operators. - * - * @var array - */ - protected $bitOperators = [ - '~', '&', '|', '#', '<<', '>>', '<<=', '>>=', - ]; - /** * {@inheritdoc} * diff --git a/tests/Database/DatabaseEloquentModelTest.php b/tests/Database/DatabaseEloquentModelTest.php index 1ff87c9bf21..76fa651e855 100755 --- a/tests/Database/DatabaseEloquentModelTest.php +++ b/tests/Database/DatabaseEloquentModelTest.php @@ -2153,7 +2153,6 @@ protected function addMockConnection($model) $model->setConnectionResolver($resolver = m::mock(ConnectionResolverInterface::class)); $resolver->shouldReceive('connection')->andReturn($connection = m::mock(Connection::class)); $connection->shouldReceive('getQueryGrammar')->andReturn($grammar = m::mock(Grammar::class)); - $grammar->shouldReceive('getBitOperators')->andReturn([]); $connection->shouldReceive('getPostProcessor')->andReturn($processor = m::mock(Processor::class)); $connection->shouldReceive('query')->andReturnUsing(function () use ($connection, $grammar, $processor) { return new BaseBuilder($connection, $grammar, $processor); @@ -2441,7 +2440,6 @@ public function getConnection() { $mock = m::mock(Connection::class); $mock->shouldReceive('getQueryGrammar')->andReturn($grammar = m::mock(Grammar::class)); - $grammar->shouldReceive('getBitOperators')->andReturn([]); $mock->shouldReceive('getPostProcessor')->andReturn($processor = m::mock(Processor::class)); $mock->shouldReceive('getName')->andReturn('name'); $mock->shouldReceive('query')->andReturnUsing(function () use ($mock, $grammar, $processor) { diff --git a/tests/Database/DatabaseQueryBuilderTest.php b/tests/Database/DatabaseQueryBuilderTest.php index b46fce4c6ad..d27a38a1027 100755 --- a/tests/Database/DatabaseQueryBuilderTest.php +++ b/tests/Database/DatabaseQueryBuilderTest.php @@ -3209,25 +3209,6 @@ public function testMySqlSoundsLikeOperator() $this->assertEquals(['John Doe'], $builder->getBindings()); } - public function testBitOperators() - { - $builder = $this->getBuilder(); - $builder->select('*')->from('users')->where('bar', '&', 1); - $this->assertSame('select * from "users" where ("bar" & ?) != 0', $builder->toSql()); - - $builder = $this->getPostgresBuilder(); - $builder->select('*')->from('users')->where('bar', '#', 1); - $this->assertSame('select * from "users" where ("bar" # ?) != 0', $builder->toSql()); - - $builder = $this->getBuilder(); - $builder->select('*')->from('users')->having('bar', '&', 1); - $this->assertSame('select * from "users" having ("bar" & ?) != 0', $builder->toSql()); - - $builder = $this->getPostgresBuilder(); - $builder->select('*')->from('users')->having('bar', '#', 1); - $this->assertSame('select * from "users" having ("bar" # ?) != 0', $builder->toSql()); - } - public function testMergeWheresCanMergeWheresAndBindings() { $builder = $this->getBuilder();