X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;f=lib%2Fpq%2FGateway%2FTable%2FOptimisticLock.php;fp=lib%2Fpq%2FGateway%2FTable%2FOptimisticLock.php;h=08e5ae364f687f2e019cc633d83dc7c72542c897;hb=580991717f5e8bb237403757e2111a8d04aca616;hp=0000000000000000000000000000000000000000;hpb=0e2eb1f13ef60ce9a8709354136c42f7d87b2345;p=m6w6%2Fpq-gateway diff --git a/lib/pq/Gateway/Table/OptimisticLock.php b/lib/pq/Gateway/Table/OptimisticLock.php new file mode 100644 index 0000000..08e5ae3 --- /dev/null +++ b/lib/pq/Gateway/Table/OptimisticLock.php @@ -0,0 +1,34 @@ +column = $column; + } + + /** + * @implements LockInterface + * @param \pq\Gateway\Row $row + * @param array $where reference to the criteria + */ + function criteria(Row $row, array &$where) { + $where["{$this->column}="] = $row->getData()[$this->column]; + $row->{$this->column}->mod(+1); + } +}