MSMediumInt

Issue #1146 resolved
Mike Bayer repo owner created an issue

the parade of random MySQL types never ends, here's MSMediumInt:

dex: lib/sqlalchemy/databases/mysql.py
===================================================================
--- lib/sqlalchemy/databases/mysql.py   (revision 5048)
+++ lib/sqlalchemy/databases/mysql.py   (working copy)
@@ -172,7 +172,7 @@
    'MSMediumBlob', 'MSMediumText', 'MSNChar', 'MSNVarChar',
    'MSNumeric', 'MSSet', 'MSSmallInteger', 'MSString', 'MSText',
    'MSTime', 'MSTimeStamp', 'MSTinyBlob', 'MSTinyInteger',
-    'MSTinyText', 'MSVarBinary', 'MSYear' )
+    'MSTinyText', 'MSVarBinary', 'MSYear', 'MSMediumInteger' )


RESERVED_WORDS = util.Set(
@@ -549,6 +549,33 @@
            return self._extend("BIGINT")


+class MSMediumInteger(MSInteger):
+    """MySQL MEDIUMINTEGER type."""
+
+    def __init__(self, length=None, **kw):
+        """Construct a MEDIUMINTEGER
+
+        length
+          Optional, maximum display width for this number.
+
+        unsigned
+          Optional.
+
+        zerofill
+          Optional. If true, values will be stored as strings left-padded with
+          zeros. Note that this does not effect the values returned by the
+          underlying database API, which continue to be numeric.
+        """
+
+        super(MSMediumInteger, self).__init__(length, **kw)
+
+    def get_col_spec(self):
+        if self.length is not None:
+            return self._extend("MEDIUMINT(%(length)s)" % {'length': self.length})
+        else:
+            return self._extend("MEDIUMINT")
+
+
class MSTinyInteger(MSInteger):
    """MySQL TINYINT type."""

the feature is requested for 0.4 and 0.5.

Comments (2)

  1. Log in to comment