Skip to Content.
Sympa Menu

freetds - Re: How to read Strings bigger than 255 chars

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: "James K. Lowden" <jklowden AT speakeasy.org>
  • To: TDS Development Group <freetds AT franklin.oit.unc.edu>
  • Subject: Re: How to read Strings bigger than 255 chars
  • Date: Mon, 04 Jun 2001 20:18:07 +0000


Michael Peppler wrote:

> >From what I'm seeing, MS is, by default under TDS 7.0, actually sending
> > the entire text clob all in one go. So technically they are sticking to
> > the protocol. It just makes the maxlength value useless for preallocating
> > memory!
>
> What?!?!
>
> Don't they honour the default TEXTSIZE value?
>
> (oh, and of course they don't allow setting CS_OPT_foo via
> ct_options() either, so you have to execute it as a language statement
> for that connection)

Well... MS doesn't offer a ct-lib client, so we can't really say what they
do. :-{ Would
better ct_option support in FreeTDS make DBD::Sybase better?

> > If freetds were to allow a "set textsize" to be executed automatically on
> > connect, ct_describe would return a sane value and everyone should be
> > happy.

If I read Brian's message right, ct_describe doesn't return a value
representative of
TEXTSIZE until it's been explicitly set, which is (as Mr.Friesen observes)
less than
helpful. A pain in the tookus, my grandfather would have said.

The documentation http://larr.unm.edu/~owen/SQLBOL70/html/globals_26.htm
says:

"The default size is 4096 bytes (4 KB)."

Houston, we have a bug.

May I offer a suggestion?

If you're going to send "set textsize" on connect, maybe the default value
(in the absence of
a config file value) should be 32 KB cf. Sybase or 4 KB cf. Microsoft?
Principle of least
astonishment and all that? I think that would cut down on the number of
questions. Better
truncated data (which the calling application can should test for in any
case) than a broken
query.

If someone objects that they don't want to pay the overhead of sending a
query on every
connection for a feature they don't use, which might be reasonable in some
web environments,
the config file could have the option to skip it:

That would leave 3 behaviors:

1. No config file entry. Send "set textsize = 32 * 1024" or "set textsize
= @@textsize".
2. Config file entry reads "textsize=X" where X is between 0 and a maximum
length of 2^31
- 1.
Result: Send "set textsize= X".
3. Config file entry reads "textsize=default" (literally). Result: Do
nothing.

How's that sound?

There's a fly in the ointment, too: unicode. "Textsize" is measured in
bytes, not
characters. Just when you thought you knew what text is, the world goes
multilingual on you.

"In our country," said Alice, still panting a little, "you'd generally get to
somewhere else
-- if you ran very fast for a long time as we've been doing."

"A slow sort of country!" said the Queen. "Now, *here*, you see, it takes
all the running
you can do, to keep in the same place."

OK. I'll stop kibitzing now and return to the docs.

--jkl







Archive powered by MHonArc 2.6.24.

Top of Page