Robin,

Sorry to see you go.  One point, though...

Robin Haswell wrote:
> SQLObject
> =========
> * I also can't stand how if you remove a row from the database that has
> a reference somewhere, SO will raise SQLObjectNotFound whenever it goes
> near that data. My PHP apps don't suffer from this because I write the
> complete three-table inner join in SQL, which will ignore missing
> references (and is a boatload faster). It makes the DB a little messy
> sometimes, but that's nothing compared to DOSing the page with a 500
> error. Updating my CRUD methods every time I associate a new object is
> *not* fun web development.
>
> I know the last point can be solved with using a DB that supports
> foreign key constrains. We use MySQL, there are no PG servers, that's
> just the way of it. I could convert my tables to InnoDB - I probably
> will in future.

I definitely agree with this, however, SQLObject has a fairly
undocumented feature where it will "fake" referential integrity
whenever you use a ForeignKey column on a DB without native referential
integrity.  You get at it via the "cascade" keyword argument:
(from SQLObject col.py:)
        # cascade can be one of:
        # None: no constraint is generated
        # True: a CASCADE constraint is generated
        # False: a RESTRICT constraint is generated
        # 'null': a SET NULL trigger is generated

All the magic happens in destroySelf() (which is itself called by
delete()).  And it works on MySQL with MyISAM tables.  Plus, when you
migrate to an engine that *does* support referential integrity, the
constraints get generated automagically for nearly seamless transition.

It took me quite a bit of searching on mailing lists and newsgroups to
find this tidbit.  Hopefully this will help some other hapless TG
early-adopter.


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"TurboGears" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/turbogears
-~----------~----~----~----~------~----~------~--~---

Reply via email to