Skip to Content.
Sympa Menu

freetds - RE: [freetds] Possible bug: DBD::Sybase + current FreeTDS + selec tall_hashref

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: "Thompson, Bill D (London)" <ThompBil AT exchange.uk.ml.com>
  • To: "'freetds AT lists.ibiblio.org'" <freetds AT lists.ibiblio.org>
  • Subject: RE: [freetds] Possible bug: DBD::Sybase + current FreeTDS + selec tall_hashref
  • Date: Fri, 7 Feb 2003 19:05:50 -0000

OK all,

I've gotten (eventually) to the bottom of this!

It all stems, as I thought, from my rework of ctlibrary, although not from
the CS_EXPOSE_FMTS issue ...

it turns out that if you have an empty result set ( select * from table
where 1 = 2 ), that ct_results() should return with a result type of
CS_ROW_RESULT, even though there isn't one!
I tested this with sqsh 1.7 (and some printfs) linked to the sybase
libraries.

Looking back at the old code, I notice a flag in the command structure (
called empty_res_hack ) , whose purpose was not clear to me, and which I had
thought I could do away with.
Alas, I was wrong.

I have worked a patch for this, which should wing its way to you , early
next week.
needless to say my version of the flag is no longer so unfortunately named,
although, to paraphrase Shakespeare:
"A hack by any other name would smell as sweet...NOT!"

Bill

> -----Original Message-----
> From: Thompson, Bill D (London)
> Sent: 04 February 2003 09:56
> To: 'freetds AT lists.ibiblio.org'
> Subject: RE: [freetds] Possible bug: DBD::Sybase + current FreeTDS +
> selectall_hashref
>
> Hi,
>
> I suspect this problem is down to my re-working of the "results
> processing" some while back.
> I had to rework both the tds_process_results() functions and also the
> ct_results() function.
>
> In this, I took advice from the Sybase ct-library manual, in which it
> states (in the ct_results routine description):
>
> "An application will not receive format results unless the Client-Library
> CS_EXPOSE_FMTS property is set to CS_TRUE."
> I impmemented this, and the code in ct_config() to enable this property to
> be toggled.
> I assumed the default setting of this property to be CS_FALSE, although
> looking over the manuals again, I cant find anything that supports this
> assumption (or, to be fair, it's converse). Also, It looks like I didn't
> add the code to ct_con_props(), which also allows this property to be
> toggled. One or two things need to be done:
> 1) set the default for this property to be CS_TRUE, instead of CS_FALSE
> 2) implement the code in ct_con_props() to allow this property to be
> toggled. It may be the case that a call to this function is being
> "ignored" in the ct_con_props() function.
>
> HTH
> Bill
>
>
>
> -----Original Message-----
> From: Michael Peppler [SMTP:mpeppler AT peppler.org]
> Sent: 04 February 2003 01:08
> To: freetds AT lists.ibiblio.org
> Subject: Re: [freetds] Possible bug: DBD::Sybase + current
> FreeTDS + selectall_hashref
>
> On Mon, 2003-02-03 at 11:19, Martin Schroth wrote:
> > Hi,
> >
> > DBI gets the following error if there are no rows to return:
> > Can't get DBI::st=HASH(0x...)->{NAME}: unrecognised attribute
> >
> > Example:
> > my $stmt = "SELECT 1 FROM test WHERE 1=0"
> > my $hash = $dbh->selectall_hashref($stmt,1);
>
> This works fine when used with the Sybase libs, so I suspect a
> slight
> difference in return values.
>
>
>
> > -> execute for DBD::Sybase::st
> (DBI::st=HASH(0x81f9964)~0x81f9940)
> > thr#804b3c0
> > syb_st_execute() -> ct_command() OK
> > syb_st_execute() -> ct_send() OK
> > st_next_result() -> ct_results(4046) == 1
>
> And this is the difference. With the Sybase libs I get:
>
> syb_st_execute() -> ct_command() OK
> syb_st_execute() -> ct_send() OK
> st_next_result() -> ct_results(4040) == 1
> ct_res_info() returns 1 columns
> ct_describe(0): type = 8, maxlen = 4
> describe() -> col 0, type 8, realtype 8
> describe() retcode = 1
> st_next_result() -> lasterr = 0, lastsev = 0
>
> FreeTDS returns no data at all, whereas you should still get the
> column
> description even if there are no rows returned.
>
> Michael
> --
> Michael Peppler Data Migrations, Inc.
> mpeppler AT peppler.org http://www.mbay.net/~mpeppler
> Sybase T-SQL/OpenClient/OpenServer/C/Perl developer available for
> short or
> long term contract positions -
> http://www.mbay.net/~mpeppler/resume.html
> _______________________________________________
> FreeTDS mailing list
> FreeTDS AT lists.ibiblio.org
> http://lists.ibiblio.org/mailman/listinfo/freetds





Archive powered by MHonArc 2.6.24.

Top of Page