Added database transaction API. (Untested with Postgres)
authorDan Fuhry <dan@enanocms.org>
Thu, 02 Jun 2011 05:24:38 -0400
changeset 1342 2164d18cb10c
parent 1341 90e2064c8ea2
child 1343 2a31905a567d
Added database transaction API. (Untested with Postgres)
includes/dbal.php
--- a/includes/dbal.php	Thu Mar 31 13:09:56 2011 -0400
+++ b/includes/dbal.php	Thu Jun 02 05:24:38 2011 -0400
@@ -645,6 +645,33 @@
 					</div>';
 		$template->footer();
 	}
+	
+	/**
+	 * Begin transaction
+	 */
+	
+	function transaction_begin()
+	{
+		$this->sql_query('BEGIN;');
+	}
+	
+	/**
+	 * Commit transaction
+	 */
+	
+	function transaction_commit()
+	{
+		$this->sql_query('COMMIT;');
+	}
+	
+	/**
+	 * Rollback transaction
+	 */
+	
+	function transaction_rollback()
+	{
+		$this->sql_query('ROLLBACK;');
+	}
 }
 
 class postgresql
@@ -1254,6 +1281,33 @@
 					</div>';
 		$template->footer();
 	}
+	
+	/**
+	 * Begin transaction
+	 */
+	
+	function transaction_begin()
+	{
+		$this->sql_query('BEGIN;');
+	}
+	
+	/**
+	 * Commit transaction
+	 */
+	
+	function transaction_commit()
+	{
+		$this->sql_query('COMMIT;');
+	}
+	
+	/**
+	 * Rollback transaction
+	 */
+	
+	function transaction_rollback()
+	{
+		$this->sql_query('ROLLBACK;');
+	}
 }
 
 ?>