We have a very big app in Sinatra. I set up logging when we switched
to Datamapper, which is how we are able to look at our development and
tests logs to determine the final SQL. That isn't what I am looking
for, because we already have that. I am looking for a way, preferably
in tests to be able to inspect the SQL string generated by ?query?
objects. Clearly the string is generated before it is sent to the
database, so where is that string so that we can make assertions
against it.

Why would I want to do this? Did I mention that we have a very big
application? Some or our joins combine many datamapper query objects
with intersection, or, and ... Very ofter postgres is fussy about such
things as the order of clauses, sub-selects, requirements in the where
clause. We are having performance issues related to this fussiness,
and because we do test driven development, we would like to match our
queries to assure no regressions as our code changes or we update
gems.

So, Ted's solution is by far the best. Thanks Ted.

I can build a method on our search object that does this kind of thing
with less verbosity. But I would really like my query all put
together, with the question marks dumped supplanted already with
variables. This will be good enough, but I would love it all.

-- 
You received this message because you are subscribed to the Google Groups 
"DataMapper" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/datamapper?hl=en.

Reply via email to