本文整理汇总了Python中DataBase.update_table方法的典型用法代码示例。如果您正苦于以下问题:Python DataBase.update_table方法的具体用法?Python DataBase.update_table怎么用?Python DataBase.update_table使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DataBase
的用法示例。
在下文中一共展示了DataBase.update_table方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: update_process
# 需要导入模块: import DataBase [as 别名]
# 或者: from DataBase import update_table [as 别名]
def update_process(self, data):
data_base = DataBase(self.key)
# client name, process name
primary_key = data_base.get_primary_key(data[3], data[1])
# param, value, classification_ID
data_base.update_table("Classification", "Classification", data[0], primary_key)
return "Process updated"
示例2: __init__
# 需要导入模块: import DataBase [as 别名]
# 或者: from DataBase import update_table [as 别名]
class ServerSocket:
def __init__(self): #Constructor
self.server_socket = socket.socket()
self.server_socket.bind(('0.0.0.0', 1729))
self.server_socket.listen(10)
self.open_client_sockets = []
self.database = DataBase()
def handle_clients(self): #handle all the clients using the service
while True:
read_list , write_list, error_list = select.select([self.server_socket]+ self.open_client_sockets, [], [])
for current_socket in read_list:
if current_socket is self.server_socket:
(new_socket , address) = self.server_socket.accept()
self.open_client_sockets.append(new_socket)
else:
data = current_socket.recv(1024)
if data =="":
self.open_client_sockets.remove(current_socket)
print "connection with client close"
else :
datalist = self.unpack_command(data)
current_socket.send(self.handle_command(datalist))
def unpack_command(self, command): #unpacking command parts like command itself, parameters , parameters' number
params = []
details = command.split('#')
command = details[0]
param_number = int(details[1])
for x in xrange(param_number):
params.append(details[x+2])
return [command, param_number, params]
#region fill it
def send_list(self, client_name, classification):
return self.database.get_list(client_name, classification)
def remove_process(self, classification_ID):
self.database.delete_row("Classification", classification_ID)
return "process removed"
def update_process(self, param, value, classification_ID):
self.database.update_table("Classification", param, value, classification_ID)
return "process update"
#endregion
def handle_command(self, datalist): #call the right command from the dictionary
commands_dict = {"GetWhiteList": self.send_list(datalist[2][0], datalist[2][1]), "GetBlackList": self.send_list(datalist[2][0], datalist[2][1]), "RemoveProcess": self.remove_process(datalist[2][0]), "UpdateProcess": self.update_process(datalist[2][0], datalist[2][1], datalist[2][2])}
if (datalist[1] in commands_dict.keys()):
return commands_dict[datalist[0]]