Hi all,

Which is the preferred soci way to create out-of-order and other kinds of
complex statements?

Some examples of what I mean:
1) Creation of SQL statements and binding of the respective variables based
on conditions or loops.
2) Bind the variables first, then append the SQL statement which may be
decided later between an INSERT or a UPDATE.
3) Execute a SQL statement during the creation of another one to make
decisions regarding the contents of the later.
4) Work on the WHERE clause first, then in the main clause
(SELECT/UPDATE/DELETE).

Using directly the soci::statement class you can do all of them at some
extend but you lost all the soci's syntactic sugar, you must manage the SQL
stream/string by yourself and you need to call a bunch of members functions
in the proper sequence to make the whole thing work.

Holding a soci::detail::prepared_statement_temp_type variable you keep all
the soci's syntactic sugar and you can do 1), 2) and 3) with some
limitations (you must append an empty string to soci::session to clear the
query stream). However, I don't think using soci's internal variables is a
future proof solution.

A third solution (what I'm doing right now) is creating a wrapper around
soci::statement which works like soci::detail::prepared_statement_temp_type.

What are your thoughts and experiences with soci regarding such situations?

Thank you,
Ricardo Andrade
------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_mar
_______________________________________________
soci-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/soci-users

Reply via email to