0.4.0beta6
----------
-- mapper compilation has been reorganized such that most compilation
- occurs upon mapper construction. this allows us to have fewer
+- Mapper compilation has been reorganized such that most compilation
+ occurs upon mapper construction. This allows us to have fewer
calls to mapper.compile() and also to allow class-based properties
to force a compilation (i.e. User.addresses == 7 will compile all
mappers; this is [ticket:758]). The only caveat here is that
so mappers within inheritance relationships need to be constructed in
inheritance order (which should be the normal case anyway).
-- removed "parameters" argument from clauseelement.compile(), replaced with
- "column_keys". the parameters sent to execute() only interact with the
- insert/update statement compilation process in terms of the column names
- present but not the values for those columns.
- produces more consistent execute/executemany behavior, simplifies things a
- bit internally.
+- Removed "parameters" argument from clauseelement.compile(), replaced with
+ "column_keys". The parameters sent to execute() only interact with the
+ insert/update statement compilation process in terms of the column names
+ present but not the values for those columns. Produces more consistent
+ execute/executemany behavior, simplifies things a bit internally.
+- Fixed reflection of the empty string for mysql enums.
+
0.4.0beta5
----------
self.enums = strip_enums
self.strict = kw.pop('strict', False)
- length = max([len(v) for v in strip_enums])
+ length = max([len(v) for v in strip_enums] + [0])
super(MSEnum, self).__init__(length, **kw)
def bind_processor(self, dialect):
r'(?:\((\d+)\))?(?=\,|$))+' % quotes)
# 'foo' or 'foo','bar' or 'fo,o','ba''a''r'
- self._re_csv_str = _re_compile(r'\x27(?:\x27\x27|[^\x27])+\x27')
+ self._re_csv_str = _re_compile(r'\x27(?:\x27\x27|[^\x27])*\x27')
# 123 or 123,456
self._re_csv_int = _re_compile(r'\d+')
r'%(iq)s(?P<name>(?:%(esc_fq)s|[^%(fq)s])+)%(fq)s +'
r'(?P<coltype>\w+)'
r'(?:\((?P<arg>(?:\d+|\d+,\d+|'
- r'(?:\x27(?:\x27\x27|[^\x27])+\x27,?)+))\))?'
+ r'(?:\x27(?:\x27\x27|[^\x27])*\x27,?)+))\))?'
r'(?: +(?P<unsigned>UNSIGNED))?'
r'(?: +(?P<zerofill>ZEROFILL))?'
r'(?: +CHARACTER SET +(?P<charset>\w+))?'
self.assert_eq(res, expected)
enum_table.drop()
+ @testing.supported('mysql')
+ def test_enum_parse(self):
+ """More exercises for the ENUM type."""
+
+ db = testbase.db
+ enum_table = Table('mysql_enum', MetaData(testbase.db),
+ Column('e1', mysql.MSEnum("'a'")),
+ Column('e2', mysql.MSEnum("''")),
+ Column('e3', mysql.MSEnum("'a'", "''")),
+ Column('e4', mysql.MSEnum("''", "'a'")),
+ Column('e5', mysql.MSEnum("''", "'''a'''", "'b''b'")))
+ try:
+ enum_table.create()
+ reflected = Table('mysql_enum', MetaData(testbase.db),
+ autoload=True)
+ for t in enum_table, reflected:
+ assert t.c.e1.type.enums == ['a']
+ assert t.c.e2.type.enums == ['']
+ assert t.c.e3.type.enums == ['a', '']
+ assert t.c.e4.type.enums == ['', 'a']
+ assert t.c.e5.type.enums == ['', "''a''", "b''b"]
+ finally:
+ enum_table.drop()
+
@testing.supported('mysql')
@testing.exclude('mysql', '<', (5, 0, 0))
def test_type_reflection(self):
( mysql.MSBlob(1234), mysql.MSBlob()),
( mysql.MSMediumBlob(),),
( mysql.MSLongBlob(),),
+ ( mysql.MSEnum("''","'fleem'"), ),
]
columns = [Column('c%i' % (i + 1), t[0]) for i, t in enumerate(specs)]