A plugin for the php-webapp-framework project for creating a responsive interface for T-SQL queries.
Go to file
2025-09-12 14:37:16 -06:00
files Downgraded Chart.js 2025-09-10 09:09:22 -06:00
js Support for queries nested in directories, directory search, and sharing search queries 2025-09-03 12:09:20 -06:00
lib Made pages more printer friendly, default values for inputs, added hidden column class hinting + more 2025-09-02 07:54:08 -06:00
pages Fixed find command to search in symlinks 2025-09-12 14:37:16 -06:00
.gitattributes Actual initial commit with all libraries included and basic functionality 2025-08-27 11:12:05 -06:00
footer.php Obey browser color scheme and created renderHead function for reuse in SQL companion views 2025-09-07 11:33:27 -06:00
head.php Downgraded Chart.js 2025-09-10 09:09:22 -06:00
header.php Added table filtering on output data, reduce dark mode flicker, refactored a few names of options 2025-09-08 12:06:48 -06:00
init.php Added authentication via UserAuth class (not supplied) 2025-08-28 11:44:13 -06:00
README.md README.md work and reduce flickering by rendering d-none early (instead of in JS) 2025-09-09 10:26:18 -06:00

QueryRunnerBS5

A plugin for the php-webapp-framework project for creating a responsive interface for T-SQL queries.


Query Options

Query options can be specified in the comments of your SQL queries, e.g.

-- Title: Report A
-- Description: This is a SQL query that returns the data for Report A.

List of options:

  • NoSorting — Specify this option to disable Datatables sorting
  • Allow — Specify a list of UserAuth usernames and groups allowed to use and run the report
  • Title — A title for the query
  • Scale — Specify the default scale for the text
  • Description — A brief description of the query
  • Danger
  • Warning
  • Info
  • ButtonLabel — Change the text of the execute button, e.g. Delete
  • ButtonClass — Change the Bootstrap 5 class of the execute button, e.g. btn-outline-danger
  • ButtonIcon — Change the FontAwesone icon of the execute button, e.g. fa-trash

Query Inputs

Designed with Microsoft SQL Server in mind. Here is a typical declare statement:

declare @BeginDate datetime = ?;
declare @EndDate datetime = ?;

The above creates two date inputs on the page for the user to provide when the query is selected. The question marks tell the PDO prepared statement where to place the user input values. This is done in the order they are provided.

For other languages like MySQL, write the declare statements in a comment like the following:

-- declare @BeginDate datetime = ?;
-- declare @EndDate datetime = ?;

Other SQL languages will not interpret those lines, but they are read by the software to create input fields for the end user. To use the values, place question marks where each value is needed in the query itself, e.g.:

select *
from event_log
where
    begin_date >= ?
and end_date < ?

Just be sure that the order of the declare statements (in comments) matches the order of the appearances of the question marks in the query.


Query Input Options

To create a dropdown input for the user to select from a list of values, you can specify the options like the following:

declare @Fruit varchar(100) = ?; -- Options: Apple,Orange,Banana

The above will allow the user to select from either Apple, Orange, or Banana. The chosen string will be passed as the value. To associate a hidden value with a label, do the following:

declare @Fruit varchar(100) = ?; -- Options: Apple=0,Orange=1,Banana=2

The above will still allow a user to select a fruit's name from the dropdown, but only one of the corresponding values 0, 1, or 2 will be sent to the query as a varchar(100).