Exemple #1
0
 def get_by_id(id_: int, cook=True):
     value = DBUtils.get_by_single("music", "id", id_)
     # 转换成music对象
     if cook and value is not None:
         m = Converter.local_data_local_music(value)
         return m
     return value
Exemple #2
0
 def get_by_name(name, cook=True):
     value = DBUtils.get_by_single("music", "name", name)
     # 转换成music对象
     if cook and value is not None:
         m = Converter.local_data_local_music(value)
         return m
     return value
Exemple #3
0
 def get_by_music_id(music_id: str, cook=True):
     value = DBUtils.get_by_single("music", "music_id", music_id)
     # 转换成music对象
     if cook and value is not None:
         m = Converter.local_data_local_music(value)
         return m
     return value
Exemple #4
0
 def get_all(cook=True):
     cursor = DBUtils.get_cursor()
     cursor.execute("select * from music")
     values = cursor.fetchall()
     cursor.close()
     # 转换成music对象
     if cook:
         musics = []
         for v in values:
             m = Converter.local_data_local_music(v)
             musics.append(m)
         return musics
     return values