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

Prepared statement inserts NULL value when inserting integer values into char columns [ODBC140] #137

Closed
firebird-automations opened this issue Feb 15, 2012 · 5 comments

Comments

@firebird-automations
Copy link

Submitted by: Sven Steinseifer (svensteinseifer)

Is duplicated by ODBC75

When I try to insert integer values into char columns via prepared statements, NULL values get inserted.

Code:
r = SQLPrepare(hstmt, (SQLCHAR*)"INSERT INTO test (id, text) VALUES (1, ?)", SQL_NTS); // test.text is a CHAR column

int value = 1;
SQLINTEGER i = SQL_NTS;
r = SQLBindParameter(hstmt, 1, SQL_PARAM_INPUT, SQL_C_SLONG, SQL_INTEGER, 0, 0, &value, 0, &i); // binds INTEGER value to CHAR column
// last parameter should be ignored according to MSDN, but 0 leads to a crash (see Issue ODBC139).

r = SQLExecute(hstmt);

In the resulting row, test.text should contain "1" but contains NULL.

Commits: 6122325

@firebird-automations
Copy link
Author

Modified by: @alexpotapchenko

status: Open [ 1 ] => Resolved [ 5 ]

resolution: Duplicate [ 3 ]

Fix Version: 2.1 Beta [ 10410 ]

@firebird-automations
Copy link
Author

Modified by: @alexpotapchenko

Fix Version: 2.0.1 [ 10430 ]

Fix Version: 2.1 Beta [ 10410 ] =>

@firebird-automations
Copy link
Author

Modified by: @alexpotapchenko

Link: This issue is duplicated by ODBC75 [ ODBC75 ]

@firebird-automations
Copy link
Author

Commented by: Sven Steinseifer (svensteinseifer)

It works!

@firebird-automations
Copy link
Author

Modified by: @alexpotapchenko

status: Resolved [ 5 ] => Closed [ 6 ]

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

No branches or pull requests

2 participants