Hi All,
In the Web2py book, in the DAL section, one of the arguments of the
SQLField constructor is "ondelete" and the explanation is that any
SQLField that has the "ondelete="CASCADE" will have all referencing
records deleted when it is deleted.
But i have noticed that this doesnt work for me. Can anyone explain
how the ondelete works?
Here is an example of the code:

db.define_table("Person",
SQLField("name", "string", length=32, default=None, required=True,
requires=IS_NOT_EMPTY(), ondelete="cascade")
)

db.define_table("Pet",
SQLField("pet_name', "string", lentgth=32, default=None,
required=True),
SQLField("pet_owner", db.Person, requires=IS_IN_DB(db, "Person.id",
"Person.name"))
)

after creating records of a pet owner and some pets, if i try deleting
a pet owner, i would expect the records of all the pets owned by that
"Person" to be deleted also but the records are still there.
I would like to know if i am missing something here? Any explanation
is welcome.
Thanks
Pystar.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to