]> git.openstreetmap.org Git - nominatim.git/blob - lib/db.php
Import class:type from linked features to the extratags files. Use place tags (in...
[nominatim.git] / lib / db.php
1 <?php
2         require_once('DB.php');
3
4         function &getDB($bNew = false, $bPersistent = false)
5         {
6                 // Get the database object
7                 $oDB =& DB::connect(CONST_Database_DSN.($bNew?'?new_link=true':''), $bPersistent);
8                 if (PEAR::IsError($oDB))
9                 {
10                         var_dump(CONST_Database_DSN);
11                         var_Dump($oDB);
12                         fail($oDB->getMessage());
13                 }
14                 $oDB->setFetchMode(DB_FETCHMODE_ASSOC);
15                 $oDB->query("SET DateStyle TO 'sql,european'");
16                 $oDB->query("SET client_encoding TO 'utf-8'");
17                 return $oDB;
18         }
19
20         function getDBQuoted($s)
21         {
22                 return "'".pg_escape_string($s)."'";
23         }
24