Fix Master/Slave for DB->query()

Use a write/master connection for query() to avoid potential problems [0] in a master-slave [1]
environment where the SQLStore excutes $db->query(  'INSERT ' ... );

[0] http://wikimedia.7.x6.nabble.com/RuntimeException-due-to-read-only-when-upgrading-SMW-tp5032521.html
[1] https://www.mediawiki.org/wiki/Manual:$wgDBservers