示例#1
0
 public static function uniqHash($table, $field = "hash")
 {
     $hash = self::base_encode(mt_rand(10000000, 99999999));
     $exist = DB::getCell("SELECT 1 FROM {$table} WHERE {$field}=:field LIMIT 1", [':field' => $hash]);
     if ($exist) {
         self::uniqHash($table, $field);
     } else {
         return $hash;
     }
 }
示例#2
0
 public function testGetCell()
 {
     $r = DB::getCell('select name from f**k limit 1');
     $this->assertTrue((bool) $r === true);
 }
 function generate(IdentifiableOrmEntity $entity)
 {
     $id = $this->db->getCell($this->query);
     return $id;
 }