Author: phd
Date: 2006-02-20 08:33:00 -0700 (Mon, 20 Feb 2006)
New Revision: 1616
Modified:
home/phd/SQLObject/paramstyles/sqlobject/col.py
home/phd/SQLObject/paramstyles/sqlobject/mysql/mysqlconnection.py
Log:
Merged patches from the revisions 1614:1615 from the trunk
Modified: home/phd/SQLObject/paramstyles/sqlobject/col.py
===================================================================
--- home/phd/SQLObject/paramstyles/sqlobject/col.py 2006-02-20 15:30:54 UTC (rev 1615)
+++ home/phd/SQLObject/paramstyles/sqlobject/col.py 2006-02-20 15:33:00 UTC (rev 1616)
@@ -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: home/phd/SQLObject/paramstyles/sqlobject/mysql/mysqlconnection.py
===================================================================
--- home/phd/SQLObject/paramstyles/sqlobject/mysql/mysqlconnection.py 2006-02-20 15:30:54 UTC (rev 1615)
+++ home/phd/SQLObject/paramstyles/sqlobject/mysql/mysqlconnection.py 2006-02-20 15:33:00 UTC (rev 1616)
@@ -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
|