One database for several SQL questions

One database for several SQL questions

von Maribel Madueno -
Anzahl Antworten: 1

Dear Richard,

I wonder whether it is possible to use the same database for different SQL questions without attaching the sqlite database each time.

Thanks in advance,

Maribel


Als Antwort auf Maribel Madueno

Re: One database for several SQL questions

von Richard Lobb -

The support files from the question prototype are loaded into the working directory along with those of the specific question(s). So, you could make a question prototype, say with type SQL_Using_Blah, that contains the database file you wish to use repeatedly. You could then change the type of all the questions using database Blah to be of type SQL_Using_Blah.

However, that approach requires familiarity with how prototypes work (see https://github.com/trampgeek/moodle-qtype_coderunner#user-defined-question-types) and you have to be careful to always keep the prototype in scope alongside the questions that use it. It seems like a somewhat heavy-handed solution unless you have a large number of questions using that same database. However, it does make maintenance a bit easier in that you have only one copy of the database if you wish to change it. Is that the problem you're trying to solve?

Note that it isn't as inefficient as you might think to have multiple questions with the same database file. It's only uploaded once to the Jobe server, not on every job run, as you might have expected.