kalle           Mon Oct  6 21:50:48 2008 UTC

  Modified files:              (Branch: PHP_5_3)
    /php-src/ext/mssql  php_mssql.c 
  Log:
  MFH:
  * is_output and is_null parameters are now booleans instead of int in 
mssql_bind
  * Added missing conditional from old parameter parsing
  
http://cvs.php.net/viewvc.cgi/php-src/ext/mssql/php_mssql.c?r1=1.152.2.13.2.4.2.9&r2=1.152.2.13.2.4.2.10&diff_format=u
Index: php-src/ext/mssql/php_mssql.c
diff -u php-src/ext/mssql/php_mssql.c:1.152.2.13.2.4.2.9 
php-src/ext/mssql/php_mssql.c:1.152.2.13.2.4.2.10
--- php-src/ext/mssql/php_mssql.c:1.152.2.13.2.4.2.9    Sun Oct  5 04:55:49 2008
+++ php-src/ext/mssql/php_mssql.c       Mon Oct  6 21:50:48 2008
@@ -16,7 +16,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: php_mssql.c,v 1.152.2.13.2.4.2.9 2008/10/05 04:55:49 kalle Exp $ */
+/* $Id: php_mssql.c,v 1.152.2.13.2.4.2.10 2008/10/06 21:50:48 kalle Exp $ */
 
 #ifdef COMPILE_DL_MSSQL
 #define HAVE_MSSQL 1
@@ -2009,23 +2009,28 @@
 }
 /* }}} */
 
-/* {{{ proto bool mssql_bind(resource stmt, string param_name, mixed var, int 
type [, int is_output [, int is_null [, int maxlen]]])
+/* {{{ proto bool mssql_bind(resource stmt, string param_name, mixed var, int 
type [, bool is_output [, bool is_null [, int maxlen]]])
    Adds a parameter to a stored procedure or a remote stored procedure  */
 PHP_FUNCTION(mssql_bind)
 {
        char *param_name;
        int param_name_len, datalen;
        int status = 0;
-       long type = 0, is_output = 0, is_null = 0, maxlen = -1;
+       long type = 0, maxlen = -1;
        zval *stmt, **var;
+       zend_bool is_output = 0, is_null = 0;
        mssql_link *mssql_ptr;
        mssql_statement *statement;
        mssql_bind bind,*bindp;
        LPBYTE value = NULL;
 
-       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rsZl|lll", &stmt, 
&param_name, &param_name_len, &var, &type, &is_output, &is_null, &maxlen) == 
FAILURE) {
+       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rsZl|bbl", &stmt, 
&param_name, &param_name_len, &var, &type, &is_output, &is_null, &maxlen) == 
FAILURE) {
                return;
        }
+
+       if (ZEND_NUM_ARGS() == 7 && !is_output) {
+               maxlen = -1;
+       }
        
        ZEND_FETCH_RESOURCE(statement, mssql_statement *, &stmt, -1, "MS 
SQL-Statement", le_statement);
 
@@ -2039,24 +2044,21 @@
                if (is_null) {
                        maxlen=0;
                        datalen=0;
-               }
-               else {
+               } else {
                        convert_to_string_ex(var);
                        datalen=Z_STRLEN_PP(var);
                        value=(LPBYTE)Z_STRVAL_PP(var);
                }
-       }
-       else    {       /* fixed-length type */
+       } else {
+               /* fixed-length type */
                if (is_null)    {
                        datalen=0;
-               }
-               else {
+               } else {
                        datalen=-1;
                }
                maxlen=-1;
 
-               switch (type)   {
-
+               switch (type) {
                        case SQLFLT4:
                        case SQLFLT8:
                        case SQLFLTN:



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to