示例#1
0
 /**
  * Loads self::$db if it is not loaded already.
  * Dies if the connection could not be established.
  *
  * @return void
  */
 protected static function loadDb()
 {
     global $dbhost, $dbuser, $dbpass, $dbname, $dbport, $dbpersist, $dbtype, $dbneedssetnames;
     if (self::$db !== null) {
         return;
     }
     include_once 'SemanticScuttle/db/' . $dbtype . '.php';
     $db = new sql_db();
     $db->sql_connect($dbhost, $dbuser, $dbpass, $dbname, $dbport, $dbpersist);
     if (!$db->db_connect_id) {
         message_die(CRITICAL_ERROR, 'Could not connect to the database', self::$db);
     }
     $dbneedssetnames && $db->sql_query('SET NAMES UTF8');
     self::$db = $db;
 }