diff options
author | Mark A. Hershberger <mah@debian.(none)> | 2009-03-25 00:35:13 -0400 |
---|---|---|
committer | Mark A. Hershberger <mah@debian.(none)> | 2009-03-25 00:35:13 -0400 |
commit | 0a36161e13484a99ccf69bb38f206462d27cc6d6 (patch) | |
tree | d5107db4b7369603ac7c753829e8972ee74949f7 /ext/mssql | |
parent | ce7edc9b3c7370f32fec0bc7a8ec3e29ed9a5f61 (diff) | |
download | php-0a36161e13484a99ccf69bb38f206462d27cc6d6.tar.gz |
Imported Upstream version 5.1.2upstream/5.1.2
Diffstat (limited to 'ext/mssql')
-rw-r--r-- | ext/mssql/php_mssql.c | 31 | ||||
-rw-r--r-- | ext/mssql/php_mssql.h | 15 |
2 files changed, 27 insertions, 19 deletions
diff --git a/ext/mssql/php_mssql.c b/ext/mssql/php_mssql.c index e85c8dcd2..12c8a84bc 100644 --- a/ext/mssql/php_mssql.c +++ b/ext/mssql/php_mssql.c @@ -2,12 +2,12 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2005 The PHP Group | + | Copyright (c) 1997-2006 The PHP Group | +----------------------------------------------------------------------+ - | This source file is subject to version 3.0 of the PHP license, | + | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | | available through the world-wide-web at the following url: | - | http://www.php.net/license/3_0.txt. | + | http://www.php.net/license/3_01.txt | | If you did not receive a copy of the PHP license and are unable to | | obtain it through the world-wide-web, please send a note to | | license@php.net so we can mail you a copy immediately. | @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: php_mssql.c,v 1.152.2.7 2005/11/18 21:23:20 fmk Exp $ */ +/* $Id: php_mssql.c,v 1.152.2.12 2006/01/01 12:50:09 sniper Exp $ */ #ifdef COMPILE_DL_MSSQL #define HAVE_MSSQL 1 @@ -47,7 +47,7 @@ static void php_mssql_get_column_content_without_type(mssql_link *mssql_ptr,int static void _mssql_bind_hash_dtor(void *data); -function_entry mssql_functions[] = { +zend_function_entry mssql_functions[] = { PHP_FE(mssql_connect, NULL) PHP_FE(mssql_pconnect, NULL) PHP_FE(mssql_close, NULL) @@ -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.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) +#ifdef HAVE_FREETDS + STD_PHP_INI_ENTRY("mssql.charset", "", PHP_INI_ALL, OnUpdateString, charset, zend_mssql_globals, mssql_globals) +#endif PHP_INI_END() /* error handler */ @@ -170,7 +173,7 @@ static int php_mssql_message_handler(DBPROCESS *dbproc, DBINT msgno,int msgstate return 0; } -static int _clean_invalid_results(list_entry *le TSRMLS_DC) +static int _clean_invalid_results(zend_rsrc_list_entry *le TSRMLS_DC) { if (Z_TYPE_P(le) == le_result) { mssql_link *mssql_ptr = ((mssql_result *) le->ptr)->mssql_ptr; @@ -495,7 +498,9 @@ static void php_mssql_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent) #endif #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 DBSETLAPP(mssql.login,MS_SQL_G(appname)); @@ -510,11 +515,11 @@ static void php_mssql_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent) persistent=0; } if (persistent) { - list_entry *le; + zend_rsrc_list_entry *le; /* try to find if we already have this link in our persistent list */ if (new_link || zend_hash_find(&EG(persistent_list), hashed_details, hashed_details_length + 1, (void **) &le)==FAILURE) { /* we don't */ - list_entry new_le; + zend_rsrc_list_entry new_le; if (MS_SQL_G(max_links) != -1 && MS_SQL_G(num_links) >= MS_SQL_G(max_links)) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Too many open links (%ld)", MS_SQL_G(num_links)); @@ -566,7 +571,7 @@ static void php_mssql_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent) memcpy(mssql_ptr, &mssql, sizeof(mssql_link)); Z_TYPE(new_le) = le_plink; new_le.ptr = mssql_ptr; - if (zend_hash_update(&EG(persistent_list), hashed_details, hashed_details_length + 1, &new_le, sizeof(list_entry), NULL)==FAILURE) { + if (zend_hash_update(&EG(persistent_list), hashed_details, hashed_details_length + 1, &new_le, sizeof(zend_rsrc_list_entry), NULL)==FAILURE) { free(mssql_ptr); efree(hashed_details); dbfreelogin(mssql.login); @@ -619,7 +624,7 @@ static void php_mssql_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent) } ZEND_REGISTER_RESOURCE(return_value, mssql_ptr, le_plink); } else { /* non persistent */ - list_entry *index_ptr, new_index_ptr; + zend_rsrc_list_entry *index_ptr, new_index_ptr; /* first we check the hash for the hashed_details key. if it exists, * it should point us to the right offset where the actual mssql link sits. @@ -696,7 +701,7 @@ static void php_mssql_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent) /* add it to the hash */ new_index_ptr.ptr = (void *) Z_LVAL_P(return_value); Z_TYPE(new_index_ptr) = le_index_ptr; - if (zend_hash_update(&EG(regular_list), hashed_details, hashed_details_length + 1,(void *) &new_index_ptr, sizeof(list_entry),NULL)==FAILURE) { + if (zend_hash_update(&EG(regular_list), hashed_details, hashed_details_length + 1,(void *) &new_index_ptr, sizeof(zend_rsrc_list_entry),NULL)==FAILURE) { efree(hashed_details); RETURN_FALSE; } @@ -1009,7 +1014,7 @@ static void _mssql_get_sp_result(mssql_link *mssql_ptr, mssql_statement *stateme /* Now to fetch RETVAL and OUTPUT values*/ num_rets = dbnumrets(mssql_ptr->link); - + if (num_rets!=0) { for (i = 1; i <= num_rets; i++) { parameter = (char*)dbretname(mssql_ptr->link, i); diff --git a/ext/mssql/php_mssql.h b/ext/mssql/php_mssql.h index 088dd329f..403817593 100644 --- a/ext/mssql/php_mssql.h +++ b/ext/mssql/php_mssql.h @@ -2,12 +2,12 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2005 The PHP Group | + | Copyright (c) 1997-2006 The PHP Group | +----------------------------------------------------------------------+ - | This source file is subject to version 3.0 of the PHP license, | + | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | | available through the world-wide-web at the following url: | - | http://www.php.net/license/3_0.txt. | + | http://www.php.net/license/3_01.txt | | If you did not receive a copy of the PHP license and are unable to | | obtain it through the world-wide-web, please send a note to | | license@php.net so we can mail you a copy immediately. | @@ -17,7 +17,7 @@ */ -/* $Id: php_mssql.h,v 1.42 2005/08/08 21:32:18 fmk Exp $ */ +/* $Id: php_mssql.h,v 1.42.2.3 2006/01/01 12:50:09 sniper Exp $ */ #ifndef PHP_MSSQL_H #define PHP_MSSQL_H @@ -158,11 +158,14 @@ ZEND_BEGIN_MODULE_GLOBALS(mssql) zend_bool allow_persistent; char *appname; char *server_message; +#ifdef HAVE_FREETDS + char *charset; +#endif long min_error_severity, min_message_severity; long cfg_min_error_severity, cfg_min_message_severity; long connect_timeout, timeout; zend_bool compatability_mode; - void (*get_column_content)(mssql_link *mssql_ptr,int offset,pval *result,int column_type TSRMLS_DC); + void (*get_column_content)(mssql_link *mssql_ptr,int offset,zval *result,int column_type TSRMLS_DC); long textsize, textlimit, batchsize; zend_bool datetimeconvert; HashTable *resource_list, *resource_plist; @@ -180,7 +183,7 @@ typedef struct mssql_field { } mssql_field; typedef struct mssql_result { - pval **data; + zval **data; mssql_field *fields; mssql_link *mssql_ptr; mssql_statement * statement; |