Az

Schriftart wählen

Schriftgröße wählen

Zeilenabstand wählen

Schnellzugriff Verlauf Funktionen
Wunsch?
Komponente ? Software-Internes
Wichtigkeit ? Trivial
Status ? ACK
Beschreibung
insert_id() uses SELECT lastval() which returns the last sequence value used in the current database session, regardless of which table it came from.
This is currently safe because there aren't any INSERT triggers or rules using sequences on other tables.

So this is latent bug, which can be avoided:
current pattern:
QA("INSERT ...",[...]);
$id=mydb_get_insert_id()
then:
$id=QAV("INSERT ... RETURNING id", [...]);

TODO: modules/discuss/discuss.php: $mid = mydb_get_insert_id();
TODO: modules/importexport.php: $id = mydb_get_insert_id();
TODO: types/cht/cht.php: $mid = mydb_get_insert_id();
TODO: includes/functions.php: return mydb_get_insert_id();
TODO: includes/db.php:function mydb_get_insert_id(): int ==> remove function
TODO: includes/db_base.php: abstract public function insert_id(): int; ==> remove function
TODO: includes/object_funcs.php: $oid = mydb_get_insert_id();
TODO: includes/db_pg.php: public function insert_id(): int (remove) ==> remove function