SQLite primart key value after post

Discussion of open issues, suggestions and bugs regarding UniDAC (Universal Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
Andrey
Posts: 6
Joined: Sun 14 Nov 2010 19:27

SQLite primart key value after post

Post by Andrey » Fri 26 Nov 2010 19:27

Have another trouble with the SQLite.
I use autoincrement primary key fields and after adding new record with 'Append'/'Post' methods of TUniQuery the value of Primary key field is '0'. So i need to refresh dataset to aquire actual value.

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Post by AlexP » Mon 29 Nov 2010 08:16

Hello,

I can not reproduce the problem.

Please try to create the following table:

CREATE TABLE test
(
id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
text VARCHAR(50)
)

and insert data into it like this:

UniQuery1.SQL.Clear;
UniQuery1.SQL.Text := 'SELECT * FROM test';
UniQuery1.Open;
UniQuery1.Append;
UniQuery1.FieldByName('text').AsString:= 'test';
UniQuery1.Post;
ShowMessage(UniQuery1.FieldByName('id').AsString);

you should see correct data from the ID field.

I have tested it on the 3.50.0.13 version of UniDAC.

Andrey
Posts: 6
Joined: Sun 14 Nov 2010 19:27

Post by Andrey » Mon 29 Nov 2010 09:27

I've compared your example (it works) with my. I use these syntax:

Code: Select all

CREATE TABLE "ProductType" (
    "ProductType_id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
    "ProductType_name" VARCHAR(100)
)
It seems that quotes make difference. With field name in quotes id is not returned after 'Post' and without them it works well.

I think it should works with quotes too.

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Post by AlexP » Mon 29 Nov 2010 09:53

Hello,

Thank you for the information.
We have reproduced the problem.
We will notify you as soon as we have any results.

bork
Devart Team
Posts: 649
Joined: Fri 12 Mar 2010 07:55

Post by bork » Wed 01 Dec 2010 13:37

Hello

We have fixed this problem. This fix will be included in the next UniDAC build.

Post Reply