/** * Retrieves the ID generated for an AUTO_INCREMENT column by the previous INSERT query. * @param string generator name * @return int|FALSE int on success or FALSE on failure */ public function getInsertId($sequence) { return ibase_gen_id($sequence, 0, $this->connection); }
/** * Insert ID * * @param string $generator_name * @param int $inc_by * @return int */ public function insert_id($generator_name, $inc_by = 0) { //If a generator hasn't been used before it will return 0 return ibase_gen_id('"' . $generator_name . '"', $inc_by); }
/** * @brief 1씩 증가되는 sequence값을 return (firebird의 generator 값을 증가) **/ function getNextSequence() { $gen = "GEN_" . $this->prefix . "sequence_ID"; $sequence = ibase_gen_id($gen, 1); return $sequence; }
public function insertId() { if (!empty($this->connect)) { return ibase_gen_id('id'); } else { return false; } }
function genid($tablename) { if ($this->debug) { echo "<pre style=\"color : green\">Getting a generator id from {$this->dbpath} <p style=\"color:purple;\"> {$tablename} </p></pre>"; } switch ($this->dbtype) { /* Firebird Functionality */ case "firebird": //write some things here $id = ibase_gen_id(strtoupper("GEN_" . $tablename . "_ID"), 1, $this->dbh); break; /* SQLite Functionality */ /* SQLite Functionality */ case "sqlite": //See how to get an autonumber from a table $exist = $this->fetch("select name from sqlite_master where type='table' and upper(name) = upper('{$tablename}')"); if ($exist->NAME == "") { $this->exec("create table cde_gen (id integer not null, tablename varchar (100) not null, primary key (id, tablename))"); } $id = $this->fetch("select max(id) as maxid from cde_gen where upper(tablename) = upper('{$tablename}')"); if ($id->MAXID == "") { $newid = 0; } else { $newid = $id->MAXID; } $newid++; $this->exec("insert into cde_gen (id, tablename) values ({$newid}, upper('{$tablename}'))"); $this->commit(); $id = $newid; break; /* Oracle Functionality */ /* Oracle Functionality */ case "oracle": //See how to get an autonumber from a table break; } return $id; if ($this->debug) { echo "<pre style=\"color : blue\">Getting a generator {$id} \n </pre>"; } }
protected function incrementaGenerator($nomeGenerator) { return ibase_gen_id($nomeGenerator, 1); }
/** * Retrieves the ID generated for an AUTO_INCREMENT column by the previous INSERT query. * @param string generator name * @return int|FALSE int on success or FALSE on failure */ public function getInsertId($sequence) { return ibase_gen_id($sequence, 0, $this->connection); //throw new NotSupportedException('Firebird/InterBase does not support autoincrementing.'); }