| @@ 1564-1571 (lines=8) @@ | ||
| 1561 | * @return bool |
|
| 1562 | * @since 1.20 |
|
| 1563 | */ |
|
| 1564 | public function lockIsFree( $lockName, $method ) { |
|
| 1565 | $key = $this->addQuotes( $this->bigintFromLockName( $lockName ) ); |
|
| 1566 | $result = $this->query( "SELECT (CASE(pg_try_advisory_lock($key)) |
|
| 1567 | WHEN 'f' THEN 'f' ELSE pg_advisory_unlock($key) END) AS lockstatus", $method ); |
|
| 1568 | $row = $this->fetchObject( $result ); |
|
| 1569 | ||
| 1570 | return ( $row->lockstatus === 't' ); |
|
| 1571 | } |
|
| 1572 | ||
| 1573 | /** |
|
| 1574 | * 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 | $lockName = $this->addQuotes( $this->makeLockName( $lockName ) ); |
|
| 977 | $result = $this->query( "SELECT IS_FREE_LOCK($lockName) AS lockstatus", $method ); |
|
| 978 | $row = $this->fetchObject( $result ); |
|
| 979 | ||
| 980 | return ( $row->lockstatus == 1 ); |
|
| 981 | } |
|
| 982 | ||
| 983 | /** |
|
| 984 | * @param string $lockName |
|