[pmwiki-devel] PmWiki's database standard
Ben Stallings
Ben at InterdependentWeb.com
Thu Nov 30 16:04:11 CST 2006
Marc wrote,
> The first point is regarding the use of ADOdb's esoteric functions.
OK, I give up, which ones are more esoteric? Do you mean all functions
that are not included in the lite version, or some subset of those? I'm
not sure whether the functions I'm using are ones you consider esoteric
or not, so please clarify.
It seems to me that there could be multiple versions of the Database
Standard file for sites using ADOdb, ADOdb-lite, or even PEAR; or that
all three of those could be put into one PHP function with the
$ADOdbLocation global or its equivalent telling the function which
standard to use. The important thing as I see it is to get the
connection routines out of the individual recipes in order to prevent
duplicate connections. I'm not keen on telling recipe authors which
functions they can and cannot use; I'll leave that to someone with more
credibility.
> Perhaps more contentiously, having examined adodb-connect.php and
> AuthUserDbase-2.0.0.php, I'm not clear why the database object is being
> passed as an array variable via PHP's globals. Is there a reason for not
> using the object?
Yes there is, thanks for asking. The reasoning was that the
ADOdbConnect() function returns either true or an error message to be
handled by the recipe that calls the function, since adodb-connect.php
does not have any user interface of its own and hence no error handling.
If it returned an object instead of true, each recipe that uses the
function would have to test whether or not the result is an object
before handling the error message. While that might make sense to you,
it seems clumsy to me, so I didn't write it that way. :-)
Also, the purpose of the function is to provide a standard API for
databases, and a global variable ensures that any time a recipe refers
to $DB, it's the same $DB that other recipes are using.
It ain't perfect, but you asked for the reason, so that's it! --Ben S.
More information about the pmwiki-devel
mailing list