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

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
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Posted 32m ago in Confluence

Calling all marketing teams who use Confluence - we want to hear from you!

Hi Community! me again 🙂 If you’re a marketing team using Confluence, we want to hear your story! How did you start using Confluence? What are your use cases? What have been some of the benefits?...

7 views 0 1
Join discussion

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