Skip to Content.
Sympa Menu

freetds - Re: [freetds] dblib bcp, t0017 broken

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] dblib bcp, t0017 broken
  • Date: Fri, 27 Jan 2006 14:28:54 +0100

>
> Freddy
>
> $ od -x t0017.in
>
> 0000000 0411 2233 4445 0000 0070 726f 7661 2064
> 0000020 6920 7465 7374 6f20 7175 6573 746f 2074
> 0000040 6573 746f 2064 6f76 7265 6262 6520 616e
>
> so in the file there is a one byte prefix-len for the integer
> but we're telling bcp there is no prefix (because column is
> not null on
> database)
>
> 11:56:31.013669 parsing host column 1
> 11:56:31.013725 prefix_len = 0 collen = 0
> 11:56:31.013765 Reading 4 bytes from hostfile.
>
> remove that 1st byte form the file and things go much better...
>
> "strange" data...
>
> 0030 00 30 00 30 00 31 00 37-00 02 63 00 32 00 d1 44
> |.0.0.1.7 ..c.2..D|
> 0040 33 22 11 10 ff ff ff ff-ff ff ff ff ff ff ff ff
> |3"...... ........|
> 0050 ff ff ff ff ff ff ff ff-ff ff ff ff 45 00 00 00
> |........ ....E...|
> 0060 70 72 6f 76 61 20 64 69-20 74 65 73 74 6f 20 71 |prova
> di testo q|
> 0070 75 65 73 74 6f 20 74 65-73 74 6f 20 64 6f 76 72 |uesto
> te sto dovr|
> 0080 65 62 62 65 20 61 6e 64-61 72 65 20 61 20 66 69 |ebbe
> and are a fi|
> 0090 6e 69 72 65 20 69 6e 20-75 6e 20 63 61 6d 70 6f |nire in
> un campo|
> 00a0 20 74 65 78 74 - | text|
>
> d1 = row marker
> 44 33 22 11 = int data
>
> 0x10 = 16
> followed by 16 * 0xff
>
> This is the dummy textptr
>
> followed by 8 * 0xff
>
> this is Dummy timestamp
>
> 45 00 00 00 length of text data to follow = 69
>
> followed by 69 bytes of (italian) text
>
> HTH,
>
> Bill
>

Ok, so mainly table creation is broken. However trying to analyze the
problem I did this
- create table (null int, text instead of int, text)
- insert data
- bulk out
- bulk in the same file (output was a byte to byte copy of t0017.in)
I caused the nightmare... doing bulk in what happen for nullable int ??
- row 1099 (bcp.c) we read the prefix from file, collen == 4
- row 1171 there is no terminator, skip
- row 1240 nullable, so we read a byte to set collen, now collen = 17
(0x11) and we read an unwanted bye
- row 1288 we read 17 bytes for an integer
- row 1315 and following we set bcp_column_data->data and related
- we loose sync so we read an invalid length for text, malloc return
NULL and we return error
So we are not able to load data we dumped...

freddy77




Archive powered by MHonArc 2.6.24.

Top of Page