| @@ 938-944 (lines=7) @@ | ||
| 935 | * @return bool |
|
| 936 | * @since 1.20 |
|
| 937 | */ |
|
| 938 | public function lockIsFree( $lockName, $method ) { |
|
| 939 | $lockName = $this->addQuotes( $this->makeLockName( $lockName ) ); |
|
| 940 | $result = $this->query( "SELECT IS_FREE_LOCK($lockName) AS lockstatus", $method ); |
|
| 941 | $row = $this->fetchObject( $result ); |
|
| 942 | ||
| 943 | return ( $row->lockstatus == 1 ); |
|
| 944 | } |
|
| 945 | ||
| 946 | /** |
|
| 947 | * @param string $lockName |
|
| @@ 1559-1566 (lines=8) @@ | ||
| 1556 | * @return bool |
|
| 1557 | * @since 1.20 |
|
| 1558 | */ |
|
| 1559 | public function lockIsFree( $lockName, $method ) { |
|
| 1560 | $key = $this->addQuotes( $this->bigintFromLockName( $lockName ) ); |
|
| 1561 | $result = $this->query( "SELECT (CASE(pg_try_advisory_lock($key)) |
|
| 1562 | WHEN 'f' THEN 'f' ELSE pg_advisory_unlock($key) END) AS lockstatus", $method ); |
|
| 1563 | $row = $this->fetchObject( $result ); |
|
| 1564 | ||
| 1565 | return ( $row->lockstatus === 't' ); |
|
| 1566 | } |
|
| 1567 | ||
| 1568 | /** |
|
| 1569 | * See http://www.postgresql.org/docs/8.2/static/functions-admin.html#FUNCTIONS-ADVISORY-LOCKS |
|