Bug / CPU issue with LAST_INSERT_ID()

Discussion of open issues, suggestions and bugs regarding MyDAC (Data Access Components for MySQL) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply

Bug / CPU issue with LAST_INSERT_ID()

Post by 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->Add( "select"
                     " LAST_INSERT_ID() SeqNo"
                     " from txqueue" );
    if ( !Query->Eof )
      SeqNo = Query->FieldByName( "SeqNo" )->AsInteger;


Correction to code sample

Post by dragonslayer » Sat 25 Jun 2005 17:09

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

Posts: 186
Joined: Wed 03 Nov 2004 16:57
Location: Spain

Post by 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).

Post Reply