public inbox for [email protected]
help / color / mirror / Atom feedFrom: Kamil ADEM <[email protected]>
To: [email protected] <[email protected]>
Cc: Haluk DALKIRAN <[email protected]>
Subject: Procedure parameter list enumeration error
Date: Fri, 1 Oct 2021 11:46:07 +0000
Message-ID: <[email protected]> (raw)
Hello,
We use psqlODBC to access Postgres in our MFC C source on Windows. While enumerating procedure parameters we observe some errors we would like to be solved.
We have a procedure declared as:
public.SP_TEST(INOUT return_value INTEGER, INOUT p1_varchar1024 ACIKLAMA1024, INOUT p2_char20 KOD, INOUT p3_int TAMSAYI, INOUT p4_smallint YIL, INOUT p5_bit BOOL, INOUT p6_float MEBLAG, INOUT p7_datetime TARIH)
The parameter types are user created domains.
We have the following C source using Microsoft ADODB :
_CommandPtr pCommand;
pCommand->CommandType = adCmdStoredProc;
pCommand->CommandText = _bstr_t("SP_TEST");
Next, we enumerate the array pCommand->Parameters using pCommand->Parameters->Item[_variant_t(i)] and get the following output:
Name=return_value, Type=3, Direction=3, Size=0
Name=p1_varchar1024, Type=200, Direction=3, Size=255
Name=p2_char20, Type=200, Direction=3, Size=255
Name=p3_int, Type=200, Direction=3, Size=255
Name=p4_smallint, Type=200, Direction=3, Size=255
Name=p5_bit, Type=200, Direction=3, Size=5
Name=p6_float, Type=200, Direction=3, Size=255
Name=p7_datetime, Type=200, Direction=3, Size=255
The problem is that the types and sizes of the user created domains are not reported correctly!
When we change the procedure to the following, replacing the domains with underlying data types:
public.SP_TEST(INOUT return_value INTEGER, INOUT p1_varchar1024 VARCHAR(1024), INOUT p2_char20 CHAR(20), INOUT p3_int INT, INOUT p4_smallint SMALLINT, INOUT p5_bit BOOLEAN, INOUT p6_float FLOAT, INOUT p7_datetime TIMESTAMP)
we get the following enumeration result:
Name=return_value, Type=3, Direction=3, Size=0
Name=p1_varchar1024, Type=200, Direction=3, Size=255
Name=p2_char20, Type=200, Direction=3, Size=255
Name=p3_int, Type=3, Direction=3, Size=0
Name=p4_smallint, Type=2, Direction=3, Size=0
Name=p5_bit, Type=200, Direction=3, Size=5
Name=p6_float, Type=5, Direction=3, Size=0
Name=p7_datetime, Type=135, Direction=3, Size=0
This time the types are reported correctly (with the exception of boolean), but the size field for character types are still incorrect!
We use the following connection string:
"Driver={PostgreSQL ANSI};Server=localhost;Port=5432;Database=...;Uid=postgres;Pwd=..."
On the ODBC DSN configuration, the following changes have been made:
"Bools as Char" is unchecked
"Max VarChar" = 1036
We have a generic interface for calling stored procedures in our code being migrated from MSSQL to PostgreSQL. So we need to enumerate the parameters before calling the procedure to generate the parameter list.
How can we get rid of these issues? How can you help us to solve these problems?
Thanks in advance.
Kamil Adem
Aqvila Software Yazılım A.Ş.
view thread (3+ messages) latest in thread
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: [email protected]
Cc: [email protected], [email protected]
Subject: Re: Procedure parameter list enumeration error
In-Reply-To: <[email protected]>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox