Subject Re: [Firebird-Architect] Enumerated Types
Author Arno Brinkman
Hi,

> I keep coming up against the problem of interpreting Delphi
> enumerated types into database field values and back again. Soon I
> will have to translate my app into different languages, and the
> problem will increase as this happens. So I am asking whether a new
> datatype might be possible - called say "Enumerated".
>
> Here is a sample scenario.
>
> In Delphi I define
>
> TOrderStatus = (osQuotation,osOrder,osDelivered,osInvoiced);
> TOrderStatuses = array[TOrderStatus] of string;
>
> In my language dependent Constants unit I define a constant as
>
> Const
> OrderStatuses:TOrderStatuses =
> ('Quotation','Order','Delivered','Invoiced');
>
> So whenever I refer to it I can use
>
> OrderStatuses[osQuotation]
>
> rather than a literal string.

I use this in delphi :

type
TOrderStatus = $01..$04;
TOrderStatuses = set of TOrderStatus;

const
osQuotation = TOrderStatus($01);
osOrder = TOrderStatus($02);
osDelivered = TOrderStatus($03);
osInvoiced = TOrderStatus($04);

Now jou can just store integers in your database and easy assign it to your
types in Delphi.


Regards,
Arno Brinkman
ABVisie

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Firebird links :
http://www.firebirdsql.com
http://www.firebirdsql.info
http://www.fingerbird.de/
http://www.comunidade-firebird.org/


Nederlandse firebird nieuwsgroep :
news://80.126.130.81