Autoinc problem

Discussion of open issues, suggestions and bugs regarding MyDAC (Data Access Components for MySQL) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
davor.TCS
Posts: 29
Joined: Thu 05 Apr 2012 22:10
Contact:

Autoinc problem

Post by davor.TCS » Sat 29 Oct 2016 18:26

I am using Delphi XE8, with MyDAC 8.7.25. I have wrong representation of AutoInc field in my table.
AutoInc field in MySQL is defined as tinyint(3) unsigned NOT NULL.
In DBGrid i get some strange values...
https://postimg.org/image/db5hka22b/
Probably some small thing I overlooked.

ViktorV
Devart Team
Posts: 3168
Joined: Wed 30 Jul 2014 07:16

Re: Autoinc problem

Post by ViktorV » Mon 31 Oct 2016 14:34

Unfortunately, we could not reproduce the issue.
In order to get a detailed answer, please compose a small sample demonstrating the described behavior and send it using the contact form https://www.devart.com/company/contactform.html including scripts for creating database objects. Also, please specify the exact version of the used MySQL server.

davor.TCS
Posts: 29
Joined: Thu 05 Apr 2012 22:10
Contact:

Re: Autoinc problem

Post by davor.TCS » Wed 02 Nov 2016 18:40

Ok. Sent it to you with contactform...

ViktorV
Devart Team
Posts: 3168
Joined: Wed 30 Jul 2014 07:16

Re: Autoinc problem

Post by ViktorV » Thu 03 Nov 2016 14:25

The issue is not related to the work of MyDAC, and it is connected with the peculiarities of IDE work with the fields type TUnsignedAutoIncField. This class is designed only to work with LongWord data type.
You can verify this by trying to connect to the database, using the standard FireDAC components.
To solve the issue, you can re-create a field of TUnsignedAutoIncField type on TAutoIncField or remove persistent fields.

davor.TCS
Posts: 29
Joined: Thu 05 Apr 2012 22:10
Contact:

Re: Autoinc problem

Post by davor.TCS » Sat 07 Jan 2017 19:56

I solved it like this:
- If they are unsigned in mysql field must be declared as mediumint, and in Delphi as TUnsignedAutoInc
- If it is signed then in mysql field must be declared minimum as mediumint or int, and in Delphi as TAutoInc

Perhaps there is a better way, but for my db this was quick fix.

ViktorV
Devart Team
Posts: 3168
Joined: Wed 30 Jul 2014 07:16

Re: Autoinc problem

Post by ViktorV » Wed 11 Jan 2017 08:58

We are glad to know you have found a solution for the issue.
Feel free to contact us if you have any further questions about our products.

Post Reply