--- branches/pear-db/db_connect.php 2004/03/05 13:42:57 47 +++ branches/pear-db/db_connect.php 2004/03/05 22:38:33 50 @@ -3,23 +3,31 @@ /****************************************************************/ /* constants */ - $DEBUG = 0; + $DEBUG = 0; // XXX not used at all? /****************************************************************/ /* database parameters */ - $db_nam = "libdata"; - $db_srv = "localhost"; - $db_usr = "libdata"; - $db_pwd = "libdatapw"; + #$dsn = 'mysql://libdata:libdatapw@localhost/libdata'; + $dsn = 'pgsql://dpavlin@/libdata'; + $dsn_options = array( + 'debug' => 2, + 'portability' => DB_PORTABILITY_ALL, + ); /****************************************************************/ - /* establish a connection to the database or bailout */ - $con = xx_connect ( $db_srv, $db_usr, $db_pwd ) - or die ( "ERROR: Could not connect to database server!" ); - $result = xx_select_db ( $db_nam, $con ) - or die ( "ERROR: Could not connect to database!" ); + /* establish a connection to the database or bailout */ + $db =& DB::connect($dsn, $dsn_options); + if (DB::isError($db)) { + XXX_debug($db->getMessage() ." / ". + $db->getUserInfo() . " / ". + $db->getDebugInfo()); + # XXX remove this! + print $db->getDebugInfo(); + + die($db->getMessage()); + } /****************************************************************/