[CDBI] Class::DBI vs DBIx::Class

Perrin Harkins perrin at elem.com
Tue Jan 17 20:30:21 GMT 2006


On Tue, 2006-01-17 at 19:00 +0000, Matt S Trout wrote:
> (2) because the way Ima::DBI uses it, it'll recycle a live sth you'd hung onto
>     because you weren't finished fetching data from it, thus screwing your app
>     up quite spectactularly. It only works for CDBI because CDBI fetches all
>     the data from the sth straight off and throws it away.

If it works for CDBI then it's probably not a useful point in
distinguishing between CDBI and DBIx::Class, but for reference, this has
to do with calling Ima::DBI queries directly, right?  And the issue is
that if you execute the same query twice with different bind parameters,
prepare_cached() will reuse the statement handle, and throw away the
results from the first execution?

If the data is small, reading it all at once from the first handle would
be a workaround for this.  If it's too big for that, you'd need to avoid
prepare_cached.  In that case, you'd have to modify your set_sql call
for this query to pass the "don't cache me" flag.  I don't think you'd
need to change any of the other set_sql queries, or modify any
Class::DBI code because of this.

- Perrin





More information about the ClassDBI mailing list