Link to home
Create AccountLog in
Avatar of potworny
potwornyFlag for Poland

asked on

Does Mysql Have a Log?

I am using Windows Vista Business and MySQL 5.0.51a.
When I used WinXP Home there was no problem. But with Vista there is something wrong.
Adding a new record is OK. But updating does not allow to apply changes in my program.

I am using a BCB 6 based on mysql.dll (233 472 bytes). Trying to modify and update a record produced an error.

I would LOVE to see what this error might be.

Is there a log in MySQL?

Sincerely,
The Terrible
Avatar of Guy Hengel [angelIII / a3]
Guy Hengel [angelIII / a3]
Flag of Luxembourg image

yes:
http://dev.mysql.com/doc/refman/5.0/en/log-files.html

however, what is the code/method you use the updated?
Avatar of potworny

ASKER

OK. This is my code snippet. I have marked the place the program runs into the error.
Why would I try to reapply changes? It is because the MySQL seems to go to sleep when there is no actual record added/updated for a long time.
bool __fastcall TForm1::ApplyChanges(int iErrorsAcceptable)
{
// Apply changes
 
  try
  {
        if (Form3->SQLClientDataSet1->ApplyUpdates(iErrorsAcceptable) == iErrorsAcceptable)
        {
                LogThis("OK. DB update successful");
        }
        else
        {
                LogThis("WARNING. Error when updating DB!");
                // THIS IS WHERE the program ENCOUNTERS the DB ERROR!
                return false;
        }
  }
  catch(...)
  {
      try
        {
                // Try to apply again
                if (Form3->SQLClientDataSet1->ApplyUpdates(0) == 0)
                {
                        LogThis("OK. Reapplying the changes was successful.");
                }
                else
                {
                        LogThis("WARNING. Second Error when updating DB!");
                        return false;
                }
        }
        catch(...)
        {
                LogThis("WARNING. Another Error when updating DB! After the second critical exception...");
                Beep();
                return false;
        }
 
  }
  Sleep(100);
  return true;
}
//---------------------------------------------------------------------------

Open in new window

does that code mean that whenever the update failed, you retry the update?
yes, that could make sense, in case you have some locking/deadlocking occuring often.
now, as that is C++ code, I can read it, but ....
... there we don't see any "UPDATE ... " statement, but I guess that the ApplyUpdates does that?

you should return the catched exception message to see what the error actually is...
Sorry, no exception message is displayed...

Following is the code I got from the binnary log and tried to use the code in mysql...
After pressing Enter only the -> changes to '>
mysql> use ascze;
Database changed
mysql> update klucze  set
    ->  uwagi = '2008-02-29 09:28:04 opeation completed\r\naaa\0'
    -> where
    ->  klucz = '4248.0' and
    ->  data_zakupu = '2008-2-29' and
    ->  zaplacono = '19.990000' and
    ->  pl = 'true' and
    ->  en = 'false' and
    ->  de = 'false;
    '>

Open in new window

I have this strange feeling that this is a Vista isue only...
All changes are kept here:

c:\Users\Potworny\AppData\Local\VirtualStore\Program Files\MySQL\MySQL Server 5.0\data\

I will try to follow this track and try to find out sth about Vista and MySQL issues.
ASKER CERTIFIED SOLUTION
Avatar of potworny
potworny
Flag of Poland image

Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account