1515# BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
1616# SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
1717#
18- #$Id: rdbms_common.py,v 1.199 2008-08-18 06:25:47 richard Exp $
1918""" Relational database (SQL) backend common code.
2019
2120Basics:
@@ -157,8 +156,7 @@ def open_connection(self):
157156 def sql (self , sql , args = None ):
158157 """ Execute the sql with the optional args.
159158 """
160- if __debug__ :
161- logging .getLogger ('hyperdb' ).debug ('SQL %r %r' % (sql , args ))
159+ self .log_debug ('SQL %r %r' % (sql , args ))
162160 if args :
163161 self .cursor .execute (sql , args )
164162 else :
@@ -262,8 +260,7 @@ def upgrade_db(self):
262260 return 0
263261
264262 if version < 2 :
265- if __debug__ :
266- logging .getLogger ('hyperdb' ).info ('upgrade to version 2' )
263+ log_info ('upgrade to version 2' )
267264 # change the schema structure
268265 self .database_schema = {'tables' : self .database_schema }
269266
@@ -276,8 +273,7 @@ def upgrade_db(self):
276273 self .create_version_2_tables ()
277274
278275 if version < 3 :
279- if __debug__ :
280- logging .getLogger ('hyperdb' ).info ('upgrade to version 3' )
276+ log_info ('upgrade to version 3' )
281277 self .fix_version_2_tables ()
282278
283279 if version < 4 :
@@ -775,9 +771,8 @@ def clear(self):
775771 def addnode (self , classname , nodeid , node ):
776772 """ Add the specified node to its class's db.
777773 """
778- if __debug__ :
779- logging .getLogger ('hyperdb' ).debug ('addnode %s%s %r' % (classname ,
780- nodeid , node ))
774+ self .log_debug ('addnode %s%s %r' % (classname ,
775+ nodeid , node ))
781776
782777 # determine the column definitions and multilink tables
783778 cl = self .classes [classname ]
@@ -850,9 +845,8 @@ def addnode(self, classname, nodeid, node):
850845 def setnode (self , classname , nodeid , values , multilink_changes = {}):
851846 """ Change the specified node.
852847 """
853- if __debug__ :
854- logging .getLogger ('hyperdb' ).debug ('setnode %s%s %r'
855- % (classname , nodeid , values ))
848+ self .log_debug ('setnode %s%s %r'
849+ % (classname , nodeid , values ))
856850
857851 # clear this node out of the cache if it's in there
858852 key = (classname , nodeid )
@@ -1113,9 +1107,8 @@ def addjournal(self, classname, nodeid, action, params, creator=None,
11131107 # create the journal entry
11141108 cols = 'nodeid,date,tag,action,params'
11151109
1116- if __debug__ :
1117- logging .getLogger ('hyperdb' ).debug ('addjournal %s%s %r %s %s %r' % (classname ,
1118- nodeid , journaldate , journaltag , action , params ))
1110+ self .log_debug ('addjournal %s%s %r %s %s %r' % (classname ,
1111+ nodeid , journaldate , journaltag , action , params ))
11191112
11201113 # make the journalled data marshallable
11211114 if isinstance (params , type ({})):
@@ -1140,10 +1133,9 @@ def setjournal(self, classname, nodeid, journal):
11401133
11411134 dc = self .hyperdb_to_sql_value [hyperdb .Date ]
11421135 for nodeid , journaldate , journaltag , action , params in journal :
1143- if __debug__ :
1144- logging .getLogger ('hyperdb' ).debug ('addjournal %s%s %r %s %s %r' % (
1145- classname , nodeid , journaldate , journaltag , action ,
1146- params ))
1136+ self .log_debug ('addjournal %s%s %r %s %s %r' % (
1137+ classname , nodeid , journaldate , journaltag , action ,
1138+ params ))
11471139
11481140 # make the journalled data marshallable
11491141 if isinstance (params , type ({})):
@@ -2114,7 +2106,7 @@ def filter(self, search_matches, filterspec, sort=[], group=[]):
21142106 backward-compatibility reasons a single (dir, prop) tuple is
21152107 also allowed.
21162108
2117- "search_matches" is a sequence type or None
2109+ "search_matches" is a container type or None
21182110
21192111 The filter must match all properties specificed. If the property
21202112 value to match is a list:
0 commit comments