Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 3 of 3 total
Thread IndexFieldnames property and primary keys
Wed, Jul 28 2010 8:59 AMPermanent Link

Kick

ENK Software

Hi,

I am using a edbtable with a clientdataset and a datasetprovider. It seems that setting the edbTable.IndexFieldnames property to the fieldname that is the primary key produces a "Table1: Index 'GLN' not found" message when I open the clientdataset. If I create an index on the field GLN rather than creating a primary key constraint for the GLN field it works fine.

The problem occurs in TEDBTable.PSGetDefaultOrder, it seems the FindexName variable is inspected first and seems to have the value of IndexFieldnames. I think something is off there.
Wed, Jul 28 2010 4:53 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Kick,

<< I am using a edbtable with a clientdataset and a datasetprovider. It
seems that setting the edbTable.IndexFieldnames property to the fieldname
that is the primary key produces a "Table1: Index 'GLN' not found" message
when I open the clientdataset. If I create an index on the field GLN rather
than creating a primary key constraint for the GLN field it works fine.

The problem occurs in TEDBTable.PSGetDefaultOrder, it seems the FindexName
variable is inspected first and seems to have the value of IndexFieldnames.
I think something is off there. >>

Are you running this in the IDE ?  The initial block in PSGetDefaultOrder
has a try..except, so it expects to encounter an exception in certain cases,
and then carries on by trying to use the primary key, and then any unique
key as the order.

As for what can cause the exception - the standard
TIndexDefs.GetIndexForFields method is very picky and will ignore indexes
that use case-insensitive columns.  You can see this by looking at the
method in the standard db.pas unit that comes with Delphi.  So, if you have
columns in the  primary key that are marked with the "_CI" collation flag,
then that's the source of the original exception.

--
Tim Young
Elevate Software
www.elevatesoft.com
Thu, Jul 29 2010 2:59 PMPermanent Link

Kick

ENK Software

"Tim Young [Elevate Software]" wrote:

<<Are you running this in the IDE ?  The initial block in PSGetDefaultOrder
has a try..except, so it expects to encounter an exception in certain cases,
and then carries on by trying to use the primary key, and then any unique
key as the order.>>

Yes, It's only in the IDE. I thought the clientdataset wasn't filled correctly due to this exception but that seemed to be another problem.... my fault!

Thanks
Image