Code patches written by our users to solve certain "problems" that were not solved, yet.
Moderators: gto , cipto_kh , EgonHugeist , mdaems
Ostfriese
Junior Boarder
Posts: 25 Joined: 12.05.2009, 10:48
Location: Coburg
Contact:
Post
by Ostfriese » 15.05.2009, 11:22
Currently the Delphi compiler throws a hint that the assigned return value for ExecuteDirect is never used.
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;
to
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;
this hint can be removed and the function is IMHO aditionaly more fail-save
Thomas Jefferson wrote: Information ist die Währung der Demokratie
gto
Zeos Dev Team
Posts: 278 Joined: 11.11.2005, 18:35
Location: Porto Alegre / Brasil
Post
by gto » 15.05.2009, 11:58
Ostfriese wrote: Currently the Delphi compiler throws a hint that the assigned return value for ExecuteDirect is never used.
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;
to
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;
this hint can be removed and the function is IMHO aditionaly more fail-save
Good patch
Totally agreed
Ostfriese
Junior Boarder
Posts: 25 Joined: 12.05.2009, 10:48
Location: Coburg
Contact:
Post
by Ostfriese » 15.05.2009, 12:42
Thanks
Thomas Jefferson wrote: Information ist die Währung der Demokratie
mdaems
Zeos Project Manager
Posts: 2766 Joined: 20.09.2005, 15:28
Location: Brussels, Belgium
Contact:
Post
by mdaems » 18.05.2009, 23:57
gto ,
You've got SVN commit rights, you can use them to apply this kind of patches
Don't forget to update the changes.xml file in the documentation directory.
Ostfriese ,
SVN rev. 643
Mark