Example #1
0
 public static function getInstance($config = null, $className = null, $dbName = null)
 {
     if (!self::$instance) {
         self::$instance = new Pdo($config);
     } else {
         if (Request::isLongServer()) {
             self::$instance->ping();
         }
     }
     if ($className) {
         self::$instance->setClassName($className);
     }
     if ($dbName) {
         self::$instance->setDBName($dbName);
     }
     return self::$instance;
 }
Example #2
0
 public function add($attr)
 {
     $this->useDb();
     return $this->_db->replace($attr, \array_keys(\get_object_vars($attr)));
 }