Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SQLRowCount set affected row numbers is incorrect when use SQLBindParameter and SQLSetStmtAttr for SQL_ATTR_PARAMSET_SIZE #34

Open
Oliver0624 opened this issue Jul 18, 2024 · 0 comments

Comments

@Oliver0624
Copy link

Oliver0624 commented Jul 18, 2024

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.

status = SQLBindParameter(cda,
parm_pos,
param_type,
ftype,
mapped_sqltype,
temp_column_size,
sqltype == SQL_TYPE_TIMESTAMP ? odbc_date_scale : 0,
v.p_v,
buflen,
v.p_len);

status = SQLSetStmtAttr(cda,
SQL_ATTR_PARAMSET_SIZE,
temp_iters,
SQL_NTS);

status = SQLExecute(cda);

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

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.


July 23,2024
OK. I've found how to fix this bug, and have checked it on my computer. ( It's not so easy to fix this bug )
Can I send a pull request ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant