Insert Value -> SQL Function -> MD5(str)

fbachofner's profile image fbachofner posted 9 years ago in General Permalink
I have an application which is limited to (unfortunately) MD5 passwords.

I took over someone's table which had passwords in plain text. It was a small table and I knew that HeidiSQL has a feature like Insert Value -> SQL Function -> MD5(str) from a grid.

I tried that (replacing str with an individual password) and Heidi errors

Running a query [i.e. update employee set Password=MD5(Password) ] from the query tab updates all passwords with no problem.
jfalch's profile image jfalch posted 9 years ago Permalink
error message ?
fbachofner's profile image fbachofner posted 9 years ago Permalink
version : 9.1.0.4938
compiled with : Delphi XE5
madExcept version : 4.0.8.1
callstack crc : $1ec881a7, $fcc0f5df, $fcc0f5df
exception number : 1
exception class : EAccessViolation
exception message : Access violation at address 00690073 in module 'heidisql.exe'. Write of address 0176DE70.

main thread ($5e4):
00690073 heidisql.exe Vcl.Buttons .TSpeedButtonActionLink
005b6706 heidisql.exe Vcl.Controls TWinControl.DoKeyDown
005d0d8d heidisql.exe Vcl.StdCtrls TCustomCombo.ComboWndProc
005d2619 heidisql.exe Vcl.StdCtrls TCustomComboBox.ComboWndProc
005d0ae3 heidisql.exe Vcl.StdCtrls TCustomCombo.EditWndProc
0053b840 heidisql.exe System.Classes StdWndProc
7e418a0b USER32.dll DispatchMessageW
0068534b heidisql.exe Vcl.Forms TApplication.ProcessMessage
0068538e heidisql.exe Vcl.Forms TApplication.HandleMessage
006856c9 heidisql.exe Vcl.Forms TApplication.Run
[expired user #9706]'s profile image [expired user #9706] posted 8 years ago Permalink

Hei there. I have a similar problem. I tried to update one field via insert value -> sql function -> MD5(str) This worked well one time and the next time I got:

0 rows updated when that should have been 1.

When closing this message and reloading the table, ALL the fields of this column were changed to the previously inserted MD5 value.

This already happened two times now...

Do you know about this problem? (I am using 9.3.0.4984 on windows 10)

Best, FElix

ansgar's profile image ansgar posted 8 years ago Permalink

Does your table have a primary or unique key? Otherwise HeidiSQL could fail with a non-sufficient WHERE clause in the UPDATE query.

You could also post the automatic UPDATE query which HeidiSQL fires right before you get that 0 rows updated... message. You can see all queries in the lower SQL log panel.

[expired user #9706]'s profile image [expired user #9706] posted 8 years ago Permalink

Hello Ansgar, thank you for the fast response.

The table has a primary.

I took the automatic UPDATE query and inserted it into the query window and it runs like it should, as long as the column field is not highlighted. Might be that this causes the problem?

(I mean that as long as the column field is editable the query fails, just after clicking on another field or undoing the last change (what sometimes causes the problem of updating all fields as well), the query runs like expected.)

Best, Felix

ps. this is the query: UPDATE database.table SET senha=MD5('123123') WHERE idUsuarios=228;

ansgar's profile image ansgar posted 8 years ago Permalink

Well, the result of MD5('123123') is of course exactly the same each time executed. So there is no effective change when you do that UPDATE the second time, at least if the value is really '123123'.

[expired user #9706]'s profile image [expired user #9706] posted 8 years ago Permalink

Hello Ansgar. Yes, of course. You are right. But it does not explain how I managed to change all fields of that column to the MD5 value.

Unfortunately, I can not reproduce it at the moment. I hope not, but if it occure again, I will report back here. So far, thank you for your time.

Best, Felix

Please login to leave a reply, or register at first.