1
0
mirror of https://github.com/moodle/moodle.git synced 2025-04-24 01:44:27 +02:00

Changed postgresql sequence fetching to GetID. MDL-7183

This commit is contained in:
stronk7 2008-05-25 02:38:30 +00:00
parent 4572f85588
commit c97e8deb3a

@ -151,6 +151,7 @@ class postgres7_adodb_moodle_database extends adodb_moodle_database {
/**
* Insert new record into database, as fast as possible, no safety checks, lobs not supported.
* (overloaded from adodb_moodle_database because of sequence numbers
* @param string $table name
* @param mixed $params data record as object or array
* @param bool $returnit return it of inserted record
@ -169,7 +170,8 @@ class postgres7_adodb_moodle_database extends adodb_moodle_database {
}
unset($params['id']);
if ($returnid) {
if ($nextval = $this->get_field_sql("SELECT NEXTVAL('{$this->prefix}{$table}_id_seq')")) {
$seqname = "{$this->prefix}{$table}_id_seq";
if ($nextval = $this->db->GenID($seqname)) {
$params['id'] = (int)$nextval;
}
}