[pmwiki-users] most user-friendly method of database configuration
Ben Stallings
Ben at InterdependentWeb.com
Sun Oct 15 11:28:16 CDT 2006
Crisses wrote:
> I must be walking in in the middle of something I don't "get". I'm
> looking at this from the overall perspective of CookbookAuthorsUnite --
> you're looking at it for your own recipe.
Touche. I got carried away with the possible ramifications of my recipe
and forgot that it wouldn't do everything database-related. At least I
know I'm not the first to go down that path. ;-)
> You were talking about using a variety of databases, but in the
> definitions I see things like type ("mysql") and "database" and "server"
> but not a specific distinct name of each
If you look again at the syntax Pm proposed, you'll see that the
database name is the third parameter, though it could just as easily be
the first:
$WikiLibDirs[] = new DataStore(array(
'type' => 'mysql',
'server' => 'db.example.com',
'name' => 'example_database_name',
'user' => 'example_user',
'passwd' => 'example_password'));
But you make a good point that that's not very accessible to other
recipes that are not using databases as PageStores. I'm sold on your
rationale for using a single, global $Databases variable for all
ADODB-based recipes.
> "there can only be one connection to a given database at a
> time" -- this is not true. I can easily do $db1 and $db2 as two
> connections, perhaps each looking at a different table of the same
> database...
I stand corrected. But (if I may cover my rear by switching arguments)
why would you want to have two connections, when you can look at two
tables in two queries, or at two tables within a single query, or even
the same table twice within a query?
SELECT t1.person_name,t2.friend_name FROM people AS t1, people AS t2
WHERE t1.friend_id = t2.person_id;
> Another reason I'm writing is to verify whether you're working on
> database-based authentication. I'm slated to work, alone or with Ben
> Wilson, on improving AuthUserDBase and incorporating ADOdb, etc. If
> you're working on it, then I shouldn't. We don't need more confusion,
> Ben & I discussed eliminating confusion by merging the AuthUserDBase and
> XesAuthUserDBase recipes. So I wanted to check whether or not this is
> something that is part of your recipe. I doubt it, but it's better that
> I ask.
Thank you. If I understand AuthUser correctly, and if DataQuery works
as I hope it will, all you'll have to do to use a database table for
authentication will be to put a line like this in Site.AuthUser:
(:dataquery fields=username,password from=user_table fmt=list:)
Assuming the password field is encrypted, and assuming you haven't
declared that field off-limits to DataQuery. But... this list of users
would be read-only, because adding users and changing passwords and all
that would be a whole other can of worms. So it would probably be
better to stick with your plans for AuthUserDBase. Unless there's
another possibility I'm missing... --Ben S.
More information about the pmwiki-users
mailing list