Skip to Content.
Sympa Menu

freetds - Re: [freetds] Problem with freebcp and fixed text output [NC]

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: Cedric ROUVRAIS <cedric.rouvrais AT sgcib.com>
  • To: FreeTDS Development Group <freetds AT lists.ibiblio.org>
  • Subject: Re: [freetds] Problem with freebcp and fixed text output [NC]
  • Date: Thu, 6 Aug 2009 17:59:04 -0400

Well, not in sybase for sure. This is an app that is running in production
on Sybase and that we are moving to SQL Server.

So I modified bcp.c as follows:

/** Cedric: support for none mapped columns, Sybase style. */
if (whichcol == TAB_COLNUM) {
ci->tab_colnum = 0;
whichcol = NO_MORE_COLS;
}
/** /Cedric */
if (whichcol == NO_MORE_COLS)
return (TRUE);
else
return (FALSE);

And tada it works for :o)

a++ Cedric



|------------------------------
| Konrad J Hambrick
| <konrad AT payplus.c
| om>
| Sent by:
| freetds-bounces@l
| ists.ibiblio.org
|
|
| 08/06/2009 05:53
| PM
|
|
| Please respond to
| konrad AT payplus.co
| m; Please respond
| to
| FreeTDS
| Development Group
| <freetds AT lists.ib
| iblio.org>
|
|


To
FreeTDS Development Group
<freetds AT lists.ibiblio.org>
cc

Subject
Re: [freetds] Problem with
freebcp and fixed text
output [NC]











Hmmm ...

Does the FORMAT file not need an explicit 0 (zero)
in Column 6 of the 2nd row of the FORMAT file to
skip DB Table Column 2 ?

I believe this is so in MS SQLServer.

-- kjh


Cedric ROUVRAIS wrote:
> Hi,
>
> Say you have a file with 100 columns and a table with 10 colums (case for
> one of our apps), how do you selectively bcp in the file? With Sybase you
> simply do not specify TAB_COLNUM and that column in the file is ignored.
>
> Sample format file (incomplete)
>
> 10.0
> 182
> 1 SYBCHAR 0 20 ";" 1 id
> 2 SYBCHAR 0 20 ";"
> 3 SYBCHAR 0 20 ";" 2 gop
>
> freebcp chokes on the second column (2 SYBCHAR 0 20 ";") and exits
whereas
> Sybase knows that it just needs to ignore this data, so I am modifying
> bcp.c to accomodate this behaviour.
>
> If I understand what you mean
>
> 2 SYBCHAR 0 20 ";" 0
>
> would be the appropriate format file and then freebcp would ignore this
> field but still bcp the file in?
>
> a++ Cedric
>
>
>
> |------------------------------

> | "James K. Lowden"

> | <jklowden@freetds

> | .org>

> | Sent by:

> | freetds-bounces@l

> | ists.ibiblio.org

> |

> |

> | 08/06/2009 05:39

> | PM

> |

> |

> | Please respond to

> | FreeTDS

> | Development Group

> | <freetds AT lists.ib

> | iblio.org>

> |

> |

>

>

>
To
> FreeTDS Development Group

>
<freetds AT lists.ibiblio.org>
>
cc
>

>
Subject
> Re: [freetds] Problem with

> freebcp and fixed text

> output [NC]

>

>

>

>

>

>

>
>
>
>
> Cedric ROUVRAIS wrote:
>> The issue one of my teams reported is that if there is a column in the
>> file that does not get imported into the table, then it fails. The
>> faulty procedure is _bcp_readfmt_colinfo which fails because TAB_COLNUM
>> is not present in that case.
>>
>> Any ideas before I start implementing a fix?
>
> I don't know what you mean by "not present", Cedric. It's an integer; it
> has to be present.
>
> It looks OK to me. The dbproc->hostfileinfo->host_columns array points
to
> a memory allocated with calloc(3) in bcp_columns(). By default, then,
> ci->tab_colnum should be zero, meaning the field in the file is ignored.
>
> HTH.
>
> --jkl
> _______________________________________________
> FreeTDS mailing list
> FreeTDS AT lists.ibiblio.org
> http://lists.ibiblio.org/mailman/listinfo/freetds
>
>
>
> *************************************************************************
> This message and any attachments (the "message") are confidential,
intended
> solely for the addressee(s), and may contain legally privileged
information.
> Any unauthorised use or dissemination is prohibited. E-mails are
susceptible
> to alteration. Neither SOCIETE GENERALE nor any of its subsidiaries or
> affiliates shall be liable for the message if altered, changed or
falsified.
> *************************************************************************
>
> _______________________________________________
> FreeTDS mailing list
> FreeTDS AT lists.ibiblio.org
> http://lists.ibiblio.org/mailman/listinfo/freetds
>
_______________________________________________
FreeTDS mailing list
FreeTDS AT lists.ibiblio.org
http://lists.ibiblio.org/mailman/listinfo/freetds



*************************************************************************
This message and any attachments (the "message") are confidential, intended
solely for the addressee(s), and may contain legally privileged information.
Any unauthorised use or dissemination is prohibited. E-mails are susceptible
to alteration. Neither SOCIETE GENERALE nor any of its subsidiaries or
affiliates shall be liable for the message if altered, changed or falsified.
*************************************************************************





Archive powered by MHonArc 2.6.24.

Top of Page