[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: with argument substitution
From: |
Cook, Malcolm |
Subject: |
RE: with argument substitution |
Date: |
Thu, 14 Apr 2011 17:20:07 -0500 |
some considerations discussed and worked out for placeholders in perl DBI here
http://search.cpan.org/~timb/DBI-1.616/DBI.pm#Placeholders_and_Bind_Values
Malcolm Cook
Stowers Institute for Medical Research - Bioinformatics
Kansas City, Missouri USA
> -----Original Message-----
> From: parallel-bounces+mec=stowers.org@gnu.org
> [mailto:parallel-bounces+mec=stowers.org@gnu.org] On Behalf
> Of Ole Tange
> Sent: Wednesday, April 13, 2011 5:29 PM
> To: parallel@gnu.org
> Subject: sql: with argument substitution
>
> 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
>
>