diff options
author | Felipe Pena <felipe@php.net> | 2009-05-14 17:24:42 +0000 |
---|---|---|
committer | Felipe Pena <felipe@php.net> | 2009-05-14 17:24:42 +0000 |
commit | 63c12a8f990a4f52bf43ae69b3ff6f75c10a02d8 (patch) | |
tree | 55c02a9f9beeb1f91c0f76cbf8295561e81f096a /ext/odbc/php_odbc.c | |
parent | eeed7e12f569aa3efe91dcfc3678ec1f21b97100 (diff) | |
download | php-git-63c12a8f990a4f52bf43ae69b3ff6f75c10a02d8.tar.gz |
- MFH: Improved fix for #42414
Diffstat (limited to 'ext/odbc/php_odbc.c')
-rw-r--r-- | ext/odbc/php_odbc.c | 66 |
1 files changed, 19 insertions, 47 deletions
diff --git a/ext/odbc/php_odbc.c b/ext/odbc/php_odbc.c index 331acdcf62..9218245d71 100644 --- a/ext/odbc/php_odbc.c +++ b/ext/odbc/php_odbc.c @@ -3031,7 +3031,7 @@ PHP_FUNCTION(odbc_tables) int cat_len = 0, schema_len = 0, table_len = 0, type_len = 0; RETCODE rc; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|ssss", &pv_conn, &cat, &cat_len, &schema, &schema_len, + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|s!sss", &pv_conn, &cat, &cat_len, &schema, &schema_len, &table, &table_len, &type, &type_len) == FAILURE) { return; } @@ -3098,7 +3098,7 @@ PHP_FUNCTION(odbc_columns) int cat_len = 0, schema_len = 0, table_len = 0, column_len = 0; RETCODE rc; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|ssss", &pv_conn, &cat, &cat_len, &schema, &schema_len, + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|s!sss", &pv_conn, &cat, &cat_len, &schema, &schema_len, &table, &table_len, &column, &column_len) == FAILURE) { return; } @@ -3127,10 +3127,6 @@ PHP_FUNCTION(odbc_columns) schema = NULL; } - if (cat && cat_len == 0) { - cat = NULL; - } - rc = SQLColumns(result->stmt, cat, (SQLSMALLINT) cat_len, schema, (SQLSMALLINT) schema_len, @@ -3168,11 +3164,11 @@ PHP_FUNCTION(odbc_columnprivileges) zval *pv_conn; odbc_result *result = NULL; odbc_connection *conn; - char *cat, *schema, *table, *column; - int cat_len, schema_len, table_len, column_len; + char *cat = NULL, *schema, *table, *column; + int cat_len = 0, schema_len, table_len, column_len; RETCODE rc; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rssss", &pv_conn, &cat, &cat_len, &schema, &schema_len, + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs!sss", &pv_conn, &cat, &cat_len, &schema, &schema_len, &table, &table_len, &column, &column_len) == FAILURE) { return; } @@ -3193,10 +3189,6 @@ PHP_FUNCTION(odbc_columnprivileges) efree(result); RETURN_FALSE; } - - if (cat_len == 0) { - cat = NULL; - } rc = SQLColumnPrivileges(result->stmt, cat, SAFE_SQL_NTS(cat), @@ -3236,11 +3228,11 @@ PHP_FUNCTION(odbc_foreignkeys) zval *pv_conn; odbc_result *result = NULL; odbc_connection *conn; - char *pcat, *pschema, *ptable, *fcat, *fschema, *ftable; - int pcat_len, pschema_len, ptable_len, fcat_len, fschema_len, ftable_len; + char *pcat = NULL, *pschema, *ptable, *fcat, *fschema, *ftable; + int pcat_len = 0, pschema_len, ptable_len, fcat_len, fschema_len, ftable_len; RETCODE rc; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rssssss", &pv_conn, &pcat, &pcat_len, &pschema, &pschema_len, + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs!sssss", &pv_conn, &pcat, &pcat_len, &pschema, &pschema_len, &ptable, &ptable_len, &fcat, &fcat_len, &fschema, &fschema_len, &ftable, &ftable_len) == FAILURE) { return; } @@ -3273,10 +3265,6 @@ PHP_FUNCTION(odbc_foreignkeys) efree(result); RETURN_FALSE; } - - if (pcat_len == 0) { - pcat = NULL; - } rc = SQLForeignKeys(result->stmt, pcat, SAFE_SQL_NTS(pcat), @@ -3377,10 +3365,10 @@ PHP_FUNCTION(odbc_primarykeys) odbc_result *result = NULL; odbc_connection *conn; char *cat = NULL, *schema = NULL, *table = NULL; - int cat_len, schema_len, table_len; + int cat_len = 0, schema_len, table_len; RETCODE rc; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rsss", &pv_conn, &cat, &cat_len, &schema, &schema_len, &table, &table_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs!ss", &pv_conn, &cat, &cat_len, &schema, &schema_len, &table, &table_len) == FAILURE) { return; } @@ -3400,10 +3388,6 @@ PHP_FUNCTION(odbc_primarykeys) efree(result); RETURN_FALSE; } - - if (cat_len == 0) { - cat = NULL; - } rc = SQLPrimaryKeys(result->stmt, cat, SAFE_SQL_NTS(cat), @@ -3449,7 +3433,7 @@ PHP_FUNCTION(odbc_procedurecolumns) WRONG_PARAM_COUNT; } - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|ssss", &pv_conn, &cat, &cat_len, &schema, &schema_len, + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|s!sss", &pv_conn, &cat, &cat_len, &schema, &schema_len, &proc, &proc_len, &col, &col_len) == FAILURE) { return; } @@ -3517,7 +3501,7 @@ PHP_FUNCTION(odbc_procedures) WRONG_PARAM_COUNT; } - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|sss", &pv_conn, &cat, &cat_len, &schema, &schema_len, &proc, &proc_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|s!ss", &pv_conn, &cat, &cat_len, &schema, &schema_len, &proc, &proc_len) == FAILURE) { return; } @@ -3576,11 +3560,11 @@ PHP_FUNCTION(odbc_specialcolumns) odbc_result *result = NULL; odbc_connection *conn; char *cat = NULL, *schema = NULL, *name = NULL; - int cat_len, schema_len, name_len; + int cat_len = 0, schema_len, name_len; SQLUSMALLINT type, scope, nullable; RETCODE rc; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rlsssll", &pv_conn, &vtype, &cat, &cat_len, &schema, &schema_len, + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rls!ssll", &pv_conn, &vtype, &cat, &cat_len, &schema, &schema_len, &name, &name_len, &vscope, &vnullable) == FAILURE) { return; } @@ -3605,10 +3589,6 @@ PHP_FUNCTION(odbc_specialcolumns) efree(result); RETURN_FALSE; } - - if (cat_len == 0) { - cat = NULL; - } rc = SQLSpecialColumns(result->stmt, type, @@ -3649,12 +3629,12 @@ PHP_FUNCTION(odbc_statistics) long vunique, vreserved; odbc_result *result = NULL; odbc_connection *conn; - char *cat, *schema, *name; - int cat_len, schema_len, name_len; + char *cat = NULL, *schema, *name; + int cat_len = 0, schema_len, name_len; SQLUSMALLINT unique, reserved; RETCODE rc; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rsssll", &pv_conn, &cat, &cat_len, &schema, &schema_len, + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs!ssll", &pv_conn, &cat, &cat_len, &schema, &schema_len, &name, &name_len, &vunique, &vreserved) == FAILURE) { return; } @@ -3678,10 +3658,6 @@ PHP_FUNCTION(odbc_statistics) efree(result); RETURN_FALSE; } - - if (cat_len == 0) { - cat = NULL; - } rc = SQLStatistics(result->stmt, cat, SAFE_SQL_NTS(cat), @@ -3722,10 +3698,10 @@ PHP_FUNCTION(odbc_tableprivileges) odbc_result *result = NULL; odbc_connection *conn; char *cat = NULL, *schema = NULL, *table = NULL; - int cat_len, schema_len, table_len; + int cat_len = 0, schema_len, table_len; RETCODE rc; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rsss", &pv_conn, &cat, &cat_len, &schema, &schema_len, &table, &table_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs!ss", &pv_conn, &cat, &cat_len, &schema, &schema_len, &table, &table_len) == FAILURE) { return; } @@ -3745,10 +3721,6 @@ PHP_FUNCTION(odbc_tableprivileges) efree(result); RETURN_FALSE; } - - if (cat_len == 0) { - cat = NULL; - } rc = SQLTablePrivileges(result->stmt, cat, SAFE_SQL_NTS(cat), |