At my presentation yesterday a person in the audience suggested being
able to make arguments when making an sql-script executable.
So something like:
#!/usr/bin/sql -Y {2}
SELECT * FROM mytable WHERE user = '{1}';
You could then call that script like:
./myscript joe mysql:///
and:
{1} would then be replaced with joe
{2} would then be replaced with mysql:///
I am not sure if the {1} syntax is good or if the syntax should use $1
instead. I would prefer using a syntax that is easy to understand -
preferably something already known and which does not make problems
with any dialect of SQL. So if some obscure SQL dialect uses $1 for
something else (e.g. in functions), then that is a no-go.
So dear users: Please give some advice on what you think about this
and if you can find an even better idea for implementation.
/Ole