X-Original-To: pgsql-odbc-postgresql.org@localhost.postgresql.org Received: from localhost (mx1.hub.org [200.46.208.251]) by postgresql.org (Postfix) with ESMTP id 2AC8211F61E8 for ; Wed, 26 Apr 2006 00:39:56 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) with ESMTP id 16445-04-2 for ; Wed, 26 Apr 2006 00:39:33 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from sd.tpf.co.jp (sd.tpf.co.jp [210.161.239.34]) by postgresql.org (Postfix) with SMTP id C01B511F61C2 for ; Wed, 26 Apr 2006 00:39:31 -0300 (ADT) Received: (qmail 19239 invoked from network); 26 Apr 2006 12:39:29 +0900 Received: from unknown (HELO ?100.0.32.254?) (100.0.32.254) by sd2.tpf-fw-c.co.jp with SMTP; 26 Apr 2006 12:39:29 +0900 Message-ID: <444EEB57.8060505@tpf.co.jp> Date: Wed, 26 Apr 2006 12:39:03 +0900 From: Hiroshi Inoue User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206) X-Accept-Language: ja, en-us, en MIME-Version: 1.0 To: Philippe Lang CC: pgsql-odbc@postgresql.org Subject: Re: PG 8 INOUT parameters & ADO References: <6C0CF58A187DA5479245E0830AF84F421D0C1A@poweredge.attiksystem.ch> In-Reply-To: <6C0CF58A187DA5479245E0830AF84F421D0C1A@poweredge.attiksystem.ch> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=1.217 tagged_above=0 required=5 tests=BAYES_00, SPF_HELO_SOFTFAIL, SPF_SOFTFAIL X-Spam-Level: * X-Archive-Number: 200604/99 X-Sequence-Number: 7626 Philippe Lang wrote: > Thanks Ludek, it works like a charm with the "experimental" driver. > > For those who want to play with that, here some code to test... I think this > an elegant interface between MS Access, Postgreql and perl... > > ------------------ PG > > CREATE FUNCTION perl_test(a inout integer, b inout integer, r1 out integer, > r2 out integer) AS > ' > my ($a, $b) = @_; > > $r1 = $a + $b; > $r2 = $a * $b; > > if ($a > $b) > { > return {a => $a + 1, b => $b, r1 => $r1, r2 => $r2}; > } > else > { > return{a => $b, b => $a + 1, r1 => $r1, r2 => $r2}; > } > > return; > > ' LANGUAGE plperl; > > ------------------ VBA > > Public Function perl_test(ByRef a As Integer, ByRef b As Integer, ByRef r1 > As Integer, ByRef r2 As Integer) > On Error GoTo ErrorHandler > > Dim oConnection As ADODB.Connection > Dim oCommand As ADODB.Command > Dim oRecordset As ADODB.Recordset > > Set oConnection = New ADODB.Connection > oConnection.Open "DSN=test" > > Set oCommand = New ADODB.Command > > Set oCommand.ActiveConnection = oConnection > oCommand.CommandText = "perl_test" > oCommand.CommandType = adCmdStoredProc > > oCommand.Parameters.Append _ > oCommand.CreateParameter("a", adInteger, adParamInputOutput, , a) > > oCommand.Parameters.Append _ > oCommand.CreateParameter("b", adInteger, adParamInputOutput, , b) > > oCommand.Parameters.Append _ > oCommand.CreateParameter("r1", adInteger, adParamOutput) > > oCommand.Parameters.Append _ > oCommand.CreateParameter("r2", adInteger, adParamOutput) > > Set oRecordset = oCommand.Execute Thers may be another way. oCommand.Execute(, , ADODB.ExecuteOptionEnum.adExecuteNoRecords) a = oCommand.Parameters(0).Value b = oCommand.Parameters(1).Value r1 = oCommand.Parameters(2).Value r2 = oCommand.Parameters(3).Value regards, Hiroshi Inoue