Re: PDO driver in CVS
Arnaud Limbourg <arnaud-GdXxm9JVFPlWk0Htik3J/[email protected]> Tue, 06 Dec 2005 12:18:13 +0100
| Newsgroups | gmane.comp.php.pear.liveuser |
|---|---|
| Message-ID | <[email protected]> |
Quoting Lukas Kahwe Smith <[email protected]>: > Lukas Kahwe Smith wrote: >> Arnaud Limbourg wrote: >> >>> Hi All, >>> >>> I added a PDO driver in CVS today. If you want to try it grab cvs (it is >>> not bundled) and go to the docs/examples/example5 directory, there is a >>> conf_pdo.php you need to rename to conf.php. Modify the parameters >>> according to your system settings and you're good to go. >>> >>> It is not quite there yet but it does work :) >>> >>> Feedback is appreciated ! >> >> >> Cool .. I will take a look. > > Looks good to me (I havent tested it). > Unfortunately PDO insists on this rather clumsy dsn/username/password > handling, so I guess sticking it inside the options is the only > sensible way. However since you may not need a password or even user > in some cases but you may need attributes I think we should check > each item separately if its exists in the options array before using > it. That is exactly what I did. The dsn has to be the dsn PDO expects. For addtionnal params one should use the options array. 'options' => array( 'user' => 'the second parameter PDO expects ($login)', 'passwd' => 'the third parameter PDO expects ($password)', 'attr' => the fourth parameter PDO expects ($attributes)') I chose that approach to avoid adding yet another option. I also think it is a good use of the options array. The code does the check on elements presence (or should :) Arnaud.