diff options
author | Kalle Sommer Nielsen <kalle@php.net> | 2008-10-06 21:50:48 +0000 |
---|---|---|
committer | Kalle Sommer Nielsen <kalle@php.net> | 2008-10-06 21:50:48 +0000 |
commit | 1b34fa1675c6583d14d4953df83243a04d3d464e (patch) | |
tree | c02b0db9ed36a25f81b69ed54ac69115a96f37b6 /ext/mssql | |
parent | 96d199d1b10b2352d315e37072db483019db52e7 (diff) | |
download | php-git-1b34fa1675c6583d14d4953df83243a04d3d464e.tar.gz |
MFH:
* is_output and is_null parameters are now booleans instead of int in mssql_bind
* Added missing conditional from old parameter parsing
Diffstat (limited to 'ext/mssql')
-rw-r--r-- | ext/mssql/php_mssql.c | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/ext/mssql/php_mssql.c b/ext/mssql/php_mssql.c index 77913f61b0..e29a5e3f02 100644 --- a/ext/mssql/php_mssql.c +++ b/ext/mssql/php_mssql.c @@ -2009,23 +2009,28 @@ PHP_FUNCTION(mssql_init) } /* }}} */ -/* {{{ 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, ¶m_name, ¶m_name_len, &var, &type, &is_output, &is_null, &maxlen) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rsZl|bbl", &stmt, ¶m_name, ¶m_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 @@ PHP_FUNCTION(mssql_bind) 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: |