[SQL-CVS] r209 - in trunk/SQLObject: docs sqlobject
SQLObject is a Python ORM.
Brought to you by:
ianbicking,
phd
From: <sub...@co...> - 2004-08-30 21:25:18
|
Author: ianb Date: 2004-08-30 13:15:21 -0400 (Mon, 30 Aug 2004) New Revision: 209 Modified: trunk/SQLObject/docs/News.txt trunk/SQLObject/sqlobject/col.py Log: Added CASCADE SET NULL option Modified: trunk/SQLObject/docs/News.txt =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- trunk/SQLObject/docs/News.txt 2004-08-30 17:07:02 UTC (rev 208) +++ trunk/SQLObject/docs/News.txt 2004-08-30 17:15:21 UTC (rev 209) @@ -43,10 +43,10 @@ * ``*Col`` constructors now support cascade: ``cascade=3DNone`` (default) means no constraint; ``cascade=3DTrue`` means that if the foreign key is deleted, the object will be deleted; - ``cascade=3DFalse`` means that the delete will fail. ``SET NULL`` is - not implemented, and the constraints are only implemented in the - DBMS, not in SQLObject (i.e., they will not work in databases like - MySQL and SQLite). + ``cascade=3DFalse`` means that the delete will fail; + ``cascade=3D"null"`` means that the column will be set to NULL. The + constraints are only implemented in the DBMS, not in SQLObject + (i.e., they will not work in databases like MySQL and SQLite). =20 * New ``_create(id, **kw)`` method that can be overridden to intercept and modify attempts to insert rows in the database. Modified: trunk/SQLObject/sqlobject/col.py =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- trunk/SQLObject/sqlobject/col.py 2004-08-30 17:07:02 UTC (rev 208) +++ trunk/SQLObject/sqlobject/col.py 2004-08-30 17:15:21 UTC (rev 209) @@ -450,7 +450,9 @@ tName =3D other._table idName =3D other._idName if self.cascade is not None: - if self.cascade: + if self.cascade.lower() =3D=3D 'null': + action =3D 'ON DELETE SET NULL' + elif self.cascade: action =3D 'ON DELETE CASCADE' else: action =3D 'ON DELETE RESTRICT' |