Skip to Content.
Sympa Menu

freetds - Re: DBD::Sybase and FreeTDS

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: Brian Bruns <camber AT umcc.ais.org>
  • To: TDS Development Group <freetds AT franklin.oit.unc.edu>
  • Subject: Re: DBD::Sybase and FreeTDS
  • Date: Tue, 28 Dec 1999 22:15:21 -0500 (EST)



On Tue, 28 Dec 1999, Ian Struble wrote:

>
> I discovered this same behavior an hour ago and confirmed for myself that
> all the results are being null terminated after reading the messages
> between you and Kevin. So this is nothing but another report of the
> problem and a thank you. Thanks for trying to fix it so quickly! I just
> wish I got responces from 'support' on some of the commercial tools like we
> have been getting from you lately. Your work is greatly appeciated!

Well, thank you. Some days I feel really burned out on the thing and other
days I can work on it for hours.

Anyway, I just checked some code in to correct this. Both PHP and
DBD::Sybase should work now :-). I didn't completely support every
possible permutation of this thing, but it goes something like this:
tds_convert() returns the length *including* the null. _ct_bind_data()
looks at the format and there is a switch statement where if its
CS_FMT_UNUSED the length is reduced by one, which is fine since the rest
of the buffer is undefined anyway. CS_FMT_NULLTERM is the default case so
nothing needs to be done for that. CS_FMT_BLANKPAD and CS_FMT_NULLPAD
should be added to that switch with the appropriate action (just didn't
feel like getting into it tonight...highlander (the movie) is on and I'm
going to go watch it). dblib should also be retrofited for
STRINGBING/NTBSTRINGBIND stuff as well so it is all handled the same.

Kevin, can you try what's in CVS and let me know? Oh and one last thing,
I changed some structures and defined values so it needs a make clean/make
of freetds and any apps built with it (ie DBD::Sybase)

Brian

