The original code is:
Code: Select all
Tokenizer := CommonTokenizer;
if FDataset is TZAbstractRODataset then
begin
if Assigned(TZAbstractRODataset(FDataset).Connection) then
begin
Driver := TZAbstractRODataset(FDataset).Connection.DbcDriver;
if Assigned(Driver) then
Tokenizer := Driver.GetTokenizer;
end;
end;
Here is my suggestion:
Code: Select all
Tokenizer := CommonTokenizer;
if FDataset is TZAbstractRODataset then
begin
if Assigned(TZAbstractRODataset(FDataset).Connection) then
begin
Driver := TZAbstractRODataset(FDataset).Connection.DbcDriver;
if Assigned(Driver) then
Tokenizer := Driver.GetTokenizer;
end;
end
else if FDataset is TZSQLProcessor then
begin
if Assigned(TZSQLProcessor(FDataset).Connection) then
begin
Driver := TZSQLProcessor(FDataset).Connection.DbcDriver;
if Assigned(Driver) then
Tokenizer := Driver.GetTokenizer;
end;
end;
Near line 161
Code: Select all
constructor TZSQLProcessor.Create(AOwner: TComponent);
begin
inherited Create(AOwner);
FParams := TParams.Create(Self);
FScript := TZSQLStrings.Create;
FScript.Dataset := Self; //----- add this ----
FScript.OnChange := UpdateSQLStrings;
FScriptParser := TZSQLScriptParser.Create;
FScriptParser.DelimiterType := dtDefault;
FScriptParser.Delimiter := ';';
FScriptParser.CleanupStatements := False;
end;
Code: Select all
SQL := TZSQLStrings.Create;
SQL.Dataset := Self; //----- add this -----
SQL.ParamCheck := FScript.ParamCheck;
SQL.MultiStatements := False;