Changeset 1717 for pykota/trunk/pykota
- Timestamp:
- 09/15/04 00:29:13 (20 years ago)
- Location:
- pykota/trunk/pykota
- Files:
-
- 3 modified
Legend:
- Unmodified
- Added
- Removed
-
pykota/trunk/pykota/storages/pgstorage.py
r1520 r1717 22 22 # 23 23 # $Log$ 24 # Revision 1.37 2004/09/14 22:29:12 jalet 25 # First version of dumpykota. Works fine but only with PostgreSQL backend 26 # for now. 27 # 24 28 # Revision 1.36 2004/06/03 23:14:11 jalet 25 29 # Now stores the job's size in bytes in the database. … … 196 200 self.tool.logdebug("Transaction aborted.") 197 201 198 def do Search(self, query) :199 """Does a search query."""202 def doRawSearch(self, query) : 203 """Does a raw search query.""" 200 204 query = query.strip() 201 205 if not query.endswith(';') : … … 207 211 raise PyKotaStorageError, msg 208 212 else : 209 if (result is not None) and (result.ntuples() > 0) : 210 return result.dictresult() 213 return result 211 214 215 def doSearch(self, query) : 216 """Does a search query.""" 217 result = self.doRawSearch(query) 218 if (result is not None) and (result.ntuples() > 0) : 219 return result.dictresult() 220 212 221 def doModify(self, query) : 213 222 """Does a (possibly multiple) modify query.""" -
pykota/trunk/pykota/storages/sql.py
r1711 r1717 22 22 # 23 23 # $Log$ 24 # Revision 1.45 2004/09/14 22:29:13 jalet 25 # First version of dumpykota. Works fine but only with PostgreSQL backend 26 # for now. 27 # 24 28 # Revision 1.44 2004/09/10 21:32:54 jalet 25 29 # Small fixes for incomplete entry intialization … … 65 69 66 70 class SQLStorage : 71 def prepareRawResult(self, result) : 72 """Prepares a raw result by including the headers.""" 73 if result.ntuples() > 0 : 74 entries = [result.listfields()] 75 entries.extend(result.getresult()) 76 return entries 77 78 def extractPrinters(self) : 79 """Extracts all printer records.""" 80 result = self.doRawSearch("SELECT * FROM printers") 81 return self.prepareRawResult(result) 82 83 def extractUsers(self) : 84 """Extracts all user records.""" 85 result = self.doRawSearch("SELECT * FROM users") 86 return self.prepareRawResult(result) 87 88 def extractGroups(self) : 89 """Extracts all group records.""" 90 result = self.doRawSearch("SELECT * FROM groups") 91 return self.prepareRawResult(result) 92 93 def extractPayments(self) : 94 """Extracts all payment records.""" 95 result = self.doRawSearch("SELECT username,payments.* FROM users,payments WHERE users.id=payments.userid") 96 return self.prepareRawResult(result) 97 98 def extractUpquotas(self) : 99 """Extracts all userpquota records.""" 100 result = self.doRawSearch("SELECT users.username,printers.printername,userpquota.* FROM users,printers,userpquota WHERE users.id=userpquota.userid AND printers.id=userpquota.printerid") 101 return self.prepareRawResult(result) 102 103 def extractGpquotas(self) : 104 """Extracts all grouppquota records.""" 105 result = self.doRawSearch("SELECT groups.groupname,printers.printername,grouppquota.* FROM groups,printers,grouppquota WHERE groups.id=grouppquota.groupid AND printers.id=grouppquota.printerid") 106 return self.prepareRawResult(result) 107 108 def extractHistory(self) : 109 """Extracts all jobhistory records.""" 110 result = self.doRawSearch("SELECT users.username,printers.printername,jobhistory.* FROM users,printers,jobhistory WHERE users.id=jobhistory.userid AND printers.id=jobhistory.printerid") 111 return self.prepareRawResult(result) 112 67 113 def getAllUsersNames(self) : 68 114 """Extracts all user names.""" -
pykota/trunk/pykota/version.py
r1713 r1717 22 22 # 23 23 24 __version__ = "1.20alpha1 0_unofficial"24 __version__ = "1.20alpha11_unofficial" 25 25 26 26 __doc__ = """PyKota : a complete Printing Quota Solution for CUPS and LPRng."""