php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Return to Bug #67278
Patch patch_04Jun2014 revision 2014-06-04 11:30 UTC by rahulpriyadarshi@php.net

Patch patch_04Jun2014 for ibm_db2 Bug #67278

Patch version 2014-06-04 11:30 UTC

Return to Bug #67278 | Download this patch
Patch Revisions:

Developer: rahulpriyadarshi@php.net


diff ibm_db2-1.9.5/ibm_db2.c ibm_db2-1.9.5_patched/ibm_db2.c
121a122
> 	int expansion_factor; /* Maximum expected expansion factor for the length of mixed character data when converted to the application code page from datavase code page */
176a178,179
> 	int expansion_factor;			/* maximum expected expansion factor for the length of mixed character data */
> 						/* when converted to the application code page from the database code page*/
498a502,503
> 	stmt_res->expansion_factor = conn_res->expansion_factor;
> 
545a551,552
> 	REGISTER_LONG_CONSTANT("DB2_I5_NAMING_ON",  SQL_TRUE, CONST_CS | CONST_PERSISTENT);
> 	REGISTER_LONG_CONSTANT("DB2_I5_NAMING_OFF", SQL_FALSE, CONST_CS | CONST_PERSISTENT);
550,551d556
< 	REGISTER_LONG_CONSTANT("DB2_I5_NAMING_ON",  SQL_TRUE, CONST_CS | CONST_PERSISTENT);
< 	REGISTER_LONG_CONSTANT("DB2_I5_NAMING_OFF", SQL_FALSE, CONST_CS | CONST_PERSISTENT);
1279a1285,1306
> 	} else if (!STRCASECMP(opt_key, "i5_naming")) {
> 		   /* i5_naming - SQL_ATTR_DBC_SYS_NAMING
> 		      DB2_I5_NAMING_ON value turns on DB2 UDB CLI iSeries system naming mode. Files are qualified using the slash (/) delimiter. Unqualified files are resolved using the library list for the job..
> 		      DB2_I5_NAMING_OFF value turns off DB2 UDB CLI default naming mode, which is SQL naming. Files are qualified using the period (.) delimiter. Unqualified files are resolved using either the default library or the current user ID.
> 		    */
> 		pvParam = option_num;
> 		switch (option_num) {
> 			case DB2_I5_NAMING_ON:
> 			case DB2_I5_NAMING_OFF:
> #ifdef PASE
> 				((conn_handle*)handle)->c_i5_sys_naming = option_num;
> 				rc = SQLSetConnectAttr((SQLHDBC)((conn_handle*)handle)->hdbc, SQL_ATTR_DBC_SYS_NAMING, (SQLPOINTER)&pvParam, SQL_NTS);
> #else
> 				rc = SQLSetConnectAttr((SQLHDBC)((conn_handle*)handle)->hdbc, SQL_ATTR_DBC_SYS_NAMING, (SQLPOINTER)pvParam, SQL_NTS);
> #endif
> 				if ( rc == SQL_ERROR ) {
> 					_php_db2_check_sql_errors((SQLHSTMT)((conn_handle*)handle)->hdbc, SQL_HANDLE_DBC, rc, 1, NULL, -1, 1 TSRMLS_CC);
> 				}
> 				break;
> 			default:
> 				php_error_docref(NULL TSRMLS_CC, E_WARNING, "i5_naming attribute must be DB2_I5_NAMING_ON or DB2_I5_NAMING_OFF)");
> 		}
1323,1340d1349
< 	} else if (!STRCASECMP(opt_key, "i5_naming")) {
< 		/* i5_naming - SQL_ATTR_DBC_SYS_NAMING
< 		DB2_I5_NAMING_ON value turns on DB2 UDB CLI iSeries system naming mode. Files are qualified using the slash (/) delimiter. Unqualified files are resolved using the library list for the job..
< 		DB2_I5_NAMING_OFF value turns off DB2 UDB CLI default naming mode, which is SQL naming. Files are qualified using the period (.) delimiter. Unqualified files are resolved using either the default library or the current user ID.
< 		*/
< 	    pvParam = option_num;
< 	    switch (option_num) {
< 			case DB2_I5_NAMING_ON:
< 			case DB2_I5_NAMING_OFF:
< 				((conn_handle*)handle)->c_i5_sys_naming = option_num;
< 				rc = SQLSetConnectAttr((SQLHDBC)((conn_handle*)handle)->hdbc, SQL_ATTR_DBC_SYS_NAMING, (SQLPOINTER)&pvParam, SQL_NTS);
< 				if ( rc == SQL_ERROR ) {
< 					_php_db2_check_sql_errors((SQLHSTMT)((conn_handle*)handle)->hdbc, SQL_HANDLE_DBC, rc, 1, NULL, -1, 1 TSRMLS_CC);
< 				}
< 				break;
< 			default:
< 				php_error_docref(NULL TSRMLS_CC, E_WARNING, "i5_naming (DB2_I5_NAMING_ON, DB2_I5_NAMING_OFF)");
< 		}
1547,1565d1555
< 	} else if (!STRCASECMP(opt_key, "i5_fetch_only")) {
<           /* i5_fetch_only - SQL_ATTR_FOR_FETCH_ONLY
<              DB2_I5_FETCH_ON - Cursors are read-only and cannot be used for positioned updates or deletes. This is the default unless SQL_ATTR_FOR_FETCH_ONLY environment has been set to SQL_FALSE. 
<              DB2_I5_FETCH_OFF - Cursors can be used for positioned updates and deletes.
<              */
< 	    pvParam = option_num;
< 	    switch (option_num) {
< 			case DB2_I5_FETCH_ON:
< 			case DB2_I5_FETCH_OFF:
< 				rc = SQLSetStmtAttr((SQLHSTMT)((stmt_handle *)handle)->hstmt,
< 					SQL_ATTR_FOR_FETCH_ONLY, (SQLPOINTER)&pvParam,
< 					SQL_IS_INTEGER );
< 				if ( rc == SQL_ERROR ) {
< 					_php_db2_check_sql_errors((SQLHSTMT)((stmt_handle *)handle)->hstmt, SQL_HANDLE_STMT, rc, 1, NULL, -1, 1 TSRMLS_CC);
< 				}
< 				break;
< 			default:
< 				php_error_docref(NULL TSRMLS_CC, E_WARNING, "i5_fetch_only (DB2_I5_FETCH_ON, DB2_I5_FETCH_OFF)");
< 		}
1780c1770,1775
< 				in_length = stmt_res->column_info[i].size+1;
---
> 				/* Multiply the size by expansion factor to handle cases where client and server code page are different*/
> 				if (stmt_res->expansion_factor > 1 ){
> 					in_length = stmt_res->column_info[i].size * stmt_res->expansion_factor + 1;
> 				} else {
> 					in_length = stmt_res->column_info[i].size+1;
> 				}
2015a2011
> 	struct sqlca sqlca;
2181a2178,2191
> 			/* Get maximum expected expansion factor for the length of mixed character data when converted to the */
> 			/* application code page from the database code page*/
> 			rc = SQLGetSQLCA((SQLHENV) conn_res->henv, (SQLHDBC) conn_res->hdbc, SQL_NULL_HSTMT, &sqlca);
> 
> 			if ( rc == SQL_ERROR ) {
> 				_php_db2_check_sql_errors(conn_res->hdbc, SQL_HANDLE_DBC, rc, 1, NULL, -1, 1 TSRMLS_CC);
> 				SQLDisconnect((SQLHDBC)conn_res->hdbc);
> 				SQLFreeHandle( SQL_HANDLE_DBC, conn_res->hdbc );
> 				SQLFreeHandle(SQL_HANDLE_ENV, conn_res->henv);
> 				break;
> 			} else {
> 				conn_res->expansion_factor = sqlca.sqlerrd[1];	
> 			}
> 
3651a3662
> 	int origlen = -1;
3707c3718
< 				int origlen = Z_STRLEN_PP(bind_data);
---
> 				origlen = Z_STRLEN_PP(bind_data);
3859c3870,3874
< 						curr->bind_indicator = (curr->value)->value.str.len;
---
> 						if (origlen != -1) {
> 							 curr->bind_indicator = origlen;
> 						} else {
> 							curr->bind_indicator = (curr->value)->value.str.len;
> 						}
3872c3887,3891
< 						curr->bind_indicator = (curr->value)->value.str.len;
---
> 						if (origlen != -1) {
> 							curr->bind_indicator = origlen;
> 						} else {
> 							curr->bind_indicator = (curr->value)->value.str.len;
> 						}
3910c3929,3933
< 					curr->bind_indicator = (curr->value)->value.str.len;
---
> 					if (origlen != -1) {
> 						curr->bind_indicator = origlen;
> 					} else {	
> 						curr->bind_indicator = (curr->value)->value.str.len;
> 					}
3941a3965
> 			
diff ibm_db2-1.9.5/php_ibm_db2.h ibm_db2-1.9.5_patched/php_ibm_db2.h
26c26
< #define	PHP_IBM_DB2_VERSION	"1.9.5"
---
> #define	PHP_IBM_DB2_VERSION	"1.9.5.04.06.2014"
43a44,48
> /* Needed for backward compatibility (SQL_ATTR_DBC_SYS_NAMING not defined prior to DB2 10.1.0.2) */
> #ifndef SQL_ATTR_DBC_SYS_NAMING
> #define SQL_ATTR_DBC_SYS_NAMING 3017
> #endif
> 
131a137,138
> #define DB2_I5_NAMING_ON  SQL_TRUE
> #define DB2_I5_NAMING_OFF SQL_FALSE
138,139d144
< #define DB2_I5_NAMING_ON  SQL_TRUE
< #define DB2_I5_NAMING_OFF SQL_FALSE
Only in ibm_db2-1.9.5.04Jun14_patch: pic1_out.jpg
Only in ibm_db2-1.9.5.04Jun14_patch: run-tests.php
Only in ibm_db2-1.9.5.04Jun14_patch: spook_out.png
Common subdirectories: ibm_db2-1.9.5/tests and ibm_db2-1.9.5.04Jun14_patch/tests
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Mar 28 21:01:27 2024 UTC