[geeklog-devel] DB_insertId and the link identifier

Dirk Haun dirk at haun-online.de
Sat Mar 26 12:12:02 EDT 2011

The MS SQL driver contains a big fat warning not to call DB_insertId without a link identifier since it could potentially return the last insert id from some other connection. So far, so good. The problem, though, is that there is no valid way to get the current link identifier in the first place, since it's a local variable in the DB class.

So, would it not make more sense that if the link identifier is empty, to use $this->_db instead, i.e. the link identifier which was used to establish the DB connection for this instance?

The same is probably true for MySQL. The Postgres driver does things differently and doesn't use the link identifier at all, so it looks like it isn't a problem there.

There are quite a few places in Geeklog where we call DB_insertId without a link identifier, e.g. in lib-comment.php

bye, Dirk

More information about the geeklog-devel mailing list