Commit 9441873a9100022c524a8538e94da23012d95633

Authored by Neil Blakey-Milner
1 parent 2caa00b4

Add startTransaction, rollback, and commit, and fix reference returns on

some functions.


git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@3587 c91229c3-7414-0410-bfa2-8a42b809f60b
Showing 1 changed file with 12 additions and 2 deletions
lib/database/dbutil.inc
@@ -37,7 +37,7 @@ class DBUtil { @@ -37,7 +37,7 @@ class DBUtil {
37 return $db; 37 return $db;
38 } 38 }
39 39
40 - function runQuery($query, $db = null) { 40 + function &runQuery($query, $db = null) {
41 global $default; 41 global $default;
42 $aParams = null; 42 $aParams = null;
43 43
@@ -192,7 +192,7 @@ class DBUtil { @@ -192,7 +192,7 @@ class DBUtil {
192 return $db->last_query; 192 return $db->last_query;
193 } 193 }
194 194
195 - function &autoDelete($sTable, $iId, $db = null) { 195 + function autoDelete($sTable, $iId, $db = null) {
196 global $default; 196 global $default;
197 // $default->log->debug('AutoDelete called for table ' . $sTable . ' with id ' . $iId); 197 // $default->log->debug('AutoDelete called for table ' . $sTable . ' with id ' . $iId);
198 $db =& DBUtil::getDB(); 198 $db =& DBUtil::getDB();
@@ -229,6 +229,16 @@ class DBUtil { @@ -229,6 +229,16 @@ class DBUtil {
229 return str_replace("\n", " ", $sQuery); 229 return str_replace("\n", " ", $sQuery);
230 } 230 }
231 231
  232 + function startTransaction() {
  233 + DBUtil::runQuery("START TRANSACTION");
  234 + }
  235 + function rollback() {
  236 + DBUtil::runQuery("ROLLBACK");
  237 + }
  238 + function commit() {
  239 + DBUtil::runQuery("COMMIT");
  240 + }
  241 +
232 } 242 }
233 243
234 ?> 244 ?>