Changeset 2644

Show
Ignore:
Timestamp:
02/03/06 15:14:08 (18 years ago)
Author:
jerome
Message:

Changed copyright messages' years

Files:
1 modified

Legend:

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

    r2639 r2644  
    44# PyKota : Print Quotas for CUPS and LPRng 
    55# 
    6 # (c) 2003-2004 Jerome Alet <alet@librelogiciel.com> 
    7 # (c) 2005 Matt Hyclak <hyclak@math.ohiou.edu> 
     6# (c) 2003, 2004, 2005, 2006 Jerome Alet <alet@librelogiciel.com> 
     7# (c) 2005, 2006 Matt Hyclak <hyclak@math.ohiou.edu> 
    88# This program is free software; you can redistribute it and/or modify 
    99# it under the terms of the GNU General Public License as published by 
     
    4242            port = int(port) 
    4343        except ValueError :     
    44             port = -1           # Use the default MySQL port 
     44            port = -1           # Use the default MySQL port 
    4545         
    4646        self.tool.logdebug("Trying to open database (host=%s, port=%s, dbname=%s, user=%s)..." % (host, port, dbname, user)) 
    4747        self.database = MySQLdb.connect(host=host, port=port, db=dbname, user=user, passwd=passwd) 
    48         self.cursor = self.database.cursor() 
     48        self.cursor = self.database.cursor() 
    4949        self.closed = 0 
    5050        self.tool.logdebug("Database opened (host=%s, port=%s, dbname=%s, user=%s)" % (host, port, dbname, user)) 
     
    5353        """Closes the database connection.""" 
    5454        if not self.closed : 
    55             self.cursor.close() 
     55            self.cursor.close() 
    5656            self.database.close() 
    5757            self.closed = 1 
     
    8484            raise PyKotaStorageError, str(msg) 
    8585        else :     
    86             # This returns a list of lists. Integers are returned as longs. 
     86            # This returns a list of lists. Integers are returned as longs. 
    8787            return self.cursor.fetchall() 
    8888             
     
    9090        """Does a search query.""" 
    9191        result = self.doRawSearch(query) 
    92         if result : 
    93             rows = [] 
     92        if result : 
     93            rows = [] 
    9494            fields = {} 
    9595            for i in range(len(self.cursor.description)) : 
    96                 fields[i] = self.cursor.description[i][0] 
    97             for row in result : 
     96                fields[i] = self.cursor.description[i][0] 
     97            for row in result : 
    9898                rowdict = {} 
    9999                for field in fields.keys() : 
    100                     value = row[field] 
    101                     try : 
    102                         value = value.encode("UTF-8") 
    103                     except: 
    104                         pass 
    105                     rowdict[fields[field]] = value 
    106                 rows.append(rowdict) 
    107             # returns a list of dicts 
    108             return rows 
     100                    value = row[field] 
     101                    try : 
     102                        value = value.encode("UTF-8") 
     103                    except: 
     104                        pass 
     105                    rowdict[fields[field]] = value 
     106                rows.append(rowdict) 
     107            # returns a list of dicts 
     108            return rows 
    109109 
    110110    def doModify(self, query) : 
     
    130130            return (self.database.string_literal(field)).encode("UTF-8") 
    131131        else : 
    132             self.tool.logdebug("WARNING: field has no type, returning NULL") 
     132            self.tool.logdebug("WARNING: field has no type, returning NULL") 
    133133            return "NULL" 
    134134 
     
    137137        if result : 
    138138            entries = [tuple([f[0] for f in self.cursor.description])] 
    139             for entry in result : 
     139            for entry in result : 
    140140                row = [] 
    141141                for value in entry :