[PHP-CVS] cvs: php-src /ext/odbc php_odbc.c php_odbc.h php_odbc_includes.h
iodbc Fri Aug 29 16:42:50 2008 UTC Modified files: /php-src/ext/odbc php_odbc.c php_odbc.h php_odbc_includes.h Log: - Fixed code to use ODBC 3.52 datatypes for 64bit systems (bug #43666) http://cvs.php.net/viewvc.cgi/php-src/ext/odbc/php_odbc.c?r1=1.209&r2=1.210&diff_format=u Index: php-src/ext/odbc/php_odbc.c diff -u php-src/ext/odbc/php_odbc.c:1.209 php-src/ext/odbc/php_odbc.c:1.210 --- php-src/ext/odbc/php_odbc.c:1.209 Sun Aug 24 20:50:02 2008 +++ php-src/ext/odbc/php_odbc.c Fri Aug 29 16:42:49 2008 @@ -20,7 +20,7 @@ +--+ */ -/* $Id: php_odbc.c,v 1.209 2008/08/24 20:50:02 felipe Exp $ */ +/* $Id: php_odbc.c,v 1.210 2008/08/29 16:42:49 iodbc Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -64,7 +64,7 @@ static int le_result, le_conn, le_pconn; -#define SAFE_SQL_NTS(n) ((SWORD) ((n)?(SQL_NTS):0)) +#define SAFE_SQL_NTS(n) ((SQLSMALLINT) ((n)?(SQL_NTS):0)) /* {{{ arginfo */ static @@ -477,7 +477,7 @@ if (res->stmt) { #if defined(HAVE_SOLID) || defined(HAVE_SOLID_30) || defined(HAVE_SOLID_35) SQLTransact(res->conn_ptr->henv, res->conn_ptr->hdbc, - (UWORD)SQL_COMMIT); + (SQLUSMALLINT) SQL_COMMIT); #endif rc = SQLFreeStmt(res->stmt,SQL_DROP); /* We don't want the connection to be closed after the last statment has been closed @@ -861,10 +861,10 @@ /* {{{ odbc_sql_error */ void odbc_sql_error(ODBC_SQL_ERROR_PARAMS) { - charstate[6]; - SDWORD error;/* Not used */ - charerrormsg[SQL_MAX_MESSAGE_LENGTH]; - SWORD errormsgsize; /* Not used */ + charstate[6]; + SQLINTEGER error;/* Not used */ + charerrormsg[SQL_MAX_MESSAGE_LENGTH]; + SQLSMALLINT errormsgsize; /* Not used */ RETCODE rc; ODBC_SQL_ENV_T henv; ODBC_SQL_CONN_T conn; @@ -940,8 +940,8 @@ { RETCODE rc; int i; - SWORD colnamelen; /* Not used */ - SDWORD displaysize; + SQLSMALLINT colnamelen; /* Not used */ + SQLLEN displaysize; result->values = (odbc_result_value *) safe_emalloc(sizeof(odbc_result_value), result->numcols, 0); @@ -949,9 +949,9 @@ result->binmode = ODBCG(defaultbinmode); for(i = 0; i < result->numcols; i++) { - rc = SQLColAttributes(result->stmt, (UWORD)(i+1), SQL_COLUMN_NAME, + rc = SQLColAttributes(result->stmt, (SQLUSMALLINT)(i+1), SQL_COLUMN_NAME, result->values[i].name, sizeof(result->values[i].name), &colnamelen, 0); - rc = SQLColAttributes(result->stmt, (UWORD)(i+1), SQL_COLUMN_TYPE, + rc = SQLColAttributes(result->stmt, (SQLUSMALLINT)(i+1), SQL_COLUMN_TYPE, NULL, 0, NULL, &result->values[i].coltype); /* Don't bind LONG / BINARY columns, so that fetch behaviour can @@ -969,17 +969,17 @@ #ifdef HAVE_ADABAS case SQL_TIMESTAMP: result->values[i].value = (char *)emalloc(27); - SQLBindCol(result->stmt, (UWORD)(i+1), SQL_C_CHAR, result->values[i].value, + SQLBindCol(result->stmt, (SQLUSMALLINT)(i+1), SQL_C_CHAR, result->values[i].value, 27, &result->values[i].vallen); break; #endif /* HAVE_ADABAS */ default: - rc = SQLColAttributes(result->stmt, (UWORD)(i+1), SQL_COLUMN_DISPLAY_SIZE, + rc = SQLColAttributes(result->stmt, (SQLUSMALLINT)(i+1), SQL_COLUMN_DISPLAY_SIZE, NULL, 0, NULL, &displaysize); displaysize = displaysize <= result->longreadlen ? displaysize : result->longreadlen; result->values[i].value = (char *)emalloc(displaysize + 1); - rc = SQLBindCol(result->stmt, (UWORD)(i+1), SQL_C_CHAR, result->values[i].value, + rc = SQLBindCol(result->stmt, (SQLUSMALLINT)(i+1), SQL_C_CHAR, result->values[i].value, displaysize + 1, &result->values[i].vallen); break; } @@ -1001,7 +1001,7 @@ ZEND_FETCH_RESOURCE2(conn, odbc_connection *, &pv_conn, -1, "ODBC-Link", le_conn, le_pconn); - rc = SQLTransact(conn->henv, conn->hdbc, (UWORD)((type)?SQL_COMMIT:SQL_ROLLBACK)); + rc = SQLTrans
[PHP-CVS] cvs: php-src(PHP_5_3) /ext/odbc php_odbc.c php_odbc.h php_odbc_includes.h
iodbc Fri Aug 29 16:44:29 2008 UTC Modified files: (Branch: PHP_5_3) /php-src/ext/odbc php_odbc.c php_odbc.h php_odbc_includes.h Log: - MFH: Fixed code to use ODBC 3.52 datatypes for 64bit systems (bug #43666) http://cvs.php.net/viewvc.cgi/php-src/ext/odbc/php_odbc.c?r1=1.189.2.4.2.7.2.6&r2=1.189.2.4.2.7.2.7&diff_format=u Index: php-src/ext/odbc/php_odbc.c diff -u php-src/ext/odbc/php_odbc.c:1.189.2.4.2.7.2.6 php-src/ext/odbc/php_odbc.c:1.189.2.4.2.7.2.7 --- php-src/ext/odbc/php_odbc.c:1.189.2.4.2.7.2.6 Sun Aug 24 20:50:41 2008 +++ php-src/ext/odbc/php_odbc.c Fri Aug 29 16:44:29 2008 @@ -20,7 +20,7 @@ +--+ */ -/* $Id: php_odbc.c,v 1.189.2.4.2.7.2.6 2008/08/24 20:50:41 felipe Exp $ */ +/* $Id: php_odbc.c,v 1.189.2.4.2.7.2.7 2008/08/29 16:44:29 iodbc Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -64,7 +64,7 @@ static int le_result, le_conn, le_pconn; -#define SAFE_SQL_NTS(n) ((SWORD) ((n)?(SQL_NTS):0)) +#define SAFE_SQL_NTS(n) ((SQLSMALLINT) ((n)?(SQL_NTS):0)) /* {{{ arginfo */ static @@ -477,7 +477,7 @@ if (res->stmt) { #if defined(HAVE_SOLID) || defined(HAVE_SOLID_30) || defined(HAVE_SOLID_35) SQLTransact(res->conn_ptr->henv, res->conn_ptr->hdbc, - (UWORD)SQL_COMMIT); + (SQLUSMALLINT) SQL_COMMIT); #endif rc = SQLFreeStmt(res->stmt,SQL_DROP); /* We don't want the connection to be closed after the last statment has been closed @@ -861,10 +861,10 @@ /* {{{ odbc_sql_error */ void odbc_sql_error(ODBC_SQL_ERROR_PARAMS) { - charstate[6]; - SDWORD error;/* Not used */ - charerrormsg[SQL_MAX_MESSAGE_LENGTH]; - SWORD errormsgsize; /* Not used */ + charstate[6]; + SQLINTEGER error;/* Not used */ + charerrormsg[SQL_MAX_MESSAGE_LENGTH]; + SQLSMALLINT errormsgsize; /* Not used */ RETCODE rc; ODBC_SQL_ENV_T henv; ODBC_SQL_CONN_T conn; @@ -940,8 +940,8 @@ { RETCODE rc; int i; - SWORD colnamelen; /* Not used */ - SDWORD displaysize; + SQLSMALLINT colnamelen; /* Not used */ + SQLLEN displaysize; result->values = (odbc_result_value *) safe_emalloc(sizeof(odbc_result_value), result->numcols, 0); @@ -949,9 +949,9 @@ result->binmode = ODBCG(defaultbinmode); for(i = 0; i < result->numcols; i++) { - rc = SQLColAttributes(result->stmt, (UWORD)(i+1), SQL_COLUMN_NAME, + rc = SQLColAttributes(result->stmt, (SQLUSMALLINT)(i+1), SQL_COLUMN_NAME, result->values[i].name, sizeof(result->values[i].name), &colnamelen, 0); - rc = SQLColAttributes(result->stmt, (UWORD)(i+1), SQL_COLUMN_TYPE, + rc = SQLColAttributes(result->stmt, (SQLUSMALLINT)(i+1), SQL_COLUMN_TYPE, NULL, 0, NULL, &result->values[i].coltype); /* Don't bind LONG / BINARY columns, so that fetch behaviour can @@ -969,17 +969,17 @@ #ifdef HAVE_ADABAS case SQL_TIMESTAMP: result->values[i].value = (char *)emalloc(27); - SQLBindCol(result->stmt, (UWORD)(i+1), SQL_C_CHAR, result->values[i].value, + SQLBindCol(result->stmt, (SQLUSMALLINT)(i+1), SQL_C_CHAR, result->values[i].value, 27, &result->values[i].vallen); break; #endif /* HAVE_ADABAS */ default: - rc = SQLColAttributes(result->stmt, (UWORD)(i+1), SQL_COLUMN_DISPLAY_SIZE, + rc = SQLColAttributes(result->stmt, (SQLUSMALLINT)(i+1), SQL_COLUMN_DISPLAY_SIZE, NULL, 0, NULL, &displaysize); displaysize = displaysize <= result->longreadlen ? displaysize : result->longreadlen; result->values[i].value = (char *)emalloc(displaysize + 1); - rc = SQLBindCol(result->stmt, (UWORD)(i+1), SQL_C_CHAR, result->values[i].value, + rc = SQLBindCol(result->stmt, (SQLUSMALLINT)(i+1), SQL_C_CHAR, result->values[i].value, displaysize + 1, &result->values[i].vallen); break; } @@ -1001,7 +1001,7 @@ ZEND_FETCH_RESOURCE2(conn, odbc_connection *, &pv_conn, -1, "ODBC-Link", le_conn, le_pconn); -
[PHP-CVS] cvs: php-src /ext/odbc php_odbc.c php_odbc_includes.h
iodbc Fri Aug 29 19:15:39 2008 UTC Modified files: /php-src/ext/odbc php_odbc.c php_odbc_includes.h Log: - Added odbc.default_cursortype to control the ODBC cursormodel (bug #43668) #[DOC] http://cvs.php.net/viewvc.cgi/php-src/ext/odbc/php_odbc.c?r1=1.210&r2=1.211&diff_format=u Index: php-src/ext/odbc/php_odbc.c diff -u php-src/ext/odbc/php_odbc.c:1.210 php-src/ext/odbc/php_odbc.c:1.211 --- php-src/ext/odbc/php_odbc.c:1.210 Fri Aug 29 16:42:49 2008 +++ php-src/ext/odbc/php_odbc.c Fri Aug 29 19:15:39 2008 @@ -20,7 +20,7 @@ +--+ */ -/* $Id: php_odbc.c,v 1.210 2008/08/29 16:42:49 iodbc Exp $ */ +/* $Id: php_odbc.c,v 1.211 2008/08/29 19:15:39 iodbc Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -677,6 +677,50 @@ } /* }}} */ + +/* {{{ PHP_INI_DISP(display_cursortype) + */ +static PHP_INI_DISP(display_cursortype) +{ + char *value; + TSRMLS_FETCH(); + + if (type == PHP_INI_DISPLAY_ORIG && ini_entry->modified) { + value = ini_entry->orig_value; + } else if (ini_entry->value) { + value = ini_entry->value; + } else { + value = NULL; + } + + if (value) { + switch (atoi (value)) + { + case SQL_CURSOR_FORWARD_ONLY: + PUTS ("Forward Only cursor"); + break; + + case SQL_CURSOR_STATIC: + PUTS ("Static cursor"); + break; + + case SQL_CURSOR_KEYSET_DRIVEN: + PUTS ("Keyset driven cursor"); + break; + + case SQL_CURSOR_DYNAMIC: + PUTS ("Dynamic cursor"); + break; + + default: + php_printf("Unknown cursor model %s", value); + break; + } + } +} + +/* }}} */ + /* {{{ PHP_INI_BEGIN */ PHP_INI_BEGIN() @@ -698,6 +742,8 @@ defaultbinmode, zend_odbc_globals, odbc_globals, display_binmode) STD_PHP_INI_BOOLEAN("odbc.check_persistent", "1", PHP_INI_SYSTEM, OnUpdateLong, check_persistent, zend_odbc_globals, odbc_globals) + STD_PHP_INI_ENTRY_EX("odbc.default_cursortype", "3", PHP_INI_ALL, OnUpdateLong, + default_cursortype, zend_odbc_globals, odbc_globals, display_cursortype) PHP_INI_END() /* }}} */ @@ -1173,7 +1219,8 @@ /* Try to set CURSOR_TYPE to dynamic. Driver will replace this with other type if not possible. */ - if (SQLSetStmtOption(result->stmt, SQL_CURSOR_TYPE, SQL_CURSOR_DYNAMIC) == SQL_ERROR) { + int cursortype = ODBCG(default_cursortype); + if (SQLSetStmtOption(result->stmt, SQL_CURSOR_TYPE, cursortype) == SQL_ERROR) { odbc_sql_error(conn, result->stmt, " SQLSetStmtOption"); SQLFreeStmt(result->stmt, SQL_DROP); efree(result); @@ -1561,7 +1608,8 @@ /* Try to set CURSOR_TYPE to dynamic. Driver will replace this with other type if not possible. */ - if (SQLSetStmtOption(result->stmt, SQL_CURSOR_TYPE, SQL_CURSOR_DYNAMIC) == SQL_ERROR) { + int cursortype = ODBCG(default_cursortype); + if (SQLSetStmtOption(result->stmt, SQL_CURSOR_TYPE, cursortype) == SQL_ERROR) { odbc_sql_error(conn, result->stmt, " SQLSetStmtOption"); SQLFreeStmt(result->stmt, SQL_DROP); efree(result); http://cvs.php.net/viewvc.cgi/php-src/ext/odbc/php_odbc_includes.h?r1=1.19&r2=1.20&diff_format=u Index: php-src/ext/odbc/php_odbc_includes.h diff -u php-src/ext/odbc/php_odbc_includes.h:1.19 php-src/ext/odbc/php_odbc_includes.h:1.20 --- php-src/ext/odbc/php_odbc_includes.h:1.19 Fri Aug 29 16:42:50 2008 +++ php-src/ext/odbc/php_odbc_includes.hFri Aug 29 19:15:39 2008 @@ -18,7 +18,7 @@ +--+ */ -/* $Id: php_odbc_includes.h,v 1.19 2008/08/29 16:42:50 iodbc Exp $ */ +/* $Id: php_odbc_includes.h,v 1.20 2008/08/29 19:15:39 iodbc Exp $ */ #ifndef PHP_ODBC_INCLUDES_H #define PHP_ODBC_INCLUDES_H @@ -265,6 +265,7 @@ int defConn; long defaultlrl; long defaultbinmode; +long default_cursortype; char laststate[6]; char lasterrormsg[SQL_MAX_MESSAGE_LENGTH]; HashTable *resource_list; -- PHP CVS Mailing List (http://www
[PHP-CVS] cvs: php-src(PHP_5_3) /ext/odbc php_odbc.c php_odbc_includes.h
iodbc Fri Aug 29 19:16:58 2008 UTC Modified files: (Branch: PHP_5_3) /php-src/ext/odbc php_odbc.c php_odbc_includes.h Log: - MFH: Added odbc.default_cursortype to control the ODBC cursormodel (bug #43668) #[DOC] http://cvs.php.net/viewvc.cgi/php-src/ext/odbc/php_odbc.c?r1=1.189.2.4.2.7.2.7&r2=1.189.2.4.2.7.2.8&diff_format=u Index: php-src/ext/odbc/php_odbc.c diff -u php-src/ext/odbc/php_odbc.c:1.189.2.4.2.7.2.7 php-src/ext/odbc/php_odbc.c:1.189.2.4.2.7.2.8 --- php-src/ext/odbc/php_odbc.c:1.189.2.4.2.7.2.7 Fri Aug 29 16:44:29 2008 +++ php-src/ext/odbc/php_odbc.c Fri Aug 29 19:16:58 2008 @@ -20,7 +20,7 @@ +--+ */ -/* $Id: php_odbc.c,v 1.189.2.4.2.7.2.7 2008/08/29 16:44:29 iodbc Exp $ */ +/* $Id: php_odbc.c,v 1.189.2.4.2.7.2.8 2008/08/29 19:16:58 iodbc Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -677,6 +677,50 @@ } /* }}} */ + +/* {{{ PHP_INI_DISP(display_cursortype) + */ +static PHP_INI_DISP(display_cursortype) +{ + char *value; + TSRMLS_FETCH(); + + if (type == PHP_INI_DISPLAY_ORIG && ini_entry->modified) { + value = ini_entry->orig_value; + } else if (ini_entry->value) { + value = ini_entry->value; + } else { + value = NULL; + } + + if (value) { + switch (atoi (value)) + { + case SQL_CURSOR_FORWARD_ONLY: + PUTS ("Forward Only cursor"); + break; + + case SQL_CURSOR_STATIC: + PUTS ("Static cursor"); + break; + + case SQL_CURSOR_KEYSET_DRIVEN: + PUTS ("Keyset driven cursor"); + break; + + case SQL_CURSOR_DYNAMIC: + PUTS ("Dynamic cursor"); + break; + + default: + php_printf("Unknown cursor model %s", value); + break; + } + } +} + +/* }}} */ + /* {{{ PHP_INI_BEGIN */ PHP_INI_BEGIN() @@ -698,6 +742,8 @@ defaultbinmode, zend_odbc_globals, odbc_globals, display_binmode) STD_PHP_INI_BOOLEAN("odbc.check_persistent", "1", PHP_INI_SYSTEM, OnUpdateLong, check_persistent, zend_odbc_globals, odbc_globals) + STD_PHP_INI_ENTRY_EX("odbc.default_cursortype", "3", PHP_INI_ALL, OnUpdateLong, + default_cursortype, zend_odbc_globals, odbc_globals, display_cursortype) PHP_INI_END() /* }}} */ @@ -1173,7 +1219,8 @@ /* Try to set CURSOR_TYPE to dynamic. Driver will replace this with other type if not possible. */ - if (SQLSetStmtOption(result->stmt, SQL_CURSOR_TYPE, SQL_CURSOR_DYNAMIC) == SQL_ERROR) { + int cursortype = ODBCG(default_cursortype); + if (SQLSetStmtOption(result->stmt, SQL_CURSOR_TYPE, cursortype) == SQL_ERROR) { odbc_sql_error(conn, result->stmt, " SQLSetStmtOption"); SQLFreeStmt(result->stmt, SQL_DROP); efree(result); @@ -1568,7 +1615,8 @@ /* Try to set CURSOR_TYPE to dynamic. Driver will replace this with other type if not possible. */ - if (SQLSetStmtOption(result->stmt, SQL_CURSOR_TYPE, SQL_CURSOR_DYNAMIC) == SQL_ERROR) { + int cursortype = ODBCG(default_cursortype); + if (SQLSetStmtOption(result->stmt, SQL_CURSOR_TYPE, cursortype) == SQL_ERROR) { odbc_sql_error(conn, result->stmt, " SQLSetStmtOption"); SQLFreeStmt(result->stmt, SQL_DROP); efree(result); http://cvs.php.net/viewvc.cgi/php-src/ext/odbc/php_odbc_includes.h?r1=1.12.2.1.2.4.2.2&r2=1.12.2.1.2.4.2.3&diff_format=u Index: php-src/ext/odbc/php_odbc_includes.h diff -u php-src/ext/odbc/php_odbc_includes.h:1.12.2.1.2.4.2.2 php-src/ext/odbc/php_odbc_includes.h:1.12.2.1.2.4.2.3 --- php-src/ext/odbc/php_odbc_includes.h:1.12.2.1.2.4.2.2 Fri Aug 29 16:44:29 2008 +++ php-src/ext/odbc/php_odbc_includes.hFri Aug 29 19:16:58 2008 @@ -18,7 +18,7 @@ +--+ */ -/* $Id: php_odbc_includes.h,v 1.12.2.1.2.4.2.2 2008/08/29 16:44:29 iodbc Exp $ */ +/* $Id: php_odbc_includes.h,v 1.12.2.1.2.4.2.3 2008/08/29 19:16:58 iodbc Exp $ */ #ifndef PHP_ODBC_INCLUDES_H #define PHP_ODBC_INCLUDES_H @@ -265,6 +265,7 @@ int defConn; long defaul
[PHP-CVS] cvs: php-src / NEWS
iodbc Mon Sep 1 08:37:22 2008 UTC Modified files: /php-srcNEWS Log: - fixes for ext/odbc http://cvs.php.net/viewvc.cgi/php-src/NEWS?r1=1.2165&r2=1.2166&diff_format=u Index: php-src/NEWS diff -u php-src/NEWS:1.2165 php-src/NEWS:1.2166 --- php-src/NEWS:1.2165 Wed Aug 6 05:51:38 2008 +++ php-src/NEWSMon Sep 1 08:37:22 2008 @@ -50,3 +50,7 @@ - Added str_getcsv() function. (Sara) - Fixed bug #40325 (Vary: header missing in gzip output handlers). (Mike) +- Fixed bug #43666) (Fixed code to use ODBC 3.52 datatypes for 64bit systems). + (iodbc) +- Fixed bug #43668) (Added odbc.default_cursortype to control the ODBC + cursormodel). (iodbc) -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src(PHP_5_3) / NEWS
iodbc Mon Sep 1 08:38:58 2008 UTC Modified files: (Branch: PHP_5_3) /php-srcNEWS Log: - fixes for ext/odbc http://cvs.php.net/viewvc.cgi/php-src/NEWS?r1=1.2027.2.547.2.965.2.300&r2=1.2027.2.547.2.965.2.301&diff_format=u Index: php-src/NEWS diff -u php-src/NEWS:1.2027.2.547.2.965.2.300 php-src/NEWS:1.2027.2.547.2.965.2.301 --- php-src/NEWS:1.2027.2.547.2.965.2.300 Sun Aug 31 17:05:12 2008 +++ php-src/NEWSMon Sep 1 08:38:58 2008 @@ -3503,3 +3503,7 @@ - Fixed bug #28694 (ReflectionExtension::getFunctions() crashes PHP). (Marcus) - Fixed bug #28512 (Allocate enough space to store MSSQL data). (Frank) - Fixed strip_tags() to correctly handle '\0' characters. (Stefan) +- Fixed bug #43666) (Fixed code to use ODBC 3.52 datatypes for 64bit systems). + (iodbc) +- Fixed bug #43668) (Added odbc.default_cursortype to control the ODBC + cursormodel). (iodbc) -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src(PHP_5_2) /ext/odbc php_odbc.c php_odbc.h php_odbc_includes.h
iodbc Mon Sep 1 15:36:56 2008 UTC Modified files: (Branch: PHP_5_2) /php-src/ext/odbc php_odbc.c php_odbc.h php_odbc_includes.h Log: MFH: - Fixed code to use ODBC 3.52 datatypes for 64bit systems (bug #43666) http://cvs.php.net/viewvc.cgi/php-src/ext/odbc/php_odbc.c?r1=1.189.2.4.2.8&r2=1.189.2.4.2.9&diff_format=u Index: php-src/ext/odbc/php_odbc.c diff -u php-src/ext/odbc/php_odbc.c:1.189.2.4.2.8 php-src/ext/odbc/php_odbc.c:1.189.2.4.2.9 --- php-src/ext/odbc/php_odbc.c:1.189.2.4.2.8 Mon Dec 31 07:20:09 2007 +++ php-src/ext/odbc/php_odbc.c Mon Sep 1 15:36:56 2008 @@ -20,7 +20,7 @@ +--+ */ -/* $Id: php_odbc.c,v 1.189.2.4.2.8 2007/12/31 07:20:09 sebastian Exp $ */ +/* $Id: php_odbc.c,v 1.189.2.4.2.9 2008/09/01 15:36:56 iodbc Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -64,7 +64,7 @@ static int le_result, le_conn, le_pconn; -#define SAFE_SQL_NTS(n) ((SWORD) ((n)?(SQL_NTS):0)) +#define SAFE_SQL_NTS(n) ((SQLSMALLINT) ((n)?(SQL_NTS):0)) /* {{{ odbc_functions[] */ @@ -180,7 +180,7 @@ if (res->stmt) { #if defined(HAVE_SOLID) || defined(HAVE_SOLID_30) || defined(HAVE_SOLID_35) SQLTransact(res->conn_ptr->henv, res->conn_ptr->hdbc, - (UWORD)SQL_COMMIT); + (SQLUSMALLINT) SQL_COMMIT); #endif rc = SQLFreeStmt(res->stmt,SQL_DROP); /* We don't want the connection to be closed after the last statment has been closed @@ -565,9 +565,9 @@ void odbc_sql_error(ODBC_SQL_ERROR_PARAMS) { charstate[6]; - SDWORD error;/* Not used */ + SQLINTEGER error;/* Not used */ charerrormsg[SQL_MAX_MESSAGE_LENGTH]; - SWORD errormsgsize; /* Not used */ + SQLSMALLINT errormsgsize; /* Not used */ RETCODE rc; ODBC_SQL_ENV_T henv; ODBC_SQL_CONN_T conn; @@ -641,8 +641,8 @@ { RETCODE rc; int i; - SWORD colnamelen; /* Not used */ - SDWORD displaysize; + SQLSMALLINT colnamelen; /* Not used */ + SQLLEN displaysize; result->values = (odbc_result_value *) safe_emalloc(sizeof(odbc_result_value), result->numcols, 0); @@ -650,9 +650,9 @@ result->binmode = ODBCG(defaultbinmode); for(i = 0; i < result->numcols; i++) { - rc = SQLColAttributes(result->stmt, (UWORD)(i+1), SQL_COLUMN_NAME, + rc = SQLColAttributes(result->stmt, (SQLUSMALLINT)(i+1), SQL_COLUMN_NAME, result->values[i].name, sizeof(result->values[i].name), &colnamelen, 0); - rc = SQLColAttributes(result->stmt, (UWORD)(i+1), SQL_COLUMN_TYPE, + rc = SQLColAttributes(result->stmt, (SQLUSMALLINT)(i+1), SQL_COLUMN_TYPE, NULL, 0, NULL, &result->values[i].coltype); /* Don't bind LONG / BINARY columns, so that fetch behaviour can @@ -670,17 +670,17 @@ #ifdef HAVE_ADABAS case SQL_TIMESTAMP: result->values[i].value = (char *)emalloc(27); - SQLBindCol(result->stmt, (UWORD)(i+1), SQL_C_CHAR, result->values[i].value, + SQLBindCol(result->stmt, (SQLUSMALLINT)(i+1), SQL_C_CHAR, result->values[i].value, 27, &result->values[i].vallen); break; #endif /* HAVE_ADABAS */ default: - rc = SQLColAttributes(result->stmt, (UWORD)(i+1), SQL_COLUMN_DISPLAY_SIZE, + rc = SQLColAttributes(result->stmt, (SQLUSMALLINT)(i+1), SQL_COLUMN_DISPLAY_SIZE, NULL, 0, NULL, &displaysize); displaysize = displaysize <= result->longreadlen ? displaysize : result->longreadlen; result->values[i].value = (char *)emalloc(displaysize + 1); - rc = SQLBindCol(result->stmt, (UWORD)(i+1), SQL_C_CHAR, result->values[i].value, + rc = SQLBindCol(result->stmt, (SQLUSMALLINT)(i+1), SQL_C_CHAR, result->values[i].value, displaysize + 1, &result->values[i].vallen); break; } @@ -702,7 +702,7 @@ ZEND_FETCH_RESOURCE2(conn, odbc_connection *, pv_conn, -1, "ODBC-Link", le_conn, le_pconn); - rc = SQLTransact(conn->henv, conn->hdbc, (UWORD)((type)?SQL_COMMIT:SQL_ROLLBACK)); + rc = SQLTransact(conn->henv, conn->hd
[PHP-CVS] cvs: php-src(PHP_5_2) /ext/odbc php_odbc.c php_odbc_includes.h
iodbc Mon Sep 1 15:48:09 2008 UTC Modified files: (Branch: PHP_5_2) /php-src/ext/odbc php_odbc.c php_odbc_includes.h Log: MFH: - Added odbc.default_cursortype to control the ODBC cursormodel (bug #43668) http://cvs.php.net/viewvc.cgi/php-src/ext/odbc/php_odbc.c?r1=1.189.2.4.2.9&r2=1.189.2.4.2.10&diff_format=u Index: php-src/ext/odbc/php_odbc.c diff -u php-src/ext/odbc/php_odbc.c:1.189.2.4.2.9 php-src/ext/odbc/php_odbc.c:1.189.2.4.2.10 --- php-src/ext/odbc/php_odbc.c:1.189.2.4.2.9 Mon Sep 1 15:36:56 2008 +++ php-src/ext/odbc/php_odbc.c Mon Sep 1 15:48:09 2008 @@ -20,7 +20,7 @@ +--+ */ -/* $Id: php_odbc.c,v 1.189.2.4.2.9 2008/09/01 15:36:56 iodbc Exp $ */ +/* $Id: php_odbc.c,v 1.189.2.4.2.10 2008/09/01 15:48:09 iodbc Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -380,6 +380,50 @@ } /* }}} */ + +/* {{{ PHP_INI_DISP(display_cursortype) + */ +static PHP_INI_DISP(display_cursortype) +{ + char *value; + TSRMLS_FETCH(); + + if (type == PHP_INI_DISPLAY_ORIG && ini_entry->modified) { + value = ini_entry->orig_value; + } else if (ini_entry->value) { + value = ini_entry->value; + } else { + value = NULL; + } + + if (value) { + switch (atoi (value)) + { + case SQL_CURSOR_FORWARD_ONLY: + PUTS ("Forward Only cursor"); + break; + + case SQL_CURSOR_STATIC: + PUTS ("Static cursor"); + break; + + case SQL_CURSOR_KEYSET_DRIVEN: + PUTS ("Keyset driven cursor"); + break; + + case SQL_CURSOR_DYNAMIC: + PUTS ("Dynamic cursor"); + break; + + default: + php_printf("Unknown cursor model %s", value); + break; + } + } +} + +/* }}} */ + /* {{{ PHP_INI_BEGIN */ PHP_INI_BEGIN() @@ -401,6 +445,8 @@ defaultbinmode, zend_odbc_globals, odbc_globals, display_binmode) STD_PHP_INI_BOOLEAN("odbc.check_persistent", "1", PHP_INI_SYSTEM, OnUpdateLong, check_persistent, zend_odbc_globals, odbc_globals) + STD_PHP_INI_ENTRY_EX("odbc.default_cursortype", "3", PHP_INI_ALL, OnUpdateLong, + default_cursortype, zend_odbc_globals, odbc_globals, display_cursortype) PHP_INI_END() /* }}} */ @@ -879,8 +925,8 @@ /* Try to set CURSOR_TYPE to dynamic. Driver will replace this with other type if not possible. */ - if (SQLSetStmtOption(result->stmt, SQL_CURSOR_TYPE, SQL_CURSOR_DYNAMIC) - == SQL_ERROR) { + int cursortype = ODBCG(default_cursortype); + if (SQLSetStmtOption(result->stmt, SQL_CURSOR_TYPE, cursortype) == SQL_ERROR) { odbc_sql_error(conn, result->stmt, " SQLSetStmtOption"); SQLFreeStmt(result->stmt, SQL_DROP); efree(result); @@ -1300,8 +1346,8 @@ /* Try to set CURSOR_TYPE to dynamic. Driver will replace this with other type if not possible. */ - if (SQLSetStmtOption(result->stmt, SQL_CURSOR_TYPE, SQL_CURSOR_DYNAMIC) - == SQL_ERROR) { + int cursortype = ODBCG(default_cursortype); + if (SQLSetStmtOption(result->stmt, SQL_CURSOR_TYPE, cursortype) == SQL_ERROR) { odbc_sql_error(conn, result->stmt, " SQLSetStmtOption"); SQLFreeStmt(result->stmt, SQL_DROP); efree(result); http://cvs.php.net/viewvc.cgi/php-src/ext/odbc/php_odbc_includes.h?r1=1.12.2.1.2.6&r2=1.12.2.1.2.7&diff_format=u Index: php-src/ext/odbc/php_odbc_includes.h diff -u php-src/ext/odbc/php_odbc_includes.h:1.12.2.1.2.6 php-src/ext/odbc/php_odbc_includes.h:1.12.2.1.2.7 --- php-src/ext/odbc/php_odbc_includes.h:1.12.2.1.2.6 Mon Sep 1 15:36:56 2008 +++ php-src/ext/odbc/php_odbc_includes.hMon Sep 1 15:48:09 2008 @@ -18,7 +18,7 @@ +--+ */ -/* $Id: php_odbc_includes.h,v 1.12.2.1.2.6 2008/09/01 15:36:56 iodbc Exp $ */ +/* $Id: php_odbc_includes.h,v 1.12.2.1.2.7 2008/09/01 15:48:09 iodbc Exp $ */ #ifndef PHP_ODBC_INCLUDES_H #define PHP_ODBC_INCLUDES_H @@ -265,6 +265,7 @@ int defConn; long defaultlrl;
Re: [PHP-CVS] cvs: php-src(PHP_5_3) /ext/odbc php_odbc.c php_odbc_includes.h
Hi Hannes, iodbc Fri Aug 29 19:16:58 2008 UTC Modified files: (Branch: PHP_5_3) /php-src/ext/odbc php_odbc.c php_odbc_includes.h Log: - MFH: Added odbc.default_cursortype to control the ODBC cursormodel (bug #43668) It would greatly simplify things for those of us without odbc setup if you could mention which constant is the default value =) Apologies, i thought the default was stated in the bug report. The code defaults to a static cursor. I will add a comment in CVS about this too. Patrick -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php