| @@ 1370-1377 (lines=8) @@ | ||
| 1367 | * @return bool |
|
| 1368 | * @since 1.20 |
|
| 1369 | */ |
|
| 1370 | public function lockIsFree( $lockName, $method ) { |
|
| 1371 | $key = $this->addQuotes( $this->bigintFromLockName( $lockName ) ); |
|
| 1372 | $result = $this->query( "SELECT (CASE(pg_try_advisory_lock($key)) |
|
| 1373 | WHEN 'f' THEN 'f' ELSE pg_advisory_unlock($key) END) AS lockstatus", $method ); |
|
| 1374 | $row = $this->fetchObject( $result ); |
|
| 1375 | ||
| 1376 | return ( $row->lockstatus === 't' ); |
|
| 1377 | } |
|
| 1378 | ||
| 1379 | /** |
|
| 1380 | * See http://www.postgresql.org/docs/8.2/static/functions-admin.html#FUNCTIONS-ADVISORY-LOCKS |
|
| @@ 975-981 (lines=7) @@ | ||
| 972 | * @return bool |
|
| 973 | * @since 1.20 |
|
| 974 | */ |
|
| 975 | public function lockIsFree( $lockName, $method ) { |
|
| 976 | $encName = $this->addQuotes( $this->makeLockName( $lockName ) ); |
|
| 977 | $result = $this->query( "SELECT IS_FREE_LOCK($encName) AS lockstatus", $method ); |
|
| 978 | $row = $this->fetchObject( $result ); |
|
| 979 | ||
| 980 | return ( $row->lockstatus == 1 ); |
|
| 981 | } |
|
| 982 | ||
| 983 | /** |
|
| 984 | * @param string $lockName |
|