Implement db_value_cmp()