Strange postresSQL errors...

Rick Delaney rick-h4KjNK7Mzas at public.gmane.org
Tue Jul 20 03:38:54 UTC 2004


You already know that quoting was the problem but...

On Mon, Jul 19, 2004 at 03:18:25PM -0400, Madison Kelly wrote:
> 2588: $DBreq=$DB->prepare("SELECT file_backup, file_restore FROM 
> file_dir WHERE file_parent_dir='$file_parent_dir' AND 
> file_name='$file_name' AND file_src_uuid='$file_src_uuid'") || die 
> $DBI::errstr;
> 2589: $passed_file_backup=$DBreq->execute();

don't do it like that.  Use placeholders and then you don't have to
worry about quoting.

    $DBreq = $DB->prepare("
      SELECT file_backup, file_restore 
      FROM file_dir 
      WHERE file_parent_dir = ? AND file_name = ? AND file_src_uuid = ?
    ") || die $DBI::errstr;
    $passed_file_backup = $DBreq->execute(
        $file_parent_dir, $file_name, $file_src_uuid,
    );

-- 
Rick Delaney
rick-h4KjNK7Mzas at public.gmane.org
--
The Toronto Linux Users Group.      Meetings: http://tlug.ss.org
TLUG requests: Linux topics, No HTML, wrap text below 80 columns
How to UNSUBSCRIBE: http://tlug.ss.org/subscribe.shtml





More information about the Legacy mailing list