From: dave%intrec.com <> Date: Tue, 20 Mar 2001 05:03:52 +0000 (+0000) Subject: Re-re-fix for bug 71550. This will quite likely fix a number of bugs in other places... X-Git-Tag: bugzilla-2.12~40 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=116bc99949d84e72184b3463aa7cc2748e578a71;p=thirdparty%2Fbugzilla.git Re-re-fix for bug 71550. This will quite likely fix a number of bugs in other places. The DBID<->Name conversion routines in globals.pl were not pushing/popping the SQL state around their SQL calls, which could result in lost data if called from inside a loop which is handling other SQL data. --- diff --git a/globals.pl b/globals.pl index d112b0c8fb..20f75debc0 100644 --- a/globals.pl +++ b/globals.pl @@ -587,6 +587,7 @@ sub InsertNewUser { } my $usenewemailtech = Param('newemailtech') & Param('newemailtechdefault'); + PushGlobalSQLState(); SendSQL("select bit, userregexp from groups where userregexp != ''"); my $groupset = "0"; while (MoreSQLData()) { @@ -605,13 +606,16 @@ sub InsertNewUser { $username = SqlQuote($username); $realname = SqlQuote($realname); SendSQL("insert into profiles (login_name, realname, password, cryptpassword, groupset, newemailtech) values ($username, $realname, '$password', encrypt('$password'), $groupset, $usenewemailtech)"); + PopGlobalSQLState(); return $password; } sub DBID_to_real_or_loginname { my ($id) = (@_); + PushGlobalSQLState(); SendSQL("SELECT login_name,realname FROM profiles WHERE userid = $id"); my ($l, $r) = FetchSQLData(); + PopGlobalSQLState(); if (!defined $r || $r eq "") { return $l; } else { @@ -622,8 +626,10 @@ sub DBID_to_real_or_loginname { sub DBID_to_name { my ($id) = (@_); if (!defined $::cachedNameArray{$id}) { + PushGlobalSQLState(); SendSQL("select login_name from profiles where userid = $id"); my $r = FetchOneColumn(); + PopGlobalSQLState(); if (!defined $r || $r eq "") { $r = "__UNKNOWN__"; } @@ -634,8 +640,10 @@ sub DBID_to_name { sub DBname_to_id { my ($name) = (@_); + PushGlobalSQLState(); SendSQL("select userid from profiles where login_name = @{[SqlQuote($name)]}"); my $r = FetchOneColumn(); + PopGlobalSQLState(); if (!defined $r || $r eq "") { return 0; }