Hi!

 -----  Message from "Joshua J. Kugler" <[EMAIL PROTECTED]> -----

Joshua> I've been arguing with MS Access lately.  Fortunately, I won.  But only 
Joshua> because I had the source to MySQL available.  Here's the situation:

<cut>

Joshua> I grep'ed the source, and found this at line 3062 of sql/sql_select.cc:

thd-> insert_id(0);            // Clear for next request

Joshua> Well, I commented that out, recompiled, and now

Joshua> SELECT id FROM table_name WHERE id IS NULL 

Joshua> mirrors the behavior of 

Joshua> SELECT LAST_INSERT_ID()

Joshua> So, I can "SELECT id FROM table_name WHERE id IS NULL" as many times as I 
Joshua> need/want to, and it will return the proper value.  Very nice.

Joshua> So, that was my problem, and the solution.  Could these be changed in the 
Joshua> official distribution?  Or at least a compile time option?  I see no reason 
Joshua> why the SELECT NULL behavior cannot mirror the behavior of LAST_INSERT_ID. 

<cut>

The reason for the above is mainly a security thing. I think the above
usage of id IS NULL is very dangerous as a general feature as it could
have strange side effects for applications that are not aware of this.

To minimize the side effects, we clear the flag after one search to
not affect the rest of the application.  I don't know if this is the
best thing to do, but this is the first time we hear about any
problems regarding this.  The question is of we should add a separate
option for to get both behavour's or just remove the 'clear for next request'.

Regards,
Monty

---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to