Issue Details (XML | Word | Printable)

Key: ODBC-140
Type: Bug Bug
Status: Closed Closed
Resolution: Duplicate
Priority: Critical Critical
Assignee: Alexander Potapchenko
Reporter: Sven Steinseifer
Votes: 0
Watchers: 1

If you were logged in you would be able to see more operations.
ODBC Driver

Prepared statement inserts NULL value when inserting integer values into char columns

Created: 15/Feb/12 12:22 PM   Updated: 31/May/12 03:26 PM
Component/s: None
Affects Version/s: 2.0
Fix Version/s: 2.0.1

Environment: Windows 7
Issue Links:

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

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

int value = 1;
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 ODBC-139).

r = SQLExecute(hstmt);

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

 All   Comments   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
Sven Steinseifer added a comment - 17/Apr/12 11:56 AM
It works!