>
> Ian
>
>
> On 12/28/99, "Brian Bruns <camber AT umcc.ais.org>" wrote:
> > Arg, this was put in because PHP does not act correctly if the length of
> > the data that returns does not include the null. The difference seems to
> > be the format. PHP specifies CS_FMT_NULLTERM and DBD::Sybase uses
> > CS_FMT_UNUSED. So, the only problem is that this info is junked when
> > ct_bind is called, so I'll take a run at putting it in tonight anyway.
> >
> > Brian
> >
> > On Tue, 28 Dec 1999, Brian Bruns wrote:
> >
> > > Ok, I can reproduce it now...let me see what is going on.
> > >
> > > Brian
> > >
> > > On Tue, 28 Dec 1999, Kevin Wormington wrote:
> > >
> > > > FYI, The old version (.47) produces the following results with your
> > > > test
> > > > program:
> > > >
> > > > 0000000 4f53 4e46 3154 000a
> > > > S O F N T 1 \n \0
> > > > 0000007
> > > >
> > > >
> > > > Kevin
> > > > -----Original Message-----
> > > > From: Kevin Wormington <kworm AT sofnet.com>
> > > > To: TDS Development Group <freetds AT franklin.oit.unc.edu>
> > > > Cc: camber AT umcc.ais.org <camber AT umcc.ais.org>
> > > > Date: Tuesday, December 28, 1999 3:26 PM
> > > > Subject: [freetds] Re: DBD::Sybase and FreeTDS
> > > >
> > > >
> > > > >I just discovered that if I pipe the output of your test program
> > > > >through
> > > > >less the ^@ does follow the system name, eg. SOFNT1^@. Here is the
> > > > >output
> > > > >piped through 'od -hc' which shows the null:
> > > > >
> > > > >0000000 4f53 4e46 3154 0a00
> > > > > S O F N T 1 \0 \n
> > > > >0000010
> > > > >
> > > > >So I guess the question is why does the newer versions add the null
> > > > >and how
> > > > >can I compensate for it?
> > > > >
> > > > >Kevin
> > > > >Sofnet, Inc.
> > > > >-----Original Message-----
> > > > >From: Brian Bruns <camber AT umcc.ais.org>
> > > > >To: TDS Development Group <freetds AT franklin.oit.unc.edu>
> > > > >Date: Tuesday, December 28, 1999 11:17 AM
> > > > >Subject: [freetds] Re: DBD::Sybase and FreeTDS
> > > > >
> > > > >
> > > > >>
> > > > >>Hi, I'm unable to reproduce this. Can you run the following and
> > > > >>tell me
> > > > >>if you get a null at the end? (change the connect string as
> > > > >>appropriate)
> > > > >>
> > > > >>Brian
> > > > >>
> > > > >>--------
> > > > >>#!/usr/bin/perl
> > > > >>use DBI;
> > > > >>
> > > > >>my $dbh = DBI->connect("dbi:Sybase:server=JDBC", "guest", "sybase",
> > > > >> {PrintError => 0});
> > > > >>
> > > > >>my $q = "select \@\@servername";
> > > > >>my $sth = $dbh->prepare($q);
> > > > >>return undef unless $sth;
> > > > >>$sth->execute;
> > > > >>
> > > > >>my $user;
> > > > >>my $server;
> > > > >>if ($server = $sth->fetchrow)
> > > > >>{
> > > > >>print "$server\n";
> > > > >>$sth->finish;
> > > > >>}
> > > > >>-----------
> > > > >>
> > > > >>On Tue, 28 Dec 1999, Kevin Wormington wrote:
> > > > >>
> > > > >>> I originally posted the following before Christmas and didn't get
> > > > >>> any
> > > > >>> responses, so I thought I would post again in case it wasn't seen.
> > > > >>>
> > > > >>> ----- Original Message -----
> > > > >>> Hi,
> > > > >>>
> > > > >>> I have been using a 0.47 snapshot with DBD::Sybase-0:20 and 0:21
> > > > >>> with
> > > > >great
> > > > >>> success going against MS-SQL 7 servers. I use it for radiator
> > > > >>> radius
> > > > and
> > > > >>> the only problem I have seen is a very slow memory leak, which is
> > > > >>> why I
> > > > >>> thought I would try a later 0.50 snapshot. The snapshot will
> > > > >>> compile
> > > > >fine
> > > > >>> but the following select returns some strange characters keeping
> > > > radiator
> > > > >>> from operating correctly. Here is the perl snippet :
> > > > >>>
> > > > >>>
> > > > >>> my $q = "select id, username, password, active, timeleft,
> > > > >>> blockuser
> > > > >>> from customer where username='$name'";
> > > > >>>
> > > > >>> my $sth = $self->prepareAndExecute($q);
> > > > >>> return undef unless $sth;
> > > > >>>
> > > > >>> my $user;
> > > > >>> my ($cust_id, $username, $password, $active, $timeleft,
> > > > >>> $blockuser);
> > > > >>> if (($cust_id, $username, $password, $active, $timeleft,
> > > > >>> $blockuser)
> > > > >=
> > > > >>> $sth->fetchrow)
> > > > >>> {
> > > > >>> $self->log($main::LOG_INFO,"$cust_id, $password, $username,
> > > > >$timeleft,
> > > > >>> $blockuser");
> > > > >>> $sth->finish;
> > > > >>> }
> > > > >>>
> > > > >>>
> > > > >>> Here are the results of the above self->log printout:
> > > > >>>
> > > > >>> Thu Dec 23 17:48:03 1999: INFO: 1074, jaw^@, sdf^@, ,
> > > > >>>
> > > > >>>
> > > > >>> As you can see there are "^@" after some fields. Any help would
> > > > >>> be
> > > > >>> greatly appreciated. Also, I have tried it with tdsver=4.2 and
> > > > >>> 7.0 and
> > > > >with
> > > > >>> DBD::Sybase 0.20 and 0.21.
> > > > >>>
> > > > >>> Thanks,
> > > > >>>
> > > > >>> Kevin
> > > > >>> Sofnet, Inc.
> > > > >>>





Archive powered by MHonArc 2.6.24.

Top of Page