libdb: fix sql syntax error