MCPcopy Create free account
hub / github.com/aaPanel/BaoTa / save

Method save

class/db.py:550–580  ·  view source on GitHub ↗
(self,keys,param)

Source from the content-addressed store, hash-verified

548 raise public.PanelError("数据库保存出错:因磁盘空间不足,当前数据库为只读状态,无法更新数据,请通过文件释放一些磁盘空间后重试!")
549
550 def save(self,keys,param):
551 #更新数据
552 self.write_lock()
553 self.clear_files()
554 self.__GetConn()
555 self.is_read_only()
556 self.__DB_CONN.text_factory = str
557 param = self.en_crypt(keys,param)
558 try:
559 opt = ""
560 for key in keys.split(','):
561 opt += key + "=?,"
562 opt = opt[0:len(opt)-1]
563 sql = "UPDATE " + self.__DB_TABLE + " SET " + opt+self.__OPT_WHERE
564
565 #处理拼接WHERE与UPDATE参数
566 tmp = list(self.__to_tuple(param))
567 for arg in self.__OPT_PARAM:
568 tmp.append(arg)
569 self.__OPT_PARAM = tuple(tmp)
570 result = self.__DB_CONN.execute(sql,self.__OPT_PARAM)
571 self._close()
572 self.__DB_CONN.commit()
573 self.rm_lock()
574 return result.rowcount
575 except Exception as ex:
576 err = str(ex)
577 if 'database or disk is full' in err:
578 raise public.PanelError("数据库保存出错:磁盘空间不足,请通过[文件管理]释放一些磁盘空间后重试!")
579 raise public.PanelError("数据库保存出错:" + "error: " + str(ex))
580 # return "error: " + str(ex)
581
582 def delete(self,id=None):
583 #删除数据

Callers 15

setFieldMethod · 0.95
updateMethod · 0.95
cron_shellFunction · 0.45
setPanelMethod · 0.45
SetPanelInfoMethod · 0.45
ToDataBaseMethod · 0.45
remove_site_typeMethod · 0.45
redis_backup_databaseMethod · 0.45
UploadFileMethod · 0.45
GetTaskSpeedMethod · 0.45
get_images_resizeMethod · 0.45
modify_crondMethod · 0.45

Calls 12

write_lockMethod · 0.95
clear_filesMethod · 0.95
__GetConnMethod · 0.95
is_read_onlyMethod · 0.95
en_cryptMethod · 0.95
__to_tupleMethod · 0.95
_closeMethod · 0.95
rm_lockMethod · 0.95
splitMethod · 0.45
appendMethod · 0.45
executeMethod · 0.45
commitMethod · 0.45

Tested by

no test coverage detected