mirror of
https://github.com/HeidiSQL/HeidiSQL.git
synced 2025-08-06 18:24:26 +08:00
Internally, always use binary strings, not hex strings, when inserting or updating grid rows. Fixes SQL errors when actBlobAsText is activated and UPDATE sends unquoted "_binary foobar" as value. Fixes issue #2166. Also, do not reload grid data when activating text display.
This commit is contained in:
@ -50,8 +50,13 @@ uses helpers, main;
|
||||
|
||||
|
||||
function TfrmBinEditor.GetText: String;
|
||||
var
|
||||
Ansi: AnsiString;
|
||||
begin
|
||||
Result := '0x' + memoText.Text;
|
||||
// Convert hex to binary string before returning
|
||||
SetLength(Ansi, memoText.GetTextLen div 2);
|
||||
HexToBin(PWideChar(memoText.Text), PAnsiChar(Ansi), Length(Ansi));
|
||||
Result := String(Ansi);
|
||||
end;
|
||||
|
||||
procedure TfrmBinEditor.SetText(text: String);
|
||||
|
@ -9173,7 +9173,7 @@ end;
|
||||
procedure TMainForm.actBlobAsTextExecute(Sender: TObject);
|
||||
begin
|
||||
// Activate displaying BLOBs as text data, ignoring possible weird effects in grid updates/inserts
|
||||
InvalidateVT(DataGrid, VTREE_NOTLOADED_PURGECACHE, False);
|
||||
DataGrid.InvalidateChildren(nil, True);
|
||||
end;
|
||||
|
||||
|
||||
|
@ -2140,7 +2140,6 @@ begin
|
||||
Val := 'NULL'
|
||||
else case Datatype(i).Category of
|
||||
dtcInteger, dtcReal: Val := Cell.NewText;
|
||||
dtcBinary: Val := '_binary ' + Cell.NewText;
|
||||
else Val := Connection.EscapeString(Cell.NewText);
|
||||
end;
|
||||
sqlUpdate := sqlUpdate + Connection.QuoteIdent(FColumnOrgNames[i]) + '=' + Val;
|
||||
|
Reference in New Issue
Block a user