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


Python DataBase.add_row_to_table方法代码示例

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


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

示例1: listen_to_client

# 需要导入模块: import DataBase [as 别名]
# 或者: from DataBase import add_row_to_table [as 别名]
 def listen_to_client(self, client, address):
     client_name = client.recv(BUFF_SIZE)
     data_base = DataBase(self.key)
     if not data_base.is_exist("Clients", client_name):
         data_base.add_row_to_table("Clients", [client_name, address[0], address[1]])
         print "Client " + client_name + " is connected"
     else:
         print "client " + client_name + " is connected again"
     while True:
         try:
             data = client.recv(BUFF_SIZE)
             print data
             if data:
                 if "#" in data:
                     data_list = self.unpack_command(data)
                     print data_list
                     answer = self.handle_command(data_list)
                     print answer
                     if type(answer) is list:
                         print "list"
                         packets = answer[1]
                         client.send(str(answer[0]))
                         for x in range(answer[0]):
                             client.send(packets[x])
                     else:
                         client.send(answer)
                 else:
                     pass
             else:
                 print 'Client disconnected'
         except:
             print "Client " + client_name + " has been disconnected"
             client.close()
             return False
开发者ID:lielmoalem12,项目名称:server,代码行数:36,代码来源:ServerSocket.py

示例2: add_process

# 需要导入模块: import DataBase [as 别名]
# 或者: from DataBase import add_row_to_table [as 别名]
 def add_process(self, data):
     data_base = DataBase(self.key)
     print data[3]
     if not data_base.is_process_exist(data[3], data[1]):
         #                                                                                  client name, process name, process signature, classification
         data_base.add_row_to_table("Classification", [data_base.classification_id_counter, data[3],     data[1],      str(data[2]),      int(data[0])])
         return "Process " + data[1] + " added to client " + data[3] + " with classification " + data[0]
     return "Process already exists"
开发者ID:lielmoalem12,项目名称:server,代码行数:10,代码来源:ServerSocket.py


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