瀏覽代碼

* Fixed mysql ftLargeInt support+test (mantis 9744)

git-svn-id: trunk@8703 -
joost 18 年之前
父節點
當前提交
66c6ba7b64

+ 6 - 1
packages/fcl-db/src/sqldb/mysql/mysqlconn.inc

@@ -427,7 +427,12 @@ function TConnectionName.MySQLDataType(AType: enum_field_types; ASize, ADecimals
 begin
   Result := True;
   case AType of
-    FIELD_TYPE_TINY, FIELD_TYPE_SHORT, FIELD_TYPE_LONG, FIELD_TYPE_LONGLONG,
+    FIELD_TYPE_LONGLONG:
+      begin
+      NewType := ftLargeint;
+      NewSize := 0;
+      end;
+    FIELD_TYPE_TINY, FIELD_TYPE_SHORT, FIELD_TYPE_LONG,
     FIELD_TYPE_INT24:
       begin
       NewType := ftInteger;

+ 36 - 0
packages/fcl-db/tests/testsqlfieldtypes.pas

@@ -26,6 +26,7 @@ type
     procedure TearDown; override;
     procedure RunTest; override;
   published
+    procedure TestBug9744;
     procedure TestCrossStringDateParam;
     procedure TestGetFieldNames;
     procedure TestUpdateIndexDefs;
@@ -866,6 +867,41 @@ begin
     inherited RunTest;
 end;
 
+procedure TTestFieldTypes.TestBug9744;
+var i : integer;
+begin
+  with TSQLDBConnector(DBConnector) do
+    begin
+    try
+      Connection.ExecuteDirect('create table TTTOBJ (         ' +
+                                '  ID INT NOT NULL,           ' +
+                                '  NAME VARCHAR(250),         ' +
+                                '  PRIMARY KEY (ID)           ' +
+                                ')                            ');
+      Connection.ExecuteDirect('create table TTTXY (          ' +
+                                '  ID INT NOT NULL,           ' +
+                                '  NP INT NOT NULL,           ' +
+                                '  X DOUBLE,                  ' +
+                                '  Y DOUBLE,                  ' +
+                                '  PRIMARY KEY (ID,NP)        ' +
+                                ')                            ');
+      for i := 0 to 7 do
+        begin
+        connection.ExecuteDirect('insert into TTTOBJ(ID,NAME) values ('+inttostr(i)+',''A'+inttostr(i)+''')');
+        connection.ExecuteDirect('insert into TTTXY(ID,NP,X,Y) values ('+inttostr(i)+',1,1,1)');
+        connection.ExecuteDirect('insert into TTTXY(ID,NP,X,Y) values ('+inttostr(i)+',2,2,2)');
+        end;
+      Query.SQL.Text := 'select OBJ.ID, OBJ.NAME, count(XY.NP) as NPF from TTTOBJ as OBJ, TTTXY as XY where (OBJ.ID=XY.ID) group by OBJ.ID';
+      query.Prepare;
+      query.open;
+      query.close;
+    finally
+      Connection.ExecuteDirect('drop table TTTXY');
+      Connection.ExecuteDirect('drop table TTTOBJ');
+      end
+    end;
+end;
+
 procedure TTestFieldTypes.TestCrossStringDateParam;
 begin
   TestXXParamQuery(ftDate,'DATE',testDateValuesCount,True);

+ 1 - 1
packages/fcl-db/tests/toolsunit.pas

@@ -70,7 +70,7 @@ type
      end;
 
 const
-  DataEventnames : Array [TDataEvent] of String[19] =
+  DataEventnames : Array [TDataEvent] of String[21] =
     ('deFieldChange', 'deRecordChange', 'deDataSetChange', 'deDataSetScroll',
      'deLayoutChange', 'deUpdateRecord', 'deUpdateState', 'deCheckBrowseMode',
      'dePropertyChange', 'deFieldListChange', 'deFocusControl' ,'deParentScroll',