Browse Source

* Fixed bug #8442 + test

git-svn-id: trunk@10905 -
joost 17 years ago
parent
commit
6f3e1bba28
2 changed files with 21 additions and 0 deletions
  1. 5 0
      packages/fcl-db/src/sqldb/sqldb.pp
  2. 16 0
      packages/fcl-db/tests/testfieldtypes.pas

+ 5 - 0
packages/fcl-db/src/sqldb/sqldb.pp

@@ -1134,6 +1134,11 @@ begin
                          FWhereStopPos := PhraseP-PSQL+1
                        else
                          FWhereStopPos := CurrentP-PSQL+1;
+                       end
+                     else if (s = 'UNION') then
+                       begin
+                       ParsePart := ppBogus;
+                       FUpdateable := False;
                        end;
                      end;
         end; {case}

+ 16 - 0
packages/fcl-db/tests/testfieldtypes.pas

@@ -29,6 +29,7 @@ type
   published
     procedure TestClearUpdateableStatus;
     procedure TestParseJoins; // bug 10148
+    procedure TestParseUnion; // bug 8442
     procedure TestInsertLargeStrFields; // bug 9600
     procedure TestNumericNames; // Bug9661
     procedure Test11Params;
@@ -906,6 +907,21 @@ begin
     end;
 end;
 
+procedure TTestFieldTypes.TestParseUnion;
+begin
+  with TSQLDBConnector(DBConnector) do
+    begin
+    with query do
+      begin
+      SQL.Text:='select NAME from FPDEV where ID<5';
+      sql.Add('union');
+      sql.Add('select NAME from FPDEV where ID>5');
+      Open;
+      close;
+      end;
+    end;
+end;
+
 procedure TTestFieldTypes.TestInsertLargeStrFields;
 begin
   with TSQLDBConnector(DBConnector) do