LinguaLeo / php-mysql

MIT License
3 stars 0 forks source link

OR when chaining criterias #7

Open t1gor opened 9 years ago

t1gor commented 9 years ago

In the example you have the following:

$criteria = new LinguaLeo\DataQuery\Criteria('table_name');

$criteria
    ->read(['a', 'b'])
    ->where('a', 1)
    ->where('b', 1, LinguaLeo\DataQuery\Criteria::EQUAL_GREATER)
    ->where('c', 1, LinguaLeo\DataQuery\Criteria::EQUAL_LESS)
    ->where('d', 1, LinguaLeo\DataQuery\Criteria::NOT_EQUAL)
    ->where('e', 1, LinguaLeo\DataQuery\Criteria::GREATER)
...

which translates into query like this:

SELECT a,b FROM db_name.table_name
WHERE
     a = 1
AND  b >= 1
AND  c <= 1
AND  d <> 1
AND  e > 1
...

Is it possible to add OR conditions?

regeda commented 9 years ago

The repository is deprecated. Please, use:

https://github.com/LinguaLeo/php-dataquery https://github.com/LinguaLeo/php-dataquery-mysql

Add OR is possible. Pull request is welcome.