Skip to Content.
Sympa Menu

freetds - Re: [freetds] segfault in Perl's Email::Store when using freetds

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: "Lowden, James K" <LowdenJK AT bernstein.com>
  • To: "FreeTDS Development Group" <freetds AT lists.ibiblio.org>
  • Subject: Re: [freetds] segfault in Perl's Email::Store when using freetds
  • Date: Fri, 11 Nov 2005 18:07:53 -0500

> From: Thompson, Bill D (London)
> Sent: Friday, November 11, 2005 11:20 AM
>
> From the thread it looks very much like DBD:Sybase is using the
> ct_dynamic() method in ct-library, which supports placeholders as
> you say. It seems to be segmenting on ct_send(CS_DESCRIBE_INPUT).
>
> ct_dynamic() and friends are now implemented in the latest snapshot,
> with one significant exception. Unfortunately, this is the
> CS_DESCRIBE_INPUT parameter to ct_send(), when using SQL server.
>
> Sybase supports this functionality by a bespoke TDS message which
> describes the number, type etc of your placeholders. SQL Server
> has no means that I could discover of providing this information
> to a client.

Hi Bill,

I had a vague feeling I was understating your progress with ct-lib
placeholders. Sorry about that. Thanks for straightening me out.

It looks like the ODBC analog to CS_DESCRIBE_INPUT is
SQLDescribeParam(). This link provides sample source code.

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/odbcsql
/od_odbc_d_1not.asp

