Skip to Content.
Sympa Menu

freetds - Re: problems with large columns

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: "Joe McDonald" <joe AT vpop.net>
  • To: "TDS Development Group" <freetds AT franklin.oit.unc.edu>
  • Subject: Re: problems with large columns
  • Date: Thu, 23 Sep 1999 16:34:32 -0700



It turns out that doing: "select a=convert(text,content) from newsletter"
is no different than a plain old "select convert(text,content) from
newsletter"

It was just that every time the query was run inside of a sqsh session, there
would be more and more "Unknown marker" messages.

I did find a really ugly hackish workaround for now though. Basically, I
found out that a substring() would work. substring still has the problem of
not returning more than 255 bytes (even if you concatenate them in the
query...), but you can run multiple substring queries and concatenate them
in your program. For instance in perl (in case someone else runs into this
problem):

# get the number of bytes in the column
my @len_hrefs =
Sybase::fetch("select clen=len(content) from newsletter where nl_id = $id");
my $clen = $len_hrefs[0]->{'clen'};

my $max_size=250;

# get the data for that column
my $content = "";
$left = $clen;
for($got = 1; $got < $clen ;) {
if($left < $max_size) { $amt = $left; }
else { $amt = $max_size; }
$q = "select str=substring(content,$got,$amt) from newsletter where n_id=
$id";
my @str_refs = Sybase::fetch($q);
$content .= $str_refs[0]->{'str'};
$got += $amt;
}

pretty ugly I know, but it does get the job done.

-joe


> -----Original Message-----
> From: bounce-freetds-95718 AT franklin.oit.unc.edu
> [mailto:bounce-freetds-95718 AT franklin.oit.unc.edu]On Behalf Of Brian
> Bruns
> Sent: Thursday, September 23, 1999 2:11 PM
> To: TDS Development Group
> Subject: [freetds] Re: problems with large columns
>
>
>
> Ok, I'll take a look at it and see what I can find.
>
> Brian
>
> On Thu, 23 Sep 1999, Joe McDonald wrote:
>
> >
> > Here is another tidbit of the problem:
> > 1> select convert(text,content) from newsletter
> > 2> go
> > Unknown marker: 0!!
> > 1> select a=convert(text,content) from newsletter
> > 2> go
> > Unknown marker: 32!!
> > Unknown marker: 105!!
> > Unknown marker: 115!!
> > Unknown marker: 32!!
> > Unknown marker: 97!!
> > Unknown marker: 110!!
> > Unknown marker: 32!!
> > Unknown marker: 101!!
> > Unknown marker: 120!!
> > Unknown marker: 97!!
> > Unknown marker: 109!!
> > Unknown marker: 112!!
> > Unknown marker: 108!!
> > Unknown marker: 101!!
> > Unknown marker: 32!!
> > Unknown marker: 110!!
> > Unknown marker: 101!!
> > Unknown marker: 119!!
> > Unknown marker: 115!!
> > Unknown marker: 108!!
> > Unknown marker: 101!!
> > Unknown marker: 116!!
> > Unknown marker: 116!!
> > Unknown marker: 101!!
> > Unknown marker: 114!!
> > Unknown marker: 46!!
> > Unknown marker: 66!!
> > Unknown marker: 0!!
> > 1>
> >
> > This is on FreeBSD 2.2.8 using sqsh 1.7 and the latest freetds from CVS.
> >
> > Thanks,
> > -joe
> >
> > > -----Original Message-----
> > > From: bounce-freetds-95718 AT franklin.oit.unc.edu
> > > [mailto:bounce-freetds-95718 AT franklin.oit.unc.edu]On Behalf Of Brian
> > > Bruns
> > > Sent: Thursday, September 23, 1999 4:58 AM
> > > To: TDS Development Group
> > > Subject: [freetds] Re: problems with large columns
> > >
> > >
> > >
> > > It depends. Are these text fields or large varchar fields?
> Large varchar
> > > is only supported in TDS 7.0 which is not really implemented
> yet (there is
> > > some code in for the login packet but much more needs to be
> done). TDS 4.2
> > > by definition will not handle it. However, text fields
> should work, so a
> > > work around would be to convert them to text during the
> select, such as:
> > >
> > > select convert(text,largecol1) from table1
> > >
> > > Hope this helps,
> > >
> > > Brian
> > >
> > > On Thu, 23 Sep 1999, Joe McDonald wrote:
> > >
> > > > Hello,
> > > >
> > > > I am using freetds to access an MS-sql server. When I try to
> > > access columns
> > > > that are larger than 256 characters, I only get the first 256
> > > characters.
> > > >
> > > > Is there a work around for this? I notice that it gets the
> column-size
> > > > with tds_get_byte(), since it is only getting 1 byte, I can
> see why the
> > > > max column_size reported is 255, I'm hoping there is a way
> around this.
> > > >
> > > > Thanks,
> > > > -joe
> > > >
>
>
> ---
> You are currently subscribed to freetds as: joe AT vpop.net
> To unsubscribe, forward this message to
> $subst('Email.Unsub')
>





Archive powered by MHonArc 2.6.24.

Top of Page