Parameter Support

Mar 4, 2013 at 11:56 AM
Edited Mar 4, 2013 at 11:57 AM

Excellent job on this project - I searched around more many similar programs but this seems the most lightweight and suitable.

Essentially, I am thinking about using Mini SQL Query as a teaching tool to help students learn SQL. It is ideal as all queries have to be written by hand - no wizards or design tools! So this is a perfect environment for learning SQL properly and getting to grips with syntax.

However the only part I cannot see or get working is the use of parameters for standard SELECT, UPDATE etc. queries. I see some of the templates accept parametised values (e.g. CREATE TABLE) but I am looking to gather input from users at run-time.

Something simple like:

SELECT Shippers.*
FROM Shippers
WHERE Shippers.Country = aParameter

This would result in the standard error of no parameter values being assigned.

Currently I'm unsure how you assign values at run-time as described or if this is even possible?

Thanks for your time,

Mar 5, 2013 at 1:18 AM

Thanks for the feedback!!

I think what you are after is in there, have a look at the "Create Table" template, each line at the beginning with "#@get <variable>" will throw up a simple input box - you just wrap the parameter in ${variable}.

It is basic but works, for example:

Example template file ""

#@get aParameter

SELECT Shippers.*
FROM Shippers
WHERE Shippers.Country = ${aParameter}
You "run" the template and an input box asks you for a value, I enter 'foo' and the generated template is:
SELECT Shippers.*
FROM Shippers
WHERE Shippers.Country = 'foo'
You can have multiple #@get directives etc.

How does that sound?

PK :-)
Marked as answer by paulkohler on 7/20/2014 at 3:59 PM
Mar 5, 2013 at 2:45 PM
Thanks! This works great.