I am experimenting with the DB_DataObject package. I have built an application using it, but when I try
to call the find() method, I get "DB Error: not found"
usually caused by the database driver eg. mysql.so/pgsql.so not being loaded..
My question is where does the DB_Object store the DSN? I know I specify it in the .ini file, that I use to
configure the DataObjects, but I don't see it referenced in any of the files. Is it hardcoded somewhere?
have a look at.
http://docs.akbkhome.com/pearcvs/DB_DataObject.html#_connect
line 18 reads the config options (into $options), and this is used to build the connect dsn (usually just $options['database'])
the database connection occurs on line 43, (unless it's alread connected). and is stored in a pear static var. (eg. line 3).
in
http://docs.akbkhome.com/pearcvs/DB_DataObject.html#_query
you can see the results array is obtained on line 4.
Its done this way to prevent the 'print_r($dataobject)' from showing the dsn. (as it's commonly used to debug.. -- you can see more about what is going on by using DB_DataObject::debugLevel(1) or 5 for a more detailed report.
** I will probably change the connection/result stuff to $GLOBALS['_DB_DATAOBJECT_CONNECTION'] etc. as this method of static var storage has a slight speed penalty.
Thanks,
Chris