How do I search within the SQL of all PocketQuery queries?

I have a fairly large number of queries and I would like to be able to search for keywords in the SQL statements.

For example, I'm editing a stored procedure in my database that I know is used in some queries, and I'd like to search for the procedure name so I can check dependencies.

Is there a way to do this? I looked in the database but this query wasn't useful:

SELECT * FROM plugindata where PLUGINKEY = 'de.scandio.confluence.plugins.pocketquery'

2 answers

1 accepted

1 vote
Accepted answer

Hi Jacob,

I prepared a little piece of JavaScript code that retrieves the query objects and their statements in Confluence Admin. When you are on that screen, you can open a browser console (e.g. DevTools in Chrome) and execute the script. It should then print all query objects (which you can expand and see all data) and a string that contains all statements separated.

(function($) {

	var allQueryObjects = [];
	var statementsString = '';

	$('#queries-list li').each(function() {
		var $this = $(this);
		var queryName = $'entityname');
		var queryObj = PocketQuery.getEntity('query', queryName);
		statementsString += '\n===\n' + queryObj.statement;

	console.log('All query objects:');

	console.log('All query statements');


Let me know if you need further help!

Regards, Felix

Hi Felix,

Wow, that will work nicely, thanks for such a quick response!

Cheers, Jacob

This is just related info - it does the same thing for the templates as the above does for the queries:

(function($) {
    var PQEntityObjects = [];
    var outputString = '';
    $('#templates-list li').each(function() {
        var $this = $(this);
        var entityname= $'entityname');
        var entityObj = PocketQuery.getEntity('template', entityname);
        outputString += '\n\n=== '+ entityname +' ===\n' + entityObj.content;
    console.log('All template objects:');
    console.log('All template content:');

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Dec 18, 2018 in Confluence Cloud

Happy holidays from our team to yours!

Hi Community!  2018 was filled with changes for our team, both big and small, and we've taken a lot of time to both celebrate our wins and recognize areas of improvement. One thing that we're a...

473 views 3 18
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you