PEAR is archived and read-only

This mirror preserves historical PEAR package releases and metadata so existing references remain available.

Home » Database » DB_DataObject » Bug #4900

storing connection

Details

Submitted2005-07-23 23:13 UTC
Fromalex_foe at gmx dot de
Assignedalan_k
StatusClosed
PackageDB_DataObject
PHP Version4.3.11
OSlamp (debian 3.1)
Roadmaps(Not assigned)

Comments

[2005-07-23 23:13 UTC] alex_foe at gmx dot de

Description:
------------
I'm not absolutley sure, that this is a bug, I saw also an option field for database configurations, err compatibility
( $db_options = PEAR::getStaticProperty('DB','options'); ) - But I'm new and I've chosen this way (see script below) of connection (over a unix socket) and got a warning, which might be in multiple db-sessions-situiation an error, in the module

DataObject.php about the line 2101

this is the wrong line:

$this->_database_dsn_md5 = md5($dsn);

For DB.php one might pass a dsn in an array form. for this, the code must be changed in DataObject.php into sth. like this:

if (!is_array($dsn)) { $this->_database_dsn_md5 = md5($dsn); }
else { $this->_database_dsn_md5 = md5(join("", $dsn)); }

Test script:
---------------
$options = &PEAR::getStaticProperty('DB_DataObject','options');
$options = array
(
'database' => array
(
'phptype' => 'mysql'
, 'database' => 'your_db_name'
, 'username' => 'db_user'
, 'password' => 'db_pass'
, 'socket' => '/var/run/mysqld/mysqld4.sock'
, 'protocol' => 'unix'
)
,'schema_location' => '/tmp/DataObject'
, 'class_location' => '/tmp/DataObject'
, 'require_prefix' => '/tmp/DataObject'
, 'debug' => 0
);

require_once 'DB/DataObject/Generator.php';

$generator = new DB_DataObject_Generator;
$generator->start();

Expected result:
----------------
no errors, warnings -;)