[pmwiki-devel] More database standards
crisses at kinhost.org
Wed Dec 13 17:23:12 CST 2006
On Dec 13, 2006, at 2:11 PM, marc wrote:
> I know that most folk aren't using a database, and probably very
> few are
> using more than one, but I'd like to pin down how we communicate the
> active connection name to recipes even for a single db.
> A connection is usually defined in (farm)config.php by:
> $Databases['connection_name'] = array(...
> where connection_name is arbitrary. This means that when a recipe
> it - to perform some db action - the connection name must be somehow
> passed to the recipe. One could pass it around in parameters, but that
> is horribly messy. Worse, when dealing with objects, it's not really
> viable at all.
What's not viable? You can't pass object pointers to objects?
I've called objects inside objects, and I'm not understanding why
creating an object in an object is ok but you can't pass objects or
object pointers.... I'm not sure I've tried, though.
> To complicate matters, where there is more than one database, you
> be passing around multiple connection names. In addition, how is a
> recipe writer to cater for the situation where one table comes from
> db and a second from another? And perhaps a third. Or a fourth.
> Is there a proposed solution for this?
I don't know. I know how I've handled it for AuthUserDBase so far.
I've used SDVA and given a sample sql script for how to set up the
database, but only for the standalone version. The very nature of
AuthUserDBase was to share the login settings of another database
already managed by another program (say vBulletin, Joomla!, Drupal,
Moodle.....or now, with ADOdb, maybe even LDAP?).
I had to set default values, but allow people to change them. I've
added a hook for an admin-created function to do the encryption for
the database, since I can't predict the encryption methods used by
every program out there, and the vBulletin one was double MD5 with a
So, I suggest you wrap your definitions in SDVA for arrays, SDV for
variables, and let the admin sort it out, get something into a
testing phase, document what you can, and get feedback from people.
The better documented, and the more hooks, the more likely people can
actually use it and you'll get good feedback.
More information about the pmwiki-devel