Re: DB::connect suggestion

From: Date: Wed, 10 Jan 2001 00:12:19 +0000
Subject: Re: DB::connect suggestion
References: 1  Groups: php.pear 
Request: Send a blank email to php-pear+get-924@lists.php.net to get a copy of this message
john On Tue, 9 Jan 2001, Daniel, Adam [EESUS] wrote: > May I suggest adding logic to the connect method to read the dsn from a file > in addition to passing the complete dsn string. For example you could do > something like: $db->connect("dev.dsn") where the file "dev.dsn" > contains > the full dsn as if it were passed as the parameter. The two major benefits I > see from this are: the convenience of only changing one file as apposed to > doing a find-and-replace on possibly hundreds when moving from development > to production; the second being the potential to encrypt the dsn file and > securing the username/password. this is what i do. at the top of each page i do an include where i include dev.dsn. this sets up vars like $db_name, $db_host, $db_login, etc. then i use these vars to make db calls. that way i only have to change that one file. i dont use pear's db stuff yet, but i think you could do something similar. john

« previous php.pear (#924) next »