From: | "(dot)"(at)babolo(dot)ru |
---|---|
To: | pgman(at)candle(dot)pha(dot)pa(dot)us (Bruce Momjian) |
Cc: | pgsql-hackers(at)postgreSQL(dot)org |
Subject: | Re: [INTERFACES] sqlbang |
Date: | 2002-04-20 23:33:06 |
Message-ID: | 200204202333.DAA24386@aaz.links.ru |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers pgsql-interfaces |
Nobody interested?
I prepare my ISP Management System (ispms)
to publish and want reduce number of patches
needed to install it.
SQLbangs widely ised in it:
0cicuta~(1)>grep -r '^#\!/usr/local/bin/psql' /usr/local/libexec/ispms | wc -l
61
The most reason for patch are paremeters,
because without parameters
#!/usr/local/bin/psql -flags
can be substituted for:
#!/bin/sh
/usr/local/bin/psql -flags << "EOF"
but for substitute shell's ${1}, ${2} so on
for real parameters "EOF" in above example
MUST be without quotes.
So all SQL text will be preprocessored
by shell. Things are worst - some
of SQLbangs prepare simple shell's
programs with some shell
variables and quotes in it which must
be escaped to be not expanded
when SQL executes.
Yes, I have m4 build system to do such
escaping:
0cicuta~(2)>find w/ispms -name \*.m4 | wc -l
71
for WWW interface mostly, but without
SQLbangs escape level will be 1 level more,
shell has some errors (or features, I dont
know) with high level escaping and
I do not want depend on this errors
(or features) in base ispms system
(WWW interface has low rights)
Bruce Momjian writes:
> Can someone comment on this feature?
>
> ---------------------------------------------------------------------------
>
> "."@babolo.ru wrote:
> > Sorry I don't know if this is right list.
> >
> > I use scripts of such a kind (I say "SQLbang")
> >
> > #!/usr/local/bin/psql -qQ
> > \a \t \pset fieldsep ' '
> >
> > \set router '\'' :1 '\''
> >
> > SELECT ispdb_sfbsdr_allow(network(inet),niface)
> > FROM ispdb_sfbsdr_riaddr, nets
> > WHERE nrouter = :router
> > AND int_type = index_int_type('int')
> > AND network(inet) <<= network(net)
> > AND nets.control
> >
> > Parameters after sqlbang's name goes to :1, :2 so on.
<patch skiped>
> > I propose to include this feature.
> > Sorry for bad English.
--
@BABOLO http://links.ru/
From | Date | Subject | |
---|---|---|---|
Next Message | Francisco Jr. | 2002-04-21 00:11:15 | Implement a .NET Data Provider |
Previous Message | Tom Lane | 2002-04-20 17:25:00 | Re: Improved scanner performance |
From | Date | Subject | |
---|---|---|---|
Next Message | Peter Eisentraut | 2002-04-21 04:53:28 | Re: [INTERFACES] sqlbang |
Previous Message | lexx_h | 2002-04-19 13:32:07 | getting value of just inserted rows |