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: "Eric Deutsch" <edeutsch AT systemsbiology.org>
  • To: "TDS Development Group" <freetds AT franklin.oit.unc.edu>
  • Subject: Re: How to read Strings bigger than 255 chars
  • Date: Mon, 4 Jun 2001 16:40:34 -0700



Having FreeTDS execute "set textsize nnnnnn" based on a parameter in a conf
file would be a pretty good solution for me. It's certainly more elegant
and flexible than my hack, although I worry a little about the possible
performance hit it imposes upon people who don't need that feature. It
probably should be an optional feature with a FAQ entry.

Thinking about Peter's comment earlier in the thread that one can download
chunks of data at a time, it seems to me that the right way to solve this
problem is something like: if maxlen>100kB, allocate just 100kB, and then
within each row, just ask for the first 100kB of such a column, and if 100kB
was provided, do another malloc() and download the next 100kB, etc. until
the whole thing was loaded. At that point, the various chunks would need to
be copied into a single block and the pointer returned. Dunno if this is
possible without making a mess of the existing code (which I admit I don't
understand), but this seems like the "no limits" solution. hmm, sounds like
an icky can of worms even to me now. Maybe it's best to leave it up to the
client to implement such logic if the need to download data larger than
"textsize" ever arises.

regards,
Eric


> -----Original Message-----
> From: bounce-freetds-127899 AT franklin.oit.unc.edu
> [mailto:bounce-freetds-127899 AT franklin.oit.unc.edu]On Behalf Of Brian
> Bruns
> Sent: Monday, June 04, 2001 4:05 PM
> To: TDS Development Group
> Subject: [freetds] Re: How to read Strings bigger than 255 chars
>
>
>
> >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!
>
> 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.
>
> Brian
>
> On Mon, 4 Jun 2001, Michael Peppler wrote:
>
> > Brian Bruns writes:
> > > Hmmm... this is a case where DBD::Sybase is dealing with
> some assumptions
> > > which MS went and changed. Is the proper place to deal with
> this your
> > > code or mine? I'm inclined to make a new config file option
> "default text
> > > size" and allow users to set it in the freetds.conf file.
> Whaddya think?
> >
> > Well - I am just using the data as returned by Client Library
> > (ct_describe() in this case) and using datafmt.maxlength to effect the
> > bind.
> >
> > By default Sybase will limit this to 32k (although you can set
> > TEXTSIZE to alter that behaviour). If MS returns 2GB for this value,
> > but still limits the amount of *data* that it returns to the default
> > (or set) TEXTSIZE value then I'd say that it's a bug in MS's
> > implementation of the protocol...
> >
> > I need to use some value here to allocate a large enough buffer for
> > the ct_bind() call, so just using some default value will not work
> > (unless the actual data fetch never exceeds that value)
> >
> > An upcoming version of DBD::Sybase will have access to ct_get_data()
> > and ct_send_data() to allow direct read/write of TEXT/IMAGE columns
> > (and to allow read/write in blocks rather than sending the whole thing
> > in one go).
> >
> > Michael
> >
> >
> > > On Mon, 4 Jun 2001, Michael Peppler wrote:
> > >
> > > > Darryl Friesen writes:
> > > > > >> Eric, if you issue the query "set textsize 10000"
> prior to selecting
> > > > > >> the text column does that also fix the problem?
> > > > > >
> > > > > > Yes it does! If I just do:
> > > > >
> > > > > Hmm. Doesn't work for me here. I still get a
> > > > >
> > > > > Out of memory during "large" request for -2147479552 bytes
> > > > >
> > > > > in my Perl script (which uses DBD::Sybase)
> > > >
> > > > I seem to recognize this one... I think MS returns the maximum
> > > > possible size of the object, instead of the actual size,
> and I use the
> > > > size value to allocate memory for the object in ct_bind() (which of
> > > > course fails in your case).
> > > >
> > > > Michael
> > > >
> > >
> > >
> > > ---
> > > You are currently subscribed to freetds as: [mpeppler AT peppler.org]
> > > To unsubscribe, forward this message to
> $subst('Email.Unsub')
> >
> >
>
>
> ---
> You are currently subscribed to freetds as: [edeutsch AT systemsbiology.org]
> To unsubscribe, forward this message to
> $subst('Email.Unsub')
>





Archive powered by MHonArc 2.6.24.

Top of Page