/[libdata]/branches/pear-db/include/db_connect.php
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Contents of /branches/pear-db/include/db_connect.php

Parent Directory Parent Directory | Revision Log Revision Log


Revision 62 - (show annotations)
Sat Mar 6 19:26:11 2004 UTC (17 years, 7 months ago) by dpavlin
File size: 1272 byte(s)
restructuring of include files to support installation into directory
(Alias in apache terms) and not as virtual host

1 <?php
2
3 /****************************************************************/
4
5 /* constants */
6 $DEBUG = 0; // XXX not used at all?
7
8 /****************************************************************/
9
10 /* database parameters */
11 #$dsn = 'mysql://libdata:libdatapw@localhost/libdata';
12 $dsn = 'pgsql://dpavlin@/libdata';
13 $dsn_options = array(
14 'debug' => 2,
15 'portability' => DB_PORTABILITY_ALL,
16 );
17
18 /****************************************************************/
19
20 /* establish a connection to the database or bailout */
21 $db =& DB::connect($dsn, $dsn_options);
22 if (DB::isError($db)) {
23 XXX_debug($db->getMessage() ." / ".
24 $db->getUserInfo() . " / ".
25 $db->getDebugInfo());
26 # XXX remove this!
27 print $db->getDebugInfo();
28
29 die($db->getMessage());
30 }
31
32 /****************************************************************/
33
34
35 /* some useful functions */
36
37 /* return an error message from a failed sql query */
38 function sql_err ( $p_sql ) {
39 printf ( "ERROR: Query failed.<br>%s<br>%s: %s<br>\n",
40 $p_sql, xx_errno(), xx_error() );
41 return 1;
42 }
43
44 /* finish off the html stream and die */
45 function bailout() {
46 die ( "Bailing Out!<br>\n</body></html>\n" );
47 }
48
49
50 ?>

  ViewVC Help
Powered by ViewVC 1.1.26