Matt Lawrence wrote:
Matt S Trout wrote:

Interesting.

Have you considered writing some code to interpolate the bind parameters?

For copy+paste into an SQL CLI prompt it's a bit inconvenient to substitute
the ?s manually.

I was contemplating it, but never got around to it.

(we're currently rounding up for 0.8100, so if somebody gets a patch like
this together in the next week or so with tests you've a good chance of
it being applied)

I'll see if I can find some time this week(end) to finish it off then. Where would you recommend the tests to go?


I found some time last night to work on this. I put the tests in a new file t/as_sql.t, they are pretty basic: just calling each new method once and checking the output is as expected

There are now 2 cursor methods that are proxied from the resultset: as_sql and as_static_sql.

as_sql leaves placeholders in the sql string and passes back the raw values that go into it, as_static_sql replaces the placeholders using the quote method from DBI, with optional data type mapping via arguments (either name-based or positional). This seems to me to be an acceptable compromise between fully-automatic data_type mapping (which seems at first glance to be non-trivial and usually unnecessary) and total disregard of data_type (which will bite Pg bytea columns et al)

Comments?

Matt


_______________________________________________
List: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class
IRC: irc.perl.org#dbix-class
SVN: http://dev.catalyst.perl.org/repos/bast/DBIx-Class/
Searchable Archive: http://www.grokbase.com/group/[EMAIL PROTECTED]

Reply via email to