addquery and addvalue utility methods for sql