Web forum is in read-only mode. Login as active registered customer for write access
  Forum Search   New Posts New Posts

Aurelius export: no indices

 Post Reply Post Reply
Author
Grobety Stephane View Drop Down
Senior Member
Senior Member
Avatar

Joined: 04 Jan 2014
Posts: 108
Post Options Post Options   Quote Grobety Stephane Quote  Post ReplyReply Direct Link To This Post Topic: Aurelius export: no indices
    Posted: 28 Mar 2018 at 9:56am
Hello,

I have several indices defined in my data structure. Yet, the corresponding DBIndex decoration is missing from all classes exported as Aurelius entities.

Is there a parameter somewhere that governs this behavior ?
Back to Top
Wagner R. Landgraf View Drop Down
TMS Support
TMS Support
Avatar

Joined: 18 May 2010
Posts: 2399
Post Options Post Options   Quote Wagner R. Landgraf Quote  Post ReplyReply Direct Link To This Post Posted: 28 Mar 2018 at 2:29pm
No, DBIndex attribute is not exported by Data Modeler, yet.
Back to Top
Grobety Stephane View Drop Down
Senior Member
Senior Member
Avatar

Joined: 04 Jan 2014
Posts: 108
Post Options Post Options   Quote Grobety Stephane Quote  Post ReplyReply Direct Link To This Post Posted: 28 Mar 2018 at 3:29pm
Thank you for your answer. Any idea when it will be included ?
Back to Top
Wagner R. Landgraf View Drop Down
TMS Support
TMS Support
Avatar

Joined: 18 May 2010
Posts: 2399
Post Options Post Options   Quote Wagner R. Landgraf Quote  Post ReplyReply Direct Link To This Post Posted: 28 Mar 2018 at 8:18pm
We have it in our huge backlog, but no timeframe set yet. Maybe in a couple of months.
Back to Top
Grobety Stephane View Drop Down
Senior Member
Senior Member
Avatar

Joined: 04 Jan 2014
Posts: 108
Post Options Post Options   Quote Grobety Stephane Quote  Post ReplyReply Direct Link To This Post Posted: 02 Jul 2018 at 3:09pm
Hello,

would it be possible to have an update on the status of this feature ? 

We're moving ahead with our migration of a rather large BDE application (100+ tables) that makes heavy use of indices and creating them manually will be a rather long task: I don't want to spend weeks of work on that if the functionality will be readily available soon (plus, manually adding the index attributes makes it impossible to re-generate the entities).

Thanks
Back to Top
Grobety Stephane View Drop Down
Senior Member
Senior Member
Avatar

Joined: 04 Jan 2014
Posts: 108
Post Options Post Options   Quote Grobety Stephane Quote  Post ReplyReply Direct Link To This Post Posted: 06 Jul 2018 at 8:10am
Could I get an answer to my question, please ?
Back to Top
Farias Anderson View Drop Down
New Member
New Member
Avatar

Joined: 19 Jan 2018
Posts: 25
Post Options Post Options   Quote Farias Anderson Quote  Post ReplyReply Direct Link To This Post Posted: 06 Jul 2018 at 4:12pm
I guess you can use the Script tab to implement what you need:

procedure OnClassGenerated(Args: TClassGeneratedArgs);
begin
  { read Args.DBTable.Indexes and write your DBIndex attributes }
end;
Back to Top
Grobety Stephane View Drop Down
Senior Member
Senior Member
Avatar

Joined: 04 Jan 2014
Posts: 108
Post Options Post Options   Quote Grobety Stephane Quote  Post ReplyReply Direct Link To This Post Posted: 06 Jul 2018 at 4:55pm
That is an excellent idea! Thanks
Back to Top
Wagner R. Landgraf View Drop Down
TMS Support
TMS Support
Avatar

Joined: 18 May 2010
Posts: 2399
Post Options Post Options   Quote Wagner R. Landgraf Quote  Post ReplyReply Direct Link To This Post Posted: 09 Jul 2018 at 11:26pm
Indeed, I simply forgot that you could do that from customization script. That was actually the reason to implement the script: to allow users export more attribute and/or customize generated code, without the need to implement every single feature in Data Modeler.

You can use the following code in customization script to export DBIndex attributes from the existing indexes:

procedure OnClassGenerated(Args: TClassGeneratedArgs);
var                                                    
  I, J: Integer;
  Idx: TGDAOIndex;    
  Fields: string;         
  Attr: TCodeAttributeDeclaration;
begin                                             
  for I := 0 to Args.DBTable.Indexes.Count - 1 do
  begin                                               
    Idx := Args.DBTable.Indexes;
    Fields := '';
    for J := 0 to Idx.IFields.Count - 1 do          
    begin
      if Fields <> '' then Fields := Fields + ',';
      Fields := Fields + Idx.IFields[J].FieldName;
    end;
    Attr := Args.CodeType.AddAttribute('DBIndex');
    Attr.AddRawArgument('''' + Idx.IndexName + '''');
    Attr.AddRawArgument('''' + Fields + '''');
  end;
end;
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down