Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

General Questions /

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

viewing SQL queries executed by the ORM? debug module?


Go to End


4 Posts   767 Views

Avatar
jmp909

Community Member, 5 Posts

17 January 2016 at 7:34am

Hi,

are there any modules available for viewing what SQL queries get executed by the ORM. Laravel for instance has the DebugBar which is really useful https://laravel-news.com/2015/02/laravel-debugbar/

just wondering if there's anything similar for SilverStripe?

I couldnt get jakr's DeveloperDashboard (https://github.com/jakr/developer_dashboard) & DBProfiler (https://github.com/jakr/silverstripe-dbprofiler) working with 3.2 so I'm not sure what they do exactly

thanks for any help
J

Avatar
swaiba

Forum Moderator, 1899 Posts

18 January 2016 at 9:28pm

Hi J,

There was an excellent 2.4 module... https://github.com/smindel/silverstripe-dbplumber which I'm sure would be welcomed if if was upgraded to work with 3.2

Alternatively https://www.adminer.org/ is a "full-featured database management tool written in PHP ... it consist of a single file ready to deploy to the target server ... MySQL, PostgreSQL, SQLite, MS SQL, Oracle, Firebird, SimpleDB, Elasticsearch and MongoDB" as it's one file it's not too much hassle to add and remove as needed. But do remember to remove when not needed :)

Avatar
swaiba

Forum Moderator, 1899 Posts

18 January 2016 at 11:22pm

I misread that didn't I?

http://docs.silverstripe.org/en/developer_guides/debugging/url_variable_tools/

and "showqueries" is what you were after!

Avatar
jmp909

Community Member, 5 Posts

19 January 2016 at 6:51am

Edited: 19/01/2016 6:52am

thanks for the info.

the only issue there really is that it's only showing the parameterized query without the values :(

SELECT DISTINCT "File"."ClassName", "File"."LastEdited", "File"."Created", 
"File"."Name", "File"."Title", "File"."Filename", "File"."Content", "File"."ShowInSearch", 
"File"."ParentID", "File"."OwnerID", "File"."ID", 
CASE WHEN "File"."ClassName" IS NOT NULL 
THEN "File"."ClassName" 
ELSE 'File' 
END 
AS "RecordClassName" FROM "File" 
WHERE ("File"."ID" = ?) AND ("File"."ClassName" IN (?, ?)) 
ORDER BY "File"."Name" 
ASC LIMIT 1

regards
J