Пример #1
0
 public static function getInstance()
 {
     if (mysql::$instance == null) {
         mysql::$instance = new mysql();
     }
     return mysql::$instance;
 }
Пример #2
0
 public static function getSql()
 {
     try {
         switch (app\config::get('dbtype')) {
             case 'mysql':
                 return dbcon\mysql::getInstance();
                 break;
             case 'postgres':
                 throw new \Exception('Code not implemented.', '10000');
                 break;
             default:
                 throw new \Exception('Configure src/init.php-file', '1000');
                 break;
         }
     } catch (\Exception $err) {
         throw $err;
     }
 }