equal
deleted
inserted
replaced
19 // Description: Constructs the database class. |
19 // Description: Constructs the database class. |
20 // |
20 // |
21 // $Id: database.inc.php,v 1.3 2002/12/27 02:45:08 azurazu Exp $ |
21 // $Id: database.inc.php,v 1.3 2002/12/27 02:45:08 azurazu Exp $ |
22 // |
22 // |
23 |
23 |
24 require_once("dal.inc.php"); |
24 require_once("MDB2.php"); |
25 |
25 |
26 function dbError($msg) |
26 function dbError($msg) |
27 { |
27 { |
28 // General function for printing critical errors. |
28 // General function for printing critical errors. |
29 include_once("header.inc.php"); |
29 include_once("header.inc.php"); |
33 <FONT STYLE="font-weight: Bold"><?= $msg->getDebugInfo(); ?><BR><BR><a href="javascript:history.go(-1)"><< <? echo _('back'); ?></a></FONT><BR></TD></TR></TABLE></P> |
33 <FONT STYLE="font-weight: Bold"><?= $msg->getDebugInfo(); ?><BR><BR><a href="javascript:history.go(-1)"><< <? echo _('back'); ?></a></FONT><BR></TD></TR></TABLE></P> |
34 <? |
34 <? |
35 die(); |
35 die(); |
36 } |
36 } |
37 |
37 |
38 // Setup error handling. |
|
39 PEAR::setErrorHandling(PEAR_ERROR_CALLBACK, 'dbError'); |
38 PEAR::setErrorHandling(PEAR_ERROR_CALLBACK, 'dbError'); |
40 |
39 |
41 //$dsn = "mysql://padev:blapadev@localhost/padev" ; |
|
42 $dsn = "$dbdsntype://$dbuser:$dbpass@$dbhost/$dbdatabase"; |
40 $dsn = "$dbdsntype://$dbuser:$dbpass@$dbhost/$dbdatabase"; |
43 $db = DB::connect($dsn); |
41 $db = MDB2::connect($dsn); |
44 |
42 |
45 if (DB::isError($db)) |
43 if (MDB2::isError($db)) |
46 { |
44 { |
47 // Error handling should be put. |
45 // Error handling should be put. |
48 error(MYSQL_ERROR_FATAL, $db->getMessage()); |
46 error(MYSQL_ERROR_FATAL, $db->getMessage()); |
49 } |
47 } |
50 |
48 |
51 // Do an ASSOC fetch. Gives us the ability to use ["id"] fields. |
49 // Do an ASSOC fetch. Gives us the ability to use ["id"] fields. |
52 $db->setFetchMode(DB_FETCHMODE_ASSOC); |
50 $db->setFetchMode(MDB2_FETCHMODE_ASSOC); |
53 |
|
54 |
51 |
55 /* erase info */ |
52 /* erase info */ |
56 $mysql_pass = $dsn = ''; |
53 $mysql_pass = $dsn = ''; |
57 |
54 |
58 |
55 |