[SOLVED]: SQLite3 Posting error with "index" as a field name

Discussion of open issues, suggestions and bugs regarding UniDAC (Universal Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
LongHairCook
Posts: 3
Joined: Wed 15 Dec 2010 00:32

[SOLVED]: SQLite3 Posting error with "index" as a field name

Post by LongHairCook » Wed 15 Dec 2010 00:53

First off thanks for making an excellent set of components!

I'm currently testing uniDAC v3.50.0.13 and have come across an error posting to a SQLite3 table with "index" as a field name with, which also happens to be the primary key field and is part of a secondary key. Not my table I'm testing against so can't change the field name. Tested the table against multiple front ends and they handle posting to the table fine.

I did however change the field name to test if the error would go away if the field name "index" wasn't actually the name and there wasn't an error on post.

Any suggestions/fixes for this besides the obvious of changing the field name and associated indexes?

Any help would be greatly appreciated.
Last edited by LongHairCook on Thu 16 Dec 2010 16:12, edited 1 time in total.

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

Post by bork » Wed 15 Dec 2010 15:51

Hello

Can you provide DDL script for creating your table where the same filed is a part of the primary key and a part of the secondary key. It will be very helpful to resolve this issue.

LongHairCook
Posts: 3
Joined: Wed 15 Dec 2010 00:32

Post by LongHairCook » Wed 15 Dec 2010 16:02

Hi,

Thanks for the quick response! Here's the SQL taken from SQLite Administrator:

CREATE TABLE Categories(
[index] [integer] NOT NULL PRIMARY KEY,
[active] [integer] NOT NULL DEFAULT (1),
[deleted] [integer] NOT NULL DEFAULT (0),
[icon] [integer] NOT NULL DEFAULT (-1),
[name] [varchar](255) NOT NULL DEFAULT ('Something'),
[parentIndex] [integer] NOT NULL DEFAULT (0),
[originalName] [varchar](255) NOT NULL DEFAULT (''));

CREATE UNIQUE INDEX Categories_IndexAndActiveAndDeletedAndNameAndParentIndex on Categories (
[index] ASC,
[active] ASC,
[deleted] ASC,
[name] ASC,
[parentIndex] ASC);

Thanks again for taking the time in looking at this.

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

Post by AlexP » Thu 16 Dec 2010 08:16

Hello,

To resolve the problem you should set the UniQuery.Options.QuoteNames property to true.

LongHairCook
Posts: 3
Joined: Wed 15 Dec 2010 00:32

Post by LongHairCook » Thu 16 Dec 2010 16:10

To resolve the problem you should set the UniQuery.Options.QuoteNames property to true.
This worked like a charm. Thanks very much for the quick responses. It's great to see support as good as the components!

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

Post by AlexP » Thu 16 Dec 2010 16:22

Hello,

It is good to see that this problem was solved. If any other questions come up, please contact us.

Post Reply