Field type translation configuration

A big improvement to the Data Modeler would be in my eyes, if I could influence the translation of filed types in the configuration somewhere.


In the Table / Fields / Properties dialog there is a Physical type field, but it is disabled.

Very helpful would be a general translation table for each database type.

I miss the MS SQL filed types money, text and some more. 

I added it to the Feature Requests to Data Modeler

Hello, sorry, but I could not understand exactly what you mean? The physical type field is enabled when you choose the data type as "computed". This way you can type anything you want for the field type/expression.

Is it what you were looking for?

Inside the DataModeler I can choose the fieldtype money well, 

but when Aurelius expects or creates the field it is always a float type in MS SQL.

There is no way to create a money fieldtype on the database.
Even if I try the computed option as suggested.

Maybe this is a Aurelius issue?

>>> There is no way to create a money fieldtype on the database.


On the database, or in the class? Still don't get it, if you are using Data Moduler, the field is already money in the database. Can you please give specific examples?

Hi,


In the DataModeler I create a table with these fields:

Price MONEY
Percent FLOAT

the resulting Aurelius class is always a double type.

    [Column('Price', [])]
    FPrice: Nullable<double>;
    
    [Column('Percent', [])]
    FPercent: Nullable<double>;


Further when I let create the mssql database with Aurelius the types are always float, 
Price float
Percent float

Even if I change the field type outside manually the manager claims a wrong format during the structure check.

But I would like to have the field Price as a currency type in my database and maybe in the Aurelius class too, like I defined in the DataModeler.

Hi,


we cannot change that otherwise we will break backward compatibility. But we have just released the 2.5 version of TMS Data Modeler which now allows you to specify the type of the property directly. So, the default is "Nullable<double>", but now you can go to the Aurelius export mapping and change it to "Nullable<Currency>" (or just "Currency" if you will)

Hi Wagner,


Thanks a lot, that's what I wanted.

But now I get an Aurelius error during the structure check like:

"Column Table.CurrField - Type mismatch. Existing: float. Target: NUMERIC($pre, $sca)"

Perfect would be in my eyes, if the expected field type in the database is MONEY as well, not NUMERIC(y, x).

Hi Florian, again we can't change it because it will break backward compatibility. But you can create a new dialect that uses MONEY type instead of NUMERIC. This is more or less how to do it (not full code, just the key parts):


TMyMSSQLGenerator = class(TMSSQLSQLGenerator)
    procedure DefineColumnType(Column: TColumnMetadata); override;
    function GetSqlDialect: string; override;

function TMyMSSQLGenerator.GetSqlDialect: string;
begin
  Result := 'MSSQL2';
end;

procedure TMyMSSQLGenerator.DefineColumnType(Column: TColumnMetadata);
begin
  case Column.FieldType of
    ftCurrency: Column.DataType := 'MONEY';
  else
    inherited DefineColumnType(Column);
end;


then register it:

  TSQLGeneratorRegister.GetInstance.RegisterGenerator(TMyMSSQLGenerator.Create);

and then when creating your IDBConnection interface, specify the 'MSSQL2' dialect to be used as the second parameter:

MyConnection := TFireDacConnectionAdapter.Create(FDConnection1, 'MSSQL2', False);