summaryrefslogtreecommitdiff
path: root/ext/odbc/php_odbc.c
diff options
context:
space:
mode:
authorSean Finney <seanius@debian.org>2009-06-24 22:49:04 +0200
committerSean Finney <seanius@debian.org>2009-06-24 22:49:04 +0200
commit84f4ca9b07fe5b73d840258f4aa7c1eb534c4253 (patch)
tree9829bd578af8a4a8b42b04277f9067e00dc5ad90 /ext/odbc/php_odbc.c
parent6821b67124604da690c5e9276d5370d679c63ac8 (diff)
downloadphp-upstream/5.3.0_RC4.tar.gz
Imported Upstream version 5.3.0~RC4upstream/5.3.0_RC4upstream/5.3.0.RC4
Diffstat (limited to 'ext/odbc/php_odbc.c')
-rw-r--r--ext/odbc/php_odbc.c67
1 files changed, 30 insertions, 37 deletions
diff --git a/ext/odbc/php_odbc.c b/ext/odbc/php_odbc.c
index c69b11e93..28ba8b7f4 100644
--- a/ext/odbc/php_odbc.c
+++ b/ext/odbc/php_odbc.c
@@ -20,7 +20,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_odbc.c,v 1.189.2.4.2.7.2.14 2009/02/17 12:38:21 felipe Exp $ */
+/* $Id: php_odbc.c,v 1.189.2.4.2.7.2.21 2009/05/14 17:24:42 felipe Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -1274,7 +1274,7 @@ PHP_FUNCTION(odbc_execute)
}
otype = (*tmp)->type;
- convert_to_string(*tmp);
+ convert_to_string_ex(tmp);
if (Z_TYPE_PP(tmp) != IS_STRING) {
php_error_docref(NULL TSRMLS_CC, E_WARNING,"Error converting parameter");
SQLFreeStmt(result->stmt, SQL_RESET_PARAMS);
@@ -1629,17 +1629,15 @@ static void php_odbc_fetch_hash(INTERNAL_FUNCTION_PARAMETERS, int result_type)
#ifdef HAVE_SQL_EXTENDED_FETCH
SQLULEN crow;
SQLUSMALLINT RowStatus[1];
- SQLLEN rownum = -1;
+ SQLLEN rownum;
zval *pv_res, *tmp;
- long pv_row;
+ long pv_row = -1;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|l", &pv_res, &pv_row) == FAILURE) {
return;
}
- if (ZEND_NUM_ARGS() > 1) {
- rownum = pv_row;
- }
+ rownum = pv_row;
#else
zval *pv_res, *tmp;
@@ -1928,11 +1926,11 @@ PHP_FUNCTION(solid_fetch_prev)
Fetch a row */
PHP_FUNCTION(odbc_fetch_row)
{
- SQLLEN rownum = 1;
+ SQLLEN rownum;
odbc_result *result;
RETCODE rc;
zval *pv_res;
- long pv_row;
+ long pv_row = 1;
#ifdef HAVE_SQL_EXTENDED_FETCH
SQLULEN crow;
SQLUSMALLINT RowStatus[1];
@@ -1942,9 +1940,7 @@ PHP_FUNCTION(odbc_fetch_row)
return;
}
- if (ZEND_NUM_ARGS() > 1){
- rownum = pv_row;
- }
+ rownum = pv_row;
ZEND_FETCH_RESOURCE(result, odbc_result *, &pv_res, -1, "ODBC result", le_result);
@@ -3035,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;
}
@@ -3102,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;
}
@@ -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;
}
@@ -3232,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;
}
@@ -3307,19 +3303,17 @@ PHP_FUNCTION(odbc_foreignkeys)
PHP_FUNCTION(odbc_gettypeinfo)
{
zval *pv_conn;
- long pv_data_type;
+ long pv_data_type = SQL_ALL_TYPES;
odbc_result *result = NULL;
odbc_connection *conn;
RETCODE rc;
- SQLSMALLINT data_type = SQL_ALL_TYPES;
+ SQLSMALLINT data_type;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|l", &pv_conn, &pv_data_type) == FAILURE) {
return;
}
- if (ZEND_NUM_ARGS() > 1) {
- data_type = (SQLSMALLINT) pv_data_type;
- }
+ data_type = (SQLSMALLINT) pv_data_type;
ZEND_FETCH_RESOURCE2(conn, odbc_connection *, &pv_conn, -1, "ODBC-Link", le_conn, le_pconn);
@@ -3371,11 +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;
- int argc;
- 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;
}
@@ -3440,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;
}
@@ -3508,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;
}
@@ -3567,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;
}
@@ -3636,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;
}
@@ -3705,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;
}