Example #1
0
 public static function getHandle()
 {
     if (!isset(self::$handle)) {
         self::$handle = call_user_func(array(self::$handleClassName, 'getHandle'));
     }
     return self::$handle;
 }
Example #2
0
 public static function dbConnect($pool = "")
 {
     if (self::$handle) {
         return;
     }
     $host = "rivendell";
     $user = "******";
     $pass = "******";
     switch ($pool) {
         case "pgc":
             $db = "pgc";
             break;
         case "lge":
             $db = "lge";
             break;
         case "kg":
             $db = "kg";
             break;
         case "poolailler":
             $db = "poolailler";
             break;
         case "st-nic":
             $db = "st-nic";
             break;
         case "pmh":
             $db = "pmh";
             break;
         case "poolvpti":
             $db = "poolvpti";
             break;
         case "bliz":
             $db = "bliz";
             break;
         case "bchtl":
             $db = "bchtl";
             break;
         case "test":
             $db = "test";
             break;
         default:
             $db = "interactivePool";
             break;
     }
     $mysqli = new mysqli($host, $user, $pass, $db);
     if (mysqli_connect_errno()) {
         printf("Erreur de connexion à la bd. Ré-essayer un peu plus tard.\nErreur: %s\n", mysqli_connect_error());
         exit;
     }
     self::$handle = $mysqli;
     return self::$handle;
 }
Example #3
0
 public static function get_handle()
 {
     if (empty(self::$handle)) {
         self::$handle = mysql_connect(DB_HOST, DB_USER, DB_PASS);
         if (self::$handle) {
             mysql_select_db(DB_NAME, self::$handle);
             mysql_query('SET NAMES utf8', self::$handle);
         } else {
             $error = mysql_error();
             throw new Lvc_Exception('Could not connect to the database. Error: ' . $error);
         }
     }
     return self::$handle;
 }