[SQL-CVS] r2363 - SQLObject/trunk/sqlobject
SQLObject is a Python ORM.
Brought to you by:
ianbicking,
phd
|
From: <sub...@co...> - 2007-03-02 14:34:25
|
Author: phd
Date: 2007-03-02 07:34:18 -0700 (Fri, 02 Mar 2007)
New Revision: 2363
Modified:
SQLObject/trunk/sqlobject/col.py
Log:
Applied the patch 1450576: support for MySQL INT type attributes: UNSIGNED, ZEROFILL.
Modified: SQLObject/trunk/sqlobject/col.py
===================================================================
--- SQLObject/trunk/sqlobject/col.py 2007-03-02 14:28:10 UTC (rev 2362)
+++ SQLObject/trunk/sqlobject/col.py 2007-03-02 14:34:18 UTC (rev 2363)
@@ -594,6 +594,11 @@
class SOIntCol(SOCol):
# 3-03 @@: support precision, maybe max and min directly
+ def __init__(self, **kw):
+ self.length = popKey(kw, 'length')
+ self.unsigned = bool(popKey(kw, 'unsigned'))
+ self.zerofill = bool(popKey(kw, 'unsigned'))
+ SOCol.__init__(self, **kw)
def autoConstraints(self):
return [consts.isInt]
@@ -602,8 +607,21 @@
return [IntValidator(name=self.name)] + \
super(SOIntCol, self).createValidators()
+ def addSQLAttrs(self, str):
+ _ret = str
+ if str is None or len(str) < 1:
+ return None
+
+ if self.length >= 1:
+ _ret = "%s(%d)" % (_ret, self.length)
+ if self.unsigned:
+ _ret = _ret + " UNSIGNED"
+ if self.zerofill:
+ _ret = _reg + " ZEROFILL"
+ return _ret
+
def _sqlType(self):
- return 'INT'
+ return self.addSQLAttrs("INT")
class IntCol(Col):
baseClass = SOIntCol
|