MDL-46647 grades: Fix fetch_all_helper() towards cross-db

That helper, used to fetch information from DB by all the grade_object
chidren classes was not behaving properly handling TEXT/CLOB columns.

Instead of creating a property within every class listing the
existing columns, it seems to be a better solution to instrospect
the database metadata (cached) to ensure the correct SQL is generated
in every case.
MDL-46647 core_grades: Adding tests for fetch_all_helper()