i use SVN Testing 188
the parameter FParamCheck is only used in
constructor TZAbstractRODataset.Create(AOwner: TComponent);
it can be removed
i use TZReadOnlyQuery to do a lot of insert in postgres (with TZReadOnlyQuery ) and sometime there is a exception in
Code: Select all
procedure TZAbstractRODataset.SetStatementParams(Statement: IZPreparedStatement;
ParamNames: TStringDynArray; Params: TParams; DataLink: TDataLink);
var
I: Integer;
TempParam, Param: TParam;
Stream: TStream;
Dataset: TDataset;
Field: TField;
begin
if DataLink.Active then
Dataset := DataLink.DataSet
else Dataset := nil;
TempParam := TParam.Create(nil); //<< The exception is raise by rtl
For the problem is here
Code: Select all
procedure TZAbstractRODataset.ExecSQL;
begin
Connection.ShowSQLHourGlass;
try
if Active then Close;
CheckSQLQuery;
CheckInactive;
CheckConnected;
if (Statement = nil) or (Statement.GetConnection.IsClosed) then
Statement := CreateStatement(FSQL.Statements[0].SQL, Properties);
// alway check params !!
SetStatementParams(Statement, FSQL.Statements[0].ParamNamesArray,
FParams, FDataLink);
FRowsAffected := Statement.ExecuteUpdatePrepared;
finally
Connection.HideSQLHourGlass;
end;
end;
Code: Select all
procedure TZAbstractRODataset.ExecSQL;
begin
Connection.ShowSQLHourGlass;
try
if Active then Close;
CheckSQLQuery;
CheckInactive;
CheckConnected;
if (Statement = nil) or (Statement.GetConnection.IsClosed) then
Statement := CreateStatement(FSQL.Statements[0].SQL, Properties);
if( ParamCheck ) then
SetStatementParams(Statement, FSQL.Statements[0].ParamNamesArray,
FParams, FDataLink);
FRowsAffected := Statement.ExecuteUpdatePrepared;
finally
Connection.HideSQLHourGlass;
end;
end;