| @@ 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 |
|
| @@ 1307-1314 (lines=8) @@ | ||
| 1304 | return parent::streamStatementEnd( $sql, $newLine ); |
|
| 1305 | } |
|
| 1306 | ||
| 1307 | public function lockIsFree( $lockName, $method ) { |
|
| 1308 | // http://www.postgresql.org/docs/8.2/static/functions-admin.html#FUNCTIONS-ADVISORY-LOCKS |
|
| 1309 | $key = $this->addQuotes( $this->bigintFromLockName( $lockName ) ); |
|
| 1310 | $result = $this->query( "SELECT (CASE(pg_try_advisory_lock($key)) |
|
| 1311 | WHEN 'f' THEN 'f' ELSE pg_advisory_unlock($key) END) AS lockstatus", $method ); |
|
| 1312 | $row = $this->fetchObject( $result ); |
|
| 1313 | ||
| 1314 | return ( $row->lockstatus === 't' ); |
|
| 1315 | } |
|
| 1316 | ||
| 1317 | public function lock( $lockName, $method, $timeout = 5 ) { |
|