Page 1 of 1

BUG: OptimizedBigInt does not optimize INT(10) UNSIGNED

Posted: Wed 12 May 2010 02:26
by lancelot59
OptimizedBigInt is supposed to convert "all fields with field length less than 11" of ftLargeInt to ftInteger, however INT(10) UNSIGNED fields are NOT converted but remain to be ftLargeInt.

Also, sometimes when using SUM() or COUNT(*) MySQL auto-creates a field that's
larger than INT(11), so it would be nice to have the following options:

Code: Select all

   1. Options.OptimizedBigInt    (convert ftLargeInt <= 11 to ftInteger)  
	2. Options.OptimizedBigIntEx  (convert ALL ftLargeInt to ftInteger)
and maybe even	
	3. Options.IgnoreOptimizationOverflow default TRUE (to stay compatible)
	     false : a conversion exception is raised if value is out of bounds
		  true  : overflow is ignored
Replicate:

Code: Select all

1. Drop a TMyConnection and a TMyQuery on a form
   set option TOptimizedBigint to TRUE

2. Set TMyQuery.SQL to:
DROP TABLE IF EXISTS TEST.DABIGINT;
CREATE TABLE TEST.DABIGINT (
   AUTO_INC_INT   INT(10)  UNSIGNED  NOT NULL   AUTO_INCREMENT,
   NORMAL_INT     INT(11),
   UNSIGNED_INT   INT(10)  UNSIGNED,
PRIMARY KEY (AUTO_INC_INT)
) ENGINE=MyISAM;
INSERT INTO TEST.DABIGINT (AUTO_INC_INT,NORMAL_INT,UNSIGNED_INT) VALUES (0,0,0);
SELECT * FROM TEST.DABIGINT;

3. Execute the query and examine the returned datatypes:
MyQuery1.fieldbyname('NORMAL_INT').DataType = ftInteger as expected
MyQuery1.fieldbyname('AUTO_INC_INT').DataType = ftLargeInt NOT expexted
MyQuery1.fieldbyname('UNSIGNED_INT').DataType = ftLargeInt NOT expected
Version info:
MyDAC v5.90.0.57 for Delphi 5 (Trial Edition)
Delphi v5.0 (build 6.18 ) update pack 1
MySQL server version: 5.1.46-community
MySQL client version: Direct

Thanks.
8)

Posted: Wed 12 May 2010 07:47
by Dimon
Setting the OptimizedBigInt property converts fields with field length less than 11 of TLargeIntField type into TIntegerField. This options has no effect for unsigned fields and for the default LongInt MySQL type, because this fields can keep numbers that exceed the maximum permissible value of TIntegerField.