ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/public/ibx/trunk/runtime/IBSQLParser.pas
(Generate patch)

Comparing ibx/trunk/runtime/IBSQLParser.pas (file contents):
Revision 45 by tony, Tue Dec 6 10:33:46 2016 UTC vs.
Revision 139 by tony, Wed Jan 24 16:16:29 2018 UTC

# Line 117 | Line 117 | type
117      FCTE: TCTEDef;
118      FNested: integer;
119      FDestroying: boolean;
120 +    FOwner: TSelectSQLParser;
121      procedure AddToSQL(const Word: string);
122      procedure CTEClear;
123      function GetCTE(Index: integer): PCTEDef;
# Line 136 | Line 137 | type
137      procedure SetGroupClause(const Value: string);
138      procedure SetFromClause(const Value: string);
139    protected
140 <    constructor Create(SQLText: TStrings; StartLine, StartIndex: integer); overload;
140 >    constructor Create(aOwner: TSelectSQLParser; SQLText: TStrings; StartLine, StartIndex: integer); overload;
141      procedure Changed;
142    public
143      constructor Create(aDataSet: TDataSet; SQLText: TStrings); overload;
# Line 177 | Line 178 | implementation
178   uses Sysutils, IBCustomDataSet;
179  
180   resourcestring
180  sNoEndToThis    = 'Unterminated string';
181    sBadBy          = 'Unexpected symbol "BY" in: %s';
182    sBadSymbol      = 'Unknown Symbol';
183    sIncomplete     = 'Incomplete Union';
# Line 582 | Line 582 | begin
582          begin
583            if FIndex > length(Lines[I]) then
584              if I+1 < Lines.Count then
585 <              FUnion := TSelectSQLParser.Create(Lines,I+1,1)
585 >              FUnion := TSelectSQLParser.Create(self,Lines,I+1,1)
586              else
587                raise Exception.Create(sIncomplete)
588            else
589 <            FUnion := TSelectSQLParser.Create(Lines,I,FIndex);
589 >            FUnion := TSelectSQLParser.Create(self,Lines,I,FIndex);
590            Exit
591          end;
592        end;
# Line 668 | Line 668 | end;
668   constructor TSelectSQLParser.Create(aDataSet: TDataSet; SQLText: TStrings);
669   begin
670    FDataSet := aDataSet;
671 <  Create(SQLText,0,1)
671 >  Create(nil,SQLText,0,1)
672   end;
673  
674   constructor TSelectSQLParser.Create(aDataSet: TDataSet; const SQLText: string);
# Line 683 | Line 683 | begin
683    end
684   end;
685  
686 < constructor TSelectSQLParser.Create(SQLText: TStrings; StartLine,
687 <  StartIndex: integer);
686 > constructor TSelectSQLParser.Create(aOwner: TSelectSQLParser;
687 >  SQLText: TStrings; StartLine, StartIndex: integer);
688   begin
689    inherited Create;
690 +  FOwner := aOwner;
691    FParamList := TStringList.Create;
692    FCTEs := TList.Create;
693    FLastSymbol := sqNone;
# Line 699 | Line 700 | end;
700  
701   procedure TSelectSQLParser.Changed;
702   begin
703 +  if FOwner <> nil then
704 +    FOwner.Changed
705 +  else
706    if assigned(FOnSQLChanging) and not FDestroying then
707       OnSQLChanging(self)
708   end;
# Line 869 | Line 873 | end;
873  
874   procedure TSelectSQLParser.SetSelectClause(const Value: string);
875   begin
876 <  if Union <> nil then Union.SelectClause := Value;
877 <  FSelectClause := Value;
878 <  Changed
876 >  if FSelectClause <> Value then
877 >  begin
878 >    FSelectClause := Value;
879 >    Changed
880 >  end;
881   end;
882  
883   procedure TSelectSQLParser.SetFromClause(const Value: string);
884   begin
885 <  if Union <> nil then
886 <    Union.FromClause := Value
887 <  else
888 <  FFromClause := Value;
889 <  Changed
885 >  if FFromClause <> Value then
886 >  begin
887 >    FFromClause := Value;
888 >    Changed
889 >  end;
890   end;
891  
892   procedure TSelectSQLParser.SetGroupClause(const Value: string);
893   begin
894 <  if Union <> nil then
895 <    Union.GroupClause := Value
896 <  else
897 <  FGroupClause := Value;
898 <  Changed
894 >  if FGroupClause <> Value then
895 >  begin
896 >    FGroupClause := Value;
897 >    Changed
898 >  end;
899   end;
900  
901   procedure TSelectSQLParser.SetOrderByClause(const Value: string);
# Line 897 | Line 903 | begin
903    if Union <> nil then
904      Union.OrderByClause := Value
905    else
906 +  if FOrderByClause <> Value then
907 +  begin
908      FOrderByClause := Value;
909 <  Changed
909 >    Changed
910 >  end;
911   end;
912  
913   procedure TSelectSQLParser.DropUnion;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines