function lock() { global $_Query_lock_depth; if ($_Query_lock_depth < 0) { Fatal::internalError('Negative lock depth'); } if ($_Query_lock_depth == 0) { $row = $this->select1($this->mkSQL('select get_lock(%Q, %N) as locked', OBIB_LOCK_NAME, OBIB_LOCK_TIMEOUT)); if (!isset($row['locked']) or $row['locked'] != 1) { Fatal::cantLock(); } } $_Query_lock_depth++; }