我正在使用Delphi 10开发更新APP。我正在运行Windows 7 64x,FireBird 2.5.1.26351 32x。
执行顺序:
当我尝试执行.SQL文件时弹出错误代码-901。我知道W7 64x和FDB 32x存在不兼容问题,但是,我可以做任何事情:备份和恢复(gbak),数据库命令(全部)。我尝试使用FDB 64x,但它不起作用。
代码:
//Components
FDWaitCursor: TFDGUIxWaitCursor;
FDDriverLink: TFDPhysFBDriverLink;
FDConnection:TFDConnection;
FDScript: TFDScript;
function TTHR_Script.CreateComponents:boolean;
begin
try
FDDriverLink := TFDPhysFBDriverLink.Create(FDDriverLink);
FDWaitCursor := TFDGUIxWaitCursor.Create(FDWaitCursor);
FDConnection := TFDConnection.Create(FDConnection);
with FDConnection do
begin
DriverName := 'FB';
Params.UserName := THRBanco.BDUser;
Params.Password := THRBanco.BDPass;
Params.Database := THRBanco.DIROrigem;
end;
FDScript := TFDScript.Create(FDScript);
with FDScript do
begin
Connection := FDConnection;
OnConsolePut := FDScript_ConsolePut;
end;
Result := true;
except on E:Exception do
begin
Result := false;
end;
end;
end;
procedure TTHR_Script.ExecLogs;
var
F : integer;
SR : TSearchRec;
begin
F := FindFirst(ExtractFilePath(Application.ExeName)+'\manager\update\logs\*.sql',faArchive,SR);
FDConnection.Open;
while F = 0 do
begin
with FDScript do
begin
SQLScripts.Clear;
SQLScriptFileName := ExtractFilePath(Application.ExeName)+'\manager\update\logs\'+SR.Name;
ValidateAll;
ExecuteAll;
end;
Application.ProcessMessages;
F := FindNext(SR);
end;
FDConnection.Close;
end;
安装Firebird 2.5.6后,仍然出现相同的-901错误。错误日志:
update empresa set emp_verbanco='2016.55';
[13_09_2016 | 14:29]: Ok [00:00:00.047].
[13_09_2016 | 14:29]: update empresa set emp_versis='2016.55';
[13_09_2016 | 14:29]: Ok [00:00:00.016].
[13_09_2016 | 14:29]: commit work;
[13_09_2016 | 14:29]: ERROR: Dynamic SQL Error SQL error code = -901 invalid transaction handle (expecting explicit transaction start)