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

This widget could not be displayed.

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 = $this.data('entityname');
		var queryObj = PocketQuery.getEntity('query', queryName);
		allQueryObjects.push(queryObj);
		statementsString += '\n===\n' + queryObj.statement;
	});

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

	console.log('All query statements');
	console.log(statementsString);

}(jQuery))

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 widget could not be displayed.

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= $this.data('entityname');
        var entityObj = PocketQuery.getEntity('template', entityname);
        PQEntityObjects.push(entityObj);
        outputString += '\n\n=== '+ entityname +' ===\n' + entityObj.content;
    });
 
    console.log('All template objects:');
    console.log(PQEntityObjects);
 
    console.log('All template content:');
    console.log(outputString);
 
}(jQuery))

Suggest an answer

Log in or Sign up to answer
Atlassian Summit 2018

Meet the community IRL

Atlassian Summit is an excellent opportunity for in-person support, training, and networking.

Learn more
Community showcase
Published Tuesday in Confluence

Add-on evaluation with confluence templates

Atlassian market place contains number of Apps/Addons which improves the capability of out of the box Atlassian products. It is good to follow a plugin evaluation process before install add-ons. So t...

121 views 12 6
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