Using DBI methods
Gervase Markham
gerv at mozilla.org
Mon Aug 19 20:36:02 UTC 2002
> 1) Can use stuff like:
> my ($a, $b) = $dbh->selectrow_array("SELECT a,b FROM foo WHERE
> prim_key=7");
>
> or selectall_arrayref, and so on
>
> which is nicer/cleaner/faster/easier to read than our sendsql+fetch stuff
I'm not convinced - I find the abstraction we have, with its one
standard method of doing things, easy to understand and very readable.
The syntax above is ugly :-)
> 2) We get to use DBI's error handling + exceptions - currently we only
> check for errors in one place, which is bad.
Why? I'd say it was good - I'd much rather the error handling was
localised than scattered throughout the code next to every database access.
> 4) No more state stack
> - don't have to worry about forgetting to push/pop the state stack -
> simply get a new statement handle when you need one from teh globally
> available dbh when needed.
This is hardly a burden - usually, it's really obvious when you've
forgotten.
I've always thought our simple DB API was one of the good things about
Bugzilla's code :-)
Gerv
More information about the developers
mailing list