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')