Gianni Pucciani wrote:
> Can anyone tell me how this type in converted in c++ and wich type I
> have to use if I want to test such a field?
From reading the MySQL docs, it appears that if you don't do anything
special, it gets treated as a string type.
However, if you execute a custom query, you can force it to send you the
integer value behind the enum:
SELECT enum_column+0 from my_table;
Then you could declare a parallel C enum, and do comparisons against
those values. You would treat the column as an integer in this case.
When you insert an integer into an enum column, MySQL does the right
thing, and C++ can treat enums as integers as well.
> I've tried with the followng:
> if (row[o] == "value1") do something...
Assuming that row[o] is returning type std::string, operator == isn't
going to do what you want. Read the manual on this. What you want is
the compare() member function.
|• enum type||Gianni Pucciani||17 Aug|
| • Re: enum type||Warren Young||17 Aug|