added db_query_fmt function