Menu

#1 Passing custom ADODB DSN to DbStore constructor

open
nobody
DbModel (1)
5
2007-07-18
2007-07-18
No

This was submitted by Olivier Berger to the mailing list on 2007-07-16:

May I suggest some sort of possibility to use new DB connection options for ModelFactory::getDbStore() function.

This would allow use a new argument maybe (see proposed patch link
bellow), which, if present, would be the DSN for ADODB.

This would have the advantage of allowing the use of more advanced
connection mechanisms, like persistent connections, etc.

Example :

instead of using :
$this->dbstore = ModelFactory::getDbStore('MySQL', 'localhost', 'database', 'user', 'pass');

which would do a standard ADODB Connect() (reusing the previous
connection), one could use :

$this->dbstore = ModelFactory::getDbStore(NULL, NULL, NULL, NULL, NULL, 'mysql://user:pass@localhost/database?new');

which will use a ADODB NConnect(), creating a new connection each time.

See the corresponding patch at : http://picoforge.int-evry.fr/websvn/filedetails.php?repname=picoforge&path=%2Ftrunk%2Flibphp-rap%2Fpatching%2Fdsn.patch&rev=0&sc=1

Discussion


Log in to post a comment.