Ldap sql changes

Changes related to https://github.com/poweradmin/poweradmin/issues/133