topcoder-platform / tc-database-scripts

4 stars 22 forks source link

Add get_challenge_accessibility_and_groups Query #29

Open skyhit opened 6 years ago

skyhit commented 6 years ago

Select the informixoltp database for informix, and execute the following data: insert into query (query_id, text, name, ranking, column_index) values(49999, null, 'get_challenge_accessibility_and_groups', 0, null); insert into command values(49999, 'get_challenge_accessibility_and_groups', 24964); insert into command_query_xref values(49999, 49999, 1);

insert into input_lu values(49999, 'userId', 1001, 'user id'); insert into input_lu values(49998, 'challengeId', 1001, 'challengeId');

insert into query_input_xref values(49999, 'N', null, 49999, 1); insert into query_input_xref values(49999, 'N', null, 49998, 1);

After executing the above statements, the query text for is null. You can use jdbc to update the query text or the informix pipe to insert the blob text: update query set text= ? where query_id=49999

The text parameter value should be: SELECT ce.is_studio, sg.challenge_group_ind, ugx.group_id AS user_group_xref_found, sg.group_id AS group_id FROM (( tcs_catalog:contest_eligibility ce LEFT JOIN tcs_catalog:group_contest_eligibility gce ON ce.contest_eligibility_id = gce.contest_eligibility_id) LEFT JOIN security_groups sg ON gce.group_id = sg.group_id) LEFT JOIN ( SELECT group_id FROM user_group_xref WHERE login_id=@userId@) ugx ON ugx.group_id = gce.group_id WHERE ce.contest_id = @challengeId@

Schpotsky commented 4 years ago

@skyhit , There is a tiny bug in the text Query: userid should be userId (camelCase should be used) [EDIT] Looks like this is an issue in Github markdown Editor

skyhit commented 4 years ago

@Schpotsky yes.