Skip to content

Commit

Permalink
Merge pull request #20 from scragar/master
Browse files Browse the repository at this point in the history
Maintain transaction state upon commit and rollback
  • Loading branch information
Tom Walder committed Apr 13, 2014
2 parents 08ee19f + 7a907a8 commit ba4a3b1
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/Docnet/DB.php
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ public function commit()
if (!$this->obj_db->commit()) {
throw new \Exception("MySQL failed to commit the transaction");
}
$this->bol_in_transaction = FALSE;
return $this;
}

Expand All @@ -113,6 +114,7 @@ public function rollback()
if (!$this->obj_db->rollback()) {
throw new \Exception("MySQL failed to rollback the transaction");
}
$this->bol_in_transaction = FALSE;
return $this;
}

Expand Down Expand Up @@ -257,4 +259,4 @@ public function __destruct()
}
}

}
}
3 changes: 2 additions & 1 deletion src/Docnet/DB/Statement.php
Original file line number Diff line number Diff line change
Expand Up @@ -551,7 +551,8 @@ private function bindParameters()
*/
private function isAssoc(array $arr)
{
return (gettype(array_keys($arr)[0]) == "string");
$arr_keys = array_keys($arr);
return (gettype($arr_keys[0]) == "string");
}

/**
Expand Down

0 comments on commit ba4a3b1

Please sign in to comment.