Changeset 33293 for trunk/ippToPsps/jython/ipptopspsdb.py
- Timestamp:
- Feb 16, 2012, 3:33:46 PM (14 years ago)
- File:
-
- 1 edited
-
trunk/ippToPsps/jython/ipptopspsdb.py (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippToPsps/jython/ipptopspsdb.py
r33266 r33293 717 717 718 718 ''' 719 Remove client 720 ''' 721 def removeClient(self, host, pid): 722 self.execute("DELETE FROM clients WHERE host = '" + host + "' AND pid = " + str(pid)) 723 724 ''' 725 Insert client 726 ''' 727 def insertClient(self, host, pid): 728 self.execute("INSERT INTO clients (timestamp, host, pid) VALUES (now(), '" + host + "', " + str(pid) + ")") 729 730 ''' 731 Update clients, or inserts it for the first time 732 ''' 733 def updateClient(self, host, pid): 734 735 try: 736 self.insertClient(host, pid) 737 except: 738 self.execute("UPDATE clients SET timestamp = now() WHERE host = '" + host + "' AND pid = " + str(pid)) 739 740 ''' 741 Is this client paused? 742 ''' 743 def isPaused(self, host, pid): 744 return self.getClientsColumnBoolean("paused", host, pid) 745 746 ''' 747 Is this client killed? 748 ''' 749 def isKilled(self, host, pid): 750 return self.getClientsColumnBoolean("killed", host, pid) 751 752 ''' 753 Returns boolean value for this column in clients table 754 ''' 755 def getClientsColumnBoolean(self, col, host, pid): 756 757 sql = "SELECT " + col + " \ 758 FROM clients \ 759 WHERE host = '" + host + "' AND pid = " + str(pid) 760 761 try: 762 rs = self.executeQuery(sql) 763 rs.first() 764 if rs.getInt(1) == 1: return True 765 else: return False 766 except: 767 self.logger.exception("Unable to check whether " + col + " is true or false in clients table") 768 769 return False 770 771 772 ''' 719 773 Destructor 720 774 '''
Note:
See TracChangeset
for help on using the changeset viewer.
