#1 2014-11-29 09:09:50

itSDS
Member
From: Germany
Registered: 2014-04-24
Posts: 516

Indexname generation causes every time Index generation

Hi AB,
i found a little Bug in your Index - Name generation if IndexName Length > 27 Chars.

I create a unique index in InitializeTable. The Tablename and the Fieldname together is longer than 40 chars.
Everytime i start my Program a new Index is generated.

The Reason is that the Indexname is different every time !

I saw in your name generation that you append a tickcount - may be that's the reason why.
The Idea to generate a Unique ID from the names sounds accectable.

My private idea is:
Can you modify the Indexname Generation depending on the Database Type ?
Some Databases support Indexnames longer than 32 chars (Seems to be an outdated limit coming from former times i think)
I remember the old btrieve day's on novell.

ATM i specify the IndexName on my own. But there i have a problem with an Index i create for derived Classes. In that case i have to generate a unique Index Name in the parent class else it will not be created:

class procedure TSQLDFExampleTableReferenzRecord.InitializeTable(Server: TSQLRestServer; const FieldName: RawUTF8; Options: TSQLInitializeTableOptions);
begin
  if (FieldName = '') or (FieldName = 'LID') then
    Server.CreateSQLIndex(Self, 'Fieldname', false, 'IDX' + Self.ClassName.Substring(4, Self.Classname.Length - 10)+'Fieldname');   
end;

here i would like to use '' as indexname but like also to get a readable Indexname.

Last edited by itSDS (2014-11-29 09:14:37)


Rad Studio 12.1 Santorini

Offline

#2 2014-11-29 15:16:02

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,662
Website

Re: Indexname generation causes every time Index generation

Indeed.
This GetTickCount64 was superfluous.

Should be fixed by http://synopse.info/fossil/info/c08af935f7

Online

Board footer

Powered by FluxBB