def addClassMsg(self, msg, pid): dbclass = Db('tp_function') data = {} for line in msg: data['pid'] = str(pid) data['function_name'] = line['function_name'] data['params'] = line['params'] data['class_extends'] = line['extends'] content = MySQLdb.escape_string(line['comments']) data['function_msg'] = content #data['classname']=line['className'] # print data; # exit() res = dbclass.insert(data)
def addFileMsg(self, msg, pid): print msg #msg : [level,filepath,file,pid,type][0, '/Users/baidu/doc/.editorconfig', '.editorconfig', 0, 'isfile'] db = Db('tp_file') data = {} data['level'] = msg[0] data['path_name'] = msg[1] data['file_name'] = msg[2] data['pid'] = msg[3] data['type'] = msg[4] if data['type'] == 'isdir': data['type'] = 0 else: data['type'] = 1 resid = db.insert(data) return resid