def insert_table_playlist_ids(self,ids): sql='insert ignore into playlist (ids) values(%s)'%(ids) try: self.execute(sql) logging.info(u'successfully insert_table_playlist_ds') except Exception,e: logging.error(u'failed insert_table_playlist id cause by %s'%str(e))
def update_table_song(self,comment_count,comments,ids): comments=self.check_str(comments) sql='''update song set comment_count="%s",comments="%s" where ids="%s"'''%(comment_count,comments,ids) try: self.execute(sql) logging.info(u'successfully update_table_song comments') except Exception,e: logging.error(u'failed update_table_song comments cause by %s'%str(e))
def update_table_playlist_comment(self,comment_count,comments,ids): '''可以与song合并成一个函数''' comments=self.check_str(comments) sql='''update playlist set comment_count="%s",comments="%s" where ids="%s "'''%(comment_count,comments,ids) try: self.execute(sql) logging.info(u'successfully update_table_playlist_comment info') except Exception,e: logging.error(u'failed update_table_playlist_comment cause by %s'%str(e))
def insert_table_playlist(self,title=0,ids=0,author=0,tags=0,total=0,fav=0,comment=0,share=0,description=0,song_ids=0): title=self.check_str(title) description=self.check_str(description) sql='''insert ignore into playlist (title,ids,author,tags,total,fav,comment,share,description,song_ids) values("%s","%s","%s","%s","%s","%s","%s","%s","%s","%s")'''%(title,ids,author,tags,total,fav,comment,share,description,song_ids) try: self.execute(sql) logging.info(u'successfully insert_table_playlist info') except Exception,e: logging.error(u'failed insert_table_playlist info cause by %s'%str(e))
def insert_table_song(self,song,singer,ids,url,refer): sql='''insert ignore into song(song,singer,ids,url,refer) values("%s","%s","%s","%s","%s")'''%(song,singer,ids,url,refer) try: self.execute(sql) logging.info(u'successfully insert_table_song') except Exception,e: import traceback logging.error(u'traceback is:%s'%traceback.format_exc()) print u'error cause by:',e logging.error(u'failed insert_table_song cause by %s'%str(e))
def update_table_playlist_info(self,title,ids,author,tags,total,fav,comment,share,description,song_ids): title=self.check_str(title) description=self.check_str(description) sql='''update playlist set title="%s",author="%s",tags="%s",total="%s", fav="%s",comment="%s",share="%s",description="%s",song_ids="%s" where ids=%s '''%(title,author,tags,total,fav,comment,share,description,song_ids,ids) try: self.execute(sql) logging.info(u'successfully update_table_playlist info') except Exception,e: logging.error(u'failed update_table_playlist_info cause by %s'%str(e))