Retrieving enum types as string

Forum related to MySQL

Moderators: gto, cipto_kh, EgonHugeist

Post Reply
PhillHS
Fresh Boarder
Fresh Boarder
Posts: 12
Joined: 23.05.2007, 14:11
Location: Coventry, UK

Retrieving enum types as string

Post by PhillHS »

Hi,

Using Delphi 7, Zeos 6.6.0.

I have a database table in MySQL 5.0.26 (linux) that has the following fields defined :

iselectrical enum('Y','N')
Interest enum('Y','N','U')

When I try and uses FieldByName('iselectrical').AsString it always returns 'true' or 'false', whereas if i use FieldByName('Interest'), it returns one of 'Y','N' or 'U'.

When I look at the type information for the 'iselectrical' field it is set to ftBoolean, whereas the type of 'Interest' is ftString.

Is there anyway of overiding this behavior, though I can understand why this is coded this way.

Cheers.

Phill.
User avatar
mdaems
Zeos Project Manager
Zeos Project Manager
Posts: 2766
Joined: 20.09.2005, 15:28
Location: Brussels, Belgium
Contact:

Post by mdaems »

Edit the ConvertMySQLTypeToSQLType function in ZDbcMysqlUtils.pas.

Mark
Image
Post Reply