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/