[patch_done] Another Patch for ZConnection
Posted: 15.05.2009, 11:22
Currently the Delphi compiler throws a hint that the assigned return value for ExecuteDirect is never used.
By modifying
to
this hint can be removed and the function is IMHO aditionaly more fail-save
By modifying
Code: Select all
function TZConnection.ExecuteDirect(SQL:string; var RowsAffected:integer):boolean;
var
stmt : IZStatement;
begin
result := False;
CheckConnected;
stmt := DbcConnection.CreateStatement;
RowsAffected:= stmt.ExecuteUpdate(SQL);
result := (RowsAffected <> -1);
stmt:=nil;
end;
Code: Select all
function TZConnection.ExecuteDirect(SQL:string; var RowsAffected:integer):boolean;
var
stmt : IZStatement;
begin
//HA 090515 remove compiler hint ..
//result := False;
//CheckConnected;
//stmt := DbcConnection.CreateStatement;
//RowsAffected:= stmt.ExecuteUpdate(SQL);
//result := (RowsAffected <> -1);
//stmt:=nil;
//..
try
try
CheckConnected;
stmt := DbcConnection.CreateStatement;
RowsAffected:= stmt.ExecuteUpdate(SQL);
result := (RowsAffected <> -1);
except
RowsAffected := -1;
result := False;
end;
finally
stmt:=nil;
end;
end;