| @@ 1371-1378 (lines=8) @@ | ||
| 1368 | * @return bool |
|
| 1369 | * @since 1.20 |
|
| 1370 | */ |
|
| 1371 | public function lockIsFree( $lockName, $method ) { |
|
| 1372 | $key = $this->addQuotes( $this->bigintFromLockName( $lockName ) ); |
|
| 1373 | $result = $this->query( "SELECT (CASE(pg_try_advisory_lock($key)) |
|
| 1374 | WHEN 'f' THEN 'f' ELSE pg_advisory_unlock($key) END) AS lockstatus", $method ); |
|
| 1375 | $row = $this->fetchObject( $result ); |
|
| 1376 | ||
| 1377 | return ( $row->lockstatus === 't' ); |
|
| 1378 | } |
|
| 1379 | ||
| 1380 | /** |
|
| 1381 | * See http://www.postgresql.org/docs/8.2/static/functions-admin.html#FUNCTIONS-ADVISORY-LOCKS |
|
| @@ 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 |
|