Re: [Cppcms-users] cppdb: getting the full query
Brought to you by:
artyom-beilis
From: augustin <aug...@ov...> - 2010-12-24 13:27:39
|
On Friday 24 December 2010 06:32:56 pm Artyom wrote: > Currently this is not supported > 1. In many cases the query just does not exists or invalid. > > 2. CppDB does not rewrite the query in most of cases as it uses > prepared statements, so basically the query you give is the query that > is passed I hope you'll re-consider and support it. We almost never pass a ready-made query, but use dynamic queries most of the time. When we do: cppdb::result res = sql << "SELECT * FROM user WHERE id = ? << user_id; it's very useful in many circumstances to know which user_id was actually passed. Internally, cppdb must be creating the full query before passing it to the backend. I need to have the full query with the replacements made: "SELECT * FROM user WHERE id = 123" Moreover, in a real application, some queries can become increasingly complex and increasingly dynamic (e.g. see Drupal and some of its API like db_rewrite_query()...!) Often, in order to understand why we don't get the result we expect, we need to have the very exact query as run by the SQL server. One more thing: when an application crashes, or throws an error, generally we don't know which query in the code causes the problem. Looking at the error logs at some generic error message is not useful. Having the full query appended in the error logs would help to find the cause much more quickly. I don't understand the cppdb internals and don't understand your first point ("the query just does not exists or is invalid"). But surely, at some point you must be sending a full query to the server, so it should be fairly easy to retrieve it. Augustin. -- Friends: http://www.reuniting.info/ http://activistsolutions.org/ My projects: http://astralcity.org/ http://3enjeux.overshoot.tv/ http://linux.overshoot.tv/ http://overshoot.tv/ http://charityware.info/ http://masquilier.org/ http://openteacher.info/ http://minguo.info/ http://www.wechange.org/ http://searching911.info/ . |