Fix coverity warnings
Fix sdb_dec query and related tests