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 <canyonknight@gmail.com>
Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
This commit is contained in:
canyonknight 2012-05-23 15:30:52 -04:00 committed by Lukas Fleischer
parent 82d234c4d5
commit 763cbf8373
3 changed files with 129 additions and 48 deletions

View file

@ -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);
}