[ciapug] Adodb -> mssql, grabbing from a result set

Chris Hettinger ciapug@cialug.org
Wed, 17 Dec 2003 14:34:14 -0600


Purely for the sake of time, I went the route of issuing in a DB =
connection Close, then recreated the connection, before each of my mssql =
queries and that has done the trick without any significant, or really =
any noticable, performance loss. This bought me some time to research a =
fix and do those updates. For now it is working.

-ch

-----Original Message-----
From: David Champion [mailto:dave@visionary.com]
Sent: Monday, December 15, 2003 6:22 PM
To: ciapug@cialug.org
Subject: Re: [ciapug] Adodb -> mssql, grabbing from a result set


Not sure if this will take you to the right msg, if not just search the=20
forums for "tds".

http://phplens.com/lens/lensforum/msgs.php?LeNs#LensBM_forummsg

One note says on a query he's getting an empty record set, similar to=20
your problem.

The fun part is it could be a specific combo of MS-SQL / FreeTDS / ADODB =

versions that's causing the problem. Chris and I talked about this=20
off-list a bit.

He'll start with updating ADODB (that's the easiest), then update his=20
FreeTDS / PHP, which needs to be done anyway.

-dc

Chris Hettinger wrote:

>Yeah had a feeling that did look right...  And the query does work in =
Query Analizer.
>
>Our DB dude here thinks is may be that it is a issue with the TDS =
library (odbc driver) I am using to access mssql.
>
>We did a test where I did my insert and then immediately did a select =
from a table within a completely different database... It failed as =
well.
>
>He thought it to be an issue with the driver/library not being two-way =
(full duplexed) ... And I may have to open / close the db connection for =
each query.
>
>:-\
>
>What a thing to find and the last freaking second! :(
>
>-----Original Message-----
>From: Lathrop Preston [mailto:laith@prestonfam.org]
>Sent: Monday, December 15, 2003 1:35 PM
>To: ciapug@cialug.org
>Subject: Re: [ciapug] Adodb -> mssql, grabbing from a result set
>
>
>
>That is not anything close to what the expected data should be.
>
>have you tried running the query outside of php (ie in the query =
analizer?
>
>it looks like the query is returning no rows.
>
>try sticking the following between the query execution and
>$tmp =3D $rsCaseID->GetAssoc();
>
>if($rsCaseID =3D=3D=3D false){ die($qtdb->ErrorMsg()); }
>
>or you can echo instead of die();
>
>Laith
>
>Chris Hettinger wrote:
>
> =20
>
>>If I take the LastGenID and break it out to it's own page, to test =
it... it works. And I included the var_dump
>>
>>$tmp =3D $rsCaseID->GetAssoc();
>>var_dump($tmp);
>>
>>here is the output:
>>
>>bool(false)=20
>>
>>
>>-----Original Message-----
>>From: Lathrop Preston [mailto:laith@prestonfam.org]
>>Sent: Monday, December 15, 2003 12:35 PM
>>To: ciapug@cialug.org
>>Subject: Re: [ciapug] Adodb -> mssql, grabbing from a result set
>>
>>
>>Chris Hettinger wrote:
>>
>>
>>   =20
>>
>>>Those that are familiar with ADODB...
>>>=09
>>>	$sql =3D "SELECT LastGenID FROM QTII_UR.dbo.urlastgenid WHERE userid =
=3D 'encwebtools'";
>>>       	$rsCaseID =3D $qtdb->Execute($sql);
>>>
>>>
>>>
>>>     =20
>>>
>>>>>Succeeds, Returns 1 record with the value '3281608'
>>>>>         =20
>>>>>
>>>       	$caseID =3D $rsCaseID->fields['LastGenID'];
>>>
>>>$caseID is empty... Though my select is succeeding the assignment is =
not grabbing the value of the field. I have also tried the assignement =
like this:
>>>
>>>	$caseID =3D $rsCaseID->fields[0]; // still nothing.
>>>
>>>I have review the Adodb manual, but not sure if I need to do this =
assignment differnet since I am querying a Mssql DB ???
>>>     =20
>>>
>>
>>Try accessing the value as $rsCaseID->Fields('LastGenID');
>>
>>I have noticed that sometimes for no apparent reason Fields() will =
work=20
>>but fields[] will not and the reverse.
>>
>>you might also try doing the following
>>
>>$tmp =3D $rsCaseID->GetAssoc();
>>var_dump($tmp);
>>to see if maybe there is a case sensitivity issue with mssql
>>   =20
>>


_______________________________________________
ciapug mailing list
ciapug@cialug.org
http://cialug.org/mailman/listinfo/ciapug


CONFIDENTIALITY NOTICE:  This communication, including any attachment, =
may contain confidential information and is intended only for the =
individual or entity to whom it is addressed.  Any review, =
dissemination, or copying of this communication by anyone other than the =
intended recipient is strictly prohibited.  If you are not the intended =
recipient, please contact the sender by reply email, delete and destroy =
all copies of the original message.'