Change getLocks' query

The query is using a LEFT join which is a LEFT outer join really, so it returns databases which don't have a lock with the mode and granted column as null.

Changed the LEFT join to INNER join to fix the problem