Skip to Content.
Sympa Menu

freetds - Re: need some help with freebcp

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: "Thompson, Bill D (London)" <ThompBil AT exchange.uk.ml.com>
  • To: "'TDS Development Group'" <freetds AT franklin.oit.unc.edu>
  • Subject: Re: need some help with freebcp
  • Date: Wed, 23 Oct 2002 17:42:46 +0100


OK,

I've tracked down these errors. As I suspected they are both symptoms of the
same bug.

I remember now that my fix for this last time was to change dbconvert(), but
that change doesn't seem to have made it into CVS ( for good reason I'm sure
- it was to do with my use of strlen, I think).

As I have no wish to re-visit the convert code :-) , I've fixed the issue at
source in bcp.c
here it is, a one line change.

in function _bcp_exec_out() :

for (i = 0; i < dbproc->bcp_colcount; i++) {

bcpcol = dbproc->bcp_columns[i];
curcol = resinfo->columns[bcpcol->tab_colnum - 1];

if (is_blob_type(curcol->column_type)) {
/* FIX ME -- no converts supported */
src = curcol->column_textvalue;
len = curcol->column_cur_size;
}
else
{

src = &resinfo->current_row[curcol->column_offset];

srctype = tds_get_conversion_type(curcol->column_type,
curcol->column_size);

if ( srctype != bcpcol->db_type )
{
bcpcol->db_type = srctype;
}

if (is_numeric_type(curcol->column_type))
memcpy(bcpcol->data, src, sizeof(TDS_NUMERIC));
else
memcpy(bcpcol->data, src, curcol->column_size);

-- bcpcol->data_size = curcol->column_size;
++ bcpcol->data_size = curcol->column_cur_size;
}
}

A quick test shows that this resolves both issues.
Perhaps someone could put this patch in ?
Ta.

Bill

> -----Original Message-----
> From: Thompson, Bill D (London) [SMTP:ThompBil AT exchange.uk.ml.com]
> Sent: Wednesday, October 23, 2002 5:12 PM
> To: TDS Development Group
> Subject: [freetds] Re: need some help with freebcp
>
> All,
>
> The "padded out with NULLs" bug was raised a while ago.
> I know that I included a fix for it in my last-batch-of-changes-bar-one,
> so
> it may have gone away by now.
> It was to do with the length returned by dbconvert().
>
> If it's still there, I can take a look.
>
> Garbage appended to shorter values.
> Sounds to me like it could be a different symptom of the same problem.
>
> I've just looked , and I can reproduce BOTH problems.
> Unless anyone else wants to take it up, leave it with me. I'll sort them
> tomorrow
>
>
> Looks like I could spend some time on freebcp - sorting out the text
> fields
> issue, getting error handling better and so on. I could also de-dblib the
> code so that it can be called from ctlib and odbc...
>
> Bill
>
> > -----Original Message-----
> > From: James K. Lowden [SMTP:jklowden AT speakeasy.org]
> > Sent: Wednesday, October 23, 2002 1:30 PM
> > To: TDS Development Group
> > Subject: [freetds] Re: need some help with freebcp
> >
> > On Tue, 22 Oct 2002 22:05:11 -0400 (EDT), "Bob Kline"
> > <bkline AT rksystems.com> wrote:
> > > I can see
> > > some evidence of possible problems that might be related to the
> > > difficulties John is experiencing. For example:
> > >
> > > 1. In addition to the tab separator, values are padded out with
> nulls.
> >
> > That's a bug.
> >
> > > 2. The tail ends of longer values from earlier rows are carried
> > > forward as garbage appended to shorter values in subsequent rows.
> >
> > That's a bad bug.
> >
> > > As I say, I'm not intimately familiar with the way Sybase's version is
> > > supposed to work, but this doesn't look right to me.
> >
> > Ahem. Methinks thou doest protest too much.
> >
> > --jkl
> >
> > ---
> > You are currently subscribed to freetds as:
> [thompbil AT exchange.uk.ml.com]
> > To unsubscribe, forward this message to
> > $subst('Email.Unsub')
>
>
> ---
> You are currently subscribed to freetds as: [thompbil AT exchange.uk.ml.com]
> To unsubscribe, forward this message to
> $subst('Email.Unsub')





Archive powered by MHonArc 2.6.24.

Top of Page