]> granicus.if.org Git - php/commitdiff
- Improved fix for #42414
authorFelipe Pena <felipe@php.net>
Thu, 14 May 2009 17:23:51 +0000 (17:23 +0000)
committerFelipe Pena <felipe@php.net>
Thu, 14 May 2009 17:23:51 +0000 (17:23 +0000)
ext/odbc/php_odbc.c

index d54a46fb615450078aa8c8906c9880983236a027..a87b9095800d23ca1878723588c497db2ae152bc 100644 (file)
@@ -3026,7 +3026,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;
        }
@@ -3093,7 +3093,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;
        }
@@ -3122,10 +3122,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,
@@ -3161,7 +3157,7 @@ PHP_FUNCTION(odbc_columns)
 PHP_FUNCTION(odbc_columnprivileges)
 {
        zval *pv_conn;
-       odbc_result   *result = NULL;
+       odbc_result *result = NULL;
        odbc_connection *conn;
        char *cat, *schema, *table, *column;
        int cat_len, schema_len, table_len, column_len;
@@ -3188,10 +3184,6 @@ PHP_FUNCTION(odbc_columnprivileges)
                efree(result);
                RETURN_FALSE;
        }
-       
-       if (cat_len == 0) {
-               cat = NULL;
-       }
 
        rc = SQLColumnPrivileges(result->stmt, 
                        cat, SAFE_SQL_NTS(cat),
@@ -3231,11 +3223,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;
        }
@@ -3268,10 +3260,6 @@ PHP_FUNCTION(odbc_foreignkeys)
                efree(result);
                RETURN_FALSE;
        }
-       
-       if (pcat_len == 0) {
-               pcat = NULL;
-       }
 
        rc = SQLForeignKeys(result->stmt, 
                        pcat, SAFE_SQL_NTS(pcat), 
@@ -3716,10 +3704,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;
        }
 
@@ -3739,10 +3727,6 @@ PHP_FUNCTION(odbc_tableprivileges)
                efree(result);
                RETURN_FALSE;
        }
-       
-       if (cat_len == 0) {
-               cat = NULL;
-       }
 
        rc = SQLTablePrivileges(result->stmt, 
                        cat, SAFE_SQL_NTS(cat),