>From trunk i still get: ProgrammingError: Cannot operate on a closed database.
On 15 Maj, 21:07, mdipierro <[email protected]> wrote: > This is a bit can of worms. > > Not all database divers are thread safe (in the sense that they allows > you to use the same open connection safely in multiple threads). > sqlite is not thread safe and to prevent problems it blocks access > from a different thread than the one that created the thread. The > programming error below is a sqlite error, not a web2py error. > > Anyway, sqlite also allows you to avoid this check in case you really > need to use it in multiple threads but assumes you have a lock > mechanism to avoid problems. > > The web2py in thunk disabled the check. I needed this in order to get > the web2py ajax shell working (and it is *almost* working). Disabling > the check allows you to access the db object from multiple threads but > does not avoid he underlying problems which may lead to database > corruption. > > I really should recommend that you do not pass one db object between > threads. There many subtleties that can lead to data corruption. If > you really have to do it make sure you: > - implement a lock mechanism > - do not access the db object after the thread that created the object > has returned (because the connection is automatically close and > transaction committed). > > Massimo > > On May 15, 11:22 am, Kacper Krupa <[email protected]> wrote: > > > Hi, > > > I've written application which creates another thread and do things > > inside it. But why i can't use ORM in it? I'm using sqlite3 and i > > always get: > > > ProgrammingError: SQLite objects created in a thread can only be used > > in that same thread.The object was created in thread id 28329984 and > > this is thread id 28687360 > > > Any ideas? --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "web2py Web Framework" 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/web2py?hl=en -~----------~----~----~----~------~----~------~--~---

