Closed
Bug 139559
Opened 23 years ago
Closed 17 years ago
Bugzilla should remove line breaks from SQL for people using DB status tools
Categories
(Bugzilla :: Bugzilla-General, enhancement, P3)
Tracking
()
RESOLVED
WONTFIX
People
(Reporter: myk, Unassigned)
References
(Blocks 1 open bug)
Details
Attachments
(1 file, 2 obsolete files)
(deleted),
patch
|
mkanat
:
review+
justdave
:
review-
|
Details | Diff | Splinter Review |
Some Bugzilla queries contain line breaks, and this makes server tools like
"mysqladmin --verbose processlist" harder to use. Bugzilla queries, even when
broken into multiple lines in the Perl code that defines them, should contain no
line breaks.
Comment 1•23 years ago
|
||
This refers to SQL in the source code right?
Why does it make mysqladmin harder to use?
Priority: -- → P3
Target Milestone: --- → Bugzilla 2.18
Reporter | ||
Comment 2•23 years ago
|
||
>This refers to SQL in the source code right?
Right.
>Why does it make mysqladmin harder to use?
"mysqladmin processlist" displays a list of queries with one query per line.
Having line breaks in the queries messes up this formatting, making it harder
for humans and scripts to parse the output.
Comment 3•21 years ago
|
||
These unloved bugs have been sitting untouched since June 2002 or longer. If
nobody does anything else to them, they certainly won't make 2.18
Retargetting to 2.20. If you really plan to push them right now, you might pull
them back in.
Target Milestone: Bugzilla 2.18 → Bugzilla 2.20
Updated•20 years ago
|
Blocks: bz-majorarch
Comment 4•20 years ago
|
||
Having the line breaks makes things infinitely more readable in the Perl source
code....
With our new architecture changes, since I believe Bugzilla::DB is (or shortly
will be) overriding DBI, perhaps we could override ->prepare and ->do and
friends and collapse whitespace in the queries before passing them to the
server? (Or does DBI perhaps already have an option for that?)
Comment 5•20 years ago
|
||
Reassigning bugs that I'm not actively working on to the default component owner
in order to try to make some sanity out of my personal buglist. This doesn't
mean the bug isn't being dealt with, just that I'm not the one doing it. If you
are dealing with this bug, please assign it to yourself.
Assignee: justdave → general
QA Contact: mattyt-bugzilla → default-qa
Comment 6•19 years ago
|
||
This overrides the following DBI methods in Bugzilla/DB.pm:
prepare, do, selectrow_array, selectrow_arrayref, selectrow_hashref,
selectall_arrayref, selectall_hashref, selectcol_arrayref
This removes all \n chars from the query, so that the processlist output will
be the same. It does *not* kill any extra whitespace though, since that may
affect the paramaters for the query if they aren't being called through binding
them - this is a safety precaution more than anything.
Updated•19 years ago
|
Attachment #191790 -
Flags: review?(mkanat)
Updated•19 years ago
|
Attachment #191790 -
Attachment is obsolete: true
Attachment #191790 -
Flags: review?(mkanat)
Comment 7•19 years ago
|
||
As above, but with the second parameter to prepare
Attachment #191791 -
Flags: review?(mkanat)
Updated•19 years ago
|
Attachment #191791 -
Attachment description: Patch v1.1 → Patch v1.1 (patch -p2 when applying)
Comment 8•19 years ago
|
||
Comment on attachment 191791 [details] [diff] [review]
Patch v1.1 (patch -p2 when applying)
OK, instead of doing the arguments the way you're doing them, you can do this:
my $self = shift;
my $query = shift;
$query =~ s/\n/ /g;
return $self->SUPER::function($query, @_);
That allows us to be compatible if the arguments ever change for those
functions.
Note also that I think it's better to replace the newline with a space than
with nothing at all, to be safe.
Attachment #191791 -
Flags: review?(mkanat) → review-
Comment 9•19 years ago
|
||
Addresses review comments
Assignee: general → colin.ogilvie
Attachment #191791 -
Attachment is obsolete: true
Status: NEW → ASSIGNED
Attachment #191794 -
Flags: review?(mkanat)
Updated•19 years ago
|
Severity: normal → enhancement
Summary: Bugzilla queries should not contain line breaks → Bugzilla should remove line breaks from SQL for people using DB status tools
Comment 10•19 years ago
|
||
Comment on attachment 191794 [details] [diff] [review]
Patch v2
Yep. Seems to work.
However, please move all these subs into their own section, instead of where
they are now. Put it at the bottom, or something.
Attachment #191794 -
Flags: review?(mkanat) → review+
Comment 11•19 years ago
|
||
It's up to justdave whether or not we actually want to do this.
I *think* it wouldn't hurt... my only mild concern is that it is a bit of a
strange side-effect to add to these methods.
Flags: approval?
Updated•19 years ago
|
Flags: approval?
Comment 12•19 years ago
|
||
Comment on attachment 191794 [details] [diff] [review]
Patch v2
As much as I like the idea of doing this, we can't just arbitrarily remove all
line breaks.
Any line breaks that ocurr inside quotes need to be preserved, as that's actual
data and not part of the query syntax.
Attachment #191794 -
Flags: review-
Comment 13•19 years ago
|
||
Oh, and also, I just remembered -- the first argument of the select* or do
methods can be an $sth, so we have to make sure that it's not.
Comment 14•19 years ago
|
||
Only prepare method needs to be overridden because it's called by the select*
and do methods. This way there is no need to worry about statement handle
parameters.
There seems to be code in DBD::Chart's prepare method to remove newlines (since
v0.21). Looks awfully complicated but that's probably because it does the
preparing part too. Maybe it can give some clues on how to implement this or not..
Updated•19 years ago
|
Assignee: colin.ogilvie → general
Status: ASSIGNED → NEW
Updated•19 years ago
|
Target Milestone: Bugzilla 2.20 → ---
Comment 15•17 years ago
|
||
This isn't worth the required complexity.
Status: NEW → RESOLVED
Closed: 17 years ago
Resolution: --- → WONTFIX
You need to log in
before you can comment on or make changes to this bug.
Description
•