Bug / CPU issue with LAST_INSERT_ID()

Bug / CPU issue with LAST_INSERT_ID()

Postby dragonslayer » Sat 25 Jun 2005 17:07

I was wondering if anyone else had had a problem with a query on LAST_INSERT_ID(). When I execute the following C++ code it will work, but when execution reaches the Query->Open() the CPU load jumps to 100% and it takes about 5 seconds to complete. It seems only to happen on this table, but is not an isolated event - I have seen it in other sections of my code where LAST_INSERT_ID() is used.

Thanks in anticipation ...

Code: Select all
    TMyQuery* Query2 = new TMyQuery(0);
    Query->Connection = MyDBSession;
    Query->SQL->Clear();
    Query->SQL->Add( "select"
                     " LAST_INSERT_ID() SeqNo"
                     " from txqueue" );
    Query->Open();
    if ( !Query->Eof )
      SeqNo = Query->FieldByName( "SeqNo" )->AsInteger;
[/code]
dragonslayer
 

Correction to code sample

Postby dragonslayer » Sat 25 Jun 2005 17:09

Sould read ...
TMyQuery* Query = new TMyQuery(0);
and not ...
TMyQuery* Query2 = new TMyQuery(0);
dragonslayer
 

Postby GEswin » Mon 27 Jun 2005 08:03

We had some unresolved issue with mysql 4.1.7 or 4.1.8 where selecting LAST_INSERT_ID() caused the server to shutdown (This under windows2003 server).
GEswin
 
Posts: 186
Joined: Wed 03 Nov 2004 16:57
Location: Spain


Return to MySQL Data Access Components