Show
Ignore:
Timestamp:
02/21/06 16:43:18 (18 years ago)
Author:
jerome
Message:

Completely untested modification stuff...

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • pykota/trunk/pykota/storages/sql.py

    r2734 r2735  
    672672        self.doModify("UPDATE userpquota SET pagecounter=pagecounter + %s,lifepagecounter=lifepagecounter + %s WHERE id=%s" % (self.doQuote(nbpages), self.doQuote(nbpages), self.doQuote(userpquota.ident))) 
    673673        
    674     def writeUserPQuotaPagesCounters(self, userpquota, newpagecounter, newlifepagecounter) :     
    675         """Sets the new page counters permanently for a user print quota.""" 
    676         self.doModify("UPDATE userpquota SET pagecounter=%s, lifepagecounter=%s, warncount=0, datelimit=NULL WHERE id=%s" % (self.doQuote(newpagecounter), self.doQuote(newlifepagecounter), self.doQuote(userpquota.ident))) 
    677         
    678674    def saveBillingCode(self, code) :     
    679675        """Saves the billing code to the database.""" 
     
    718714            self.doModify("UPDATE jobhistory SET userid=%s, jobid=%s, pagecounter=%s, action=%s, jobsize=%s, jobprice=%s, filename=%s, title=%s, copies=%s, options=%s, hostname=%s, jobsizebytes=%s, md5sum=%s, pages=%s, billingcode=%s, precomputedjobsize=%s, precomputedjobprice=%s, jobdate=now() WHERE id=%s" % (self.doQuote(user.ident), self.doQuote(jobid), self.doQuote(pagecounter), self.doQuote(action), self.doQuote(jobsize), self.doQuote(jobprice), self.doQuote(filename), self.doQuote(title), self.doQuote(copies), self.doQuote(options), self.doQuote(clienthost), self.doQuote(jobsizebytes), self.doQuote(jobmd5sum), self.doQuote(jobpages), self.doQuote(jobbilling), self.doQuote(precomputedsize), self.doQuote(precomputedprice), self.doQuote(printer.LastJob.ident))) 
    719715             
    720     def writeUserPQuotaLimits(self, userpquota, softlimit, hardlimit) : 
    721         """Sets soft and hard limits for a user quota.""" 
    722         self.doModify("UPDATE userpquota SET softlimit=%s, hardlimit=%s, warncount=0, datelimit=NULL WHERE id=%s" % (self.doQuote(softlimit), self.doQuote(hardlimit), self.doQuote(userpquota.ident))) 
     716    def saveUserPQuota(self, userpquota) : 
     717        """Saves an user print quota entry.""" 
     718        self.doModify("UPDATE userpquota SET softlimit=%s, hardlimit=%s, warncount=%s, datelimit=%s, pagecounter=%s, lifepagecounter=%s WHERE id=%s" \ 
     719                              % (self.doQuote(userpquota.SoftLimit), \ 
     720                                 self.doQuote(userpquota.HardLimit), \ 
     721                                 self.doQuote(userpquota.WarnCount), \ 
     722                                 self.doQuote(userpquota.DateLimit), \ 
     723                                 self.doQuote(userpquota.PageCounter), \ 
     724                                 self.doQuote(userpquota.LifePageCounter), \ 
     725                                 self.doQuote(userpquota.ident))) 
    723726         
    724727    def writeUserPQuotaWarnCount(self, userpquota, warncount) : 
     
    730733        self.doModify("UPDATE userpquota SET warncount=warncount+1 WHERE id=%s" % self.doQuote(userpquota.ident)) 
    731734         
    732     def writeGroupPQuotaLimits(self, grouppquota, softlimit, hardlimit) : 
    733         """Sets soft and hard limits for a group quota on a specific printer.""" 
    734         self.doModify("UPDATE grouppquota SET softlimit=%s, hardlimit=%s, datelimit=NULL WHERE id=%s" % (self.doQuote(softlimit), self.doQuote(hardlimit), self.doQuote(grouppquota.ident))) 
     735    def saveGroupPQuota(self, grouppquota) : 
     736        """Saves a group print quota entry.""" 
     737        self.doModify("UPDATE grouppquota SET softlimit=%s, hardlimit=%s, datelimit=%s WHERE id=%s" \ 
     738                              % (self.doQuote(grouppquota.SoftLimit), \ 
     739                                 self.doQuote(grouppquota.HardLimit), \ 
     740                                 self.doQuote(grouppquota.DateLimit), \ 
     741                                 self.doQuote(grouppquota.ident))) 
    735742 
    736743    def writePrinterToGroup(self, pgroup, printer) :