| @@ 963-969 (lines=7) @@ | ||
| 960 | * @return bool |
|
| 961 | * @since 1.20 |
|
| 962 | */ |
|
| 963 | public function lockIsFree( $lockName, $method ) { |
|
| 964 | $lockName = $this->addQuotes( $this->makeLockName( $lockName ) ); |
|
| 965 | $result = $this->query( "SELECT IS_FREE_LOCK($lockName) AS lockstatus", $method ); |
|
| 966 | $row = $this->fetchObject( $result ); |
|
| 967 | ||
| 968 | return ( $row->lockstatus == 1 ); |
|
| 969 | } |
|
| 970 | ||
| 971 | /** |
|
| 972 | * @param string $lockName |
|
| @@ 1574-1581 (lines=8) @@ | ||
| 1571 | * @return bool |
|
| 1572 | * @since 1.20 |
|
| 1573 | */ |
|
| 1574 | public function lockIsFree( $lockName, $method ) { |
|
| 1575 | $key = $this->addQuotes( $this->bigintFromLockName( $lockName ) ); |
|
| 1576 | $result = $this->query( "SELECT (CASE(pg_try_advisory_lock($key)) |
|
| 1577 | WHEN 'f' THEN 'f' ELSE pg_advisory_unlock($key) END) AS lockstatus", $method ); |
|
| 1578 | $row = $this->fetchObject( $result ); |
|
| 1579 | ||
| 1580 | return ( $row->lockstatus === 't' ); |
|
| 1581 | } |
|
| 1582 | ||
| 1583 | /** |
|
| 1584 | * See http://www.postgresql.org/docs/8.2/static/functions-admin.html#FUNCTIONS-ADVISORY-LOCKS |
|