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.h Mon 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; 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