Commit d7f12988 authored by lpsolit%gmail.com's avatar lpsolit%gmail.com

Bug 314120: [Oracle] DBI::st::rows is used in a way that breaks Oracle - Patch…

Bug 314120: [Oracle] DBI::st::rows is used in a way that breaks Oracle - Patch by Fré©ric Buclin <LpSolit@gmail.com> r/a=mkanat
parent 1402b4bc
...@@ -1039,10 +1039,10 @@ installation has many users. ...@@ -1039,10 +1039,10 @@ installation has many users.
ENDTEXT ENDTEXT
# Re-crypt everyone's password. # Re-crypt everyone's password.
my $total = $dbh->selectrow_array('SELECT COUNT(*) FROM profiles');
my $sth = $dbh->prepare("SELECT userid, password FROM profiles"); my $sth = $dbh->prepare("SELECT userid, password FROM profiles");
$sth->execute(); $sth->execute();
my $total = $sth->rows;
my $i = 1; my $i = 1;
print "Fixing passwords...\n"; print "Fixing passwords...\n";
...@@ -1081,11 +1081,11 @@ sub _update_bugs_activity_to_only_record_changes { ...@@ -1081,11 +1081,11 @@ sub _update_bugs_activity_to_only_record_changes {
# Now we need to process the bugs_activity table and reformat the data # Now we need to process the bugs_activity table and reformat the data
print "Fixing activity log...\n"; print "Fixing activity log...\n";
my $total = $dbh->selectrow_array('SELECT COUNT(*) FROM bugs_activity');
my $sth = $dbh->prepare("SELECT bug_id, who, bug_when, fieldid, my $sth = $dbh->prepare("SELECT bug_id, who, bug_when, fieldid,
oldvalue, newvalue FROM bugs_activity"); oldvalue, newvalue FROM bugs_activity");
$sth->execute; $sth->execute;
my $i = 0; my $i = 0;
my $total = $sth->rows;
while (my ($bug_id, $who, $bug_when, $fieldid, $oldvalue, $newvalue) while (my ($bug_id, $who, $bug_when, $fieldid, $oldvalue, $newvalue)
= $sth->fetchrow_array()) = $sth->fetchrow_array())
{ {
...@@ -2145,20 +2145,19 @@ sub _fix_group_with_empty_name { ...@@ -2145,20 +2145,19 @@ sub _fix_group_with_empty_name {
# group_$gid and add _<n> if necessary. # group_$gid and add _<n> if necessary.
my $trycount = 0; my $trycount = 0;
my $trygroupname; my $trygroupname;
my $trygroupsth = $dbh->prepare("SELECT id FROM groups where name = ?"); my $sth = $dbh->prepare("SELECT 1 FROM groups where name = ?");
do { my $name_exists = 1;
while ($name_exists) {
$trygroupname = "group_$emptygroupid"; $trygroupname = "group_$emptygroupid";
if ($trycount > 0) { if ($trycount > 0) {
$trygroupname .= "_$trycount"; $trygroupname .= "_$trycount";
} }
$trygroupsth->execute($trygroupname); $name_exists = $dbh->selectrow_array($sth, undef, $trygroupname);
if ($trygroupsth->rows > 0) { $trycount++;
$trycount ++;
} }
} while ($trygroupsth->rows > 0); $dbh->do("UPDATE groups SET name = ? WHERE id = ?",
my $sth = $dbh->prepare("UPDATE groups SET name = ? " . undef, $trygroupname, $emptygroupid);
"WHERE id = $emptygroupid");
$sth->execute($trygroupname);
print "Group $emptygroupid had an empty name; renamed as", print "Group $emptygroupid had an empty name; renamed as",
" '$trygroupname'.\n"; " '$trygroupname'.\n";
} }
...@@ -2215,10 +2214,10 @@ sub _migrate_email_prefs_to_new_table { ...@@ -2215,10 +2214,10 @@ sub _migrate_email_prefs_to_new_table {
$dbh->bz_start_transaction(); $dbh->bz_start_transaction();
# Select all emailflags flag strings # Select all emailflags flag strings
my $total = $dbh->selectrow_array('SELECT COUNT(*) FROM profiles');
my $sth = $dbh->prepare("SELECT userid, emailflags FROM profiles"); my $sth = $dbh->prepare("SELECT userid, emailflags FROM profiles");
$sth->execute(); $sth->execute();
my $i = 0; my $i = 0;
my $total = $sth->rows;
while (my ($userid, $flagstring) = $sth->fetchrow_array()) { while (my ($userid, $flagstring) = $sth->fetchrow_array()) {
$i++; $i++;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment