It’s doing multiple statements I guess based on the fact that there is a page limit of 20 for the grid:
First it gets the count:
SELECT COUNT(*) FROM application_shift LEFT JOIN application ON application_shift.application_id = application.id LEFT JOIN applicant ON application.applicant_id = applicant.id LEFT JOIN department ON applicant.department_id = department.id LEFT JOIN faculty ON department.faculty_id = faculty.id LEFT JOIN application_floor ON application_shift.application_id = application_floor.application_id LEFT JOIN floor ON application_floor.floor_id = floor.id LEFT JOIN building ON floor.building_id = building.id LEFT JOIN shift ON application_shift.shift_id = shift.id
this is correct, then it gets the data but only from the application_shift table (I tried changing it so it grabbed just the data I wanted from all the tables by adding ->select(‘faculty.name’) but this didnt work):
SELECT application_shift.* FROM application_shift LEFT JOIN application ON application_shift.application_id = application.id LEFT JOIN applicant ON application.applicant_id = applicant.id LEFT JOIN department ON applicant.department_id = department.id LEFT JOIN faculty ON department.faculty_id = faculty.id LEFT JOIN application_floor ON application_shift.application_id = application_floor.application_id LEFT JOIN floor ON application_floor.floor_id = floor.id LEFT JOIN building ON floor.building_id = building.id LEFT JOIN shift ON application_shift.shift_id = shift.id LIMIT 20
Then it gets the application IDs:
SELECT * FROM application WHERE id IN (1, 4, 6, 7, 12, 13)
SHOW FULL COLUMNS FROM application
Then it does this, Im not sure what it is (what is this?):
SELECT
kcu.constraint_name,
kcu.column_name,
kcu.referenced_table_name,
kcu.referenced_column_name
FROM information_schema.referential_constraints AS rc
JOIN information_schema.key_column_usage AS kcu ON
(
kcu.constraint_catalog = rc.constraint_catalog OR
(kcu.constraint_catalog IS NULL AND rc.constraint_catalog IS NULL)
) AND
kcu.constraint_schema = rc.constraint_schema AND
kcu.constraint_name = rc.constraint_name
WHERE rc.constraint_schema = database() AND kcu.table_schema = database()
AND rc.table_name = ‘application’ AND kcu.table_name = ‘application’
Then it selects application again, and a similar thing it did with application:
SELECT * FROM application WHERE id IN (1, 4, 6, 7, 12, 13)
SELECT * FROM applicant WHERE id IN (1, 4, 6, 7, 12, 13)
SHOW FULL COLUMNS FROM applicant
SELECT
kcu.constraint_name,
kcu.column_name,
kcu.referenced_table_name,
kcu.referenced_column_name
FROM information_schema.referential_constraints AS rc
JOIN information_schema.key_column_usage AS kcu ON
(
kcu.constraint_catalog = rc.constraint_catalog OR
(kcu.constraint_catalog IS NULL AND rc.constraint_catalog IS NULL)
) AND
kcu.constraint_schema = rc.constraint_schema AND
kcu.constraint_name = rc.constraint_name
WHERE rc.constraint_schema = database() AND kcu.table_schema = database()
AND rc.table_name = ‘applicant’ AND kcu.table_name = ‘applicant’
SELECT * FROM application WHERE id IN (1, 4, 6, 7, 12, 13)
SELECT * FROM applicant WHERE id IN (1, 4, 6, 7, 12, 13)
SELECT * FROM department WHERE id IN (68, 22, 26, 63, 8, 67)
SHOW FULL COLUMNS FROM department
SELECT
kcu.constraint_name,
kcu.column_name,
kcu.referenced_table_name,
kcu.referenced_column_name
FROM information_schema.referential_constraints AS rc
JOIN information_schema.key_column_usage AS kcu ON
(
kcu.constraint_catalog = rc.constraint_catalog OR
(kcu.constraint_catalog IS NULL AND rc.constraint_catalog IS NULL)
) AND
kcu.constraint_schema = rc.constraint_schema AND
kcu.constraint_name = rc.constraint_name
WHERE rc.constraint_schema = database() AND kcu.table_schema = database()
AND rc.table_name = ‘department’ AND kcu.table_name = ‘department’
SELECT * FROM application WHERE id IN (1, 4, 6, 7, 12, 13)
SELECT * FROM applicant WHERE id IN (1, 4, 6, 7, 12, 13)
SELECT * FROM department WHERE id IN (68, 22, 26, 63, 8, 67)
SELECT * FROM faculty WHERE id IN (3, 1, 2)
SHOW FULL COLUMNS FROM faculty
…