Aurelius export: no indices


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 ?

No, DBIndex attribute is not exported by Data Modeler, yet.

Thank you for your answer. Any idea when it will be included ?

We have it in our huge backlog, but no timeframe set yet. Maybe in a couple of months.


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).


Could I get an answer to my question, please ?

I guess you can use the Script tab to implement what you need:

procedure OnClassGenerated(Args: TClassGeneratedArgs);
  { read Args.DBTable.Indexes and write your DBIndex attributes }

That is an excellent idea! Thanks

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);
  I, J: Integer;
  Idx: TGDAOIndex;    
  Fields: string;         
  Attr: TCodeAttributeDeclaration;
  for I := 0 to Args.DBTable.Indexes.Count - 1 do
    Idx := Args.DBTable.Indexes;
    Fields := '';
    for J := 0 to Idx.IFields.Count - 1 do          
      if Fields <> '' then Fields := Fields + ',';
      Fields := Fields + Idx.IFields[J].FieldName;
    Attr := Args.CodeType.AddAttribute('DBIndex');
    Attr.AddRawArgument('''' + Idx.IndexName + '''');
    Attr.AddRawArgument('''' + Fields + '''');