Bug 161865 - GetFieldID shouldn't INSERT into the fielddefs table

r=joel x2
parent 159185ae
......@@ -1746,6 +1746,9 @@ sub AddFDef ($$$) {
}
# Note that all of these entries are unconditional, from when GetFieldID
# used to create an entry if it wasn't found. New fielddef columns should
# be created with their associated schema change.
AddFDef("bug_id", "Bug \#", 1);
AddFDef("short_desc", "Summary", 1);
AddFDef("product", "Product", 1);
......@@ -1779,9 +1782,10 @@ AddFDef("(to_days(now()) - to_days(bugs.delta_ts))", "Days since bug changed",
0);
AddFDef("longdesc", "Comment", 0);
AddFDef("alias", "Alias", 0);
AddFDef("everconfirmed", "Ever Confirmed", 0);
AddFDef("groupset", "Groupset", 0);
AddFDef("reporter_accessible", "Reporter Accessible", 0);
AddFDef("cc_accessible", "CC Accessible", 0);
###########################################################################
# Detect changed local settings
......
......@@ -349,12 +349,7 @@ sub GetFieldID {
my ($f) = (@_);
SendSQL("SELECT fieldid FROM fielddefs WHERE name = " . SqlQuote($f));
my $fieldid = FetchOneColumn();
if (!$fieldid) {
my $q = SqlQuote($f);
SendSQL("REPLACE INTO fielddefs (name, description) VALUES ($q, $q)");
SendSQL("SELECT LAST_INSERT_ID()");
$fieldid = FetchOneColumn();
}
die "Unknown field id: $f" if !$fieldid;
return $fieldid;
}
......
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