Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 7E718475E7B for ; Mon, 16 Sep 2002 13:48:01 -0400 (EDT) Received: from hotmail.com (dav17.law15.hotmail.com [64.4.22.121]) by postgresql.org (Postfix) with ESMTP id 5E588476384 for ; Mon, 16 Sep 2002 13:47:59 -0400 (EDT) Received: from mail pickup service by hotmail.com with Microsoft SMTPSVC; Mon, 16 Sep 2002 10:47:59 -0700 X-Originating-IP: [204.244.28.188] From: "david williams" To: Subject: Re: Problem returning a cursor through ODBC to ASP layer from postgres Date: Mon, 16 Sep 2002 13:50:32 -0400 MIME-Version: 1.0 X-Mailer: MSN Explorer 7.00.0021.1900 Content-Type: multipart/alternative; boundary="----=_NextPart_001_0001_01C25D88.06429F00" Message-ID: X-OriginalArrivalTime: 16 Sep 2002 17:47:59.0254 (UTC) FILETIME=[322E3360:01C25DA9] X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200209/67 X-Sequence-Number: 2038 ------=_NextPart_001_0001_01C25D88.06429F00 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable If I make the following change so that only the select getallusers('rs'); e= xecutes then all I get is: 1|select getallusers('rs'); <------------ Debug code - 1 field and co= mmand executedgetallusers rs <%=20=20 strconn=3D"DSN=3Dp_cars4u;uid=3Dpostgres;pwd=3D" 'mySQL=3D"select * from users" 'mySQL =3D "begin; "&vbcrlf mySQL =3D mySQL & "select getallusers('rs'); " 'mySQL =3D mySQL & "fetch all in rs; " 'mySQL =3D mySQL & "commit; " 'call query2table(mySQL,strconn)' %> So text is being returned rather than a pointer/cursor/whatever. Thanks Dave ----- Original Message ----- From: david williams Sent: Monday, September 16, 2002 1:17 PM To: pgsql-odbc@postgresql.org Subject: Re: [ODBC] Problem returning a cursor through ODBC to ASP layer fr= om postgres The entire ASP page (read.asp) is here: read.asp <%=20=20 strconn=3D"DSN=3Dp_cars4u;uid=3Dpostgres;pwd=3D" 'mySQL=3D"select * from users" mySQL =3D "begin; "&vbcrlf mySQL =3D mySQL & "select getallusers('rs'); " mySQL =3D mySQL & "fetch all in rs; " 'mySQL =3D mySQL & "commit; " 'call query2table(mySQL,strconn)' %> <%=20=20 sub query2table(inputquery, inputDSN) dim conntemp, rstemp set conntemp=3Dserver.createobject("adodb.connection") conntemp.open inputDSN set rstemp=3Dconntemp.execute(inputquery) howmanyfields=3Drstemp.fields.count -1%> <% 'Put Headings On The Table of Field Names for i=3D0 to howmanyfields %> <% next %> <% ' Now lets grab all the records do while not rstemp.eof %> <------------------ LINE= 35 <% for i =3D 0 to howmanyfields thisvalue=3Drstemp(i) If isnull(thisvalue) then thisvalue=3D" " end if%> <% next %> <%rstemp.movenext loop%>
<%=3Drstemp(i).name%>
<%=3Dthisvalue%>
<% rstemp.close set rstemp=3Dnothing conntemp.close set conntemp=3Dnothing end sub%> I get this error: Error Type: ADODB.Recordset (0x800A0E78) Operation is not allowed when the object is closed. /read.asp, line 35 It seems that the object is closed already because it returns nothing. Thanks=20=20 Dave ----- Original Message ----- From: Janet Borschowa Sent: Monday, September 16, 2002 1:05 PM To: 'david williams'; pgsql-odbc@postgresql.org Subject: RE: [ODBC] Problem returning a cursor through ODBC to ASP layer fr= om postgres I believe that when you call commit the refcursor is closed. =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=20= =20 Janet Borschowa=20=20 Software Engineer, Database Products=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20 Rogue Wave Software=20=20 (541) 753-1931 FAX: (541) 757-4630=20=20 mailto:borschow@roguewave.com http://www.roguewave.com =20=20=20 -----Original Message----- From: david williams [mailto:dw_remote@hotmail.com] Sent: Friday, September 13, 2002 9:29 AM To: pgsql-odbc@postgresql.org Subject: [ODBC] Problem returning a cursor through ODBC to ASP layer from postgres I have created a function in postgres called getallusers(var) that returns a cursor. This works fine at the psql level but when I try to return it through ODBC I get errors. The function is as follows: CREATE OR REPLACE FUNCTION getallusers(refcursor) RETURN refcursor AS' begin open $1 for select * from users; return $1; end; ' language 'plpgsql'; I call it like this: <%=20=20 strconn=3D"DSN=3Dp_test;uid=3Dpostgres;pwd=3D" mySQL =3D "begin "&vbcrlf mySQL =3D mySQL & "select getallusers('rs'); " mySQL =3D mySQL & "fetch all in rs; " mySQL =3D mySQL & "commit; " call query2table(mySQL,strconn) %> This does not seem to return anything. Thanks !-------------------------------------! David Williams _____=20=20=20 Get more from the Web. FREE MSN Explorer download : http://explorer.msn.com =20=20 Get more from the Web. FREE MSN Explorer download : http://explorer.msn.com= Get more from the Web. FREE MSN Explorer download : http://explorer.msn.com ------=_NextPart_001_0001_01C25D88.06429F00 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable
If I make the fo= llowing change so that only the select getallusers('rs'); executes then all= I get is:
 
