TAutoIncField not generated automatically with SQL Azure
TAutoIncField not generated automatically with SQL Azure
Hello,
I noticed that AutoIncfields (identity) are created as TIntegerField,
I use direct mode
Regards
I noticed that AutoIncfields (identity) are created as TIntegerField,
I use direct mode
Regards
Re: TAutoIncField not generated automatically with SQL Azure
Yes, you are right and it is correct UniDAC behavior.
UniDAC when working with Azure fills in auto-incremental fields automatically on inserting a new record to a dataset, independently on whether they have the TIntegerField type or TAutoIncField.
You can define whether a field is auto-incremental in the following way:
UniDAC when working with Azure fills in auto-incremental fields automatically on inserting a new record to a dataset, independently on whether they have the TIntegerField type or TAutoIncField.
You can define whether a field is auto-incremental in the following way:
Code: Select all
if UniQuery.GetFieldDesc('YourField').IsAutoIncrement then
// ... Field is AutoIncrement
Re: TAutoIncField not generated automatically with SQL Azure
Hello, is there a way to implement an provider specific option wich allows to use TAutoIncField for all Identity columns?
Because, all common components (wich are based on TDataSet) expect that autoinc fields have this type.
That includes also DevExpress which i use since many years with other DB frameworks.
And now, it hangs only on a total uncommon behavior of the DB framework to which i want change.
(i use trial 7.0.1)
Because, all common components (wich are based on TDataSet) expect that autoinc fields have this type.
That includes also DevExpress which i use since many years with other DB frameworks.
And now, it hangs only on a total uncommon behavior of the DB framework to which i want change.
(i use trial 7.0.1)
Re: TAutoIncField not generated automatically with SQL Azure
We are investigating the possibility of returning the ftAutoInc field type for auto-increment fields and will inform you about the results.
Re: TAutoIncField not generated automatically with SQL Azure
Thanks for you reply!
I had a deeper look into that case. Azure generates the new value automatically while posting a new record. If you use the Microsoft SSMS for test on database level you can see Identity fields are not able to edit. Means they are managed from the database.
What was you concern to use TInteger instead of TAutoInc for identity fields? Maybe it help to understand why ViktorV called it as correct behavior for UniDAC.
Btw. i can't find any description / information in the Helpfile about the GetFieldDesc function and its result type.
I had a deeper look into that case. Azure generates the new value automatically while posting a new record. If you use the Microsoft SSMS for test on database level you can see Identity fields are not able to edit. Means they are managed from the database.
What was you concern to use TInteger instead of TAutoInc for identity fields? Maybe it help to understand why ViktorV called it as correct behavior for UniDAC.
Btw. i can't find any description / information in the Helpfile about the GetFieldDesc function and its result type.
Re: TAutoIncField not generated automatically with SQL Azure
UniDAC provider for SQL Server returns for INT IDENTITY fields the TIntegerField class and set the TIntegerField.ReadOnly property to True. When calling the TUniQuery.Post method UniDAC requests the IDENTITY field value for the inserted record and returns this value to the TIntegerField instance. All the above corresponds to the behavior of auto-increment fields.
The GetFieldDesc method returns the TFieldDesc object which contains meta information about TUniQuery dataset field. As an argument this method can accept:
- the TField field instance
- a field name as a string value
- a field ordinal number in dataset as an integer value
In UniDAC the TFieldDesc class is developed for internal use, so its description is missing in the documentation.
The GetFieldDesc method returns the TFieldDesc object which contains meta information about TUniQuery dataset field. As an argument this method can accept:
- the TField field instance
- a field name as a string value
- a field ordinal number in dataset as an integer value
In UniDAC the TFieldDesc class is developed for internal use, so its description is missing in the documentation.
Re: TAutoIncField not generated automatically with SQL Azure
Thanks for you explanation, Azyk.
As far as i know means INT IDENTITY in every case autoinc. And TAutoInc field means an integer, read only, generated by the database. An TInteger field which is read only means calculated. So, still not editable for some reason.
I think, the DataType of an INT IDENTITY should be AutoInc (TAutoInc field class) and all should work fine.
If you think, that it will make a problem in some case, please tell me, will see if it helps to talk about
Ok, that means we should use an undocumentet function for find out if a field is autoinc or not. That will work als long we know that we work with UniDac. But all our components which are work with TDataSet have no clue about that.In UniDAC the TFieldDesc class is developed for internal use, so its description is missing in the documentation.
As far as i know means INT IDENTITY in every case autoinc. And TAutoInc field means an integer, read only, generated by the database. An TInteger field which is read only means calculated. So, still not editable for some reason.
I think, the DataType of an INT IDENTITY should be AutoInc (TAutoInc field class) and all should work fine.
If you think, that it will make a problem in some case, please tell me, will see if it helps to talk about

Re: TAutoIncField not generated automatically with SQL Azure
The investigation of implementation possibility is still in progress. We will inform you about the results.
Re: TAutoIncField not generated automatically with SQL Azure
Thank you very much, Azyk.