mirror of
https://github.com/HeidiSQL/HeidiSQL.git
synced 2025-08-06 18:24:26 +08:00
Examine query error messages for "(errno: 123)" and add the more meaningful message returned by perror.exe . Adds a static error message list from my local 5.1.22 server. This is especially helpful in the foreign key editor, where any InnoDB error seems to be the more cryptic one by default, while there are lots of possible error causes. See issue #400.
This commit is contained in:
@ -5,7 +5,7 @@ interface
|
||||
uses
|
||||
Windows, Messages, Forms, Db, Classes, ZConnection, ZDataSet, StdCtrls, SysUtils,
|
||||
ZMessages,
|
||||
HeidiComp;
|
||||
HeidiComp, SynRegExpr, mysql_structures;
|
||||
|
||||
{$IFDEF EXAMPLE_APP}
|
||||
const
|
||||
@ -311,10 +311,24 @@ begin
|
||||
end;
|
||||
|
||||
procedure TMysqlQueryThread.SetState(AResult: Integer; AComment: String);
|
||||
var
|
||||
rx: TRegExpr;
|
||||
msg: String;
|
||||
begin
|
||||
debug(Format('qry: Setting status %d with comment %s', [AResult, AComment]));
|
||||
FResult := AResult;
|
||||
FComment := AComment;
|
||||
if FResult <> MQR_SUCCESS then begin
|
||||
// Find "(errno: 123)" in message and add more meaningful message from perror.exe
|
||||
rx := TRegExpr.Create;
|
||||
rx.Expression := '.+\(errno\:\s+(\d+)\)';
|
||||
if rx.Exec(FComment) then begin
|
||||
msg := MySQLErrorCodes.Values[rx.Match[1]];
|
||||
if msg <> '' then
|
||||
FComment := FComment + CRLF + CRLF + msg;
|
||||
end;
|
||||
rx.Free;
|
||||
end;
|
||||
end;
|
||||
|
||||
end.
|
||||
|
Reference in New Issue
Block a user