using datatype set / enum in MyDAC

Discussion of open issues, suggestions and bugs regarding MyDAC (Data Access Components for MySQL) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
jkuiper
Posts: 138
Joined: Fri 04 Aug 2006 14:17

using datatype set / enum in MyDAC

Post by jkuiper » Tue 16 Dec 2008 14:35

in MySQL you can create a table like this:

Code: Select all

 CREATE TABLE set_test(
    rowid INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
    myset SET('Travel','Sports','Dancing','Fine Dining')
  );
Is it possible to use this datatype field with MyDAC and delphi?

Dimon
Devart Team
Posts: 2910
Joined: Mon 05 Mar 2007 16:32

Post by Dimon » Wed 17 Dec 2008 13:13

MyDAC supports the SET MySQL type. In Delphi this type is mapped to TStringField.

jkuiper
Posts: 138
Joined: Fri 04 Aug 2006 14:17

Post by jkuiper » Thu 18 Dec 2008 19:00

Conclusion: it doesn't work at the way it should be. You should really expecting an emuration back and not a string.

But it doesn't matter. It's not a standard database feature and is better to forget.

Dimon
Devart Team
Posts: 2910
Joined: Mon 05 Mar 2007 16:32

Post by Dimon » Fri 19 Dec 2008 13:14

The point is that Delphi does not support the SET field type. Also MySQL server returns the string type for this field.
However, MySQL server processes this field type correctly and if you set a value that is not included in specified set, this value will not be set.

jkuiper
Posts: 138
Joined: Fri 04 Aug 2006 14:17

Post by jkuiper » Mon 22 Dec 2008 07:10

I understand. Will MyDAC read the set into the fielddefs property, so the values can be parsed into a TString(list) (with an own procedure offcource)?

Dimon
Devart Team
Posts: 2910
Joined: Mon 05 Mar 2007 16:32

Post by Dimon » Mon 22 Dec 2008 11:41

Yes, you can parse that string and process the values of the set.

Post Reply