Re: pocket-sql - generating and running sql queries.
Steven Dobay <[email protected]>
| Newsgroups | gmane.comp.lang.scala |
|---|---|
| Message-ID | <[email protected]> |
Yeah, you're right about that. Maybe I should give a chance for the predicates and I just force to use the key mappings. Regards, Steven On Tuesday, June 9, 2015 at 7:12:42 PM UTC+2, Alvaro Carrasco wrote: > > 2015-06-09 10:22 GMT-06:00 Steven Dobay <[email protected] <javascript:> > >: > >> 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.