예제 #1
0
파일: APIStatus.py 프로젝트: zhmsg/dms
 def insert_function_module(self, service_id, function_title, function_desc):
     if check_chinese_en(function_title) is False:
         return False, "Bad function_title"
     if check_special_character(function_desc) is False:
         return False, "Bad function_desc"
     select_sql = "SELECT MAX(function_id) FROM %s WHERE service_id=%s;" % (self.function_module, service_id)
     result = self.db.execute(select_sql)
     if result == 0:
         function_id = 0
     else:
         db_result = self.db.fetchone()[0]
         if db_result is None:
             function_id = 0
         else:
             function_id = db_result + 1
     insert_sql = "INSERT INTO %s (service_id,function_id,function_title,function_desc) VALUES (%s,%s,'%s','%s');" \
                  % (self.function_module, service_id, function_id, function_title, function_desc)
     self.db.execute(insert_sql)
     return True, {"function_id": fill_zero(function_id, 2), "function_title": function_title, "function_desc": function_desc}