dbh caching works but i sort of reaching the solution by trying/guessing but don't know exactly why.Well, dbh "caching" works if you mean that calling MyDB->dbh() will return an existing handle. It does not mean you will get the same handle the next time your CGI script is called. You'll need mod_perl for that.
can someone please explain to me?What part of the code are you unsure about? It seems pretty straightforward to me.
by the way, is it a good practice for caching dbh this way?I would do it. The only real problems you might get with this approach is if you need multiple handles or switch schemas. Usually you don't, and if you do, you'd know about it.
Will it still work under mod_perl without using Apache::DBI?Yes, but Apache::DBI is a little more sophisticated - it will only return a cached handle if the connection parameters are exactly the same.
In reply to Re: OO question
by Joost
in thread OO question
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |