Subject | RE: [IBO] Re: Field trimming |
---|---|
Author | Jason Wharton |
Post date | 2008-02-02T19:40:26Z |
> Oops... here is the code for CreateDSQL:Please avoid using a NILL owner in constructors.
>
> function TDataModuleName.CreateDSQL(aTx: TIB_Transaction; const aSQL:
> String): TIB_DSQL;
> begin
> result := TIB_DSQL.Create(nil);
> result.IB_Connection := FIBConn;
> result.IB_Transaction := aTx;
> result.SQL.Text := aSQL;
> end;
See below for how it should be done:
function TDataModuleName.CreateDSQL(
aTx: TIB_Transaction; const aSQL: String): TIB_DSQL;
begin
result := TIB_DSQL.Create( FIBConn );
result.IB_Connection := FIBConn;
result.IB_Transaction := aTx;
result.SQL.Text := aSQL;
end;
Using a nil owner causes all objects to use the default session and so if
you are using multi-threading this could become problematic.
Jason Wharton