X-Original-To: pgsql-odbc-postgresql.org@localhost.postgresql.org Received: from localhost (mx2.hub.org [200.46.204.254]) by postgresql.org (Postfix) with ESMTP id EC9D211F8BC5 for ; Wed, 12 Apr 2006 00:10:44 -0300 (ADT) X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Score: 0.002 X-Spam-Level: X-Spam-Status: No, score=0.002 required=5 tests=[BAYES_50=0.001, HTML_MESSAGE=0.001] Received: from postgresql.org ([200.46.204.71]) by localhost (mx2.hub.org [200.46.204.254]) (amavisd-new, port 10024) with ESMTP id 7whz5z9RdZKq for ; Wed, 12 Apr 2006 00:10:39 -0300 (ADT) Received: from svr4.postgresql.org (svr4.postgresql.org [66.98.251.159]) by postgresql.org (Postfix) with ESMTP id E47F411F8DA6 for ; Wed, 12 Apr 2006 00:02:15 -0300 (ADT) Received: from xproxy.gmail.com (xproxy.gmail.com [66.249.82.201]) by svr4.postgresql.org (Postfix) with ESMTP id B86C85AF999 for ; Wed, 12 Apr 2006 00:02:53 +0000 (GMT) Received: by xproxy.gmail.com with SMTP id h31so950204wxd for ; Tue, 11 Apr 2006 17:01:52 -0700 (PDT) Received: by 10.70.113.3 with SMTP id l3mr4503782wxc; Tue, 11 Apr 2006 16:55:48 -0700 (PDT) Received: from sam ( [216.23.184.250]) by mx.gmail.com with ESMTP id h14sm1404918wxd.2006.04.11.16.55.48; Tue, 11 Apr 2006 16:55:48 -0700 (PDT) From: "Sam Thukral" To: Subject: ADO Ref cursor return Date: Tue, 11 Apr 2006 16:55:06 -0700 MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_0080_01C65D88.B0687910" X-Mailer: Microsoft Office Outlook, Build 11.0.5510 Thread-Index: AcZdw1ukHAr8mwcxThe6DlVevfNMJw== X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 Message-ID: <443c4204.0d49a05d.69f8.ffff92bc@mx.gmail.com> X-Archive-Number: 200604/39 X-Sequence-Number: 7566 This is a multi-part message in MIME format. ------=_NextPart_000_0080_01C65D88.B0687910 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Hello, We are currently porting to Postgres from SQL Server and are experiencing problems with ADO and returning refcursors. We currently use the parameterized ADO methodology to return our data from procedures in the database. After researching and converting over our database to postgres, we are trying to re-use as much of our logic as we can. As currently configured, we return a refcursor as an out parameter from the procedure, and try to return the data into an ADO resultset. From further research, we found methodology to call our procedure and return the cursor, and then fetch the results into a resultset. Here is the current code: Procedure: CREATE OR REPLACE FUNCTION usp_commhost_get(IN sdomain "varchar", OUT swv_refcur refcursor) AS $BODY$ BEGIN -- GET SUBDOMAIN COMMUNITY DETAILS open swv_RefCur for SELECT C.ccPublicCommID FROM tbl_Comm C WHERE(LOWER(C.ccDomain) = LOWER(sdomain) OR C.ccDomain = 'change_me') AND(C.ccStatusID = 1); RETURN; END; $BODY$ LANGUAGE 'plpgsql' VOLATILE; ALTER FUNCTION usp_commhost_get(IN sdomain "varchar", OUT swv_refcur refcursor) OWNER TO postgres; ASP code <% dim conn, rst, cmd set conn = server.createobject("ADOdb.connection") conn.open "Data Source=pssam1;location=Connect3_0;UserID=username;password=password;" Set cmd = Server.CreateObject("ADODB.Command") cmd.ActiveConnection = conn cmd.CommandText = "select usp_commhost_get('refcur', 'localhost'); FETCH ALL IN refcur;" set rst = server.createobject("ADOdb.recordset") Set rst= cmd.Execute do until rst.eof response.write Server.HTMLEncode(rst.fields(0))&"
" rst.movenext loop rst.Close conn.Close %> We would like to convert this into a parameterized call to the procedure, and not have to stipulate the cursor name to retrieve the data. Is this possible? And if so, what is the proper format? Thank you for any help in advance. Sam Thukral Centercode ------=_NextPart_000_0080_01C65D88.B0687910 Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable

Hello,

 

We are currently porting to Postgres from SQL Server = and are experiencing problems with ADO and returning refcursors.  We currently use the parameterized = ADO = methodology to return our data from procedures in the database.  After researching and converting over our database to postgres, we are trying to re-use as = much of our logic as we can.  As currently configured, we return a = refcursor as an out parameter from the procedure, and try to return the data into an = ADO resultset. =  From further research, we found methodology to call our procedure and return = the cursor, and then fetch the results into a resultset.  Here is the = current code:

 

Procedure:

 

CREATE OR REPLACE FUNCTION usp_commhost_get(IN = sdomain "varchar", OUT swv_refcur refcursor) = AS

$BODY$

BEGIN

-- GET SUBDOMAIN COMMUNITY = DETAILS

   open swv_RefCur for SELECT = C.ccPublicCommID FROM tbl_Comm C  WHERE(LOWER(C.ccDomain) =3D LOWER(sdomain) OR = C.ccDomain =3D 'change_me') AND(C.ccStatusID =3D 1);

   RETURN;

END; $BODY$

  LANGUAGE 'plpgsql' = VOLATILE;

ALTER FUNCTION usp_commhost_get(IN sdomain = "varchar", OUT swv_refcur refcursor) OWNER TO = postgres;

 

ASP code

 

<!--#include virtual=3D"/global/constants.html"-->

<html>

<head></head>

<body>

<%

dim conn, rst, = cmd

 

set conn =3D server.createobject("ADOdb.connection")

conn.open = "Data Source=3Dpssam1;location=3DConnect3_0;UserID=3Dusername;password=3Dpasswo= rd;"

Set cmd =3D Server.CreateObject("ADODB.Command")

cmd.ActiveConnection =3D conn

cmd.CommandText =3D "select usp_commhost_get('refcur', 'localhost'); FETCH ALL IN refcur;"

set rst =3D server.createobject("ADOdb.recordset")=

Set rst=3D = cmd.Execute

 

do until = rst.eof

  response.write Server.HTMLEncode(rst.fields(0))&"<BR>"

  = rst.movenext

loop

rst.Close

conn.Close

 

%>

</body>

</html>

 

We would like to convert this into a parameterized = call to the procedure, and not have to stipulate the cursor name to retrieve the = data.  Is this possible?  And if so, what is the proper format?  Thank = you for any help in advance.

 

Sam Thukral

Centercode

 

 

 

 

------=_NextPart_000_0080_01C65D88.B0687910--