Added global, cross-database locking function