Home  |  Linux  | Mysql  | PHP  | XML
From:Kalle Sommer Nielsen Date:Mon Oct  6 15:50:18 2008
Subject:cvs: php-src /ext/mssql php_mssql.c
kalle		Mon Oct  6 21:50:18 2008 UTC

  Modified files:              
    /php-src/ext/mssql	php_mssql.c 
  Log:
  * 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.177&r2=1.178&diff_format=u
Index: php-src/ext/mssql/php_mssql.c
diff -u php-src/ext/mssql/php_mssql.c:1.177 php-src/ext/mssql/php_mssql.c:1.178
--- php-src/ext/mssql/php_mssql.c:1.177	Sun Oct  5 04:55:33 2008
+++ php-src/ext/mssql/php_mssql.c	Mon Oct  6 21:50:18 2008
@@ -16,7 +16,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: php_mssql.c,v 1.177 2008/10/05 04:55:33 kalle Exp $ */
+/* $Id: php_mssql.c,v 1.178 2008/10/06 21:50:18 kalle Exp $ */
 
 #ifdef COMPILE_DL_MSSQL
 #define HAVE_MSSQL 1
@@ -2002,23 +2002,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);
 
@@ -2032,24 +2037,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:


Navigate in group php.cvs at sever news.php.net
Previous Next




  
© No Copyright
You are free to use Anything
Site Maintained by PHP Developer
Powered By PHP Consultants