Initialize d_stmt even if query is empty
Fix wrong parameter name
Fix wrong parameter name