diff options
author | Frank M. Kromann <fmk@php.net> | 2000-09-28 16:42:04 +0000 |
---|---|---|
committer | Frank M. Kromann <fmk@php.net> | 2000-09-28 16:42:04 +0000 |
commit | e048e34e8001c90169799d0234fec0c87463c20f (patch) | |
tree | 4a544cf6262c55ad7846165b9e2fab1e4129de3b | |
parent | 56c474cf48344b040891f2618d33ef09a0e8be7e (diff) | |
download | php-git-e048e34e8001c90169799d0234fec0c87463c20f.tar.gz |
Having odbc_tables() and odbc_columns() match the documentation with parameters optionel from the right
-rw-r--r-- | ext/odbc/php_odbc.c | 64 |
1 files changed, 30 insertions, 34 deletions
diff --git a/ext/odbc/php_odbc.c b/ext/odbc/php_odbc.c index d187614c38..bb0a0184bd 100644 --- a/ext/odbc/php_odbc.c +++ b/ext/odbc/php_odbc.c @@ -2438,25 +2438,23 @@ PHP_FUNCTION(odbc_tables) int argc; argc = ZEND_NUM_ARGS(); - if (argc == 1) { - if (zend_get_parameters_ex(1, &pv_conn) == FAILURE) { - WRONG_PARAM_COUNT; - } - } else if (argc == 5) { - if (zend_get_parameters_ex(5, &pv_conn, &pv_cat, &pv_schema, &pv_table, &pv_type) == FAILURE) { - WRONG_PARAM_COUNT; - } - convert_to_string_ex(pv_cat); - cat = (*pv_cat)->value.str.val; - convert_to_string_ex(pv_schema); - schema = (*pv_schema)->value.str.val; - convert_to_string_ex(pv_table); - table = (*pv_table)->value.str.val; - convert_to_string_ex(pv_type); - type = (*pv_type)->value.str.val; - } else { + if (argc < 1 || argc > 5 || zend_get_parameters_ex(argc, &pv_conn, &pv_cat, &pv_schema, &pv_table, &pv_type) == FAILURE) { WRONG_PARAM_COUNT; } + switch (argc) { + case 5: + convert_to_string_ex(pv_type); + type = (*pv_type)->value.str.val; + case 4: + convert_to_string_ex(pv_table); + table = (*pv_table)->value.str.val; + case 3: + convert_to_string_ex(pv_schema); + schema = (*pv_schema)->value.str.val; + case 2: + convert_to_string_ex(pv_cat); + cat = (*pv_cat)->value.str.val; + } ZEND_FETCH_RESOURCE2(conn, odbc_connection *, pv_conn, -1, "ODBC-Link", le_conn, le_pconn); @@ -2520,24 +2518,22 @@ PHP_FUNCTION(odbc_columns) int argc; argc = ZEND_NUM_ARGS(); - if (argc == 1) { - if (zend_get_parameters_ex(1, &pv_conn) == FAILURE) { - WRONG_PARAM_COUNT; - } - } else if (argc == 5) { - if (zend_get_parameters_ex(5, &pv_conn, &pv_cat, &pv_schema, &pv_table, &pv_column) == FAILURE) { + if (argc < 1 || argc > 5 || zend_get_parameters_ex(argc, &pv_conn, &pv_cat, &pv_schema, &pv_table, &pv_column) == FAILURE) { WRONG_PARAM_COUNT; - } - convert_to_string_ex(pv_cat); - cat = (*pv_cat)->value.str.val; - convert_to_string_ex(pv_schema); - schema = (*pv_schema)->value.str.val; - convert_to_string_ex(pv_table); - table = (*pv_table)->value.str.val; - convert_to_string_ex(pv_column); - column = (*pv_column)->value.str.val; - } else { - WRONG_PARAM_COUNT; + } + switch (argc) { + case 5: + convert_to_string_ex(pv_column); + column = (*pv_column)->value.str.val; + case 4: + convert_to_string_ex(pv_table); + table = (*pv_table)->value.str.val; + case 3: + convert_to_string_ex(pv_schema); + schema = (*pv_schema)->value.str.val; + case 2: + convert_to_string_ex(pv_cat); + cat = (*pv_cat)->value.str.val; } ZEND_FETCH_RESOURCE2(conn, odbc_connection *, pv_conn, -1, "ODBC-Link", le_conn, le_pconn); |