Changeset 3258

Show
Ignore:
Timestamp:
11/26/07 11:42:53 (17 years ago)
Author:
jerome
Message:

Removed LIMIT where it's not needed (unique key), because LIMIT is
not supported everywhere. Two instances remain, not sure how to
remove them in a portable way without exhausting all the available
memory when the history is big...

Files:
1 modified

Legend:

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

    r3184 r3258  
    352352    def getUserFromBackend(self, username) :     
    353353        """Extracts user information given its name.""" 
    354         result = self.doSearch("SELECT * FROM users WHERE username=%s LIMIT 1"\ 
     354        result = self.doSearch("SELECT * FROM users WHERE username=%s"\ 
    355355                      % self.doQuote(self.userCharsetToDatabase(username))) 
    356356        if result : 
     
    361361    def getGroupFromBackend(self, groupname) :     
    362362        """Extracts group information given its name.""" 
    363         result = self.doSearch("SELECT groups.*,COALESCE(SUM(balance), 0.0) AS balance, COALESCE(SUM(lifetimepaid), 0.0) AS lifetimepaid FROM groups LEFT OUTER JOIN users ON users.id IN (SELECT userid FROM groupsmembers WHERE groupid=groups.id) WHERE groupname=%s GROUP BY groups.id,groups.groupname,groups.limitby,groups.description LIMIT 1" \ 
     363        result = self.doSearch("SELECT groups.*,COALESCE(SUM(balance), 0.0) AS balance, COALESCE(SUM(lifetimepaid), 0.0) AS lifetimepaid FROM groups LEFT OUTER JOIN users ON users.id IN (SELECT userid FROM groupsmembers WHERE groupid=groups.id) WHERE groupname=%s GROUP BY groups.id,groups.groupname,groups.limitby,groups.description" \ 
    364364                      % self.doQuote(self.userCharsetToDatabase(groupname))) 
    365365        if result : 
     
    370370    def getPrinterFromBackend(self, printername) :         
    371371        """Extracts printer information given its name.""" 
    372         result = self.doSearch("SELECT * FROM printers WHERE printername=%s LIMIT 1" \ 
     372        result = self.doSearch("SELECT * FROM printers WHERE printername=%s" \ 
    373373                      % self.doQuote(self.userCharsetToDatabase(printername))) 
    374374        if result : 
     
    379379    def getBillingCodeFromBackend(self, label) :         
    380380        """Extracts a billing code information given its name.""" 
    381         result = self.doSearch("SELECT * FROM billingcodes WHERE billingcode=%s LIMIT 1" \ 
     381        result = self.doSearch("SELECT * FROM billingcodes WHERE billingcode=%s" \ 
    382382                      % self.doQuote(self.userCharsetToDatabase(label))) 
    383383        if result :