00001 <?php 00006 class MysqlIdGenerator extends MIdGenerator 00007 { 00020 public function getNewId($sequence = 'admin', $tableGenerator = 'cm_sequence') 00021 { 00022 $this->value = $this->getNextValue($sequence); 00023 return $this->value; 00024 } 00025 00038 public function getNextValue($sequence = 'admin', $tableGenerator = 'cm_sequence') 00039 { 00040 $sql = new sql('value', 'id', "(sequence = '$sequence')"); 00041 $query = $this->db->GetQuery($sql); 00042 $value = $query->fields('value'); 00043 $nextValue = $value + 1; 00044 $this->db->Execute($sql->Update($nextValue)); 00045 return $value; 00046 } 00047 } 00048 ?>