diff options
author | bugreport%peshkin.net <> | 2005-08-27 08:11:30 +0200 |
---|---|---|
committer | bugreport%peshkin.net <> | 2005-08-27 08:11:30 +0200 |
commit | bc7607c1c4e31b9583a6a772c41567c1b1928e6d (patch) | |
tree | 3b370d740050b6bb2ec9013f374802585170f409 /Bugzilla | |
parent | d8a52b79b5b12e2e002614bc0aea343a9a535258 (diff) | |
download | bugzilla-bc7607c1c4e31b9583a6a772c41567c1b1928e6d.tar.gz bugzilla-bc7607c1c4e31b9583a6a772c41567c1b1928e6d.tar.xz |
Bug 305333: Move attachments.thedata to its own table
Patch by Joel Peshkin <bugreport@peshkin.net>
r=lpsolit, a=justdave
Diffstat (limited to 'Bugzilla')
-rw-r--r-- | Bugzilla/Attachment.pm | 2 | ||||
-rw-r--r-- | Bugzilla/DB/Schema.pm | 8 | ||||
-rw-r--r-- | Bugzilla/Search.pm | 13 | ||||
-rw-r--r-- | Bugzilla/Search/Quicksearch.pm | 4 |
4 files changed, 24 insertions, 3 deletions
diff --git a/Bugzilla/Attachment.pm b/Bugzilla/Attachment.pm index 78f4ceed5..558d7f8bc 100644 --- a/Bugzilla/Attachment.pm +++ b/Bugzilla/Attachment.pm @@ -78,6 +78,8 @@ sub query isobsolete, isprivate, LENGTH(thedata), submitter_id FROM attachments + INNER JOIN attach_data + ON id = attach_id WHERE bug_id = ? ORDER BY attach_id", undef, $bugid); diff --git a/Bugzilla/DB/Schema.pm b/Bugzilla/DB/Schema.pm index 3e86cc50d..e77e6d85b 100644 --- a/Bugzilla/DB/Schema.pm +++ b/Bugzilla/DB/Schema.pm @@ -301,7 +301,6 @@ use constant ABSTRACT_SCHEMA => { mimetype => {TYPE => 'MEDIUMTEXT', NOTNULL => 1}, ispatch => {TYPE => 'BOOLEAN'}, filename => {TYPE => 'varchar(100)', NOTNULL => 1}, - thedata => {TYPE => 'LONGBLOB', NOTNULL => 1}, submitter_id => {TYPE => 'INT3', NOTNULL => 1}, isobsolete => {TYPE => 'BOOLEAN', NOTNULL => 1, DEFAULT => 'FALSE'}, @@ -314,6 +313,13 @@ use constant ABSTRACT_SCHEMA => { attachments_submitter_id_idx => ['submitter_id', 'bug_id'], ], }, + attach_data => { + FIELDS => [ + id => {TYPE => 'INT3', NOTNULL => 1, + PRIMARYKEY => 1}, + thedata => {TYPE => 'LONGBLOB', NOTNULL => 1}, + ], + }, duplicates => { FIELDS => [ diff --git a/Bugzilla/Search.pm b/Bugzilla/Search.pm index f30fe733b..64342d17c 100644 --- a/Bugzilla/Search.pm +++ b/Bugzilla/Search.pm @@ -756,6 +756,19 @@ sub init { "ON groups_$chartid.id = bug_group_map_$chartid.group_id"); $f = "groups_$chartid.name"; }, + "^attach_data\.thedata," => sub { + my $atable = "attachments_$chartid"; + my $dtable = "attachdata_$chartid"; + my $extra = ""; + if (Param("insidergroup") && !UserInGroup(Param("insidergroup"))) { + $extra = "AND $atable.isprivate = 0"; + } + push(@supptables, "INNER JOIN attachments AS $atable " . + "ON bugs.bug_id = $atable.bug_id $extra"); + push(@supptables, "INNER JOIN attach_data AS $dtable " . + "ON $dtable.id = $atable.attach_id"); + $f = "$dtable.thedata"; + }, "^attachments\..*," => sub { my $table = "attachments_$chartid"; my $extra = ""; diff --git a/Bugzilla/Search/Quicksearch.pm b/Bugzilla/Search/Quicksearch.pm index 9f6724507..365e56469 100644 --- a/Bugzilla/Search/Quicksearch.pm +++ b/Bugzilla/Search/Quicksearch.pm @@ -80,8 +80,8 @@ my %mappings = (# Status, Resolution, Platform, OS, Priority, Severity "attachment" => "attachments.description", "attachmentdesc" => "attachments.description", "attachdesc" => "attachments.description", - "attachmentdata" => "attachments.thedata", - "attachdata" => "attachments.thedata", + "attachmentdata" => "attach_data.thedata", + "attachdata" => "attach_data.thedata", "attachmentmimetype" => "attachments.mimetype", "attachmimetype" => "attachments.mimetype"); |