1- # $Id: rdbms_common.py,v 1.98.2.19 2004-07-20 23:27:02 richard Exp $
1+ # $Id: rdbms_common.py,v 1.98.2.20 2004-10-07 06:33:57 richard Exp $
22''' Relational database (SQL) backend common code.
33
44Basics:
@@ -196,7 +196,7 @@ def post_init(self):
196196
197197 # update this number when we need to make changes to the SQL structure
198198 # of the backen database
199- current_db_version = 3
199+ current_db_version = 4
200200 def upgrade_db (self ):
201201 ''' Update the SQL database to reflect changes in the backend code.
202202
@@ -222,9 +222,18 @@ def upgrade_db(self):
222222 if version < 3 :
223223 self .fix_version_2_tables ()
224224
225+ if version < 4 :
226+ self .fix_version_3_tables ()
227+
225228 self .database_schema ['version' ] = self .current_db_version
226229 return 1
227230
231+ def fix_version_3_tables (self ):
232+ # drop the shorter VARCHAR OTK column and add a new TEXT one
233+ for name in ('otk' , 'session' ):
234+ self .sql ('ALTER TABLE %ss DROP %s_value' % (name , name ))
235+ self .sql ('ALTER TABLE %ss ADD %s_value TEXT' % (name , name ))
236+
228237 def fix_version_2_tables (self ):
229238 '''Default (used by sqlite): NOOP'''
230239 pass
@@ -2211,6 +2220,10 @@ def filter(self, search_matches, filterspec, sort=(None,None),
22112220 where .append ('_%s.id in (%s)' % (cn , s ))
22122221 args = args + v
22132222
2223+ # sanity check: sorting *and* grouping on the same property?
2224+ if group [1 ] == sort [1 ]:
2225+ sort = (None , None )
2226+
22142227 # "grouping" is just the first-order sorting in the SQL fetch
22152228 orderby = []
22162229 ordercols = []
0 commit comments