1|select getallusers('rs'); &n= bsp;     <------------ Debug code - 1 field and comm= and executed
getallusers
rs
 
<%
strconn=3D"DSN=3Dp_cars4u;uid=3Dpostgres;pwd=3D"
'mySQ= L=3D"select * from users"
'mySQL =3D "begin; "&vbcrlf
mySQL =3D m= ySQL & "select getallusers('rs'); "
'mySQL =3D mySQL & "fetch al= l in rs; "
'mySQL =3D mySQL & "commit; "

'call query2table(mySQL,= strconn)'
%>

So text is being returned rather than a p= ointer/cursor/whatever.
 
Thanks
&nbs= p;
Dave
----- Original Message -----
From: david williams
Sent: Monday,= September 16, 2002 1:17 PM
To: pgsql-odbc@postgresql.org
Subjec= t: Re: [ODBC] Problem returning a cursor through ODBC to ASP layer from= postgres
 
The entire ASP page (read.asp) = is here:
 

<HTML><HEAD>
<TITLE&g= t;read.asp</TITLE>
<body bgcolor=3D"#FFFFFF"></HEAD><%
strconn=3D"DSN=3Dp_cars4u;uid=3Dpostgres;pwd=3D"
'mySQL=3D"s= elect * from users"
mySQL =3D "begin; "&vbcrlf
mySQL =3D mySQL &a= mp; "select getallusers('rs'); "
mySQL =3D mySQL & "fetch all in rs;= "
'mySQL =3D mySQL & "commit; "

'call query2table(mySQL,strc= onn)'
%>

</BODY>
</HTML>

<%
sub q= uery2table(inputquery, inputDSN)
   dim conntemp, rstemp
&n= bsp;  set conntemp=3Dserver.createobject("adodb.connection")
 =   conntemp.open inputDSN
   set rstemp=3Dconntemp.execute= (inputquery)
   howmanyfields=3Drstemp.fields.count -1%>   <table border=3D1><tr>
   <% 'Put= Headings On The Table of Field Names
   for i=3D0 to howmanyf= ields %>
          =    <td><b><%=3Drstemp(i).name%></B></T= D>
   <% next %>
   </tr>
 = ;  <% ' Now lets grab all the records
   do while not = rstemp.eof %>          = ;            <---= --------------- LINE 35
      <tr>
&nb= sp;     <% for i =3D 0 to howmanyfields
 &nb= sp;       thisvalue=3Drstemp(i)
 &nbs= p;       If isnull(thisvalue) then
 &= nbsp;          thisvalue=3D"&a= mp;nbsp;"
         end if%>             = <td valign=3Dtop><%=3Dthisvalue%></td>
  &nb= sp;   <% next %>
      </tr&= gt;
      <%rstemp.movenext
   = loop%>
   </table>
   <%
 &nb= sp; rstemp.close
   set rstemp=3Dnothing
   connt= emp.close
   set conntemp=3Dnothing
end sub%>

I= get this error:
 
Error Type:
ADODB.Recordse= t (0x800A0E78)
Operation is not allowed when the object is closed.
/r= ead.asp, line 35
It seems that the object is closed already = because it returns nothing.
 
Thanks
 
Dave
----- Original Message -----
Fro= m: Janet Borschowa
Sent: M= onday, September 16, 2002 1:05 PM
= To: 'david williams'; pgsql-odbc@postgresql.org
Subject: RE: [ODBC] Problem returning a cursor throug= h ODBC to ASP layer from postgres
 
I believe that whe= n you call commit the refcursor is closed.

=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
Janet Borschowa
So= ftware Engineer, Database Products       = ;            &n= bsp;   
Rogue Wave Software
(541) 753-1931 &nbs= p; FAX: (541) 757-4630
mailto:borschow@roguewave.com <mailto:borscho= w@roguewave.com>
http://www.roguewave.com <http://www.roguewave.co= m/> 



-----Original Message-----
From: david will= iams [mailto:dw_remote@hotmail.com]
Sent: Friday, September 13, 2002 9:2= 9 AM
To: pgsql-odbc@postgresql.org
Subject: [ODBC] Problem returning = a cursor through ODBC to ASP layer from
postgres


I have creat= ed a function in postgres called getallusers(var) that returns a
cursor.= This works fine at the psql level but when I try to return it
through O= DBC I get errors.

The function is as follows:

CREATE OR REPLA= CE FUNCTION getallusers(refcursor) RETURN refcursor AS'

begin
ope= n $1 for select * from users;
return $1;
end;
' language 'plpgsql'= ;


I call it like this:

<%
strconn=3D"DSN=3Dp_test;= uid=3Dpostgres;pwd=3D"
mySQL =3D "begin "&vbcrlf
mySQL =3D mySQL = & "select getallusers('rs'); "
mySQL =3D mySQL & "fetch all in r= s; "
mySQL =3D mySQL & "commit; "
call query2table(mySQL,strconn)=
%>


This does not seem to return anything.

Thanks

!-------------------------------------!
David Williams

=
  _____ 

Get more from the Web. FREE MSN Explorer dow= nload : http://explorer.msn.com
<http://explorer.msn.com>


Get more from the Web. FREE MSN Explorer dow= nload : http://explorer.msn.com



Get more from the W= eb. FREE MSN Explorer download : http:= //explorer.msn.com

------=_NextPart_001_0001_01C25D88.06429F00--