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 39 by tony, Tue May 17 08:14:52 2016 UTC vs.
Revision 49 by tony, Thu Feb 2 16:20:12 2017 UTC

# Line 27 | Line 27 | unit IBSQLParser;
27  
28   {$Mode Delphi}
29  
30 {$IF FPC_FULLVERSION >= 20700 }
30   {$codepage UTF8}
32 {$ENDIF}
31  
32   interface
33  
# Line 119 | 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 138 | 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 584 | Line 583 | begin
583          begin
584            if FIndex > length(Lines[I]) then
585              if I+1 < Lines.Count then
586 <              FUnion := TSelectSQLParser.Create(Lines,I+1,1)
586 >              FUnion := TSelectSQLParser.Create(self,Lines,I+1,1)
587              else
588                raise Exception.Create(sIncomplete)
589            else
590 <            FUnion := TSelectSQLParser.Create(Lines,I,FIndex);
590 >            FUnion := TSelectSQLParser.Create(self,Lines,I,FIndex);
591            Exit
592          end;
593        end;
# Line 670 | Line 669 | end;
669   constructor TSelectSQLParser.Create(aDataSet: TDataSet; SQLText: TStrings);
670   begin
671    FDataSet := aDataSet;
672 <  Create(SQLText,0,1)
672 >  Create(nil,SQLText,0,1)
673   end;
674  
675   constructor TSelectSQLParser.Create(aDataSet: TDataSet; const SQLText: string);
# Line 685 | Line 684 | begin
684    end
685   end;
686  
687 < constructor TSelectSQLParser.Create(SQLText: TStrings; StartLine,
688 <  StartIndex: integer);
687 > constructor TSelectSQLParser.Create(aOwner: TSelectSQLParser;
688 >  SQLText: TStrings; StartLine, StartIndex: integer);
689   begin
690    inherited Create;
691 +  FOwner := aOwner;
692    FParamList := TStringList.Create;
693    FCTEs := TList.Create;
694    FLastSymbol := sqNone;
# Line 701 | Line 701 | end;
701  
702   procedure TSelectSQLParser.Changed;
703   begin
704 +  if FOwner <> nil then
705 +    FOwner.Changed
706 +  else
707    if assigned(FOnSQLChanging) and not FDestroying then
708       OnSQLChanging(self)
709   end;
# Line 871 | Line 874 | end;
874  
875   procedure TSelectSQLParser.SetSelectClause(const Value: string);
876   begin
877 <  if Union <> nil then Union.SelectClause := Value;
878 <  FSelectClause := Value;
879 <  Changed
877 >  if FSelectClause <> Value then
878 >  begin
879 >    FSelectClause := Value;
880 >    Changed
881 >  end;
882   end;
883  
884   procedure TSelectSQLParser.SetFromClause(const Value: string);
885   begin
886 <  if Union <> nil then
887 <    Union.FromClause := Value
888 <  else
889 <  FFromClause := Value;
890 <  Changed
886 >  if FFromClause <> Value then
887 >  begin
888 >    FFromClause := Value;
889 >    Changed
890 >  end;
891   end;
892  
893   procedure TSelectSQLParser.SetGroupClause(const Value: string);
894   begin
895 <  if Union <> nil then
896 <    Union.GroupClause := Value
897 <  else
898 <  FGroupClause := Value;
899 <  Changed
895 >  if FGroupClause <> Value then
896 >  begin
897 >    FGroupClause := Value;
898 >    Changed
899 >  end;
900   end;
901  
902   procedure TSelectSQLParser.SetOrderByClause(const Value: string);
# Line 899 | Line 904 | begin
904    if Union <> nil then
905      Union.OrderByClause := Value
906    else
907 +  if FOrderByClause <> Value then
908 +  begin
909      FOrderByClause := Value;
910 <  Changed
910 >    Changed
911 >  end;
912   end;
913  
914   procedure TSelectSQLParser.DropUnion;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines