From: Warren Young Date: August 17 2004 6:29pm Subject: Re: enum type List-Archive: http://lists.mysql.com/plusplus/3351 Message-Id: <41224E7B.50203@etr-usa.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit 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.