Persistent Autoinc fields
Persistent Autoinc fields
MySQL version 7.2.8 for XE2
When I create persistent fields from either a MySQL or MyTable, Autoinc fields are shown as TWordfield instead of TAutoincfield.
How can I change this so autoinc fields are created ? (Of course the database tables have been set correctly to autoinc)
Thanks for your help
			
									
									
						When I create persistent fields from either a MySQL or MyTable, Autoinc fields are shown as TWordfield instead of TAutoincfield.
How can I change this so autoinc fields are created ? (Of course the database tables have been set correctly to autoinc)
Thanks for your help
- 
				DemetrionQ
 - Devart Team
 - Posts: 271
 - Joined: Wed 23 Jan 2013 11:21
 
Re: Persistent Autoinc fields
Hello.
MyDAC fills in auto-incremental fields automatically on inserting a new record to a dataset, independently on whether they have the TWordField type or TAutoIncField.
			
									
									
						MyDAC fills in auto-incremental fields automatically on inserting a new record to a dataset, independently on whether they have the TWordField type or TAutoIncField.
Re: Persistent Autoinc fields
Thanks for your reply.
Unfortunately, I work a lot with memory tables and string grids, and it is important that I know what the data type is when I copy data from the MyQuery to the memory table or string grid.
I could check each time with a "SHOW FULL COLUMNS FROM xxxtable", and then see what the "extra" column is, but this means a round trip to the database every time.
Any suggestions ?
Thanks
			
									
									
						Unfortunately, I work a lot with memory tables and string grids, and it is important that I know what the data type is when I copy data from the MyQuery to the memory table or string grid.
I could check each time with a "SHOW FULL COLUMNS FROM xxxtable", and then see what the "extra" column is, but this means a round trip to the database every time.
Any suggestions ?
Thanks
Re: Persistent Autoinc fields
I have just been reading the help file, and one thing I found interesting was the section on data type mapping.   Can this be extended to cover autoincs ?
Thanks
			
									
									
						Thanks
- 
				DemetrionQ
 - Devart Team
 - Posts: 271
 - Joined: Wed 23 Jan 2013 11:21
 
Re: Persistent Autoinc fields
Hello.
Data Type Mapping is not designed for definition of auto-incremental fields or mapping in TAutoIncField.
You can define whether a field is auto-incremental in the following way:
			
									
									
						Data Type Mapping is not designed for definition of auto-incremental fields or mapping in TAutoIncField.
You can define whether a field is auto-incremental in the following way:
Code: Select all
  if MyQuery1.GetFieldDesc('YourField').IsAutoIncrement then
    // ...  Field is AutoIncrementRe: Persistent Autoinc fields
Thanks for that.  Just what I was looking for.
Regards
			
									
									
						Regards
- 
				DemetrionQ
 - Devart Team
 - Posts: 271
 - Joined: Wed 23 Jan 2013 11:21
 
Re: Persistent Autoinc fields
If any other questions come up, please contact us.
			
									
									
						Re: Persistent Autoinc fields
Hi,
Is there any way to make Field TAutoInc type when obtaining field definitions from MySQL Table? One of components I use require it, if the key value of new record would be set automatically.
Michal
			
									
									
						Is there any way to make Field TAutoInc type when obtaining field definitions from MySQL Table? One of components I use require it, if the key value of new record would be set automatically.
Michal
Re: Persistent Autoinc fields
The similar question has already been discussed on our forum. Follow the link viewtopic.php?f=7&t=7332