[pmwiki-users] most user-friendly method of database configuration

Crisses crisses at kinhost.org
Sat Oct 14 12:21:55 CDT 2006


On Oct 13, 2006, at 1:49 PM, Ben Stallings wrote:

> $DQConnections = array(
>   array(
>    'type' => 'mysql',
>    'server' => 'db.example.com',
>    'name' => 'example_database_name',
>    'user' => 'example_user',
>    'passwd' => 'example_password'),
>   array(
>    'type' => 'postgres',
>    'server' => 'postgresql.example.com',
>    'name' => 'another_example_name',
>    'user' => 'another_user',
>    'passwd' => 'another_password'),
>   array(
>    'type' => 'access',
>    'driver' => 'Microsoft Access Driver (*.mdb)',
>    'path' => 'd:\\northwind.mdb',
>    'user' => 'Admin',
>    'passwd' => ''));
> include('cookbook/dataquery.php');

Why not $DQConnections[] = array ();

Not much different than the whole DataStore.
You need an identifier though.  A nickname.  Because what if (gasp)  
you have multiple mysql databases?  ADODB is database agnostic, so  
use an agnostic method of addressing the database definitions -- then  
they can be on any server, and multiple of the same type -- or from  
the same program -- can be used:

$DQConnections['moodleA'] = array ();
$DQConnections['moodleB'] = array ();
$DQConnections['drupal'] = array ();
$DQConnections['mysistersdb'] = array ();
$DQConnections['pmwiki'] = array ();
etc.

> It seems to me that this second syntax is actually harder to screw up
> than the multi-dimensional array.  But that could just be me, so I'm
> eager for other opinions.  Or is there an even simpler syntax I  
> haven't
> thought of?  --Ben S.

They're not much different from one another, just keep in mind that  
you do need to give each database setting a unique name.

Crisses
-------------- next part --------------
An HTML attachment was scrubbed...
URL: /pipermail/pmwiki-users/attachments/20061014/20424dcd/attachment.html 


More information about the pmwiki-users mailing list