create sql_prepare helper function
add some tests & asserts