From 763cbf8373e3373254ad18f5b69fd16efdc6fd5c Mon Sep 17 00:00:00 2001 From: canyonknight Date: Wed, 23 May 2012 15:30:52 -0400 Subject: pkgsubmit.php: Pull out DB code * Move DB code in pkgsubmit.php to new functions in aur.inc.php and pkgfuncs.inc.php * Centralization of DB code important in a future transition to PDO interface Signed-off-by: canyonknight Signed-off-by: Lukas Fleischer --- web/lib/aur.inc.php | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'web/lib/aur.inc.php') diff --git a/web/lib/aur.inc.php b/web/lib/aur.inc.php index 991fb14..1a294a9 100644 --- a/web/lib/aur.inc.php +++ b/web/lib/aur.inc.php @@ -512,3 +512,24 @@ function parse_comment($comment) { return $html; } + +function begin_atomic_commit($dbh=NULL) { + if(!$dbh) { + $dbh = db_connect(); + } + db_query("BEGIN", $dbh); +} + +function end_atomic_commit($dbh=NULL) { + if(!$dbh) { + $dbh = db_connect(); + } + db_query("COMMIT", $dbh); +} + +function last_insert_id($dbh=NULL) { + if(!$dbh) { + $dbh = db_connect(); + } + return mysql_insert_id($dbh); +} -- cgit v1.2.3-54-g00ecf