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.h Fri 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.net/) To unsubscribe, visit: http://www.php.net/unsub.php