From 78865fda79e5b78288aafd75b531924c73b27883 Mon Sep 17 00:00:00 2001 From: "terry%mozilla.org" <> Date: Fri, 21 Jan 2000 05:31:18 +0000 Subject: Moved all the long descriptions out of the bugs table, and into a new table. There is now a separate entry for each new long description, rather than appending them all together in one big field. --- globals.pl | 35 +++++++++++++++++++++++++---------- 1 file changed, 25 insertions(+), 10 deletions(-) (limited to 'globals.pl') diff --git a/globals.pl b/globals.pl index 856048c4d..90d2513b7 100644 --- a/globals.pl +++ b/globals.pl @@ -51,6 +51,7 @@ sub globals_pl_sillyness { use Mysql; use Date::Format; # For time2str(). +use Date::Parse; # For str2time(). # use Carp; # for confess # Contains the version string for the current running Bugzilla. @@ -109,14 +110,11 @@ sub AppendComment { if ($comment =~ /^\s*$/) { # Nothin' but whitespace. return; } - SendSQL("select long_desc from bugs where bug_id = $bugid"); - - my $desc = FetchOneColumn(); - my $now = time2str("%Y-%m-%d %H:%M", time()); - $desc .= "\n\n------- Additional Comments From $who $now -------\n"; - $desc .= $comment; - SendSQL("update bugs set long_desc=" . SqlQuote($desc) . - " where bug_id=$bugid"); + + my $whoid = DBNameToIdAndCheck($who); + + SendSQL("INSERT INTO longdescs (bug_id, who, bug_when, thetext) " . + "VALUES($bugid, $whoid, now(), " . SqlQuote($comment) . ")"); } sub lsearch { @@ -464,8 +462,25 @@ sub DBNameToIdAndCheck { sub GetLongDescription { my ($id) = (@_); - SendSQL("select long_desc from bugs where bug_id = $id"); - return FetchOneColumn(); + my $result = ""; + SendSQL("SELECT profiles.login_name, longdescs.bug_when, " . + " longdescs.thetext " . + "FROM longdescs, profiles " . + "WHERE profiles.userid = longdescs.who " . + " AND longdescs.bug_id = $id " . + "ORDER BY longdescs.bug_when"); + my $count = 0; + while (MoreSQLData()) { + my ($who, $when, $text) = (FetchSQLData()); + if ($count) { + $result .= "\n\n------- Additional Comments From $who " . + time2str("%Y-%m-%d %H:%M", str2time($when)) . " -------\n"; + } + $result .= $text; + $count++; + } + + return $result; } -- cgit v1.2.3-24-g4f1b