当前位置: 首页>>代码示例>>Python>>正文


Python DataBase.delete_row方法代码示例

本文整理汇总了Python中DataBase.delete_row方法的典型用法代码示例。如果您正苦于以下问题:Python DataBase.delete_row方法的具体用法?Python DataBase.delete_row怎么用?Python DataBase.delete_row使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在DataBase的用法示例。


在下文中一共展示了DataBase.delete_row方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: remove_process

# 需要导入模块: import DataBase [as 别名]
# 或者: from DataBase import delete_row [as 别名]
 def remove_process(self, data):
     data_base = DataBase(self.key)
     print data[0]
     print data[1]
     #                                       clint name,  process name
     primary_key = data_base.get_primary_key(data[1],     data[0])
     print primary_key
     #                                         classification_ID
     data_base.delete_row("Classification", primary_key)
     return "Process removed"
开发者ID:lielmoalem12,项目名称:server,代码行数:12,代码来源:ServerSocket.py

示例2: __init__

# 需要导入模块: import DataBase [as 别名]
# 或者: from DataBase import delete_row [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]]
开发者ID:lielmoalem12,项目名称:Web-Camera-Protector,代码行数:54,代码来源:ServerSocket.py


注:本文中的DataBase.delete_row方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。