While the output you've shown could well be considered eroneous, surely
you shouldn't be relying on this sort of logic in a decent piece of code 
? Or am I missing something ?

If you're trying to work out which row was inserted most recently,
shouldn't you be using your db handle lastinsert_id parameter ?

*slightly blank look*

P


On Tue, 13 Feb 2001
[EMAIL PROTECTED] wrote:

> From: [EMAIL PROTECTED]
> To:   [EMAIL PROTECTED]
> Subject: Caching Bug with AUTO_INCREMENT columns
> 
> Description:
>         When i use a table with an AUTO_INCREMENT column and
>         insert Data in the Table with a NULL Value for the
>         AUTO_INCREMENT column, AUTO_INCREMENT sets an new value
>         for this column as designed (SELECT * FROM... shows
>         this value).
>         But a SELECT statement with an 'WHERE column IS NULL'
>         returns the last inserted dataset.
> 
>         If i execute the same SELECT statement again, i get
>         the correct output (Empty set).
> 
>         Does anyone know a workaround for this Problem?
>         Executing the SELECT twice is not practicable for me!
> 
>         Thanks
>         Christoph Schemainda
> 
> 
> 
> How-To-Repeat:
> 
>         CREATE TABLE IF NOT EXISTS BugTest  (
>           TestID INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
>           Name   VARCHAR(100) NOT NULL)
>         ;
>         INSERT INTO BugTest (TestID, Name) VALUES (NULL, 'Test');
> 
>         SELECT * FROM BugTest WHERE TestID IS NULL;
>         SELECT * FROM BugTest WHERE TestID IS NULL;
> 
> 
>         The firsr SELECT creates the output:
> 
>          +--------+------+
>          | TestID | Name |
>          +--------+------+
>          |      1 | Test |
>          +--------+------+
>          1 row in set (0.00 sec)
> 
> 
> 
> Fix:
> 
> 
> Synopsis:       Caching Bug with AUTO_INCREMENT columns
> Submitter-Id:   ???
> Originator:     Christoph Schemainda
> Organization:   TWT Gmbh
> MySQL support:  none
> Severity:       serious
> Priority:       high
> Category:       mysqld, mysql client
> Class:          sw-bug
> Release:        mysql-3.23.32
> 
> Exectutable:   mysqld-nt
> Environment:   I used all the default settings
> System:        Win200
> Compiler:      ??? (Binary distribution used)
> Architecture:  i686
> 
> 
> ---------------------------------------------------------------------
> 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
> 
> 


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