Database module

Thread problems when searching in a sqllite database
Hi!

I'm having some problems using the Database module from the framework.

http://dev.plexapp.com/docs/mod_Database.html#Database.Exec

I've defined the CreateDatabase() function and managed to create a database with a table and some data.
The problem is that I get an error when I try to select from it.

def CreateDatabase():
Database.Exec("create table searches(searchid, searchField, catID, age, region)")
Database.Exec("insert into searches (searchID, searchField, catID, age, region) values (?,?,?,?,)",('1', 'test', '42', '2', 'test',))
for row in Database.Exec('select * from searches'):
PMS.Log('---------------------------------------------------------')
PMS.Log(row)
PMS.Log('---------------------------------------------------------')

for row in Database.Exec('select * from searches'):
ProgrammingError: SQLite objects created in a thread can only be used in that same thread.The object was created in thread id -1340583936 and this is thread id -1597799104

Do anybody know how to fix this? I'm not able to fetch any data from the database.

Jørgen

You might want to ask Jam, since he made the following [post](http://forums.plexapp.com/index.php/topic/6200-sqlite-multithreading-issue/page__view__findpost__p__39221) in may 2009

good luck
oortmanp

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.