Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

How can I search issues with SQL in comments?

philippos September 3, 2013

I have a Jira installation with thousands of issues. Some of them contain in comments SQL commands.

I would like to collect all those SQL commands, along with corresponsing Jira ID.

Is there any such method? Simple querying for issues with "SELECT" or "INSERT" into comments returns many irrelevant records.

Thank you.

7 answers

1 accepted

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

0 votes
Answer accepted
HarryH
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 4, 2013

so now I think the workaround is to run:

comment ~ "insert" AND comment ~ "into"
1 vote
HarryH
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 3, 2013

Please use "Issue Advanced Search", and then use JQL:

comment ~ "insert" OR comment ~ "update"

philippos September 4, 2013

Thanks, this will get all comments with "insert" or "update", correct?

Can I get all comments with "Select ___ from" where ____ any single word?

HarryH
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 4, 2013

yes, the JQL I pasted search all comments contains "insert" or "update", you can change "OR" to "AND", if you want to use "and" relationship.

Also you can add more conditions after it, like: OR comment ~ "select* from"

* and ? is also support in JQL.

To perform a single character wildcard search use the "?" symbol.

To perform a multiple character wildcard search use the "*" symbol.

Please note that there is a space after *, I have tested on my jira, it works fine.

If you have any problem, please let me know.

philippos September 4, 2013

Thank you.

I get results where the words "insert" and "into" are dispersed in the comment.

Is it possible to force the results to contain them in exact sequence "insert into"?

0 votes
Dan Garthwaite January 16, 2017

I just did this with a proximate query:

status = "DONE" AND comment ~ '"SELECT FROM WHERE"~100'

Pay special attention to the spacing around the first tilde and also the single quotes around the proximate expression.

0 votes
philippos October 8, 2013

Therefore I see my only choices is to search comments for words like "select", "delete", "into", "from" etc.

0 votes
philippos September 21, 2013

Therefore I see my only choices is to search comments for words like "select", "delete", "into", "from" etc.

Thanks anyway.

0 votes
HarryH
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 4, 2013

To search the exact sequence, you can search with

comment ~ "\"insert into\""

But I have tried on my machine, it doesn't work, I think it's a bug of jira, because the documention suggests the usage.
  • Find issues where a Comment contains the exact phrase "My PC is quite old":

    comment ~ "\"My PC is quite old\""
Please refer to the doc:

https://confluence.atlassian.com/display/JIRA052/Advanced+Searching#AdvancedSearching-Comments

0 votes
Peter Van de Voorde
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
September 4, 2013

Hi philippos,


JQL doesn't allow wildcards so that might be a bit difficult.

You could ofcourse try something like this :

comment ~ 'Select' and comment ~ 'from' and comment ~ 'where'

Best Regards,

Peter

Udo Brand
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 4, 2013

Peters solution is as close as you can get. Even so it is perfect since there could be three comments one containing 'select', the second 'from' and the third 'where'.

HarryH
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 4, 2013

JQL supports wildcards, please see my example in previous comment, also please check https://confluence.atlassian.com/display/JIRA/Performing+Text+Searches

Peter Van de Voorde
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
September 4, 2013

I stand corrected, I must have misread it somewhere.

Thank you for pointing this out Harry.

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

TAGS
AUG Leaders

Atlassian Community Events