dresende / node-sql-query

NodeJS SQL query builder
122 stars 103 forks source link

Add support for multi-conditional exists statements #15

Closed notheotherben closed 11 years ago

notheotherben commented 11 years ago

This makes it possible to generate exists statements which match multiple properties across tables. This is necessary to support multiple primary keys on models in node-orm2.

Changes are implemented in a backwards compatible manner, however upon completion of my updates to node-orm2 this will be moot anyway.

This change allows statements like the following to be generated:

SELECT * FROM `people` `t1` WHERE EXISTS (SELECT * FROM `parents` WHERE `name` = `t1`.`name` AND `surname` = `t1`.`surname` AND `alive` = 1)

Currently just pending this merge to push the final changes for node-orm2 that I've been working on.

dresende commented 11 years ago

Can you just update a test file to show this change?

notheotherben commented 11 years ago

Done, should be possible to merge now. Also added a test for backwards compatibility with the old behaviour

dresende commented 11 years ago

Thank you :)