Ok, so I went on and added a SConnection.detachDataSet() static method
to SConnection.
Beware, SConnection.commit(), SConnection.detachAndClose(), ... still
destroy the records, so detachDataSet() must be called before if you
wanted it to have anything to detach...
This is in 'franck' branch of svn.
Franck
Le lundi 04 février 2008 à 21:04 +1000, Anthony & Melissa Berglas a
écrit :
> I like your idea of a detach all records
> method. It also avoids the issues of partial
> detachment, where children are detached but not parents.
>
> Anthony
>
> At 07:46 PM 04-02-08, Franck Routier wrote:
>
> >Hi Anthony,
> >
> >in my app, I tend to always detach records, to display and update
> them
> >in the presentation layer. I also detach them to handle business
> rules
> >in the business layer. Cases where I read / udpate / commit from
> within
> >a single Simpleorm transaction are ... well, I don't have such case
> >until now :) And I have been beaten by the destroy behaviour in
> methods
> >that were only querying data, where I would detach the main record,
> but
> >not the one implicitely attached to the transaction because they were
> >references.
> >
> >But I understand your argument. Maybe I could add a method to
> >SConnection to detach all records, leaving the default behaviour to
> >destroying, but giving one stop choice for those of the detaching
> kind
> >like me.
> >
> >Don't know if somebody else has an opinion on the subject ?
> >
> >Franck
> >
> >Le dimanche 03 février 2008 à 19:50 +1000, Anthony & Melissa Berglas
> a
> >écrit :
> > > Simply that accessing records after a commit is probably a
> > > bug. Updates to the records will not be reflected in the
> > > database. So the symptoms could be obscure and nasty. I do prefer
> > > the explicit detach.
> > >
> > > Anthony
> > >
> > > At 08:27 PM 29-01-08, Franck Routier wrote:
> > >
> > > >Hi,
> > > >
> > > >I am considering making detaching the records from the connection
> the
> > > >default behaviour, instead of destroying them, when
> > > committing/closing
> > > >the connection.
> > > >
> > > >But I am eager to understand why destroying the records was the
> > > default
> > > >behaviour in the first place... Any enlightenmnet on this ?
> > > >
> > > >Thanks,
> > > >Franck
> > > >
> > > >
> > >
> > > EMail:
> > <mailto:berglas%
> 40spreadsheetdetective.com>berglas@...
> > >
> > > +61 7 3369 4065 (Australian Eastern Standard Time)
> > >
> > > If the model seems correct only because the numbers look right,
> > > then why build the model in the first place?
> > >
> > >
> > >
> > >
> >--
> >Franck Routier
> >Axège Sarl - 23, rue Saint-Simon, 63000 Clermont-Ferrand (FR)
> >Tél : +33 463 059 540
> >mèl : <mailto:franck.routier%40axege.com>franck.routier@...
> >
> >
>
> EMail: berglas@...
>
> +61 7 3369 4065 (Australian Eastern Standard Time)
>
> If the model seems correct only because the numbers look right,
> then why build the model in the first place?
>
>
>
>
>
--
Franck Routier
Axège Sarl - 23, rue Saint-Simon, 63000 Clermont-Ferrand (FR)
Tél : +33 463 059 540
mèl : franck.routier@...