ticket #1146 completed in r5056, r5057. (0.5/0.4)

On Aug 20, 2008, at 4:31 PM, Ross Vandegrift wrote:

>
> Hey Mike,
>
> I have a DB that uses MySQL's MEDIUMINT type in a bunch of places.
> Because many of those are used as foreign keys, I need SQLAlchemy to
> be happy emitting tables with MEDIUMINT types.  The below patch does
> that.  This is against an 0.4 checkout from a few mins ago.
>
>
> Index: 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."""
>
>
> -- 
> Ross Vandegrift
> [EMAIL PROTECTED]
>
> "The good Christian should beware of mathematicians, and all those who
> make empty prophecies. The danger already exists that the  
> mathematicians
> have made a covenant with the devil to darken the spirit and to  
> confine
> man in the bonds of Hell."
>       --St. Augustine, De Genesi ad Litteram, Book II, xviii, 37
>
> >


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to sqlalchemy@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to