ah OK - I didn't know the record update could be split like that.
Neat.
Richard


On Nov 19, 1:23 pm, mdipierro <mdipie...@cs.depaul.edu> wrote:
> A Row object extends a dictionary and inherits an update method. It
> only updates the dict not the record. The us of it is that you can do:
>
> row.update(...)
> row.update(...)
> row.update(...)
> row.update_record()
>
> and the last update_record() without parameters will update the
> database with the previous updated changes.
>
> row.update() on its own is useless.
>
> On Nov 18, 8:09 pm, Richard <richar...@gmail.com> wrote:
>
> > what is the use case for updating the row object instead of the
> > database? I sometimes use update() instead of update_record(), so I
> > would prefer update() threw an exception.
>
> > Is it worth adding the equivalent delete_record()?
>
> > On Nov 19, 10:43 am, mdipierro <mdipie...@cs.depaul.edu> wrote:
>
> > > you can do
>
> > > del db.table[row.id]
>
> > > Mind that
>
> > > row.update(...)
>
> > > only updates the row object, not the database record.
>
> > > row.update_record(...)
>
> > > updates the database record.
>
> > > On Nov 18, 5:22 pm, Thadeus Burgess <thade...@thadeusb.com> wrote:
>
> > > > A feature to delete the record from the current object would be nice, 
> > > > like
> > > > the .update() method of the row, to have .delete()
>
> > > > row = db(db.table.id > 0).select().first()
> > > > ...
> > > > #do some other queries with row data
> > > > ...
> > > > row.delete() # i don't need row anymore, so purge it from database.
>
> > > > # I currently have to do
>
> > > > # db(db.table.id == row.id).delete()
>
> > > > -Thadeus
>
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web2py-users" 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