db: add length() method