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

Don't use NTS for returned values via env attr #28

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions ibm_driver.c
Original file line number Diff line number Diff line change
Expand Up @@ -1088,6 +1088,8 @@ static int dbh_connect(pdo_dbh_t *dbh, zval *driver_options)
rc = SQLSetEnvAttr((SQLHENV)conn_res->henv, SQL_ATTR_UTF8, (SQLPOINTER)(intptr_t)SQL_TRUE, 0);
}
#endif /* PASE */
/* forced fixed length strings to be returned */
rc = SQLSetEnvAttr((SQLHENV)conn_res->henv, SQL_ATTR_OUTPUT_NTS, (SQLPOINTER)(intptr_t)SQL_FALSE, SQL_IS_INTEGER);

/* now an actual connection handle */
rc = SQLAllocHandle(SQL_HANDLE_DBC, conn_res->henv, &(conn_res->hdbc));
Expand Down
6 changes: 4 additions & 2 deletions ibm_statement.c
Original file line number Diff line number Diff line change
Expand Up @@ -1906,10 +1906,12 @@ int record_last_insert_id( pdo_stmt_t * stmt, pdo_dbh_t *dbh, SQLHANDLE hstmt)
long int returnValue;
conn_handle *conn_res = (conn_handle *) dbh->driver_data;
char id[ MAX_IDENTITY_DIGITS ] = "";
char server[MAX_DBMS_IDENTIFIER_NAME];
char server[MAX_DBMS_IDENTIFIER_NAME + 1];
SQLSMALLINT server_name_length = 0;

rc = SQLGetInfo(conn_res->hdbc, SQL_DBMS_NAME, (SQLPOINTER)server, MAX_DBMS_IDENTIFIER_NAME, NULL);
rc = SQLGetInfo(conn_res->hdbc, SQL_DBMS_NAME, (SQLPOINTER)server, MAX_DBMS_IDENTIFIER_NAME, &server_name_length);
check_dbh_error(rc, "SQLGetInfo");
server[server_name_length] = '\0';
if( strncmp( server, "IDS", 3 ) == 0 ) {
rc = SQLGetStmtAttr( (SQLHSTMT)hstmt, SQL_ATTR_GET_GENERATED_VALUE, (SQLPOINTER)id,
MAX_IDENTITY_DIGITS, NULL );
Expand Down
Loading