Up Prev Next
From: Michael Peppler <mpeppler at peppler dot org>
Subject: Re: Mix BCP & CT-Lib? Write to bcp via fifo?
Date: Oct 19 2001 11:27PM
Larry Bertolini writes:
> I have a couple questions about Sybperl and bcp:
> 1. can I use the Sybase::BCP functions
> from within a Sybase::CTlib program?
However, you could also consider trying the latest sybperl patch
release (from http://www.peppler.org/downloads) where I've added some
of the blk_*() routines to the Sybase::CTlib module.
> 2. Right now, I'm trying to use perl to pipe
> data to the bcp process. Pseudo-code is:
> open input file
> start a background bcp process that reads from a fifo file
> open fifo file for output
> read record
> munge data
> write to fifo
> close fifo file
> close input file
> I'm having weird problems with this approach;
> bcp dies with the message:
> Unexpected EOF encountered in BCP data-file.
> bcp copy in partially failed
> Sometimes the program works (processes 500,000 records),
> but usually it fails; the number of records that it
> processes is fairly random (a couple hundred, a couple
> thousand, or several thousand). I suspect that maybe it's
> related to perl's file buffering, but I've played with
> the "$|" variable, and it seems to have no effect (that is
> to say, it doesn't solve this problem).
You may want to use syswrite() instead of print (or whatever). This
will avoid the buffering.
Michael Peppler - Data Migrations Inc. - http://www.mbay.net/~mpeppler
firstname.lastname@example.org - email@example.com
International Sybase User Group - http://www.isug.com