summaryrefslogtreecommitdiffstats
path: root/checksetup.pl
diff options
context:
space:
mode:
authormkanat%kerio.com <>2005-02-19 01:01:47 +0100
committermkanat%kerio.com <>2005-02-19 01:01:47 +0100
commit62eecf24480520e204ab0057f8f7845c13f37c13 (patch)
tree99252665b81610168701173d4b5ce272c378fda6 /checksetup.pl
parentc720bf60573fdb92874056ffd07c3d6055df22af (diff)
downloadbugzilla-62eecf24480520e204ab0057f8f7845c13f37c13.tar.gz
bugzilla-62eecf24480520e204ab0057f8f7845c13f37c13.tar.xz
Bug 280494: Replace "SELECT LAST_INSERT_ID()" with Bugzilla::DB function call
Patch By Tomas Kopal <Tomas.Kopal@altap.cz> r=mkanat, a=justdave
Diffstat (limited to 'checksetup.pl')
-rwxr-xr-xchecksetup.pl17
1 files changed, 5 insertions, 12 deletions
diff --git a/checksetup.pl b/checksetup.pl
index 79095ee3a..388703ab1 100755
--- a/checksetup.pl
+++ b/checksetup.pl
@@ -2232,9 +2232,7 @@ sub AddGroup {
VALUES (?, ?, ?, ?)');
$sth->execute($name, $desc, $userregexp, 0);
- $sth = $dbh->prepare("select last_insert_id()");
- $sth->execute();
- my ($last) = $sth->fetchrow_array();
+ my $last = $dbh->bz_last_key('groups', 'id');
return $last;
}
@@ -2459,9 +2457,8 @@ unless ($sth->rows) {
'bugzilla.", "", 0, 0, 0)');
# We could probably just assume that this is "1", but better
# safe than sorry...
- $sth = $dbh->prepare("SELECT LAST_INSERT_ID()");
- $sth->execute;
- my ($product_id) = $sth->fetchrow_array;
+ my $product_id = $dbh->bz_last_key('products', 'id');
+
$dbh->do(qq{INSERT INTO versions (value, product_id) VALUES ("other", $product_id)});
# note: since admin user is not yet known, components gets a 0 for
# initialowner and this is fixed during final checks.
@@ -2801,9 +2798,7 @@ if (GetFieldDef('bugs', 'long_desc')) {
$dbh->quote($name) .
", " . $dbh->quote(bz_crypt('okthen')) . ", " .
"'Account created only to maintain database integrity')");
- $s2 = $dbh->prepare("SELECT LAST_INSERT_ID()");
- $s2->execute();
- ($who) = ($s2->fetchrow_array());
+ $who = $dbh->bz_last_key('profiles', 'userid');
}
next;
} else {
@@ -2850,9 +2845,7 @@ if (GetFieldDef('bugs_activity', 'field')) {
if (!$id) {
$dbh->do("INSERT INTO fielddefs (name, description) VALUES " .
"($q, $q)");
- $s2 = $dbh->prepare("SELECT LAST_INSERT_ID()");
- $s2->execute();
- ($id) = ($s2->fetchrow_array());
+ $id = $dbh->bz_last_key('fielddefs', 'fieldid');
}
$dbh->do("UPDATE bugs_activity SET fieldid = $id WHERE field = $q");
}