[freetds] Fw: Free TDS with MS SQL Server 2005

ZIGLIO, Frediano, VF-IT Frediano.Ziglio at vodafone.com
Tue Mar 13 04:19:11 EDT 2007


> 
> I upgraded my freetds version from 0.62.3 to 0.64, which 
> appears to have 
> fixed the varchar truncation problem.  On Gentoo, 0.64 is 
> only in test 
> status, not release, but works well enough for my purposes at present.
> 
> Here is the trace of the prepare that I was getting with version 
> 0.62.3.  Note that P4 is varchar(1):
> 
> Sending packet @ 18:34:37.690527
> 0000 03 01 01 94 00 00 01 00-0a 00 73 00 70 00 5f 00 |........
..s.p._.|
> 0010 70 00 72 00 65 00 70 00-61 00 72 00 65 00 00 00 |p.r.e.p.
a.r.e...|
> 0020 00 01 26 04 00 00 00 63-dc 00 00 00 dc 00 00 00 |..&....c
........|
> 0030 40 00 50 00 31 00 20 00-56 00 41 00 52 00 43 00 |@.P.1. .
V.A.R.C.|
> 0040 48 00 41 00 52 00 28 00-38 00 30 00 29 00 2c 00 |H.A.R.(.
8.0.).,.|
> 0050 40 00 50 00 32 00 20 00-56 00 41 00 52 00 43 00 |@.P.2. .
V.A.R.C.|
> 0060 48 00 41 00 52 00 28 00-38 00 30 00 29 00 2c 00 |H.A.R.(.
8.0.).,.|
> 0070 40 00 50 00 33 00 20 00-56 00 41 00 52 00 43 00 |@.P.3. .
V.A.R.C.|
> 0080 48 00 41 00 52 00 28 00-38 00 30 00 29 00 2c 00 |H.A.R.(.
8.0.).,.|
> 0090 40 00 50 00 34 00 20 00-56 00 41 00 52 00 43 00 |@.P.4. .
V.A.R.C.|
> 00a0 48 00 41 00 52 00 28 00-31 00 29 00 2c 00 40 00 |H.A.R.(.
1.).,. at .|
> 00b0 50 00 35 00 20 00 56 00-41 00 52 00 43 00 48 00 |P.5. .V.
A.R.C.H.|
> 00c0 41 00 52 00 28 00 38 00-30 00 29 00 2c 00 40 00 |A.R.(.8.
0.).,. at .|
> 00d0 50 00 36 00 20 00 56 00-41 00 52 00 43 00 48 00 |P.6. .V.
A.R.C.H.|
> 00e0 41 00 52 00 28 00 38 00-30 00 29 00 2c 00 40 00 |A.R.(.8.
0.).,. at .|
> 00f0 50 00 37 00 20 00 56 00-41 00 52 00 43 00 48 00 |P.7. .V.
A.R.C.H.|
> 0100 41 00 52 00 28 00 38 00-30 00 29 00 00 00 63 76 |A.R.(.8.
0.)...cv|
> 0110 00 00 00 76 00 00 00 20-00 69 00 6e 00 73 00 65 |...v...
.i.n.s.e|
> 0120 00 72 00 74 00 20 00 69-00 6e 00 74 00 6f 00 20 |.r.t. .i .n.t.o.
|
> 0130 00 69 00 70 00 5f 00 73-00 74 00 61 00 74 00 75 |.i.p._.s
.t.a.t.u|
> 0140 00 73 00 20 00 76 00 61-00 6c 00 75 00 65 00 73 |.s. .v.a
.l.u.e.s|
> 0150 00 28 00 40 00 50 00 31-00 2c 00 40 00 50 00 32 |.(. at .P.1
.,. at .P.2|
> 0160 00 2c 00 40 00 50 00 33-00 2c 00 40 00 50 00 34 |.,. at .P.3
.,. at .P.4|
> 0170 00 2c 00 40 00 50 00 35-00 2c 00 40 00 50 00 36 |.,. at .P.5
.,. at .P.6|
> 0180 00 2c 00 40 00 50 00 37-00 29 00 20 00 00 00 38 |.,. at .P.7 .).
...8|
> 0190 01 00 00 00            -                        |....|
> 
> And here is the same packet for version 0.64.  Note that P4 
> is varchar(80):
> 
> net.c:673:Sending packet
> 0000 03 01 01 98 00 00 01 00-0a 00 73 00 70 00 5f 00 |........
..s.p._.|
> 0010 70 00 72 00 65 00 70 00-61 00 72 00 65 00 00 00 |p.r.e.p.
a.r.e...|
> 0020 00 01 26 04 00 00 00 63-de 00 00 00 de 00 00 00 |..&....c
........|
> 0030 40 00 50 00 31 00 20 00-76 00 61 00 72 00 63 00 |@.P.1. .
v.a.r.c.|
> 0040 68 00 61 00 72 00 28 00-38 00 30 00 29 00 2c 00 |h.a.r.(.
8.0.).,.|
> 0050 40 00 50 00 32 00 20 00-76 00 61 00 72 00 63 00 |@.P.2. .
v.a.r.c.|
> 0060 68 00 61 00 72 00 28 00-38 00 30 00 29 00 2c 00 |h.a.r.(.
8.0.).,.|
> 0070 40 00 50 00 33 00 20 00-76 00 61 00 72 00 63 00 |@.P.3. .
v.a.r.c.|
> 0080 68 00 61 00 72 00 28 00-38 00 30 00 29 00 2c 00 |h.a.r.(.
8.0.).,.|
> 0090 40 00 50 00 34 00 20 00-76 00 61 00 72 00 63 00 |@.P.4. .
v.a.r.c.|
> 00a0 68 00 61 00 72 00 28 00-38 00 30 00 29 00 2c 00 |h.a.r.(.
8.0.).,.|
> 00b0 40 00 50 00 35 00 20 00-76 00 61 00 72 00 63 00 |@.P.5. .
v.a.r.c.|
> 00c0 68 00 61 00 72 00 28 00-38 00 30 00 29 00 2c 00 |h.a.r.(.
8.0.).,.|
> 00d0 40 00 50 00 36 00 20 00-76 00 61 00 72 00 63 00 |@.P.6. .
v.a.r.c.|
> 00e0 68 00 61 00 72 00 28 00-38 00 30 00 29 00 2c 00 |h.a.r.(.
8.0.).,.|
> 00f0 40 00 50 00 37 00 20 00-76 00 61 00 72 00 63 00 |@.P.7. .
v.a.r.c.|
> 0100 68 00 61 00 72 00 28 00-38 00 30 00 29 00 00 00 |h.a.r.(.
8.0.)...|
> 0110 63 76 00 00 00 76 00 00-00 20 00 69 00 6e 00 73 |cv...v.. .
.i.n.s|
> 0120 00 65 00 72 00 74 00 20-00 69 00 6e 00 74 00 6f |.e.r.t.
.i.n.t.o|
> 0130 00 20 00 69 00 70 00 5f-00 73 00 74 00 61 00 74 |. .i.p._
.s.t.a.t|
> 0140 00 75 00 73 00 20 00 76-00 61 00 6c 00 75 00 65 |.u.s. .v
.a.l.u.e|
> 0150 00 73 00 28 00 40 00 50-00 31 00 2c 00 40 00 50 |.s.(. at .P
.1.,. at .P|
> 0160 00 32 00 2c 00 40 00 50-00 33 00 2c 00 40 00 50 |.2.,. at .P
.3.,. at .P|
> 0170 00 34 00 2c 00 40 00 50-00 35 00 2c 00 40 00 50 |.4.,. at .P
.5.,. at .P|
> 0180 00 36 00 2c 00 40 00 50-00 37 00 29 00 20 00 00 |.6.,. at .P .7.).
..|
> 0190 00 26 04 04 01 00 00 00-                        |.&......|
> 
> Does varchar(80) above mean that data will be truncated to 80 
> characters?
> 
> Cheers and thanks for your help,
> Craig Johannsen
> Sophos Labs
> 

No! 
You will note another prepare after binding. For better performance bind
before prepare.

freddy77




More information about the FreeTDS mailing list