Auto-cast query values (integer given as value for literal field, string given as value for string field)

This makes the library more robust.