Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mQpEZ-000401-Hx for pgsql-odbc@arkaria.postgresql.org; Thu, 16 Sep 2021 11:07:15 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1mQpEX-0003nq-9s for pgsql-odbc@arkaria.postgresql.org; Thu, 16 Sep 2021 11:07:13 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mQpEW-0003ni-TO for pgsql-odbc@lists.postgresql.org; Thu, 16 Sep 2021 11:07:13 +0000 Received: from mx08-00574e01.pphosted.com ([185.183.31.38]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mQpER-0003BO-5w for pgsql-odbc@postgresql.org; Thu, 16 Sep 2021 11:07:11 +0000 Received: from pps.filterd (m0214000.ppops.net [127.0.0.1]) by mx08-00574e01.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 18GB3JQe007382 for ; Thu, 16 Sep 2021 12:07:04 +0100 Received: from mail-ed1-f71.google.com (mail-ed1-f71.google.com [209.85.208.71]) by mx08-00574e01.pphosted.com with ESMTP id 3b43e4838e-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT) for ; Thu, 16 Sep 2021 12:07:04 +0100 Received: by mail-ed1-f71.google.com with SMTP id h15-20020aa7de0f000000b003d02f9592d6so4996610edv.17 for ; Thu, 16 Sep 2021 04:07:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=iress-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=iyszzetkvzCFAcAieEXN5hb9VPYU3BWxyhDlaMn+A/w=; b=XwpFy0EyXOjuCVP9+mjx/iZ5S0We501r5a35j/Ew/5Up/nHOl1x7bl5MkQPyfbRc24 m18maR28qw9u80au490cpyY2nbqeJNTMaha2K7fsgxYm6fvHiyqbIV00XPeSDF87sNv0 +gkWUn9Bre+qVDnaNJvqlnppLmcVUtV76FmaQIDvRcXIzk7aHCk+ov5GnLC54XCoWzbQ T0w19apHG7izFrHaW6NxTMaXX4CIG+XSb4HtmM553Wy5rgQQZY7xkJScSQ31F0U6MhiE 6AfMJCRD/0R2UCmhMZ2ZDyrWmEhs1jYrnZnVxfia0OHdDWAtAzh7j7YzOk2fsW+Fc48q 94Ag== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=iyszzetkvzCFAcAieEXN5hb9VPYU3BWxyhDlaMn+A/w=; b=mQxcTHFS/Nkkh95EZZ33JWgXaCz/4hRLm+wSENYtNY5KaBB+H51fuAnq9BxVNbV4zb VWUKcoSwNcIzn0CCZgg43ZtDpAiMe9w2q/00jDMniA+XjbYu1eg45ZqP7DdT5q5yzD9G YiPphsAby927RrXymjA3JLf/U3WK8/uoVL3mk/Zt6gs0wHMlK+n6XZmL26w+pccr+PKR fbHF5PH6bu0SUbeosaxc1g+KOdc3WN/q5eTrsd3lR4dLcSxmbmA1A2fCENGirB+hkmMF bA4y4Chxv1MLyGLDCIM6XokKx+2osoWqeDIEbFPXZLTKsOjP7QxM1L63NztbfbHypJpZ K/Ag== X-Gm-Message-State: AOAM532n4Z5FxYf60ogH37BJw4B/Jo0WPKcfkmD1LekLWs75YSIinRnA TZKtRvXC0mSDFKhQ75AOlk4+5WEh71y2RxWha+qUiQf8Ji1wbaJgwZN80TMRdSlmLuVVL/o4Rmr eaEA+xCDcerOK0V3u3uBlTm9u+JADH8JonYII2+0mcfTQqQ== X-Received: by 2002:a17:906:f243:: with SMTP id gy3mr5604711ejb.327.1631790423990; Thu, 16 Sep 2021 04:07:03 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwOzwhT1WZ9UdCY+yvx2y+KmU5pBWDlVTn5bTGLfy3vZNKoWRDrV9Mh7UPPMnFToaSdqqugNhChyUry X-Received: by 2002:a17:906:f243:: with SMTP id gy3mr5604691ejb.327.1631790423731; Thu, 16 Sep 2021 04:07:03 -0700 (PDT) Received: from eu2.smtp.exclaimer.net (eu2.smtp.exclaimer.net. [52.169.0.179]) by smtp-relay.gmail.com with ESMTPS id g15sm29765ejk.155.2021.09.16.04.07.03 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 16 Sep 2021 04:07:03 -0700 (PDT) X-Relaying-Domain: iress.com Received: from mail-wm1-f69.google.com (209.85.128.69) by eu2.smtp.exclaimer.net (52.169.0.179) with Exclaimer Signature Manager ESMTP Proxy eu2.smtp.exclaimer.net (tlsversion=TLS12, tlscipher=TLS_ECDHE_WITH_AES256_SHA1); Thu, 16 Sep 2021 11:07:03 +0000 X-ExclaimerHostedSignatures-MessageProcessed: true X-ExclaimerProxyLatency: 6045091 X-ExclaimerImprintLatency: 3271287 X-ExclaimerImprintAction: bfd45c71908e4d899c80de7e12de88dd Received: by mail-wm1-f69.google.com with SMTP id 201-20020a1c04d2000000b0030b3e4fdcfbso196197wme.0 for ; Thu, 16 Sep 2021 04:07:03 -0700 (PDT) X-Received: by 2002:adf:9e48:: with SMTP id v8mr5385884wre.141.1631790422475; Thu, 16 Sep 2021 04:07:02 -0700 (PDT) X-Received: by 2002:adf:9e48:: with SMTP id v8mr5385848wre.141.1631790422106; Thu, 16 Sep 2021 04:07:02 -0700 (PDT) MIME-Version: 1.0 References: <994c12dd0d6348d389246fda802fff07@exmbx03.ofis.int> In-Reply-To: <994c12dd0d6348d389246fda802fff07@exmbx03.ofis.int> From: Adrian Grucza Date: Thu, 16 Sep 2021 21:06:51 +1000 Message-ID: Subject: Re: Problem on calling procedures with ADODB To: Kamil ADEM Cc: "pgsql-odbc@postgresql.org" Content-Type: multipart/alternative; boundary="000000000000754c0805cc1ad07d" X-Proofpoint-GUID: vKAzrMuIiYsYNxorH8GYUSmQMCMgd9Sy X-Proofpoint-ORIG-GUID: vKAzrMuIiYsYNxorH8GYUSmQMCMgd9Sy List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk This is a multi-part message in MIME format. --000000000000754c0805cc1ad07d Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Hi Kamil, Have you tried changing pCommand->CommandText to _bstr_t("CALL sp_TEST(?, ?, ?)"), with one question mark per parameter? Adrian Grucza Technical Lead Tel: +61390185800 adrian.grucza@iress.com www.iress.com Level 16 385 Bourke St Melbourne, Victoria, 3000 The contents of this email originated from Iress. For this purpose Iress in= cludes Iress Limited and/or any of its subsidiaries, holding companies and = trading entities. =E2=80=8BIf you have received this email in error please = notify the sender immediately and delete this email. nosig On Thu, 16 Sept 2021 at 17:49, Kamil ADEM wrote= : > > > *CAUTION: *This Email is from an EXTERNAL source. Ensure you trust this > sender before clicking on any links or attachments. > > > Hello, > > > > We porting a Windows MFC application from MSSQLServer to PostgreSQL and > trying to use psqlODBC driver with Microsoft ADODB. > > We are currently performing the migration steps of our C sources and got > stuck on an issue and thought to ask for your help. > > > > We use Microsoft ADODB on Windows to access the database and cannot chang= e > this interface in short time. To access Postgres we changed the connectio= n > string accordingly. (e.g. =E2=80=9CDriver=3D {PostgreSQL ANSI};=E2=80=9D) > > On calling Postgres procedures we have the following code sample: > > _CommandPtr pCommand; > > pCommand->CommandType =3D adCmdStoredProc; > > pCommand->CommandText =3D _bstr_t(=E2=80=9Csp_TEST=E2=80=9D); > > pCommand->Parameters->Refresh(); > > pCommand->Execute(NULL, NULL, adCmdStoredProc | adExecuteNoRecords); > > The Execute() method generates the command: =E2=80=9CSELECT * FROM sp_TES= T(=E2=80=A6)=E2=80=9D > instead of =E2=80=9CCALL sp_TEST(=E2=80=A6)=E2=80=9D. This is appropriate= for Postgres functions, > but there must be a way to call procedures also. > > Do you know such a reported issue? Do you know a way to change this > behaviour? Should we use a different driver? Should we get rid of > procedures and convert our MSSQL stored procedures to Postgres functions? > > > > We would be grateful if you can guide us to the right solution. > > Thanks in advance. > > > > Best regards, > > > > Kamil Adem > > Aqvila Software Yaz=C4=B1l=C4=B1m A.=C5=9E. > > > > > > > --000000000000754c0805cc1ad07d Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: quoted-printable
Hi Kamil,
Have you tried changing pCommand->CommandText to _bstr_t(&q= uot;CALL sp_TEST(?, ?, ?)"), with one question mark per parameter?

3D"iress.com"
= <= /tr>
Adrian Grucza  
Technical Le= ad
Tel: +61390185800
adrian.grucza@iress.com
www.iress.com
3000
Level 16 385&n= bsp;Bourke St
 Melbourne, Victoria, 
<= /table>
The c= ontents of this email originated from Iress. For this purpose Iress include= s Iress Limited and/or any of its subsidiaries, holding companies and tradi= ng entities. ​If you have received this email in error please notify = the sender immediately and delete this email. 
nosig
On Thu, 16 Sept 2021 at 17:49, Kamil AD= EM <kamila@aqvilasoftware.c= om> wrote:


CAU= TION: This Email is from an EXTERNAL source. Ensure you trust th= is sender before clicking on any links or attachments.


Hello,

=C2=A0

We porting a Windows MFC application from MSSQLSer= ver to PostgreSQL and trying to use psqlODBC driver with Microsoft ADODB.

We are currently performing the migration steps of= our C sources and got stuck on an issue and thought to ask for your help.<= u>

=C2=A0

We use Microsoft ADODB on Windows to access the da= tabase and cannot change this interface in short time. To access Postgres w= e changed the connection string accordingly. (e.g. =E2=80=9CDriver=3D {PostgreSQL ANSI};=E2=80=9D)

On calling Postgres procedures we have the followi= ng code sample:

_CommandPtr pCommand;=

pCommand->CommandT= ype =3D adCmdStoredProc;

pCommand->CommandT= ext =3D _bstr_t(=E2=80=9Csp_TEST=E2=80=9D);

pCommand->Paramete= rs->Refresh();

pCommand->Execute(= NULL, NULL, adCmdStoredProc | adExecuteNoRecords);

The Execute() method generates the command: =E2= =80=9CSELECT * FROM sp_TEST(=E2=80=A6)=E2=80=9D instead of =E2=80=9CCALL sp= _TEST(=E2=80=A6)=E2=80=9D. This is appropriate for Postgres functions, but there must be a way to call procedures also.<= /span>

Do you know such a reported issue? =C2=A0Do you know = a way to change this behaviour? Should we use a different driver? Should we= get rid of procedures and convert our MSSQL stored procedures to Postgres functions?

=C2=A0

We= would be grateful if you can guide us to the right solution.=

Th= anks in advance.

=C2=A0

Best regards,

=C2=A0

Kamil Adem

Aqvila Software Yaz=C4=B1l=C4=B1m A.=C5=9E.=

=C2=A0

=C2=A0

=C2=A0

--000000000000754c0805cc1ad07d--