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