[SQL-CVS] r1615 - in SQLObject/trunk/sqlobject: . mysql
SQLObject is a Python ORM.
Brought to you by:
ianbicking,
phd
|
From: <sub...@co...> - 2006-02-20 15:31:03
|
Author: phd
Date: 2006-02-20 08:30:54 -0700 (Mon, 20 Feb 2006)
New Revision: 1615
Modified:
SQLObject/trunk/sqlobject/col.py
SQLObject/trunk/sqlobject/mysql/mysqlconnection.py
Log:
Applied the patch 1432176: redundant methods in sqlobject -> foreign keys don't work.
Modified: SQLObject/trunk/sqlobject/col.py
===================================================================
--- SQLObject/trunk/sqlobject/col.py 2006-02-20 15:25:08 UTC (rev 1614)
+++ SQLObject/trunk/sqlobject/col.py 2006-02-20 15:30:54 UTC (rev 1615)
@@ -781,37 +781,9 @@
'sTName': sTName})
return constraint
- def mysqlCreateReferenceConstraint(self):
- sTName = self.soClass.sqlmeta.table
- other = findClass(self.foreignKey, self.soClass.sqlmeta.registry)
- tName = other.sqlmeta.table
- idName = other.sqlmeta.idName
- if self.cascade is not None:
- if self.cascade == 'null':
- action = 'ON DELETE SET NULL'
- elif self.cascade:
- action = 'ON DELETE CASCADE'
- else:
- action = 'ON DELETE RESTRICT'
- else:
- action = ''
- constraint = ('ALTER TABLE %(sTName)s ADD CONSTRAINT %(sTName)s_%(colName)s_to_%(tName)s '
- 'FOREIGN KEY (%(colName)s) '
- 'REFERENCES %(tName)s (%(idName)s) '
- '%(action)s' %
- {'tName': tName,
- 'colName': self.dbName,
- 'idName': idName,
- 'action': action,
- 'sTName': sTName})
- return constraint
-
def mysqlCreateSQL(self):
return SOKeyCol.mysqlCreateSQL(self)
- def mysqlCreateReferenceConstraint(self):
- return None
-
def sybaseCreateSQL(self):
sql = SOKeyCol.sybaseCreateSQL(self)
other = findClass(self.foreignKey)
Modified: SQLObject/trunk/sqlobject/mysql/mysqlconnection.py
===================================================================
--- SQLObject/trunk/sqlobject/mysql/mysqlconnection.py 2006-02-20 15:25:08 UTC (rev 1614)
+++ SQLObject/trunk/sqlobject/mysql/mysqlconnection.py 2006-02-20 15:30:54 UTC (rev 1615)
@@ -104,15 +104,9 @@
def createColumn(self, soClass, col):
return col.mysqlCreateSQL()
- def createReferenceConstraint(self, soClass, col):
- return col.mysqlCreateReferenceConstraint()
-
def createIndexSQL(self, soClass, index):
return index.mysqlCreateIndexSQL(soClass)
- def createReferenceConstraint(self, soClass, col):
- return col.mysqlCreateReferenceConstraint()
-
def createIDColumn(self, soClass):
if soClass.sqlmeta.idType == str:
return '%s TEXT PRIMARY KEY' % soClass.sqlmeta.idName
|