From: | Dave Cramer <davecramer(at)postgres(dot)rocks> |
---|---|
To: | Chang Lu <luchang0624(at)gmail(dot)com> |
Cc: | pgsql-odbc(at)lists(dot)postgresql(dot)org |
Subject: | Re: [bug-report]SQLRowCount set affected row numbers is incorrect when use SQLBindParameter and SQLSetStmtAttr for SQL_ATTR_PARAMSET_SIZE |
Date: | 2024-07-18 10:02:32 |
Message-ID: | CADK3HHK7MwP9MZeSBGSZgOBqAB7GUFiL92hq5qMqoSVpzEosTA@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-odbc |
On Thu, 18 Jul 2024 at 05:54, Chang Lu <luchang0624(at)gmail(dot)com> wrote:
> Hi,
>
> I'm tring to insert and update a lot of records using SQLBindParameter
> and SQLSetStmtAttr, but SQLRowsCount returned record number affected by
> ONLY the LAST SINGLE SQL STATEMENT.
>
> Here is my code sequence.
>
> 1.
> status = SQLBindParameter(cda,
> KCPD_SCAST(KCPD_SQLUSMALLINT, parm_pos),
> KCPD_SCAST(KCPD_SQLSMALLINT, param_type),
> ftype,
> KCPD_SCAST(KCPD_SQLSMALLINT, mapped_sqltype),
> temp_column_size,
> sqltype == SQL_TYPE_TIMESTAMP ? kcpd_odbc_date_scale : 0,
> KCPD_RCAST(KCPD_SQLPOINTER, v.p_v),
> buflen,
> v.p_len);
>
> 2.
> status = SQLSetStmtAttr(cda,
> SQL_ATTR_PARAMSET_SIZE,
> KCPD_RCAST(void*, temp_iters),
> SQL_NTS);
>
> 3.
> status = SQLExecute(cda);
>
> 4.
> SQLRowCount(cda, affected_num);
>
> I inserted 1000 records into the table, but affected_num set by
> SQLRowCount is 1
>
> I searched the source code for this issue, and found in
> CC_send_query_append (connection.c:2062)
> [image: image.png]
>
> My question is :
> Is this line (connection.cpp : 2062) has a bug? I think it may use '+='
> rather than '='.
> lack of libpg.dll and headers, I cannot compile the source code and check
> my idea.
>
Good Morning Chang,
Thanks for the report. If you go to postgresql-interfaces/psqlodbc
(github.com) <https://github.com/postgresql-interfaces/psqlodbc> and file
the issue we will be able to track it better
Also since it will run tests for you there, you can test it with a Pull
Request.
Cheers,
Dave
From | Date | Subject | |
---|---|---|---|
Next Message | Wal, Jan Tjalling van der | 2024-07-18 10:30:14 | RE: [bug-report]SQLRowCount set affected row numbers is incorrect when use SQLBindParameter and SQLSetStmtAttr for SQL_ATTR_PARAMSET_SIZE |
Previous Message | Chang Lu | 2024-07-18 09:54:14 | [bug-report]SQLRowCount set affected row numbers is incorrect when use SQLBindParameter and SQLSetStmtAttr for SQL_ATTR_PARAMSET_SIZE |