Ejemplo n.º 1
0
Archivo: core.php Proyecto: umaxfun/x4m
 public static function getInstance()
 {
     if (!self::$objInstance) {
         try {
             self::$objInstance = new PDO('mysql:host=' . self::$host . ';dbname=' . self::$dbname, self::$user, self::$password);
             self::$objInstance->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
         } catch (PDOException $e) {
             new xPDOExceptionHandler($e);
         }
         self::$objInstance->exec('SET CHARACTER SET ' . self::$encoding);
         self::$objInstance->exec('set character_set_results=' . self::$encoding);
         self::$objInstance->exec('SET NAMES ' . self::$encoding);
     }
     return self::$objInstance;
 }