fix: replace TRUE with 1

This commit is contained in:
Terry Geng 2020-03-22 22:20:11 +08:00
parent f65ef64a77
commit ae89782450

View File

@ -21,7 +21,7 @@ class Condition:
def sql(self, conn: sqlite3.Connection = None): def sql(self, conn: sqlite3.Connection = None):
sql = self._sql sql = self._sql
if not self._sql: if not self._sql:
sql = "TRUE" sql = "1"
if self._order_by: if self._order_by:
sql += f" ORDER BY {self._order_by}" sql += f" ORDER BY {self._order_by}"
if self._desc: if self._desc:
@ -396,7 +396,7 @@ class MusicDatabase:
del music_dict['path'] del music_dict['path']
del music_dict['keywords'] del music_dict['keywords']
existed = cursor.execute("SELECT TRUE FROM music WHERE id=?", (id,)).fetchall() existed = cursor.execute("SELECT 1 FROM music WHERE id=?", (id,)).fetchall()
if len(existed) == 0: if len(existed) == 0:
cursor.execute( cursor.execute(
"INSERT INTO music (id, type, title, metadata, tags, path, keywords) VALUES (?, ?, ?, ?, ?, ?, ?)", "INSERT INTO music (id, type, title, metadata, tags, path, keywords) VALUES (?, ?, ?, ?, ?, ?, ?)",