projects
/
m6w6
/
pq-gateway
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
|
github
raw
|
patch
|
inline
| side by side (parent:
0027838
)
more versatile transaction handling
author
Michael Wallner
<mike@php.net>
Wed, 15 Oct 2014 15:22:08 +0000
(17:22 +0200)
committer
Michael Wallner
<mike@php.net>
Wed, 15 Oct 2014 15:22:08 +0000
(17:22 +0200)
lib/pq/Gateway/Rowset.php
patch
|
blob
|
history
diff --git
a/lib/pq/Gateway/Rowset.php
b/lib/pq/Gateway/Rowset.php
index c0a337088ee6da3391c3ca53d6326367ec1692c4..15352591e282a95f5aac57177b1908d1855da5be 100644
(file)
--- a/
lib/pq/Gateway/Rowset.php
+++ b/
lib/pq/Gateway/Rowset.php
@@
-99,12
+99,14
@@
class Rowset implements \SeekableIterator, \Countable, \JsonSerializable
/**
* Create all rows of this rowset
/**
* Create all rows of this rowset
- * @param
bool
$txn
+ * @param
mixed
$txn
* @return \pq\Gateway\Rowset
* @throws Exception
*/
function create($txn = true) {
* @return \pq\Gateway\Rowset
* @throws Exception
*/
function create($txn = true) {
- $txn = $txn ? $this->table->getConnection()->startTransaction() : false;
+ if ($txn && !($txn instanceof pq\Transaction)) {
+ $txn = $this->table->getConnection()->startTransaction();
+ }
try {
foreach ($this->rows as $row) {
$row->create();
try {
foreach ($this->rows as $row) {
$row->create();
@@
-123,12
+125,14
@@
class Rowset implements \SeekableIterator, \Countable, \JsonSerializable
/**
* Update all rows of this rowset
/**
* Update all rows of this rowset
- * @param
bool
$txn
+ * @param
mixed
$txn
* @return \pq\Gateway\Rowset
* @throws \Exception
*/
function update($txn = true) {
* @return \pq\Gateway\Rowset
* @throws \Exception
*/
function update($txn = true) {
- $txn = $txn ? $this->table->getConnection()->startTransaction() : false;
+ if ($txn && !($txn instanceof pq\Transaction)) {
+ $txn = $this->table->getConnection()->startTransaction();
+ }
try {
foreach ($this->rows as $row) {
$row->update();
try {
foreach ($this->rows as $row) {
$row->update();
@@
-147,12
+151,14
@@
class Rowset implements \SeekableIterator, \Countable, \JsonSerializable
/**
* Delete all rows of this rowset
/**
* Delete all rows of this rowset
- * @param
type
$txn
+ * @param
mixed
$txn
* @return \pq\Gateway\Rowset
* @throws \Exception
*/
function delete($txn = true) {
* @return \pq\Gateway\Rowset
* @throws \Exception
*/
function delete($txn = true) {
- $txn = $txn ? $this->table->getConnection()->startTransaction() : false;
+ if ($txn && !($txn instanceof pq\Transaction)) {
+ $txn = $this->table->getConnection()->startTransaction();
+ }
try {
foreach ($this->rows as $row) {
$row->delete();
try {
foreach ($this->rows as $row) {
$row->delete();