Posts Tagged ‘mysql’

Please use mysql_upgrade to fix this error. (1558)

Sunday, February 6th, 2011

that just doesn’t sound right, does it. I just now noticed it when I ran my cron backup manually. Complete error is:

mysqldump: Couldn’t execute ‘SHOW FUNCTION STATUS WHERE Db = ‘your-db-here”: Column count of mysql.proc is wrong. Expected 20, found 16. Created with MySQL 50077, now running 50152. Please use mysql_upgrade to fix this error. (1558)

so I ran mysql_upgrade , errored about password, then I ran mysql_upgrade -p and all was ok. Well, at least from the script point of view.

Running the backup again revealed another error:

Cannot proceed because system tables used by Event Scheduler were found damaged at server start (1577)

Reading about it on the net, somebody suggested a mysql restart after running the mysql_upgrade script adn what do you know, it did it.

Do note that you need to be logged as root for that command line to work. Otherwise, make sure to specify root user in the command line.

One thing that I did notice a while ago was that the “all” backup (which dumps all tables) was failing, but I didn’t give it too much attention since the per-table backups were ok. Seems this upgrade thing solved that issue as well.

This one was simple πŸ™‚

Related posts

Row cannot be located for updating. Some values may have been changed since it was last read.

Thursday, January 13th, 2011

Yet another one of those cryptic messages that basically says “you’re screwed”.

So what was I doing this time? Well, I had my mysql tables designed as having different fields as float. It just came natural to me that way. Everything went well until today when I had to modify that field on a record which had some fractional part (until now I did modifications but only to values with no fractional part) and boom. Took me a while to figure it out that it was the float type of the mysql table field that caused this because you see, float in mysql at least is not exact. It’s an approximation. That means that ADO will have a hard time to find hte modified record if you modify the value with a fractional part. It will actually raise ”

Row cannot be located for updating. Some values may have been changed since it was last read.”

Happy me. Solution? Just change the mysql column float into decimal(M,L). I use Decimal(15,2) as it works fine for my application. Yeah, have a laugh at all those people suggesting cursor type changes, ado property modifications and so on. People, first find THE CAUSE, and then find a way to fix it.

Related posts

Multiple Step Operation Generated Errors – Check each status value

Wednesday, January 12th, 2011

Yet another cryptic error with an unusual/weird test case and solution.

So, my setup:

– a table with a date field marked null/not null (tried both, same thing)

– an TADOTable to work with the above

– added all fields in the field editor

– a TDBDateEdit from RXLib with DefaultToday set to true

You make an append. You don’t touch the date as it’s set for today. You change everything else. You post. And you get the error:

“Multiple Step Operation Generated Errors – Check each status value”

Why? Well, thing is that when you make the append, the underlying TDataSet will set the state of itself to dsInsert, at which point TDBDateEdit will notice that a new record is added and set the date to today which makes the date field to be added to the internal modified field list of the TCustomADODataSet.

Now, the code runs further and calls DoOnNewRecord which clears the above mentioned internal modified field list and hence, when you do post, the date field is not in the list and hence it is not posted.

Now, since on the client side the field is set and has a value, on DB side the field was not sent and is either null or lots of zeros (if field is set not null) and hence they do not match (in this latter case delphi will also error because it cannot convert it to date. Not sure when this is done, but it is done). So, ADO will now raise this error BUT, the record was already added, just with an invalid date value. And if you are in the not null scenario and reload the grid, you will surely get the “ Data provider or other service returned an E_FAIL status.

There you go, yet another scenario for that cryptic error message πŸ™‚

Related posts

Data provider or other service returned an E_FAIL status.

Monday, January 10th, 2011

It just happened. Took me a few minutes to track it down. I’ll be short:

– my steup: mysql and delphi with ADO. a table with a date field set to not null

– on client side, I inserted a record and for some reason did not set the date. that went as lots of zero-s in mysql.

now, when loading that record, I get that message because lots of zeros are not a valid date value.

There you go, another explanation for the dreaded message.

Related posts

False/True is not a valid integer value for field blabla

Sunday, January 10th, 2010

Ok, so you designed a small mysql table with a boolean field which got translated to tinyint(1). You then wrote your query in delphi and populated your querys fields and the field got mapped to a TSmallIntField.
And then, on top of everything, you placed a db-aware checkbox on the form to set that field and now you are getting the error
“False/True is not a valid integer value for field blabla”.

What to do? Well, since delphi won’t map your field to a TBooleanField as it should (since the field is actually an integer), you must do it yourself. So, close the project, open your favorite text editor and modify the dfm and pas files so that those fields are now of type TBooleanField.

Then, right before the form declaration add the following:

TBooleanField=class(DB.TBooleanField)
public
constructor Create(AOwner: TComponent); override;
end;

and in the implementation section

{ TBooleanField }

constructor TBooleanField.Create(AOwner: TComponent);
begin
inherited;
SetDataType(ftSmallint);
end;

If you need this in more then one form, then create a unit, like MySqlBooleanField.pas and then add it to the uses clause AFTER the DB unit.

That’s it, you’re all set.

Related posts