@@ 985-991 (lines=7) @@ | ||
982 | * @return bool |
|
983 | * @since 1.20 |
|
984 | */ |
|
985 | public function lockIsFree( $lockName, $method ) { |
|
986 | $encName = $this->addQuotes( $this->makeLockName( $lockName ) ); |
|
987 | $result = $this->query( "SELECT IS_FREE_LOCK($encName) AS lockstatus", $method ); |
|
988 | $row = $this->fetchObject( $result ); |
|
989 | ||
990 | return ( $row->lockstatus == 1 ); |
|
991 | } |
|
992 | ||
993 | /** |
|
994 | * @param string $lockName |
@@ 1384-1391 (lines=8) @@ | ||
1381 | * @return bool |
|
1382 | * @since 1.20 |
|
1383 | */ |
|
1384 | public function lockIsFree( $lockName, $method ) { |
|
1385 | $key = $this->addQuotes( $this->bigintFromLockName( $lockName ) ); |
|
1386 | $result = $this->query( "SELECT (CASE(pg_try_advisory_lock($key)) |
|
1387 | WHEN 'f' THEN 'f' ELSE pg_advisory_unlock($key) END) AS lockstatus", $method ); |
|
1388 | $row = $this->fetchObject( $result ); |
|
1389 | ||
1390 | return ( $row->lockstatus === 't' ); |
|
1391 | } |
|
1392 | ||
1393 | /** |
|
1394 | * See http://www.postgresql.org/docs/8.2/static/functions-admin.html#FUNCTIONS-ADVISORY-LOCKS |