Skip to Content.
Sympa Menu

freetds - RE: [freetds] [PATCH] bcp columns too small

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: "ZIGLIO, Frediano, VF-IT" <Frediano.Ziglio AT vodafone.com>
  • To: "FreeTDS Development Group" <freetds AT lists.ibiblio.org>
  • Subject: RE: [freetds] [PATCH] bcp columns too small
  • Date: Thu, 3 Feb 2005 09:28:08 +0100

>
> I encountered a bug doing a bcp in with RC9's freebcp where a
> character
> column in the client's charset occupies more space than the
> same column
> in the server's charset. In my case, I've set the client charset to
> UTF-8 and the server's is ISO-8859-1.
>
> When dbconvert is called from _bcp_read_hostfile, it space fills up to
> the length of curcol->column_size, which is determined from
> the client's
> charset, but the data area is only allocated according to the server's
> charset (curcol->on_server.column_size). So, for example, a char(6)
> field in ISO-8859-1 could take up to 24 bytes in UTF-8. We
> only allocate
> 6 bytes (or 6 + 1?), but later space fill all 24 bytes, including 18
> bytes that belong to something else. This obviously causes a memory
> accesss error if we're lucky, or corrupted data if we're not.
>
> The attached patch deals with the problem by modifying the way column
> memory is allocated. It simply allocates based on whichever
> column size
> is larger, server or client.
>
>

Applied in both 0.63 and HEAD.

freddy77



  • RE: [freetds] [PATCH] bcp columns too small, ZIGLIO, Frediano, VF-IT, 02/03/2005

Archive powered by MHonArc 2.6.24.

Top of Page