added support and test for preparing queries