]> git.openstreetmap.org Git - nominatim.git/blob - lib/db.php
Make deduplicate work again. Only currently support 9.3 due to new postgresql functi...
[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