unknown type on auto inc key field

Discussion of open issues, suggestions and bugs regarding MyDAC (Data Access Components for MySQL) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
RoyS
Posts: 10
Joined: Wed 13 Jul 2005 11:48
Location: UK

unknown type on auto inc key field

Post by RoyS » Fri 06 Jul 2012 10:34

After upgrading to MyDac 7.2.7 from 6.10.0 I get 'unknown type' errors on the auto-increment key fields when linked client datasets are opened.
All dcu's deleted before rebuild.
Key fields: int(10) or smallint(5), auto inc, not null, PK, unsigned

Config:
Win 7 64bit Ultimate
Delphi XE Version 15.0.3953.35171
MySql v5.0 running on CentOS 5.4 VM

structure:
MyConnection
MyQuery
Dataset Provider
Client Dataset

Connection opens OK
MyQuery opens OK and can edit data within the component at design-time
Client Dataset - check 'active' displays the key field name and 'unknown type'

uninstalling MyDac7 and re-installing MyDac6 clears the problem and the program runs fine.

AndreyZ

Re: unknown type on auto inc key field

Post by AndreyZ » Fri 06 Jul 2012 14:07

Hello,

In the latest MyDAC version 7.2.7 we added the new functionality - data mapping, that allows mapping of server data types to IDE types. To fully support data mapping, we made several changes in field creation that also slightly increase performance. In MyDAC 7.2.7 for the MySQL type INT UNSIGNED the TLongWordField field is 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. This will solve the problem. Please note that to use the myIntUnsigned variable, you should add the MyDataTypeMap unit to the USES clause of your unit.

RoyS
Posts: 10
Joined: Wed 13 Jul 2005 11:48
Location: UK

Re: unknown type on auto inc key field

Post by RoyS » Fri 06 Jul 2012 15:24

Almost works, the unknown type error no longer appears but I get an access violation.
The issue is my use of tiny, small and large unsigned integer fields in the database.

My solution is to use the DataTypeMap editor on the component

field1 > word
field2 > word
dbtype tinyint unsigned > boolean
dbtype smallint unsigned > smallint
dbtype integer unsigned > largeint

it is fairly intuitive but a little help would be good. (I can't find it in the MyDac help installed in Delphi).

Thanks

AndreyZ

Re: unknown type on auto inc key field

Post by AndreyZ » Mon 09 Jul 2012 09:15

You can download the updated MyDAC documentation in the CHM and PDF formats here (in the "Documentation and Demo" section): http://www.devart.com/mydac/download.html . In the updated MyDAC documentation you will find the "Working with Data Type Mapping" article that describes the "Data Type Mapping" feature in details.

RoyS
Posts: 10
Joined: Wed 13 Jul 2005 11:48
Location: UK

Re: unknown type on auto inc key field

Post by RoyS » Mon 09 Jul 2012 09:30

Thanks - I should have scrolled down the page further!
:?

That is all for this thread, hopefully it will be useful to others too.
Thanks for your help.

AndreyZ

Re: unknown type on auto inc key field

Post by AndreyZ » Mon 09 Jul 2012 11:39

Feel free to contact us if you have any further questions about MyDAC.

skydvrz
Posts: 32
Joined: Tue 23 Feb 2010 23:49
Location: Kissimmee, Florida USA
Contact:

Re: unknown type on auto inc key field

Post by skydvrz » Fri 20 Jul 2012 16:23

AndreyZ wrote:You can download the updated MyDAC documentation in the CHM and PDF formats here (in the "Documentation and Demo" section): http://www.devart.com/mydac/download.html .
Just to let you know...

The MyDAC documentation PDF file has "UNREGISTERED VERSION OF CHM TO PDF CONVERTER STA" watermarked over every other page in big red letters - about 1230 times, if I am doing the math correctly.

This is pretty annoying. :|

Best regards,

Kevin G. McCoy

AndreyZ

Re: unknown type on auto inc key field

Post by AndreyZ » Mon 23 Jul 2012 07:59

We already fixed the problem with all DAC products' documentation. The next DAC builds will not have this problem with the documentation.

Post Reply