Page 1 of 1

using datatype set / enum in MyDAC

Posted: Tue 16 Dec 2008 14:35
by jkuiper
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?

Posted: Wed 17 Dec 2008 13:13
by Dimon
MyDAC supports the SET MySQL type. In Delphi this type is mapped to TStringField.

Posted: Thu 18 Dec 2008 19:00
by jkuiper
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.

Posted: Fri 19 Dec 2008 13:14
by Dimon
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.

Posted: Mon 22 Dec 2008 07:10
by jkuiper
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)?

Posted: Mon 22 Dec 2008 11:41
by Dimon
Yes, you can parse that string and process the values of the set.