I understand you reasoning.  If you don't change the official source code, I 
can always make the change when I get a new version.  Whatever you feel is 
best.

But what scares me is a comment in the source code by the line I commented 
out:

/*
** Handles this special case for some ODBC applications:
** They are requesting the row that was just updated with a auto_increment
** value with this construct:
**
** SELECT * from table_name where auto_increment_column IS NULL
** This will be changed to:
** SELECT * from table_name where auto_increment_column = LAST_INSERT_ID
*/

PLEASE DON'T change it!!!!  It would break MS Access, as MS Access relies on 
SELECT ... IS NULL to retrieve the last row inserted.  When were you planning 
on changing it?  I hope not soon.  Actually, I hope not ever.  Or if you do, 
allow it to support both contstructs.  Please understand, if this were just a 
"user space" issue, I wouldn't mind: I can change my VB code no problem.  But 
from watching the MySQL logs, I can see that Access uses IS NULL and I can't 
change that!!!! :)

Thanks for your help on this issue.

j----- k-----


On Thursday 24 May 2001 11:02, Michael Widenius wrote:
> Hi!
> The reason for the [below] 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'.
>
>  -----  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>
>

-- 
Joshua Kugler
Associated Students of the University of Alaska Fairbanks
Information Services Director
[EMAIL PROTECTED]
907-474-7601

---------------------------------------------------------------------
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