Project

General

Profile

Actions

Bug #462

closed

schema-r12857.py does not work right

Added by Anchi Cheng over 14 years ago. Updated over 14 years ago.

Status:
Closed
Priority:
High
Assignee:
Category:
-
Target version:
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.

Actions #1

Updated by Anchi Cheng over 14 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.

Actions #2

Updated by Neil Voss over 14 years ago

  • Status changed from In Code Review to Assigned
  • Assignee changed from Neil Voss to Anchi Cheng

The revision number is wrong.

Actions #3

Updated by Anchi Cheng over 14 years ago

  • Status changed from Assigned to In Code Review
  • Assignee changed from Anchi Cheng to Neil Voss

my bad. It is r13880

Actions #4

Updated by Neil Voss over 14 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')
Actions #5

Updated by Anchi Cheng over 14 years ago

Sorry, I didn't check what I changed, just did a substitute all.

Actions #6

Updated by Anchi Cheng over 14 years ago

  • Status changed from In Test to Closed

cleaned up unnecessary references in r14034 and tested.

Actions

Also available in: Atom PDF