Subject: | Prepared queries at connect time |
Date: | Mon, 04 Aug 2014 09:47:23 +0000 |
To: | bug-dancer-plugin-database [...] rt.cpan.org |
From: | Czuczy Gergely <phoemix [...] harmless.hu> |
Hello,
I'm trying to set up a bunch of prepared queries (using dancer1 atm)
which are being used quite frequently for my application at connection
time, and just keep on executing them during runtime. However, the
database_connected hook passes the DBI handler before being reblessed
to the handle_class, this makes this slightly messy, because the
returned $sth handlers have to be stored somewhere (DBI has the
private_foo stuff for private data, which is a workaround).
I was wonder, wouldn't it be possible to add a facility for this
kind of usage by supporting prepared query definitions in the YAML
config and just referencing them runtime? The database plugin could be
preparing all these during connection time automatically, and such
statement's handler could be fetched by something like
database->pquery($foo). This sounds conventient to me. I haven't
checked other applications, however I expect preparing queries at
connection time to be a common practice, as it is a good
one, then
just executing them during runtime, therefore supporting this kind of
usage seems logical to me.
So, what are your thoughts regarding this?
Regards,
Gergey