/usr/local/miolo2/classes/database/odbc/midgenerator.class

Go to the documentation of this file.
00001 <?php
00002 
00003 class ODBCIdGenerator extends MIdGenerator
00004 {
00005     private $tableGenerator = "cm_sequence";
00006 
00007     public function getNewId($sequence = 'admin', $tableGenerator = 'cm_sequence')
00008     {
00009         $this->value = $this->getNextValue($sequence, $tableGenerator);
00010         return $this->value;
00011     }
00012 
00013     public function getNextValue($sequence = 'admin', $tableGenerator = 'cm_sequence')
00014     {
00015         $sql = new sql("value", $tableGenerator, "sequence='$sequence'");
00016         $query = $this->db->getQuery($sql);
00017         $value = $query->fields('value');
00018         $sql = new sql("value", $tableGenerator, "sequence='$sequence'");
00019         $value++;
00020         $this->db->execute($sql->update("$value"));
00021         return $value;
00022     }
00023 }
00024 ?>
CopyLeft (L) 2001-2006 - [MIOLO Development Team] SOLIS - Cooperativa de Soluções Livres - Lajeado/RS - Brasil