Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Two changes: where() function values of 0, and query .as() function #11

Merged
merged 2 commits into from Nov 2, 2011
Merged

Conversation

nicjansma
Copy link
Contributor

Notes in changes below

…he items in the array is the value 0, it won't be used. Compare to undefined instead.
…oject the output as something different than the .from() table. For example, if you have


new joli.query().select('table2.*').from('table1').join('table2', 'id', 'table2.id')

This will be translated to:

select table2.* from table1 left outer join on table1.id = table2.id

You may want to prepare the SQL statement in this backwards order (table1 left outer joined to table2) for performance reasons.  However, you may need the results projected as 'table2' items.

To aid in this, I've added a simple .as() function.  You can use .as() to change a query to project as a different table than the .from() function:

new joli.query().select('table2.*').from('table1').join('table2', 'id', 'table2.id').as('table2')

These will produce results as 'table2' objects.
xavierlacot added a commit that referenced this pull request Nov 2, 2011
Two changes: where() function values of 0, and query .as() function
@xavierlacot xavierlacot merged commit 5052576 into xavierlacot:master Nov 2, 2011
@xavierlacot
Copy link
Owner

Nic,

This is a great work! Thanks for the pull request!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants