SQLpage icon indicating copy to clipboard operation
SQLpage copied to clipboard

Add debugging option to include the SQL queries in the output

Open mingfang opened this issue 11 months ago • 2 comments

It would make debugging and learning somebody else's SQLPage site easier if I can hover over a component to see the SQL that was used to generate it.

For example, when I hover over a button like this

Image

I would see the SQL in a popover like this

Image

mingfang avatar Jan 22 '25 04:01 mingfang

That would indeed be cool! But also a lot of work to implement :) I think we'll focus on important much requested new features at first.

lovasoa avatar Jan 22 '25 06:01 lovasoa

Couldn't you edit the SQL in the backend so that another expression is added? For example: SELECT 'purple' AS title , 'purple' AS outline; becomes SELECT 'purple' AS title , 'purple' AS outline , 'SELECT \'purple\' AS title, \'purple\' AS outline;' AS sql_query;

I tried to look at it at https://github.com/sqlpage/SQLPage/blob/main/src/webserver/database/sql.rs, but I can't get along with Rust.

And the data can then be displayed in the respective handlebars using the sql_query parameter.

Or are there better approaches?

Kitsune-Kuro avatar Feb 22 '25 06:02 Kitsune-Kuro