Page 1 of 1

AutoIncrement problem with DataAdapter.FillSchema

Posted: Fri 16 Dec 2011 15:33
by wcroteau
There appears to be a problem with autoincrement columns when filling a DataSet schema...

I have this table:

Code: Select all

CREATE TABLE Test (ID INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, Val INTEGER);
My test code is as follows:

Code: Select all

DataSet ds = new DataSet();
SQLiteDataAdapter da = new SQLiteDataAdapter("SELECT ID, Val FROM Test", conn);
da.FillSchema(ds, SchemaType.Mapped, "Test");
da.Fill(ds, "Test");
Now when I inspect ds.Tables[0].Columns["ID"].AutoIncrement I get false.

In my mind, this isn't supposed to happen. It should be true since I expressly created the column as AUTOINCREMENT.

I know that SQLite is capable of doing autoincrement in another way but that doesn't seem to be compatible with generic DataSets.

I cannot use a typed DataSet in this case so that's not a viable option.

I'm running dotConnect for SQLite v.3.60.258.0

And by the way, I've compared this result with the results of a similar test using the provider from System.Data.SQLite and that implementation returns true as expected so this seems to be an issue with the provider and not the underlying database.

Posted: Tue 20 Dec 2011 09:38
by Pinturiccio
We have reproduced the issue. We will investigate it and notify you about the results as soon as possible.

Posted: Thu 22 Dec 2011 13:05
by Pinturiccio
The behavior when AutoIncrement property is not returned with SQLiteDataAdapter.FillSchema(DataSet, SchemaType.Mapped) is the designed behavior. SQLite allows setting assigning custom values to AutoIncrement columns, so we decided not to set Autoincrement property for the columns when using SQLiteDataAdapter.FillSchema(DataSet, SchemaType.Mapped) in order to permit modifying Autoincrement column values with DML statements.