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; } }
public function testGetCell() { $r = DB::getCell('select name from fuck limit 1'); $this->assertTrue((bool) $r === true); }
function generate(IdentifiableOrmEntity $entity) { $id = $this->db->getCell($this->query); return $id; }