Try to speed up getting actor id
- Explicitly select only 1 entry
This commit is contained in:
parent
f02bb4a873
commit
30f9518b82
1 changed files with 3 additions and 2 deletions
|
@ -283,7 +283,8 @@ class Kodidb_Functions():
|
|||
"SELECT actor_id",
|
||||
"FROM actor",
|
||||
"WHERE name = ?",
|
||||
"COLLATE NOCASE"
|
||||
"COLLATE NOCASE",
|
||||
"LIMIT 1"
|
||||
))
|
||||
self.cursor.execute(query, (name,))
|
||||
try:
|
||||
|
@ -292,7 +293,7 @@ class Kodidb_Functions():
|
|||
# Cast entry does not exists
|
||||
self.cursor.execute("select coalesce(max(actor_id),0) from actor")
|
||||
actorid = self.cursor.fetchone()[0] + 1
|
||||
query = "INSERT INTO actor(actor_id, name) values(?, ?)"
|
||||
query = "INSERT INTO actor(actor_id, name) VALUES (?, ?)"
|
||||
self.cursor.execute(query, (actorid, name))
|
||||
return actorid
|
||||
|
||||
|
|
Loading…
Reference in a new issue