Page 1 of 1
Troubles with data type mapping
Posted: Wed 17 Oct 2012 09:54
by maurix_01
Hi,
after upgrading to the latest 7.5 I receive the following error:
exception class : EDatabaseError
exception message : 4294967295 is not a valid value for field 'Features'. The allowed range is 0 to 2147483647.
This is how the field is declared:
Features int(11) unsigned DEFAULT '4294967295'
Can you tell me how to map this case?
Thanks
Re: Troubles with data type mapping
Posted: Wed 17 Oct 2012 11:42
by AndreyZ
Hello,
Please specify the following:
- the data type mapping rules you have in your connection and dataset;
- the exact version of your IDE;
- the exact version of MySQL server and client. You can learn it from the Info sheet of TMyConnection Editor.
Re: Troubles with data type mapping
Posted: Wed 17 Oct 2012 20:50
by maurix_01
Hi AndreyZ,
I hope the following information can help you:
1) In the TMyConnection DataType Mapping sheet I have:
DatabaseType = Integer Unsigned
Field Name = Features
Field Type = LongWord
You can also look a screenshot I made for you:
2) The IDE is Delphi XE
3) MySQL server version: 5.5.9-log
4) MySQL client version: Direct
5) DAC version 7.5.9
Thanks
Re: Troubles with data type mapping
Posted: Thu 18 Oct 2012 06:31
by AndreyZ
This problem can occur if you set the MaxValue property of the Features field to 2147483647. To avoid the problem, you should set it to its default value 0.
Re: Troubles with data type mapping
Posted: Sat 20 Oct 2012 22:21
by maurix_01
Hi AndreyZ, the MaxValue property is set to 0 and the error still occur and I really dont't know how to proceed. Before upgrading to the latest DAC all things were working good.
Just for further information the error is related to a TMyTable object and not a TMyQuery.
Please look at the following lines from MadExcept.
compiled with : Delphi XE
madExcept version : 4.0.5
callstack crc : $b6eac833, $329bf8df, $aea2370e
exception number : 1
exception class : EDatabaseError
exception message : 4294959104 is not a valid value for field 'Features'. The allowed range is 0 to 2147483647.
main thread ($1e40):
006a268c +074 PBXmanager.exe DB DatabaseError
006a2701 +031 PBXmanager.exe DB DatabaseErrorFmt
006a8065 +06d PBXmanager.exe DB TNumericField.RangeError
006a874f +04f PBXmanager.exe DB TLongWordField.GetAsInteger
015a35d7 +00b PBXmanager.exe dmEar 475 +4 TDataModEar.tblUtentiAfterScroll
006b8409 +015 PBXmanager.exe DB TDataSet.DoAfterScroll
00f3b376 +026 PBXmanager.exe DBAccess TCustomDADataSet.DoAfterScroll
006b7088 +0bc PBXmanager.exe DB TDataSet.First
The field in the database is declared:
Features int(11) unsigned DEFAULT '4294967295'
I also tried to set the DEFAULT to 0, but none.
Re: Troubles with data type mapping
Posted: Mon 22 Oct 2012 08:17
by AndreyZ
This problem occurs because you access the Features field using the AsInteger property. Because the integer type cannot hold the 4294967295 value, the TLongWordField class generates the error you encountered. In MyDAC 7.2.7, for the MySQL type INT UNSIGNED the TLongWordField field is created. In previous versions, the TLargeintField field was created. To return the old behaviour, you should add the following mapping rule:
Code: Select all
MyConnection.DataTypeMap.AddDBTypeRule(myIntUnsigned, ftLargeint);
After this, for the MySQL type INT UNSIGNED the TLargeintField field will be created and you will not encounter the error.