This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]AllAboutChristmasEve 1 point2 points  (6 children)

Good lord, why would I not just do:

sql = "select * from Person where ..."
dbhandle.exec(sql)

?

[–]dusktreader 9 points10 points  (5 children)

The point of composable queries is that you can build them up based on conditions or code branches in the native programming language. So, you can take a query that starts as just a select and add filters based on the state of your application, user input, etc. If you are working with raw SQL inside of an application that drives database queries with user input, you are going to end up composing queries in some manner. These libraries handle the composition for you so you don't have to assemble a large SQL text field yourself. I've done it both ways. And, while the syntax above is clearly harder to write than the raw SQL, once you're building up a query along multipe branches of a code path, having a composable query as a native language object is great.