cvs: php-src(PHP_5_3) /ext/odbc php_odbc.c php_odbc_includes.h

From: Date: Fri, 29 Aug 2008 19:16:58 +0000
Subject: cvs: php-src(PHP_5_3) /ext/odbc php_odbc.c php_odbc_includes.h
Groups: php.cvs php.doc 
Request: Send a blank email to phpdoc+get-969379357@lists.php.net to get a copy of this message
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.h Fri 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 defaultlrl; long defaultbinmode; + long default_cursortype; char laststate[6]; char lasterrormsg[SQL_MAX_MESSAGE_LENGTH]; HashTable *resource_list;

« previous php.doc (#969379357) next »