I see that we don't implement SQLDescribeParam() in our ODBC driver
either. :-(

And I see why. :-(

I compiled their source against their library made this call:

"select * from systypes where name = ? "

I then called SQLDescribeParam() and used windump to get this answer:

[log in reply]
... 0001 0000 e317 0002 0a75 0073 005f 0065 .........u.s._.e
0x00d0 006e 0067 006c 0069 0073 0068 0000 ab70 .n.g.l.i.s.h...p
0x00e0 0047 1600 0001 0027 0043 0068 0061 006e .G.....'.C.h.a.n
0x00f0 0067 0065 0064 0020 006c 0061 006e 0067 .g.e.d...l.a.n.g
0x0100 0075 0061 0067 0065 0020 0073 0065 0074 .u.a.g.e...s.e.t
0x0110 0074 0069 006e 0067 0020 0074 006f 0020 .t.i.n.g...t.o..
0x0120 0075 0073 005f 0065 006e 0067 006c 0069 .u.s._.e.n.g.l.i
0x0130 0073 0068 002e 000b 4100 4300 3200 4b00 .s.h....A.C.2.K.
0x0140 4100 4d00 4100 3000 3800 3400 3800 0000 A.M.A.0.8.4.8...
0x0150 00ad 3600 0171 0000 0116 4d00 6900 6300 ..6..q....M.i.c.
0x0160 7200 6f00 7300 6f00 6600 7400 2000 5300 r.o.s.o.f.t...S.
0x0170 5100 4c00 2000 5300 6500 7200 7600 6500 Q.L...S.e.r.v.e.
0x0180 7200 0000 0000 0800 0332 e313 0004 0434 r........2.....4
0x0190 0030 0039 0036 0004 3400 3000 3900 3600 .0.9.6..4.0.9.6.
0x01a0 fd00 0000 0000 0000 00 .........

[to server]
0x0000 4500 00a2 2eb1 4000 8006 0000 0a51 24a0 E.....@......Q$.
0x0010 0a50 3adc 1252 09c4 39ce de32 cad3 4948 .P:..R..9..2..IH
0x0020 5018 4205 74b1 0000 0101 007a 0000 0100 P.B.t......z....
0x0030 5300 4500 5400 2000 4600 4d00 5400 4f00 S.E.T...F.M.T.O.
0x0040 4e00 4c00 5900 2000 4f00 4e00 2000 7300 N.L.Y...O.N...s.
0x0050 6500 6c00 6500 6300 7400 2000 2000 6e00 e.l.e.c.t.....n.
0x0060 6100 6d00 6500 2000 6600 7200 6f00 6d00 a.m.e...f.r.o.m.
0x0070 2000 7300 7900 7300 7400 7900 7000 6500 ..s.y.s.t.y.p.e.
0x0080 7300 2000 5300 4500 5400 2000 4600 4d00 s...S.E.T...F.M.
0x0090 5400 4f00 4e00 4c00 5900 2000 4f00 4600 T.O.N.L.Y...O.F.
0x00a0 4600 F.

[to client]
0x0000 4500 0063 fbfb 4000 7d06 8d7c 0a50 3adc E..c..@.}..|.P:.
0x0010 0a51 24a0 09c4 1252 cad3 4948 39ce deac .Q$....R..IH9...
0x0020 5018 4274 ee3b 0000 0401 003b 003b 0100 P.Bt.;.....;.;..
0x0030 fd01 00b9 0000 0000 0081 0100 0001 0a00 ................
0x0040 e700 0109 0400 0100 046e 0061 006d 0065 .........n.a.m.e
0x0050 00fd 0100 c100 0000 0000 fd00 00ba 0000 ................
0x0060 0000 00 ...

[to server]
0x0000 4500 0165 2ebf 4000 8006 0000 0a51 24a0 E..e..@......Q$.
0x0010 0a50 3adc 1252 09c4 39ce deac cad3 4983 .P:..R..9.....I.
0x0020 5018 41ca 7574 0000 0301 013d 0000 0100 P.A.ut.....=....
0x0030 ffff 0d00 0000 0001 2604 04ff ffff ff00 ........&.......
0x0040 0063 2200 0000 0904 0001 0022 0000 0040 .c"........"...@
0x0050 0050 0031 0020 006e 0076 0061 0072 0063 .P.1...n.v.a.r.c
0x0060 0068 0061 0072 0028 0031 0032 0038 0029 .h.a.r.(.1.2.8.)
0x0070 0000 0063 5000 0000 0904 0001 0050 0000 ...cP........P..
0x0080 0073 0065 006c 0065 0063 0074 0020 002a .s.e.l.e.c.t...*
0x0090 0020 0066 0072 006f 006d 0020 0073 0079 ...f.r.o.m...s.y
0x00a0 0073 0074 0079 0070 0065 0073 0020 0077 .s.t.y.p.e.s...w
0x00b0 0068 0065 0072 0065 0020 006e 0061 006d .h.e.r.e...n.a.m
0x00c0 0065 0020 003d 0020 0040 0050 0031 0020 .e...=...@.P.1..
0x00d0 0000 00e7 0001 0904 0001 0088 00cd 00cd ................
0x00e0 00cd 00cd 00cd 00cd 00cd 00cd 00cd 00cd ................
0x00f0 00cd 00cd 00cd 00cd 00cd 00cd 00cd 00cd ................

As you can see, the Microsoft ODBC driver implements SQLDescribeParam()
by parsing the SQL locally and asking the server for the datatypes of
the placeholders.

Anybody want to break out lex & yacc and build us a parser?

If not, I think we should document that this is basically never going to
work.

--jkl



-----------------------------------------
The information contained in this transmission may be privileged and
confidential and is intended only for the use of the person(s) named
above. If you are not the intended recipient, or an employee or agent
responsible
for delivering this message to the intended recipient, any review,
dissemination,
distribution or duplication of this communication is strictly prohibited. If
you are
not the intended recipient, please contact the sender immediately by reply
e-mail
and destroy all copies of the original message. Please note that we do not
accept
account orders and/or instructions by e-mail, and therefore will not be
responsible
for carrying out such orders and/or instructions. If you, as the intended
recipient
of this message, the purpose of which is to inform and update our clients,
prospects
and consultants of developments relating to our services and products, would
not
like to receive further e-mail correspondence from the sender, please "reply"
to the
sender indicating your wishes. In the U.S.: 1345 Avenue of the Americas, New
York,
NY 10105.




Archive powered by MHonArc 2.6.24.

Top of Page