]> git.openstreetmap.org Git - nominatim.git/blobdiff - lib/db.php
user interface: zoom dropdown for debugging on reverse search page
[nominatim.git] / lib / db.php
index c50b3c404deb4223728b87aae90d6f926e071954..d7c85e7b6df684f850c9e283bc3e2a29195689f9 100644 (file)
@@ -1,17 +1,21 @@
 <?php
        require_once('DB.php');
 
-       function &getDB($bNew = false)
+       function &getDB($bNew = false, $bPersistent = false)
        {
                // Get the database object
-               $oDB =& DB::connect(CONST_Database_DSN.($bNew?'?new_link=true':''), false);
+               $oDB =& DB::connect(CONST_Database_DSN.($bNew?'?new_link=true':''), $bPersistent);
                if (PEAR::IsError($oDB))
                {
-                       fail($oDB->getMessage(), 'Unable to connect to the database');
+                       var_dump(CONST_Database_DSN);
+                       var_Dump($oDB);
+                       fail($oDB->getMessage());
                }
                $oDB->setFetchMode(DB_FETCHMODE_ASSOC);
                $oDB->query("SET DateStyle TO 'sql,european'");
                $oDB->query("SET client_encoding TO 'utf-8'");
+               $iMaxExecution = ini_get('max_execution_time') * 1000;
+               if ($iMaxExecution > 0) $oDB->query("SET statement_timeout TO $iMaxExecution");
                return $oDB;
        }