]> git.openstreetmap.org Git - nominatim.git/blob - lib/db.php
nominatim refactoring
[nominatim.git] / lib / db.php
1 <?php
2         require_once('DB.php');
3
4         // Get the database object
5         $oDB =& DB::connect(CONST_Database_DSN, false);
6         if (PEAR::IsError($oDB))
7         {
8                 fail($oDB->getMessage(), 'Unable to connect to the database');
9         }
10         $oDB->setFetchMode(DB_FETCHMODE_ASSOC);
11         $oDB->query("SET DateStyle TO 'sql,european'");
12         $oDB->query("SET client_encoding TO 'utf-8'");
13
14         function getDBQuoted($s)
15         {
16                 return "'".pg_escape_string($s)."'";
17         }
18