Up Prev Next
From: Michael Peppler <mpeppler at MBAY dot NET>
Subject: Re: Executing sql statements stored in a file
Date: Sep 16 1997 4:51PM
Rakesh Dinger wrote:
> I have a requirement where I need to execute a bunch of sql statements (which
> are stored in a file) from within a perl script.
> I tried using system and isql, but this does not work as perl was compiled with
> the suidperl security patch: (The script has setuid on by design.)
> .....system ("isql -Usa -S$SVR -P$PWD -i $PROCFILE");
> /home/rdinger> admin.pl
> ==> Insecure dependency in system while running setuid at /dev/fd/3 line 281,
> chunk 13.
You should be able to fix that by using an absolute path to isql (ie
system ("/usr/local/sybase/bin/isql -Usa -S$SVR -P$PWD -i $PROCFILE");
> I then tried to read in the file line-by-line and build up a dbcmd string, but
> then I have to backslash all the sybase @ variables within the st proc file (
> which is a pain).
You only have to escape the @ variables if you use double quotes.
Use single quotes (or the q() function) and you should be OK.
Michael Peppler -||- Data Migrations Inc.
firstname.lastname@example.org -||- http://www.mbay.net/~mpeppler