зеркало из https://github.com/mozilla/pjs.git
Patch for bug 190432; saving a named query uses REPLACE INTO (not ANSI); patch by David Lawrence <dkl@redhat.com>; r=vladd; a=justdave
This commit is contained in:
Родитель
249da37d53
Коммит
1826275d29
|
@ -341,8 +341,21 @@ elsif (($::FORM{'cmdtype'} eq "doit") && $::FORM{'remtype'}) {
|
||||||
my $userid = DBNameToIdAndCheck($::COOKIE{"Bugzilla_login"});
|
my $userid = DBNameToIdAndCheck($::COOKIE{"Bugzilla_login"});
|
||||||
my $qname = SqlQuote($::defaultqueryname);
|
my $qname = SqlQuote($::defaultqueryname);
|
||||||
my $qbuffer = SqlQuote($::buffer);
|
my $qbuffer = SqlQuote($::buffer);
|
||||||
SendSQL("REPLACE INTO namedqueries (userid, name, query)
|
|
||||||
VALUES ($userid, $qname, $qbuffer)");
|
SendSQL("LOCK TABLES namedqueries WRITE");
|
||||||
|
|
||||||
|
SendSQL("SELECT userid FROM namedqueries WHERE userid = $userid " .
|
||||||
|
"AND name = $qname");
|
||||||
|
my $result = FetchOneColumn();
|
||||||
|
if ($result) {
|
||||||
|
SendSQL("UPDATE namedqueries SET query = $qbuffer " .
|
||||||
|
"WHERE userid = $userid AND name = $qname");
|
||||||
|
} else {
|
||||||
|
SendSQL("INSERT INTO namedqueries (userid, name, query, linkinfooter) VALUES " .
|
||||||
|
"($userid, $qname, $qbuffer, 0)");
|
||||||
|
}
|
||||||
|
|
||||||
|
SendSQL("UNLOCK TABLES");
|
||||||
|
|
||||||
$vars->{'message'} = "buglist_new_default_query";
|
$vars->{'message'} = "buglist_new_default_query";
|
||||||
}
|
}
|
||||||
|
@ -369,6 +382,8 @@ elsif (($::FORM{'cmdtype'} eq "doit") && $::FORM{'remtype'}) {
|
||||||
$vars->{'message'} = "buglist_updated_named_query";
|
$vars->{'message'} = "buglist_updated_named_query";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SendSQL("LOCK TABLES namedqueries WRITE");
|
||||||
|
|
||||||
SendSQL("SELECT query FROM namedqueries WHERE userid = $userid AND name = $qname");
|
SendSQL("SELECT query FROM namedqueries WHERE userid = $userid AND name = $qname");
|
||||||
if (FetchOneColumn()) {
|
if (FetchOneColumn()) {
|
||||||
SendSQL("UPDATE namedqueries
|
SendSQL("UPDATE namedqueries
|
||||||
|
@ -376,10 +391,12 @@ elsif (($::FORM{'cmdtype'} eq "doit") && $::FORM{'remtype'}) {
|
||||||
WHERE userid = $userid AND name = $qname");
|
WHERE userid = $userid AND name = $qname");
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
SendSQL("REPLACE INTO namedqueries (userid, name, query, linkinfooter)
|
SendSQL("INSERT INTO namedqueries (userid, name, query, linkinfooter)
|
||||||
VALUES ($userid, $qname, $qbuffer, $tofooter)");
|
VALUES ($userid, $qname, $qbuffer, $tofooter)");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SendSQL("UNLOCK TABLES");
|
||||||
|
|
||||||
# Make sure to invalidate any cached query data, so that the footer is
|
# Make sure to invalidate any cached query data, so that the footer is
|
||||||
# correctly displayed
|
# correctly displayed
|
||||||
Bugzilla->user->flush_queries_cache();
|
Bugzilla->user->flush_queries_cache();
|
||||||
|
|
|
@ -2094,12 +2094,14 @@ sub AddFDef ($$$) {
|
||||||
my ($fieldid) = ($sth->fetchrow_array());
|
my ($fieldid) = ($sth->fetchrow_array());
|
||||||
if (!$fieldid) {
|
if (!$fieldid) {
|
||||||
$fieldid = 'NULL';
|
$fieldid = 'NULL';
|
||||||
}
|
$dbh->do("INSERT INTO fielddefs " .
|
||||||
|
|
||||||
$dbh->do("REPLACE INTO fielddefs " .
|
|
||||||
"(fieldid, name, description, mailhead, sortkey) VALUES " .
|
"(fieldid, name, description, mailhead, sortkey) VALUES " .
|
||||||
"($fieldid, $name, $description, $mailhead, $headernum)");
|
"($fieldid, $name, $description, $mailhead, $headernum)");
|
||||||
$headernum++;
|
$headernum++;
|
||||||
|
} else {
|
||||||
|
$dbh->do("UPDATE fielddefs SET name = $name, description = $description, " .
|
||||||
|
"mailhead = $mailhead WHERE fieldid = $fieldid");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -84,14 +84,16 @@ if ($user) {
|
||||||
my ($name, $cookiename, $value) = (@$ref);
|
my ($name, $cookiename, $value) = (@$ref);
|
||||||
if ($value) {
|
if ($value) {
|
||||||
my $qname = SqlQuote($name);
|
my $qname = SqlQuote($name);
|
||||||
|
SendSQL("LOCK TABLES namedqueries WRITE");
|
||||||
SendSQL("SELECT query FROM namedqueries " .
|
SendSQL("SELECT query FROM namedqueries " .
|
||||||
"WHERE userid = $userid AND name = $qname");
|
"WHERE userid = $userid AND name = $qname");
|
||||||
my $query = FetchOneColumn();
|
my $query = FetchOneColumn();
|
||||||
if (!$query) {
|
if (!$query) {
|
||||||
SendSQL("REPLACE INTO namedqueries " .
|
SendSQL("INSERT INTO namedqueries " .
|
||||||
"(userid, name, query) VALUES " .
|
"(userid, name, query) VALUES " .
|
||||||
"($userid, $qname, " . SqlQuote($value) . ")");
|
"($userid, $qname, " . SqlQuote($value) . ")");
|
||||||
}
|
}
|
||||||
|
SendSQL("UNLOCK TABLES");
|
||||||
}
|
}
|
||||||
$cgi->send_cookie(-name => $cookiename,
|
$cgi->send_cookie(-name => $cookiename,
|
||||||
-expires => "Fri, 01-Jan-2038 00:00:00 GMT");
|
-expires => "Fri, 01-Jan-2038 00:00:00 GMT");
|
||||||
|
|
Загрузка…
Ссылка в новой задаче