def get_col_spec(self):
if self.precision is not None and self.length is not None:
return kw_colspec(self, "DECIMAL(%(precision)s, %(length)s)" % {'precision': self.precision, 'length' : self.length})
-class MSDouble(sqltypes.Numeric):
+class MSDouble(MSNumeric):
def __init__(self, precision=10, length=2, **kw):
if (precision is None and length is not None) or (precision is not None and length is None):
raise exceptions.ArgumentError("You must specify both precision and length or omit both altogether.")
return kw_colspec(self, "FLOAT(%(precision)s)" % {'precision': self.precision})
else:
return kw_colspec(self, "FLOAT")
-class MSBigInteger(sqltypes.Integer):
+class MSInteger(sqltypes.Integer):
def __init__(self, length=None, **kw):
self.length = length
self.unsigned = 'unsigned' in kw
self.zerofill = 'zerofill' in kw
- super(MSBigInteger, self).__init__()
+ super(MSInteger, self).__init__()
def get_col_spec(self):
if self.length is not None:
- return kw_colspec(self, "BIGINT(%(length)s)" % {'length': self.length})
+ return kw_colspec(self, "INTEGER(%(length)s)" % {'length': self.length})
else:
- return kw_colspec(self, "BIGINT")
-class MSInteger(sqltypes.Integer):
+ return kw_colspec(self, "INTEGER")
+class MSBigInteger(MSInteger):
def __init__(self, length=None, **kw):
self.length = length
self.unsigned = 'unsigned' in kw
self.zerofill = 'zerofill' in kw
- super(MSInteger, self).__init__()
+ super(MSBigInteger, self).__init__()
def get_col_spec(self):
if self.length is not None:
- return kw_colspec(self, "INTEGER(%(length)s)" % {'length': self.length})
+ return kw_colspec(self, "BIGINT(%(length)s)" % {'length': self.length})
else:
- return kw_colspec(self, "INTEGER")
+ return kw_colspec(self, "BIGINT")
class MSSmallInteger(sqltypes.Smallinteger):
def __init__(self, length=None, **kw):
self.length = length
return None
else:
return buffer(value)
-class MSEnum(sqltypes.String):
+
+class MSMediumBlob(MSBinary):
+ def get_col_spec(self):
+ return "MEDIUMBLOB"
+
+class MSEnum(MSString):
def __init__(self, *enums):
self.__enums_hidden = enums
length = 0
Column('id', Integer, primary_key=True),
Column('num1', mysql.MSInteger(unsigned=True)),
Column('text1', mysql.MSLongText),
- Column('text2', mysql.MSLongText())
+ Column('text2', mysql.MSLongText()),
+ Column('num2', mysql.MSBigInteger),
+ Column('num3', mysql.MSBigInteger()),
+ Column('num4', mysql.MSDouble),
+ Column('num5', mysql.MSDouble()),
+ Column('enum1', mysql.MSEnum('"black"', '"white"')),
)
try:
table.create(checkfirst=True)
assert t2.c.num1.type.unsigned
assert isinstance(t2.c.text1.type, mysql.MSLongText)
assert isinstance(t2.c.text2.type, mysql.MSLongText)
+ assert isinstance(t2.c.num2.type, mysql.MSBigInteger)
+ assert isinstance(t2.c.num3.type, mysql.MSBigInteger)
+ assert isinstance(t2.c.num4.type, mysql.MSDouble)
+ assert isinstance(t2.c.num5.type, mysql.MSDouble)
+ assert isinstance(t2.c.enum1.type, mysql.MSEnum)
t2.drop()
t2.create()
finally: