Skip to Content.
Sympa Menu

freetds - RE: [freetds] Re: Data conversion limit for strings

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] Re: Data conversion limit for strings
  • Date: Mon, 26 Jan 2004 17:00:21 -0500

> From: Frediano Ziglio [mailto:freddyz77 AT tin.it]
> Sent: January 26, 2004 3:49 PM
>
> >From read_and_convert
>
> suppress->einval = *wire_size > 0; /* EINVAL matters only on the last
> chunk. */
> if (-1 == tds_iconv(tds, iconv_info, to_client, &bufp,
> &bufleft, outbuf,
> outbytesleft)) {
> tdsdump_log(TDS_DBG_NETWORK, "%L Error:
> read_and_convert: tds_iconv
> returned errno %d\n", errno);
> if (errno != EILSEQ) {
> tdsdump_log(TDS_DBG_NETWORK, "%L Error:
> read_and_convert: "
> "Gave up
> converting %d bytes due to error %d.\n", bufleft,
> errno);
...
> note errno != EILSEQ

Noted. I think it's a mistake, too. We should test for EINVAL, because
we're looking for an incomplete (not illegal) sequence. That's why
tds_put_string()'s test is different.

I looked at read_and_convert() when I patched tds_put_string() (as you might
be able to tell). I didn't change it, because I was trying to fix just that
one bug.

> Another problem is wire state. If we start sending a string (in this
> case a query) and we stop in the middle what should we do?

I think it's OK, more or less. tds_put_string() only stuffs text into a
packet; it doesn't set up the packet or flush it. If it writes less text
than it was asked to, the text arriving at the server will be shorter than
was intended. The state will be fine, although it would be better not to
send the string at all.

More worrisome: Suppose tds_put_string() gets a really big input, say 10,000
bytes, that overlaps several packets. Suppose the first packet is sent OK
(last packet indicator 0x00), and we hit an EILSEQ partway through Packet 2.
What now? How to tell the server to ignore Packet 1?

I don't know of any way to retract packets after they've been sent.

--jkl
-----------------------------------------
The information contained in this transmission may contain privileged and
confidential information 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 an intended recipient of this commercial e-mail or advertisement,
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