Skip to content

Commit

Permalink
Fix #35730 Use correct character encoding with FreeTDS
Browse files Browse the repository at this point in the history
  • Loading branch information
fmk committed Dec 21, 2005
1 parent 9702984 commit a7d2ac4
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 2 deletions.
1 change: 1 addition & 0 deletions NEWS
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ PHP NEWS
connecting to 5.x server. (Andrey) connecting to 5.x server. (Andrey)
- Fixed bug #35760 (sybase_ct doesn't compile on Solaris using old gcc). (Tony) - Fixed bug #35760 (sybase_ct doesn't compile on Solaris using old gcc). (Tony)
- Fixed bug #35740 (memory leak when including a directory). (Tony) - Fixed bug #35740 (memory leak when including a directory). (Tony)
- Fixed bug #35730 (Use correct character encoding, and allow setting it) (Frank)
- Fixed bug #35723 (xmlrpc_introspection.c fails compile per C99 std). (Jani) - Fixed bug #35723 (xmlrpc_introspection.c fails compile per C99 std). (Jani)
- Fixed bug #35720 (A final constructor can be overwritten). (Marcus) - Fixed bug #35720 (A final constructor can be overwritten). (Marcus)
- Fixed bug #35713 (getopt() returns array with numeric strings when passed - Fixed bug #35713 (getopt() returns array with numeric strings when passed
Expand Down
9 changes: 7 additions & 2 deletions ext/mssql/php_mssql.c
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -141,6 +141,9 @@ PHP_INI_BEGIN()
STD_PHP_INI_BOOLEAN("mssql.datetimeconvert", "1", PHP_INI_ALL, OnUpdateBool, datetimeconvert, zend_mssql_globals, mssql_globals) STD_PHP_INI_BOOLEAN("mssql.datetimeconvert", "1", PHP_INI_ALL, OnUpdateBool, datetimeconvert, zend_mssql_globals, mssql_globals)
STD_PHP_INI_BOOLEAN("mssql.secure_connection", "0", PHP_INI_SYSTEM, OnUpdateBool, secure_connection, zend_mssql_globals, mssql_globals) STD_PHP_INI_BOOLEAN("mssql.secure_connection", "0", PHP_INI_SYSTEM, OnUpdateBool, secure_connection, zend_mssql_globals, mssql_globals)
STD_PHP_INI_ENTRY_EX("mssql.max_procs", "-1", PHP_INI_ALL, OnUpdateLong, max_procs, zend_mssql_globals, mssql_globals, display_link_numbers) STD_PHP_INI_ENTRY_EX("mssql.max_procs", "-1", PHP_INI_ALL, OnUpdateLong, max_procs, zend_mssql_globals, mssql_globals, display_link_numbers)
#ifdef HAVE_FREETDS
STD_PHP_INI_ENTRY("mssql.charset", "", PHP_INI_ALL, OnUpdateString, charset, zend_mssql_globals, mssql_globals)
#endif
PHP_INI_END() PHP_INI_END()


/* error handler */ /* error handler */
Expand Down Expand Up @@ -495,7 +498,9 @@ static void php_mssql_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent)
#endif #endif


#ifdef HAVE_FREETDS #ifdef HAVE_FREETDS
DBSETLCHARSET(mssql.login, "ISO-8859-1"); if (MS_SQL_G(charset) && strlen(MS_SQL_G(charset))) {
DBSETLCHARSET(mssql.login, MS_SQL_G(charset));
}
#endif #endif


DBSETLAPP(mssql.login,MS_SQL_G(appname)); DBSETLAPP(mssql.login,MS_SQL_G(appname));
Expand Down Expand Up @@ -1009,7 +1014,7 @@ static void _mssql_get_sp_result(mssql_link *mssql_ptr, mssql_statement *stateme


/* Now to fetch RETVAL and OUTPUT values*/ /* Now to fetch RETVAL and OUTPUT values*/
num_rets = dbnumrets(mssql_ptr->link); num_rets = dbnumrets(mssql_ptr->link);

if (num_rets!=0) { if (num_rets!=0) {
for (i = 1; i <= num_rets; i++) { for (i = 1; i <= num_rets; i++) {
parameter = (char*)dbretname(mssql_ptr->link, i); parameter = (char*)dbretname(mssql_ptr->link, i);
Expand Down
3 changes: 3 additions & 0 deletions ext/mssql/php_mssql.h
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -158,6 +158,9 @@ ZEND_BEGIN_MODULE_GLOBALS(mssql)
zend_bool allow_persistent; zend_bool allow_persistent;
char *appname; char *appname;
char *server_message; char *server_message;
#ifdef HAVE_FREETDS
char *charset;
#endif
long min_error_severity, min_message_severity; long min_error_severity, min_message_severity;
long cfg_min_error_severity, cfg_min_message_severity; long cfg_min_error_severity, cfg_min_message_severity;
long connect_timeout, timeout; long connect_timeout, timeout;
Expand Down
5 changes: 5 additions & 0 deletions php.ini-dist
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -1035,6 +1035,11 @@ mssql.secure_connection = Off
; FreeTDS defaults to 4096 ; FreeTDS defaults to 4096
;mssql.max_procs = -1 ;mssql.max_procs = -1


; Specify client character set.
; If empty or not set the client charset from freetds.comf is used
; This is only used when compiled with FreeTDS
;mssql.charset = "ISO-8859-1"

[Assertion] [Assertion]
; Assert(expr); active by default. ; Assert(expr); active by default.
;assert.active = On ;assert.active = On
Expand Down
5 changes: 5 additions & 0 deletions php.ini-recommended
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -1093,6 +1093,11 @@ mssql.secure_connection = Off
; FreeTDS defaults to 4096 ; FreeTDS defaults to 4096
;mssql.max_procs = -1 ;mssql.max_procs = -1


; Specify client character set.
; If empty or not set the client charset from freetds.comf is used
; This is only used when compiled with FreeTDS
;mssql.charset = "ISO-8859-1"

[Assertion] [Assertion]
; Assert(expr); active by default. ; Assert(expr); active by default.
;assert.active = On ;assert.active = On
Expand Down

0 comments on commit a7d2ac4

Please sign in to comment.