Skip to content

Using the stored procedures

Karl Levik edited this page Nov 12, 2021 · 2 revisions

How to create proposals, sessions, persons and more

On the 'mysql' command line:

-- change to your ispyb schema:
USE ispyb_build;

-- initialise a variable, create the proposal, see the proposal you created:
SET @pid := NULL;
CALL upsert_proposal(@pid, 1, 'Development proposal', 'mx', 30000, NULL, NULL);

SELECT * FROM Proposal WHERE proposalId = @pid\G

-- init. variable, create a visit on that proposal - mx30000-1, see the resulting row:
SET @sid := NULL;
CALL upsert_session_for_proposal_code_number(@sid, 'mx', 30000, 1, NULL, '2019-03-29 10:00:00', '2019-03-29 17:00:00', 'i03', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);

SELECT * FROM BLSession WHERE sessionId = @sid\G

-- create a person:
SET @personId := NULL;
CALL upsert_person(@personId, NULL, 'Larson', 'Gary', 'Mr', '[email protected]', NULL, 'username_or_fedid_here', NULL, NULL);

-- add that person to the session you just created:
CALL upsert_session_has_person(@sid, @personId, 'Team Leader', 0);