Re: pocket-sql - generating and running sql queries.
Alvaro Carrasco <[email protected]>
| Newsgroups | gmane.comp.lang.scala |
|---|---|
| Message-ID | <CAPSirTdSNs19vPaHPFicWGAkLRTomYA-wzMviKkK254W6TgFkQ@mail.gmail.com> |
2015-06-09 10:22 GMT-06:00 Steven Dobay <[email protected]>: > Nice project, but I think it is more similar to squeryl > <https://github.com/squeryl/squeryl>. Thanks for showing it! Now, I > remember what I forgot to implement... > True, the syntax of scoop drew a lot of inspiration from squeryl (I used squeryl and anorm for about a year before starting the project). But if you look closer, you'll find the approach is actually more similar to how you describe yours: a combination of jOOQ and Anorm. Scoop (and yours) is not completely concerned with the semantics of the query (as opposed to slick and squeryl, which enforce that columns referenced are present in the from and join, etc, good, but the api syntax suffers), but more with the syntax and parsing (jooq: just validate basic syntax; anorm: just semi-type-safe parsing). > One small concern after skimming through the docs: The join 'ON' clause >> should support general boolean expression, not just a pair of fields (even >> if that's the most common use-case). >> > > I thought about it, and it would be easy to implement. But I think it's > safer to join table like this. Other predicates need to be defined in the > where clause. > Why safer? Some conditions really do belong in the ON clause though, especially with left joins: SELECT * FROM users u LEFT projects p ON p.creator_id = u.id AND p.deleted = false To accomplish the same thing with the where clause requires handling nulls: SELECT * FROM users u LEFT JOIN projects p ON p.creator_id = u.id WHERE p.id IS NULL OR p.deleted = false Alvaro -- You received this message because you are subscribed to the Google Groups "scala-language" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.