kohana/database — pull request #67 by KostyaTretyak (2014-01-19 12:54:52+00:00)
Title: Added support multiple operators and multiple conditions in query builde...

Better not to watch a comparison of Github, there's something difficult to disassemble. I try to explain the changes.

In which the code is embedded in the new logic:

* in the method [\_compile_conditions()](https://github.com/KostyaTretyak/database/blob/cc57a12e36bc8694e888931077e28c434586b6a1/classes/Kohana/Database/Query/Builder.php#L90-L136)
* added new method _ condition_to_str (), but almost all of its code is taken from the method \_ compile_conditions(). It is only [this part](https://github.com/KostyaTretyak/database/blob/cc57a12e36bc8694e888931077e28c434586b6a1/classes/Kohana/Database/Query/Builder.php#L206-L217) of the new. The rest of code in this method changed the form, not logic.
* added new method [\_quote_value()](https://github.com/KostyaTretyak/database/blob/cc57a12e36bc8694e888931077e28c434586b6a1/classes/Kohana/Database/Query/Builder.php#L153-L161), but all of its code is taken from [part](https://github.com/kohana/database/blob/cb64b293587309358207b0e17025b55eb902c563/classes/Kohana/Database/Query/Builder.php#L113-L117) method \_ compile_conditions().

What conditions you can write for the new builder:

* `->and_where('number', array('>','<'), array('10', '50'))`
* `->or_where('name', 'like', array('Geo%', 'Kons%', 'S%'))`
* `->and_where('number', array('>','in'), array('1', '3'))`
* `->or_where('number', array('in'), array('1', '3'))`
* `->or_where('number', array('in','<'), array(array('10', '11'), '3'))`

...

Of course comments need to rewrite to make it more properly in English.