[fpc-pascal] TProcess questions

Adrian Maier adrian.maier at gmail.com
Wed Oct 4 12:55:04 CEST 2006


On 10/3/06, Adrian Maier <adrian.maier at gmail.com> wrote:
> On 10/3/06, Michael Van Canneyt <michael at freepascal.org> wrote:
> >
> > On Tue, 3 Oct 2006, Adrian Maier wrote:
> >
> > > On 10/3/06, Michael Van Canneyt <michael at freepascal.org> wrote:
> > > > > Any idea how should i quote the arguments so that they would be properly
> > > > > treated by TProcess?
> > > >
> > > > You can't. The following lines (line 107 of unix/process.inc)
> > > > Result:=StringReplace(Result,'"','',[rfReplaceAll]);
> > > > Result:=StringReplace(Result,'''','',[rfReplaceAll]);
> > > > Will strip all quotes inside a quoted string.
> > > >
> > > > Obviously, this is a bug.
> > >
> > > It's a painful one.  I was hoping to switch to TProcess instead of shell (
> > > which isn't  cross-platform )  ...
> >
> > The bug won't occur on windows :)
>
> > I will see about fixing it. Could you please post a bug report so it won't
> > be forgotten.

Hello guys,

Luckily I have discovered a workaround . It is possible to add the
simple quotes
later, inside the sql script. So, it is ok to run something like :
 psql  -f  abc.sql   -v DATE1=1-jan-2006

if I add at the beginning of the script:
\set  DATE1 '\'':DATE1'\''

Chers !
Adrian Maier



More information about the fpc-pascal mailing list