Hi,
How can I use an ordinal type in a constant? I have this:
type TTableNames = (SETTINGS_META); //Ordinal (Enumerated types) var TableName : TTableNames; const creMetaTbl = 'CREATE TABLE IF NOT EXISTS '+ TableName.SETTINGS_META + '(' + 'KEY VARCHAR(50) UNIQUE ,' + 'VALUE VARCHAR(255))';
This gives the error: illegal expression.
How can I use an ordinal type in a constant?Just like that.
I have this:Uhm, what do you want to achieve by this design? If you want to ensure there are no duplicate table names, this is rather a task of your DBMS, not your Pascal program.
Uhm, what do you want to achieve by this design?
QuoteUhm, what do you want to achieve by this design?
What i would like is that i have all my table names in one place in one list. So if i later want to change a table name i have to change it in one place and not in a lot of places. I thought that ordinals where the way to go.
If that is not possible then i just have to type them where i need them.
What i would like is that i have all my table names in one place in one list. So if i later want to change a table name i have to change it in one place and not in a lot of places.
I thought that ordinals where the way to go.
[…] You could store them as individual constants in a separate unit, eg: […]I’m not a fan of duplicating data. Per se, I like to create enumeration data types as often as possible, because they create incompatibilites, i. e. I can use them as formal parameters and thus easily restrict the range of acceptable values.