[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: [owncloud] lib: add transitions to oc_db
From: Robin Appelman <icewind1991 () gmail ! com>
Date: 2011-07-31 22:08:39
Message-ID: 20110731220839.0F34FA60AE () git ! kde ! org
[Download RAW message or body]
Git commit 14f7daf53c90f14e8fa600926ae19b3e44320158 by Robin Appelman.
Committed on 31/07/2011 at 20:24.
Pushed by rappelman into branch 'master'.
add transitions to oc_db
M +33 -0 lib/db.php
http://commits.kde.org/owncloud/14f7daf53c90f14e8fa600926ae19b3e44320158
diff --git a/lib/db.php b/lib/db.php
index 858db09..b7775b7 100644
--- a/lib/db.php
+++ b/lib/db.php
@@ -361,4 +361,37 @@ class OC_DB {
self::dropTable($name);
}
}
+
+ /**
+ * Start a transaction or set a savepoint.
+ * @param string $savePoint (optional) name of the savepoint to set
+ */
+ public static function beginTransaction($savePoint=''){
+ if (!self::$DBConnection->supports('transactions')) {
+ return false;
+ }
+ if($savePoint && !self::$DBConnection->supports('savepoints')){
+ return false;
+ }
+ if($savePoint){
+ self::$DBConnection->beginTransaction($savePoint);
+ }else{
+ self::$DBConnection->beginTransaction();
+ }
+ }
+
+ /**
+ * Commit the database changes done during a transaction that is in progress or release a savepoint.
+ * @param string $savePoint (optional) name of the savepoint to commit
+ */
+ public static function commit($savePoint=''){
+ if(!self::$DBConnection->inTransaction()){
+ return false;
+ }
+ if($savePoint){
+ self::$DBConnection->commit($savePoint);
+ }else{
+ self::$DBConnection->commit();
+ }
+ }
}
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic