public static function checkAutoIncrement($server, $user, $pwd)
 {
     try {
         $link = DbPDO::_getPDO($server, $user, $pwd, false, 5);
     } catch (PDOException $e) {
         return false;
     }
     $ret = (bool) (($result = $link->query('SELECT @@auto_increment_increment as aii')) && ($row = $result->fetch()) && $row['aii'] == 1);
     $ret &= (bool) (($result = $link->query('SELECT @@auto_increment_offset as aio')) && ($row = $result->fetch()) && $row['aio'] == 1);
     unset($link);
     return $ret;
 }
Esempio n. 2
0
 /**
  * 设置要操作的数据表
  * @param  string $tbName 表名
  * @return object 当前类的实例
  */
 private static function table($tbName)
 {
     self::$_table = "`" . DB_TB_PREFIX . strtolower($tbName) . "`";
     return self::$_instance;
 }
Esempio n. 3
0
 /**
  * @see Db::checkEncoding()
  */
 public static function tryUTF8($server, $user, $pwd)
 {
     try {
         $link = DbPDO::_getPDO($server, $user, $pwd, false, 5);
     } catch (PDOException $e) {
         return false;
     }
     $result = $link->exec('SET NAMES \'utf8\'');
     unset($link);
     return $result === false ? false : true;
 }
Esempio n. 4
0
 /**
  * Rollback a transaction!
  * This includes a clear_sql()!
  * 
  * A transaction can be rolled back any time ..
  */
 public function rollbackTransaction()
 {
     // only do anything if there is an active transaction
     if (self::$trx_token == 0) {
         return;
     }
     $this->clear_sql();
     $this->rollBack();
     self::$trx_token = 0;
 }