If a db is selected like USE enwiki_p; is there a way to check this selected db in IF or CASE statements? Pseudocode: if db == enwiki_p then etc. Background: Running similar queries against different dbs using the (nearly) same code, so that one has to change the USE statement only.
Topic on Talk:Quarry
Not an answer to first question, but to (probably) your problem. You can use something like this:
use enwiki_p;
select * from some_en_wiki_table;
use dewiki_p;
select * from some_de_wiki_table;
use frwiki_p;
select * from some_fr_wiki_table;
It should work.
Not really. I found a way (see quarry:query/16164) but that's not sufficient, because other projects like wikisource or wikispecies have same names for their main pages.
Edit: Just had an idea, the page_id could be used additionally, that will work I think.
There is the DATABASE() function.
Great, thank you very much!
Try also loops