Menu

Enum values and sets

Help
2007-01-29
2012-09-19
  • Chuck Esterbrook

    Hi,

    I'm getting warmed up with my new Mac and one of the things I have run into with my fresh setup is that enum values now come in as Sets instead of strings. So whereas I used to get 'green' in Python, now I get Set(['green']).

    My table is this:
    mysql> describe Foo;
    +-----------+----------------------------+------+-----+---------+----------------+
    | Field | Type | Null | Key | Default | Extra |
    +-----------+----------------------------+------+-----+---------+----------------+
    | serialNum | int(11) | | PRI | NULL | auto_increment |
    | e | enum('red','green','blue') | YES | | NULL | |
    +-----------+----------------------------+------+-----+---------+----------------+
    2 rows in set (0.03 sec)

    My versions are:
    Python 2.5
    MySQL-python 1.2.2b2
    MySQL 4.1.x
    MacOS X 10.4.x

    Is this normal/expected? I thought an enum could only hold one of the values (red or green or blue) so Set() does not seem applicable. However, if it is for some reason, I'll update my software to deal with it.

    Thanks,
    -Chuck

     
    • Chuck Esterbrook

      Will enums be included in the regression test suite for MySQLdb?

       
      • Andy Dustman

        Andy Dustman - 2007-01-30

        That all depends on if someone writes one.

        enums are just strings anyway as far as the MySQL C API is concerned.

         
    • Andy Dustman

      Andy Dustman - 2007-01-29

      No, it's not right. Might be a new bug, but see #1561190.

       
    • Andy Dustman

      Andy Dustman - 2007-01-29

      Get the current MySQLdb-1.2 branch; it has the fix and will be in 1.2.2b3.

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.