[geeklog-devel] SQL stuff

Randy Kolenko randy at nextide.ca
Sat Nov 3 13:46:37 EDT 2007

> #1: In story.class.php, we have a hard-coded REPLACE INTO (I 
> assume it also exists in 1.4.1 - didn't check). That, IIRC, 
> is a MySQL extension. Shouldn't we try and avoid these sort 
> of things? Given that the story class already does a lot of 
> checks for existing IDs it looks like that shouldn't be too 
> hard to replace with INSERT and a DELETE, where needed.

All REPLACE INTO statements should be converted.  I made every attempt
in the MS SQL implementation to translate those Replace Into statements
with the appropriate syntax for SQL Server.  However it is obviously
more efficient to *not* go through a syntax and conversion process - so
the REPLACE INTO should be, well, replaced!

> # 2: What I was actually after is the ID generated from an 
> INSERT. In other words: DB_insertId().
> The MS SQL implementation carries a big warning to always 
> pass in a link identification so that you don't accidentally 
> get the last ID from another connection. But all the calls to 
> DB_insertId() that I can find are without that identifier. 
> And since it's stored in a class variable anyway, you can't 
> even pass it in from the outside.

I threw the warning in there during development of the class since, at
that point, the fetching was not working 100% properly and the only
resolution at that time was to include the link identifier.  You no
longer need to include the link identifiers to fetch the last insert ID.
Actually, my big warning message can be removed if you'd like.


More information about the geeklog-devel mailing list