I found it, it was my fault of course. The problem was that, in the method where I make the delete, several lines after the deletion (in a code not related with the database) I use a global variable not defined so the method fails, don't return anything and I guess some automatic db.commit is not called. If I fix the global variable line, everything works without the db.commit.
El jueves, 10 de enero de 2013 14:31:54 UTC+1, Wonton escribió: > > Hello, > > I've checked that from a fresh installation all inserts, updates and > deletes of the database work perfectly without db.commit(). > Besides this, I have 6 tables in which I do inserts, updates and deletes > in all of them without db.commit() and they work perfectly, except for a > specific one. In this one,my inserts and updates work well but I must do > db.commit() for the deletes. > More strange is that this table and all actions I do over it are identical > to the ones I do in a table that works well. > > I don't know how could I send some code because the project contains some > official data, so do you know what could be the possible problems for a > delete action in a database? Or how could I trace the problem (it doesn't > give me any errors). > > Thank you very much! > > El domingo, 30 de diciembre de 2012 21:08:40 UTC+1, Wonton escribió: >> >> I will try to do it, but, since I have confidential data I don't know if >> I will be able do it. Meanwhile I will try to make a fresh app and go step >> by step. >> >> El domingo, 30 de diciembre de 2012 18:19:42 UTC+1, Niphlod escribió: >>> >>> >>> >>> On Sunday, December 30, 2012 2:33:42 PM UTC+1, Wonton wrote: >>>> >>>> But it's strange. I have all this code inside my default.py controller, >>>> inside web2py. >>>> Indeen, these 2 lines: >>>> query = db(db.table.field1=='What I am looking for') >>>> query.update(field2='hello') >>>> work perfectly even without the db.commit(). >>>> >>>> >>> Ok >>> >>> >>>> But, this code: >>>> query = db(db.table.field1=='What I am looking for') >>>> deletedRow = query.delete() >>>> is not working if I don't use the db.commit() instruction. I mean, it >>>> seems that the deletion is ok, it doesn't crash and doesn't return any >>>> error, but the database is not modified. >>>> >>>> >>> Please post your model and the controller as attachments (or the app if >>> you can), because that has to work (and indeed works fine in a fresh app). >>> >> --