Hi all,

since a long time I'm working on a web2py project again. And it was about 
time! ;) 

While trying to refresh my mind, I was tinkering with DAL and a MySQL 
database in iPython and I was wondering: The reference [1] states that on a 
rollback the counter would be rolled back as well. Unfortunately I can't 
confirm this:

In [81]: db = DAL('mysql://host/mydb', pool_size=1, 
check_reserved=['mysql'], lazy_tables=False)

In [82]: db.define_table('foo', Field('name', 'string'))
Out[82]: <Table foo (id,name)>

In [83]: db.foo.insert(name='entry1')
Out[83]: 1L

In [84]: db.rollback()

In [85]: db.foo.insert(name='entry1')
Out[85]: 2L

In [86]: db.rollback()

In [87]: db.foo.insert(name='entry1')
Out[87]: 3L

In [88]: db.commit()

In [89]: db().select(db.foo.ALL)
Out[89]: <Rows (1)>

In [90]: [rec.id for rec in db().select(db.foo.ALL)]
Out[90]: [3L]

Did I make any mistake? Does the behavior depend on the database?

Kind regards,

//jotbe

[1] Paragraph "commit and rollback": 
http://web2py.com/books/default/chapter/29/6

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to