Re: [PHP-CVS] cvs: php-src(PHP_5_3) /ext/odbc php_odbc.c php_odbc_includes.h

2008-09-10 Thread Patrick van Kleef

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



Re: [PHP-CVS] cvs: php-src(PHP_5_3) /ext/odbc php_odbc.c php_odbc_includes.h

2008-09-09 Thread Hannes Magnusson
On Fri, Aug 29, 2008 at 21:16, Patrick van Kleef [EMAIL PROTECTED] wrote:
 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 =)

-Hannes

-- 
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) /ext/odbc php_odbc.c php_odbc_includes.h

2008-08-29 Thread Patrick van Kleef
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.7r2=1.189.2.4.2.7.2.8diff_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.2r2=1.12.2.1.2.4.2.3diff_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 defaultlrl;
 long defaultbinmode;
+long