Implement lo_* calls via SELECT statements.

This prevents them from being blocking.

Impact on perfomances isn't clear yet to me.