Actions
Bug #462
closedschema-r12857.py does not work right
Start date:
05/11/2010
Due date:
% Done:
100%
Estimated time:
Affected Version:
Show in known bugs:
Workaround:
Description
It has hard coded database names in custom mysql queries. Also the group assignment is hard coded for our database only.
Updated by Anchi Cheng over 15 years ago
- Status changed from Assigned to In Code Review
 - Assignee changed from Anchi Cheng to Neil Voss
 - % Done changed from 0 to 100
 
r12857 fixes this with many replacement of sinedon.cfg determined database names and some query to get the right group association.
Updated by Neil Voss over 15 years ago
- Status changed from In Code Review to Assigned
 - Assignee changed from Neil Voss to Anchi Cheng
 
The revision number is wrong.
Updated by Anchi Cheng over 15 years ago
- Status changed from Assigned to In Code Review
 - Assignee changed from Anchi Cheng to Neil Voss
 
my bad. It is r13880
Updated by Neil Voss over 15 years ago
- Status changed from In Code Review to In Test
 - Assignee changed from Neil Voss to Anchi Cheng
 
As I see it, it is good enough, but I would like to comment:
1. You could save a lot of space by using the correct db class on the queries, e.g.:
updateq = (" UPDATE "+projectdb.dbname+".shareexperiments, "+projectdb.dbname+".users " 
  +" SET "+projectdb.dbname+".shareexperiments.username = "+projectdb.dbname+".users.username " 
  +" WHERE "+projectdb.dbname+".users.userId = "+projectdb.dbname+".shareexperiments.userId " 
  +" AND "+projectdb.dbname+".shareexperiments.username IS NULL " 
)
leginondb.executeCustomSQL(updateq)
	to
updateq = (" UPDATE shareexperiments " 
  +" SET shareexperiments.username = users.username " 
  +" WHERE users.userId = shareexperiments.userId " 
  +" AND shareexperiments.username IS NULL " 
)
projectdb.executeCustomSQL(updateq)
	2. I have an updateColumn function that may be useful as well, e.g.:
updateq = (" UPDATE "+projectdb.dbname+".shareexperiments, "+projectdb.dbname+".users " 
  +" SET "+projectdb.dbname+".shareexperiments.username = "+projectdb.dbname+".users.username " 
  +" WHERE "+projectdb.dbname+".users.userId = "+projectdb.dbname+".shareexperiments.userId " 
  +" AND "+projectdb.dbname+".shareexperiments.username IS NULL " 
)
leginondb.executeCustomSQL(updateq)
projectdb.updateColumn('shareexperiments', 'username', 'users.username', 
  'users.userId = shareexperiments.userId AND username IS NULL')
Updated by Anchi Cheng over 15 years ago
Sorry, I didn't check what I changed, just did a substitute all.
Updated by Anchi Cheng over 15 years ago
- Status changed from In Test to Closed
 
cleaned up unnecessary references in r14034 and tested.
Actions