diff options
author | Peter Kokot <peterkokot@gmail.com> | 2018-10-13 14:12:55 +0200 |
---|---|---|
committer | Peter Kokot <peterkokot@gmail.com> | 2018-10-13 14:12:55 +0200 |
commit | 7f6387b59ae1b5d642b0d05afbb14cab07061a9a (patch) | |
tree | d09f6f4674163b6a57d8805408877b05294f6931 /ext/odbc | |
parent | 3f72c77ce47ee0906905b83161d9c1d24e425d89 (diff) | |
download | php-git-7f6387b59ae1b5d642b0d05afbb14cab07061a9a.tar.gz |
Trim trailing whitespace in source code files
Diffstat (limited to 'ext/odbc')
-rw-r--r-- | ext/odbc/config.m4 | 22 | ||||
-rw-r--r-- | ext/odbc/php_odbc.c | 358 |
2 files changed, 190 insertions, 190 deletions
diff --git a/ext/odbc/config.m4 b/ext/odbc/config.m4 index ecee15fd1c..21fd94c8ec 100644 --- a/ext/odbc/config.m4 +++ b/ext/odbc/config.m4 @@ -12,28 +12,28 @@ dnl dnl Figure out which library file to link with for the Solid support. dnl AC_DEFUN([PHP_ODBC_FIND_SOLID_LIBS],[ - AC_MSG_CHECKING([Solid library file]) + AC_MSG_CHECKING([Solid library file]) ac_solid_uname_r=`uname -r 2>/dev/null` ac_solid_uname_s=`uname -s 2>/dev/null` case $ac_solid_uname_s in AIX) ac_solid_os=a3x;; # a4x for AIX4/ Solid 2.3/3.0 only HP-UX) ac_solid_os=h9x;; # h1x for hpux11, h0x for hpux10 IRIX) ac_solid_os=irx;; # Solid 2.3(?)/ 3.0 only - Linux) + Linux) if ldd -v /bin/sh | grep GLIBC > /dev/null; then AC_DEFINE(SS_LINUX,1,[Needed in sqlunix.h ]) ac_solid_os=l2x else AC_DEFINE(SS_LINUX,1,[Needed in sqlunix.h ]) ac_solid_os=lux - fi;; - SunOS) + fi;; + SunOS) ac_solid_os=ssx;; # should we deal with SunOS 4? - FreeBSD) + FreeBSD) if test `expr $ac_solid_uname_r : '\(.\)'` -gt "2"; then AC_DEFINE(SS_FBX,1,[Needed in sqlunix.h for wchar defs ]) ac_solid_os=fex - else + else AC_DEFINE(SS_FBX,1,[Needed in sqlunix.h for wchar defs ]) ac_solid_os=fbx fi;; @@ -311,7 +311,7 @@ fi if test -z "$ODBC_TYPE"; then PHP_ARG_WITH(birdstep,, [ --with-birdstep[=DIR] Include Birdstep support [/usr/local/birdstep]]) - + AC_MSG_CHECKING(for Birdstep support) if test "$PHP_BIRDSTEP" != "no"; then if test "$PHP_BIRDSTEP" = "yes"; then @@ -321,7 +321,7 @@ PHP_ARG_WITH(birdstep,, ODBC_INCDIR=$PHP_BIRDSTEP/include ODBC_LIBDIR=$PHP_BIRDSTEP/$PHP_LIBDIR fi - + case $host_alias in *aix*[)] AC_DEFINE(AIX,1,[ ]);; @@ -361,7 +361,7 @@ if test -z "$ODBC_TYPE"; then PHP_ARG_WITH(custom-odbc,, [ --with-custom-odbc[=DIR] Include user defined ODBC support. DIR is ODBC install base directory [/usr/local]. Make sure to define CUSTOM_ODBC_LIBS and - have some odbc.h in your include dirs. f.e. you should define + have some odbc.h in your include dirs. f.e. you should define following for Sybase SQL Anywhere 5.5.00 on QNX, prior to running this configure script: CPPFLAGS=\"-DODBC_QNX -DSQLANY_BUG\" @@ -394,7 +394,7 @@ PHP_ARG_WITH(iodbc,, if test "$PHP_IODBC" != "no"; then if test -z "$PKG_CONFIG"; then AC_PATH_PROG(PKG_CONFIG, pkg-config, no) - fi + fi if test -x "$PKG_CONFIG" && $PKG_CONFIG --exists libiodbc ; then PHP_ADD_LIBRARY_WITH_PATH(iodbc, $PHP_IODBC/$PHP_LIBDIR) ODBC_TYPE=iodbc @@ -540,7 +540,7 @@ if test -n "$ODBC_TYPE"; then AC_DEFINE(HAVE_SQLDATASOURCES,1,[ ]) fi fi - + AC_DEFINE(HAVE_UODBC,1,[ ]) PHP_SUBST(ODBC_SHARED_LIBADD) PHP_SUBST(ODBC_INCDIR) diff --git a/ext/odbc/php_odbc.c b/ext/odbc/php_odbc.c index 514b8de74d..be46caf315 100644 --- a/ext/odbc/php_odbc.c +++ b/ext/odbc/php_odbc.c @@ -25,7 +25,7 @@ #ifdef HAVE_CONFIG_H #include "config.h" #endif - + #include "php.h" #include "php_globals.h" @@ -394,13 +394,13 @@ static PHP_GINIT_FUNCTION(odbc); */ zend_module_entry odbc_module_entry = { STANDARD_MODULE_HEADER, - "odbc", - odbc_functions, - PHP_MINIT(odbc), + "odbc", + odbc_functions, + PHP_MINIT(odbc), PHP_MSHUTDOWN(odbc), - PHP_RINIT(odbc), - PHP_RSHUTDOWN(odbc), - PHP_MINFO(odbc), + PHP_RINIT(odbc), + PHP_RSHUTDOWN(odbc), + PHP_MINFO(odbc), PHP_ODBC_VERSION, PHP_MODULE_GLOBALS(odbc), PHP_GINIT(odbc), @@ -424,7 +424,7 @@ static void _free_odbc_result(zend_resource *rsrc) odbc_result *res = (odbc_result *)rsrc->ptr; int i; RETCODE rc; - + if (res) { if (res->values) { for(i = 0; i < res->numcols; i++) { @@ -588,7 +588,7 @@ static PHP_INI_DISP(display_defPW) static PHP_INI_DISP(display_binmode) { char *value; - + if (type == PHP_INI_DISPLAY_ORIG && ini_entry->modified) { value = ZSTR_VAL(ini_entry->orig_value); } else if (ini_entry->value) { @@ -680,7 +680,7 @@ static PHP_INI_DISP(display_cursortype) /* }}} */ -/* {{{ PHP_INI_BEGIN +/* {{{ PHP_INI_BEGIN */ PHP_INI_BEGIN() STD_PHP_INI_BOOLEAN("odbc.allow_persistent", "1", PHP_INI_SYSTEM, OnUpdateLong, @@ -701,7 +701,7 @@ PHP_INI_BEGIN() defaultbinmode, zend_odbc_globals, odbc_globals, display_binmode) STD_PHP_INI_BOOLEAN("odbc.check_persistent", "1", PHP_INI_SYSTEM, OnUpdateLong, check_persistent, zend_odbc_globals, odbc_globals) - STD_PHP_INI_ENTRY_EX("odbc.default_cursortype", "3", PHP_INI_ALL, OnUpdateLong, + STD_PHP_INI_ENTRY_EX("odbc.default_cursortype", "3", PHP_INI_ALL, OnUpdateLong, default_cursortype, zend_odbc_globals, odbc_globals, display_cursortype) PHP_INI_END() /* }}} */ @@ -727,7 +727,7 @@ PHP_MINIT_FUNCTION(odbc) le_conn = zend_register_list_destructors_ex(_close_odbc_conn, NULL, "odbc link", module_number); le_pconn = zend_register_list_destructors_ex(NULL, _close_odbc_pconn, "odbc link persistent", module_number); odbc_module_entry.type = type; - + REGISTER_STRING_CONSTANT("ODBC_TYPE", PHP_ODBC_TYPE, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("ODBC_BINMODE_PASSTHRU", 0, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("ODBC_BINMODE_RETURN", 1, CONST_CS | CONST_PERSISTENT); @@ -752,7 +752,7 @@ PHP_MINIT_FUNCTION(odbc) REGISTER_LONG_CONSTANT("SQL_CURSOR_KEYSET_DRIVEN", SQL_CURSOR_KEYSET_DRIVEN, CONST_PERSISTENT | CONST_CS); REGISTER_LONG_CONSTANT("SQL_CURSOR_DYNAMIC", SQL_CURSOR_DYNAMIC, CONST_PERSISTENT | CONST_CS); REGISTER_LONG_CONSTANT("SQL_CURSOR_STATIC", SQL_CURSOR_STATIC, CONST_PERSISTENT | CONST_CS); - + REGISTER_LONG_CONSTANT("SQL_KEYSET_SIZE", SQL_KEYSET_SIZE, CONST_PERSISTENT | CONST_CS); /* these are for the Data Source type */ @@ -870,7 +870,7 @@ PHP_MINFO_FUNCTION(odbc) DISPLAY_INI_ENTRIES(); -} +} /* }}} */ /* {{{ odbc_sql_error */ @@ -890,7 +890,7 @@ void odbc_sql_error(ODBC_SQL_ERROR_PARAMS) conn = SQL_NULL_HDBC; } - /* This leads to an endless loop in many drivers! + /* This leads to an endless loop in many drivers! * while(henv != SQL_NULL_HENV){ do { @@ -909,7 +909,7 @@ void odbc_sql_error(ODBC_SQL_ERROR_PARAMS) } else { php_error_docref(NULL, E_WARNING, "SQL error: %s, SQL state %s", ODBCG(lasterrormsg), ODBCG(laststate)); } - /* + /* } while (SQL_SUCCEEDED(rc)); } */ @@ -930,7 +930,7 @@ void php_odbc_fetch_attribs(INTERNAL_FUNCTION_PARAMETERS, int mode) if ((result = (odbc_result *)zend_fetch_resource(Z_RES_P(pv_res), "ODBC result", le_result)) == NULL) { RETURN_FALSE; } - + if (mode) { result->longreadlen = flag; } else { @@ -962,13 +962,13 @@ int odbc_bindcols(odbc_result *result) rc = PHP_ODBC_SQLCOLATTRIBUTE(result->stmt, (SQLUSMALLINT)(i+1), PHP_ODBC_SQL_DESC_NAME, result->values[i].name, sizeof(result->values[i].name), &colnamelen, 0); - rc = PHP_ODBC_SQLCOLATTRIBUTE(result->stmt, (SQLUSMALLINT)(i+1), SQL_COLUMN_TYPE, + rc = PHP_ODBC_SQLCOLATTRIBUTE(result->stmt, (SQLUSMALLINT)(i+1), SQL_COLUMN_TYPE, NULL, 0, NULL, &result->values[i].coltype); - + /* Don't bind LONG / BINARY columns, so that fetch behaviour can * be controlled by odbc_binmode() / odbc_longreadlen() */ - + switch(result->values[i].coltype) { case SQL_BINARY: case SQL_VARBINARY: @@ -979,7 +979,7 @@ int odbc_bindcols(odbc_result *result) #endif result->values[i].value = NULL; break; - + #ifdef HAVE_ADABAS case SQL_TIMESTAMP: result->values[i].value = (char *)emalloc(27); @@ -1059,7 +1059,7 @@ void odbc_transact(INTERNAL_FUNCTION_PARAMETERS, int type) odbc_connection *conn; RETCODE rc; zval *pv_conn; - + if (zend_parse_parameters(ZEND_NUM_ARGS(), "r", &pv_conn) == FAILURE) { return; } @@ -1067,7 +1067,7 @@ void odbc_transact(INTERNAL_FUNCTION_PARAMETERS, int type) if (!(conn = (odbc_connection *)zend_fetch_resource2(Z_RES_P(pv_conn), "ODBC-Link", le_conn, le_pconn))) { RETURN_FALSE; } - + rc = SQLTransact(conn->henv, conn->hdbc, (SQLUSMALLINT)((type)?SQL_COMMIT:SQL_ROLLBACK)); if (rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO) { odbc_sql_error(conn, SQL_NULL_HSTMT, "SQLTransact"); @@ -1094,7 +1094,7 @@ void odbc_column_lengths(INTERNAL_FUNCTION_PARAMETERS, int type) { odbc_result *result; #if defined(HAVE_SOLID) || defined(HAVE_SOLID_30) - /* this seems to be necessary for Solid2.3 ( tested by + /* this seems to be necessary for Solid2.3 ( tested by * tammy@synchronis.com) and Solid 3.0 (tested by eric@terra.telemediair.nl) * Solid does not seem to declare a SQLINTEGER, but it does declare a * SQL_INTEGER which does not work (despite being the same type as a SDWORD. @@ -1163,7 +1163,7 @@ PHP_FUNCTION(odbc_close_all) } else if (p->type == le_pconn){ zend_list_close(p); /* Delete the persistent connection */ - zend_hash_apply_with_argument(&EG(persistent_list), + zend_hash_apply_with_argument(&EG(persistent_list), (apply_func_arg_t) _close_pconn_with_res, (void *)p); } } @@ -1211,10 +1211,10 @@ PHP_FUNCTION(odbc_prepare) } result = (odbc_result *)ecalloc(1, sizeof(odbc_result)); - + result->numparams = 0; result->param_info = NULL; - + rc = PHP_ODBC_SQLALLOCSTMT(conn->hdbc, &(result->stmt)); if (rc == SQL_INVALID_HANDLE) { efree(result); @@ -1255,7 +1255,7 @@ PHP_FUNCTION(odbc_prepare) odbc_sql_error(conn, result->stmt, "SQLPrepare"); RETURN_FALSE; } - + SQLNumParams(result->stmt, &(result->numparams)); SQLNumResultCols(result->stmt, &(result->numcols)); @@ -1295,7 +1295,7 @@ PHP_FUNCTION(odbc_prepare) /* {{{ proto bool odbc_execute(resource result_id [, array parameters_array]) Execute a prepared statement */ PHP_FUNCTION(odbc_execute) -{ +{ zval *pv_res, *pv_param_arr, *tmp; typedef struct params_t { SQLLEN vallen; @@ -1308,9 +1308,9 @@ PHP_FUNCTION(odbc_execute) odbc_result *result; int numArgs, i, ne; RETCODE rc; - + numArgs = ZEND_NUM_ARGS(); - + if (zend_parse_parameters(ZEND_NUM_ARGS(), "r|a", &pv_res, &pv_param_arr) == FAILURE) { return; } @@ -1318,7 +1318,7 @@ PHP_FUNCTION(odbc_execute) if ((result = (odbc_result *)zend_fetch_resource(Z_RES_P(pv_res), "ODBC result", le_result)) == NULL) { RETURN_FALSE; } - + /* XXX check for already bound parameters*/ if (result->numparams > 0 && numArgs == 1) { php_error_docref(NULL, E_WARNING, "No parameters to SQL statement given"); @@ -1336,7 +1336,7 @@ PHP_FUNCTION(odbc_execute) for(i = 0; i < result->numparams; i++) { params[i].fp = -1; } - + for(i = 1; i <= result->numparams; i++) { if ((tmp = zend_hash_get_current_data(Z_ARRVAL_P(pv_param_arr))) == NULL) { php_error_docref(NULL, E_WARNING,"Error getting parameter"); @@ -1363,7 +1363,7 @@ PHP_FUNCTION(odbc_execute) efree(params); RETURN_FALSE; } - + params[i-1].vallen = Z_STRLEN_P(tmp); params[i-1].fp = -1; @@ -1376,7 +1376,7 @@ PHP_FUNCTION(odbc_execute) if (Z_STRLEN_P(tmp) > 2 && Z_STRVAL_P(tmp)[0] == '\'' && Z_STRVAL_P(tmp)[Z_STRLEN_P(tmp) - 1] == '\'') { - + if (CHECK_ZVAL_NULL_PATH(tmp)) { RETURN_FALSE; } @@ -1431,7 +1431,7 @@ PHP_FUNCTION(odbc_execute) ¶ms[i-1].vallen); } if (rc == SQL_ERROR) { - odbc_sql_error(result->conn_ptr, result->stmt, "SQLBindParameter"); + odbc_sql_error(result->conn_ptr, result->stmt, "SQLBindParameter"); SQLFreeStmt(result->stmt, SQL_RESET_PARAMS); for (i = 0; i < result->numparams; i++) { if (params[i].fp != -1) { @@ -1448,7 +1448,7 @@ PHP_FUNCTION(odbc_execute) rc = SQLFreeStmt(result->stmt, SQL_CLOSE); if (rc == SQL_ERROR) { - odbc_sql_error(result->conn_ptr, result->stmt, "SQLFreeStmt"); + odbc_sql_error(result->conn_ptr, result->stmt, "SQLFreeStmt"); } rc = SQLExecute(result->stmt); @@ -1477,8 +1477,8 @@ PHP_FUNCTION(odbc_execute) odbc_sql_error(result->conn_ptr, result->stmt, "SQLExecute"); RETVAL_FALSE; } - } - + } + if (result->numparams > 0) { SQLFreeStmt(result->stmt, SQL_RESET_PARAMS); for(i = 0; i < result->numparams; i++) { @@ -1518,7 +1518,7 @@ PHP_FUNCTION(odbc_cursor) char *cursorname; odbc_result *result; RETCODE rc; - + if (zend_parse_parameters(ZEND_NUM_ARGS(), "r", &pv_res) == FAILURE) { return; } @@ -1531,7 +1531,7 @@ PHP_FUNCTION(odbc_cursor) if (rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO) { RETURN_FALSE; } - + if (max_len > 0) { cursorname = emalloc(max_len + 1); rc = SQLGetCursorName(result->stmt,cursorname,(SQLSMALLINT)max_len,&len); @@ -1594,12 +1594,12 @@ PHP_FUNCTION(odbc_data_source) } /* now we have the "connection" lets call the DataSource object */ - rc = SQLDataSources(conn->henv, + rc = SQLDataSources(conn->henv, fetch_type, server_name, (SQLSMALLINT)sizeof(server_name), &len1, - desc, + desc, (SQLSMALLINT)sizeof(desc), &len2); @@ -1641,7 +1641,7 @@ PHP_FUNCTION(odbc_exec) #endif numArgs = ZEND_NUM_ARGS(); - + if (zend_parse_parameters(ZEND_NUM_ARGS(), "rs|l", &pv_conn, &query, &query_len, &pv_flags) == FAILURE) { return; } @@ -1649,7 +1649,7 @@ PHP_FUNCTION(odbc_exec) if (!(conn = (odbc_connection *)zend_fetch_resource2(Z_RES_P(pv_conn), "ODBC-Link", le_conn, le_pconn))) { RETURN_FALSE; } - + result = (odbc_result *)ecalloc(1, sizeof(odbc_result)); rc = PHP_ODBC_SQLALLOCSTMT(conn->hdbc, &(result->stmt)); @@ -1664,7 +1664,7 @@ PHP_FUNCTION(odbc_exec) efree(result); RETURN_FALSE; } - + #ifdef HAVE_SQL_EXTENDED_FETCH /* Solid doesn't have ExtendedFetch, if DriverManager is used, get Info, whether Driver supports ExtendedFetch */ @@ -1682,18 +1682,18 @@ PHP_FUNCTION(odbc_exec) #endif rc = SQLExecDirect(result->stmt, query, SQL_NTS); - if (rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO && rc != SQL_NO_DATA_FOUND) { + if (rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO && rc != SQL_NO_DATA_FOUND) { /* XXX FIXME we should really check out SQLSTATE with SQLError * in case rc is SQL_SUCCESS_WITH_INFO here. */ - odbc_sql_error(conn, result->stmt, "SQLExecDirect"); + odbc_sql_error(conn, result->stmt, "SQLExecDirect"); SQLFreeStmt(result->stmt, SQL_DROP); efree(result); RETURN_FALSE; } SQLNumResultCols(result->stmt, &(result->numcols)); - + /* For insert, update etc. cols == 0 */ if (result->numcols > 0) { if (!odbc_bindcols(result)) { @@ -1732,7 +1732,7 @@ static void php_odbc_fetch_hash(INTERNAL_FUNCTION_PARAMETERS, int result_type) if (zend_parse_parameters(ZEND_NUM_ARGS(), "r|l", &pv_res, &pv_row) == FAILURE) { return; } - + rownum = pv_row; #else zval *pv_res, tmp; @@ -1765,9 +1765,9 @@ static void php_odbc_fetch_hash(INTERNAL_FUNCTION_PARAMETERS, int result_type) if (rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO) { RETURN_FALSE; } - + array_init(return_value); - + #ifdef HAVE_SQL_EXTENDED_FETCH if (rownum > 0 && result->fetch_abs) result->fetched = rownum; @@ -1796,11 +1796,11 @@ static void php_odbc_fetch_hash(INTERNAL_FUNCTION_PARAMETERS, int result_type) if (IS_SQL_LONG(result->values[i].coltype) && result->longreadlen <= 0) { ZVAL_EMPTY_STRING(&tmp); break; - } + } if (buf == NULL) { buf = emalloc(result->longreadlen + 1); } - + rc = SQLGetData(result->stmt, (SQLUSMALLINT)(i + 1), sql_c_type, buf, result->longreadlen + 1, &result->values[i].vallen); if (rc == SQL_ERROR) { @@ -1866,7 +1866,7 @@ PHP_FUNCTION(odbc_fetch_array) #endif /* {{{ proto int odbc_fetch_into(resource result_id, array &result_array [, int rownumber]) - Fetch one result row into an array */ + Fetch one result row into an array */ PHP_FUNCTION(odbc_fetch_into) { int i; @@ -1886,7 +1886,7 @@ PHP_FUNCTION(odbc_fetch_into) if (zend_parse_parameters(ZEND_NUM_ARGS(), "rz/|l", &pv_res, &pv_res_arr, &pv_row) == FAILURE) { return; } - + rownum = pv_row; #else if (zend_parse_parameters(ZEND_NUM_ARGS(), "rz/", &pv_res, &pv_res_arr) == FAILURE) { @@ -1897,12 +1897,12 @@ PHP_FUNCTION(odbc_fetch_into) if ((result = (odbc_result *)zend_fetch_resource(Z_RES_P(pv_res), "ODBC result", le_result)) == NULL) { RETURN_FALSE; } - + if (result->numcols == 0) { php_error_docref(NULL, E_WARNING, "No tuples available at this result index"); RETURN_FALSE; } - + if (Z_TYPE_P(pv_res_arr) != IS_ARRAY) { array_init(pv_res_arr); } @@ -1940,7 +1940,7 @@ PHP_FUNCTION(odbc_fetch_into) ZVAL_EMPTY_STRING(&tmp); break; } - if (result->binmode == 1) sql_c_type = SQL_C_BINARY; + if (result->binmode == 1) sql_c_type = SQL_C_BINARY; case SQL_LONGVARCHAR: #if defined(ODBCVER) && (ODBCVER >= 0x0300) @@ -1982,23 +1982,23 @@ PHP_FUNCTION(odbc_fetch_into) zend_hash_index_update(Z_ARRVAL_P(pv_res_arr), i, &tmp); } if (buf) efree(buf); - RETURN_LONG(result->numcols); + RETURN_LONG(result->numcols); } /* }}} */ /* {{{ proto bool solid_fetch_prev(resource result_id) - */ + */ #if defined(HAVE_SOLID) || defined(HAVE_SOLID_30) || defined(HAVE_SOLID_35) PHP_FUNCTION(solid_fetch_prev) { odbc_result *result; RETCODE rc; zval *pv_res; - + if (zend_parse_parameters(ZEND_NUM_ARGS(), "r", &pv_res) == FAILURE) { return; } - + if ((result = (odbc_result *)zend_fetch_resource(Z_RES_P(pv_res), "ODBC result", le_result)) == NULL) { RETURN_FALSE; } @@ -2038,13 +2038,13 @@ PHP_FUNCTION(odbc_fetch_row) if (zend_parse_parameters(ZEND_NUM_ARGS(), "r|l", &pv_res, &pv_row) == FAILURE) { return; } - + rownum = pv_row; - + if ((result = (odbc_result *)zend_fetch_resource(Z_RES_P(pv_res), "ODBC result", le_result)) == NULL) { RETURN_FALSE; } - + if (result->numcols == 0) { php_error_docref(NULL, E_WARNING, "No tuples available at this result index"); RETURN_FALSE; @@ -2064,19 +2064,19 @@ PHP_FUNCTION(odbc_fetch_row) if (rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO) { RETURN_FALSE; } - + if (ZEND_NUM_ARGS() > 1) { result->fetched = rownum; } else { result->fetched++; } - + RETURN_TRUE; -} +} /* }}} */ /* {{{ proto mixed odbc_result(resource result_id, mixed field) - Get result data */ + Get result data */ PHP_FUNCTION(odbc_result) { char *field; @@ -2099,23 +2099,23 @@ PHP_FUNCTION(odbc_result) if (zend_parse_parameters(ZEND_NUM_ARGS(), "rz", &pv_res, &pv_field) == FAILURE) { return; } - + if (Z_TYPE_P(pv_field) == IS_STRING) { field = Z_STRVAL_P(pv_field); } else { convert_to_long_ex(pv_field); field_ind = Z_LVAL_P(pv_field) - 1; } - + if ((result = (odbc_result *)zend_fetch_resource(Z_RES_P(pv_res), "ODBC result", le_result)) == NULL) { RETURN_FALSE; } - + if ((result->numcols == 0)) { php_error_docref(NULL, E_WARNING, "No tuples available at this result index"); RETURN_FALSE; } - + /* get field index if the field parameter was a string */ if (field != NULL) { if (result->values == NULL) { @@ -2154,7 +2154,7 @@ PHP_FUNCTION(odbc_result) if (rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO) { RETURN_FALSE; } - + result->fetched++; } @@ -2166,7 +2166,7 @@ PHP_FUNCTION(odbc_result) sql_c_type = SQL_C_BINARY; } if (result->binmode <= 0) { - break; + break; } case SQL_LONGVARCHAR: #if defined(ODBCVER) && (ODBCVER >= 0x0300) @@ -2179,7 +2179,7 @@ PHP_FUNCTION(odbc_result) fieldsize = result->longreadlen; } } else { - PHP_ODBC_SQLCOLATTRIBUTE(result->stmt, (SQLUSMALLINT)(field_ind + 1), + PHP_ODBC_SQLCOLATTRIBUTE(result->stmt, (SQLUSMALLINT)(field_ind + 1), (SQLUSMALLINT)((sql_c_type == SQL_C_BINARY) ? SQL_COLUMN_LENGTH : SQL_COLUMN_DISPLAY_SIZE), NULL, 0, NULL, &fieldsize); @@ -2189,7 +2189,7 @@ PHP_FUNCTION(odbc_result) field_str = zend_string_alloc(fieldsize, 0); /* SQLGetData will truncate CHAR data to fieldsize - 1 bytes and append \0. - * For binary data it is truncated to fieldsize bytes. + * For binary data it is truncated to fieldsize bytes. */ rc = SQLGetData(result->stmt, (SQLUSMALLINT)(field_ind + 1), sql_c_type, ZSTR_VAL(field_str), fieldsize, &result->values[field_ind].vallen); @@ -2207,7 +2207,7 @@ PHP_FUNCTION(odbc_result) zend_string_free(field_str); RETURN_FALSE; } - /* Reduce fieldlen by 1 if we have char data. One day we might + /* Reduce fieldlen by 1 if we have char data. One day we might have binary strings... */ if ((result->values[field_ind].coltype == SQL_LONGVARCHAR) #if defined(ODBCVER) && (ODBCVER >= 0x0300) @@ -2224,7 +2224,7 @@ PHP_FUNCTION(odbc_result) } RETURN_NEW_STR(field_str); break; - + default: if (result->values[field_ind].vallen == SQL_NULL_DATA) { RETURN_NULL(); @@ -2235,11 +2235,11 @@ PHP_FUNCTION(odbc_result) } /* If we come here, output unbound LONG and/or BINARY column data to the client */ - + /* We emalloc 1 byte more for SQL_C_CHAR (trailing \0) */ fieldsize = (sql_c_type == SQL_C_CHAR) ? 4096 : 4095; field = emalloc(fieldsize); - + /* Call SQLGetData() until SQL_SUCCESS is returned */ while(1) { rc = SQLGetData(result->stmt, (SQLUSMALLINT)(field_ind + 1),sql_c_type, field, fieldsize, &result->values[field_ind].vallen); @@ -2249,7 +2249,7 @@ PHP_FUNCTION(odbc_result) efree(field); RETURN_FALSE; } - + if (result->values[field_ind].vallen == SQL_NULL_DATA) { efree(field); RETURN_NULL(); @@ -2285,11 +2285,11 @@ PHP_FUNCTION(odbc_result_all) if (zend_parse_parameters(ZEND_NUM_ARGS(), "r|s", &pv_res, &pv_format, &pv_format_len) == FAILURE) { return; } - + if ((result = (odbc_result *)zend_fetch_resource(Z_RES_P(pv_res), "ODBC result", le_result)) == NULL) { RETURN_FALSE; } - + if (result->numcols == 0) { php_error_docref(NULL, E_WARNING, "No tuples available at this result index"); RETURN_FALSE; @@ -2298,21 +2298,21 @@ PHP_FUNCTION(odbc_result_all) if (result->fetch_abs) rc = SQLExtendedFetch(result->stmt,SQL_FETCH_NEXT,1,&crow,RowStatus); else -#endif +#endif rc = SQLFetch(result->stmt); if (rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO) { php_printf("<h2>No rows found</h2>\n"); RETURN_LONG(0); } - + /* Start table tag */ if (ZEND_NUM_ARGS() == 1) { php_printf("<table><tr>"); } else { php_printf("<table %s ><tr>", pv_format); } - + for (i = 0; i < result->numcols; i++) { php_printf("<th>%s</th>", result->values[i].name); } @@ -2332,14 +2332,14 @@ PHP_FUNCTION(odbc_result_all) php_printf("<td>Not printable</td>"); break; } - if (result->binmode <= 1) sql_c_type = SQL_C_BINARY; + if (result->binmode <= 1) sql_c_type = SQL_C_BINARY; case SQL_LONGVARCHAR: #if defined(ODBCVER) && (ODBCVER >= 0x0300) case SQL_WLONGVARCHAR: #endif - if (IS_SQL_LONG(result->values[i].coltype) && + if (IS_SQL_LONG(result->values[i].coltype) && result->longreadlen <= 0) { - php_printf("<td>Not printable</td>"); + php_printf("<td>Not printable</td>"); break; } @@ -2348,7 +2348,7 @@ PHP_FUNCTION(odbc_result_all) } rc = SQLGetData(result->stmt, (SQLUSMALLINT)(i + 1),sql_c_type, buf, result->longreadlen, &result->values[i].vallen); - + php_printf("<td>"); if (rc == SQL_ERROR) { @@ -2383,7 +2383,7 @@ PHP_FUNCTION(odbc_result_all) rc = SQLExtendedFetch(result->stmt,SQL_FETCH_NEXT,1,&crow,RowStatus); else #endif - rc = SQLFetch(result->stmt); + rc = SQLFetch(result->stmt); } php_printf("</table>\n"); if (buf) efree(buf); @@ -2416,9 +2416,9 @@ PHP_FUNCTION(odbc_free_result) efree(result->values); result->values = NULL; } - + zend_list_close(Z_RES_P(pv_res)); - + RETURN_TRUE; } /* }}} */ @@ -2443,14 +2443,14 @@ PHP_FUNCTION(odbc_pconnect) int odbc_sqlconnect(odbc_connection **conn, char *db, char *uid, char *pwd, int cur_opt, int persistent) { RETCODE rc; - + *conn = (odbc_connection *)pemalloc(sizeof(odbc_connection), persistent); memset(*conn, 0, sizeof(odbc_connection)); (*conn)->persistent = persistent; SQLAllocEnv(&((*conn)->henv)); SQLAllocConnect((*conn)->henv, &((*conn)->hdbc)); - -#if defined(HAVE_SOLID) || defined(HAVE_SOLID_30) + +#if defined(HAVE_SOLID) || defined(HAVE_SOLID_30) SQLSetConnectOption((*conn)->hdbc, SQL_TRANSLATE_OPTION, SQL_SOLID_XLATOPT_NOCNV); #endif @@ -2513,7 +2513,7 @@ int odbc_sqlconnect(odbc_connection **conn, char *db, char *uid, char *pwd, int /* Possible fix for bug #10250 * Needs testing on UnixODBC < 2.0.5 though. */ #if defined(HAVE_EMPRESS) || defined(HAVE_UNIXODBC) || defined(PHP_WIN32) || defined (HAVE_IODBC) -/* * Uncomment the line above, and comment line below to fully test +/* * Uncomment the line above, and comment line below to fully test * #ifdef HAVE_EMPRESS */ { int direct = 0; @@ -2561,7 +2561,7 @@ int odbc_sqlconnect(odbc_connection **conn, char *db, char *uid, char *pwd, int /* Persistent connections: two list-types le_pconn, le_conn and a plist * where hashed connection info is stored together with index pointer to - * the actual link of type le_pconn in the list. Only persistent + * the actual link of type le_pconn in the list. Only persistent * connections get hashed up. Normal connections use existing pconnections. * Maybe this has to change with regard to transactions on pconnections? * Possibly set autocommit to on on request shutdown. @@ -2588,14 +2588,14 @@ void odbc_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent) if (zend_parse_parameters(ZEND_NUM_ARGS(), "sss|l", &db, &db_len, &uid, &uid_len, &pwd, &pwd_len, &pv_opt) == FAILURE) { return; } - + cur_opt = pv_opt; - + if (ZEND_NUM_ARGS() > 3) { /* Confirm the cur_opt range */ - if (! (cur_opt == SQL_CUR_USE_IF_NEEDED || - cur_opt == SQL_CUR_USE_ODBC || - cur_opt == SQL_CUR_USE_DRIVER || + if (! (cur_opt == SQL_CUR_USE_IF_NEEDED || + cur_opt == SQL_CUR_USE_ODBC || + cur_opt == SQL_CUR_USE_DRIVER || cur_opt == SQL_CUR_DEFAULT) ) { php_error_docref(NULL, E_WARNING, "Invalid Cursor type (%d)", cur_opt); RETURN_FALSE; @@ -2619,11 +2619,11 @@ try_and_get_another_connection: if (persistent) { zend_resource *le; - + /* the link is not in the persistent list */ if ((le = zend_hash_str_find_ptr(&EG(persistent_list), hashed_details, hashed_len)) == NULL) { zend_resource new_le; - + if (ODBCG(max_links) != -1 && ODBCG(num_links) >= ODBCG(max_links)) { php_error_docref(NULL, E_WARNING, "Too many open links (%ld)", ODBCG(num_links)); efree(hashed_details); @@ -2634,12 +2634,12 @@ try_and_get_another_connection: efree(hashed_details); RETURN_FALSE; } - + if (!odbc_sqlconnect(&db_conn, db, uid, pwd, cur_opt, 1)) { efree(hashed_details); RETURN_FALSE; } - + new_le.type = le_pconn; new_le.ptr = db_conn; new_le.handle = -1; @@ -2670,13 +2670,13 @@ try_and_get_another_connection: UCHAR d_name[32]; SQLSMALLINT len; - ret = SQLGetInfo(db_conn->hdbc, - SQL_DATA_SOURCE_READ_ONLY, + ret = SQLGetInfo(db_conn->hdbc, + SQL_DATA_SOURCE_READ_ONLY, d_name, sizeof(d_name), &len); if(ret != SQL_SUCCESS || len == 0) { zend_hash_str_del(&EG(persistent_list), hashed_details, hashed_len); - /* Commented out to fix a possible double closure error + /* Commented out to fix a possible double closure error * when working with persistent connections as submitted by * bug #15758 * @@ -2691,7 +2691,7 @@ try_and_get_another_connection: RETVAL_RES(db_conn->res); } else { /* non persistent */ zend_resource *index_ptr, new_index_ptr; - + if ((index_ptr = zend_hash_str_find_ptr(&EG(regular_list), hashed_details, hashed_len)) != NULL) { zend_ulong conn_id; zend_resource *p; @@ -2765,11 +2765,11 @@ PHP_FUNCTION(odbc_close) } } } ZEND_HASH_FOREACH_END(); - + zend_list_close(Z_RES_P(pv_conn)); - + if(is_pconn){ - zend_hash_apply_with_argument(&EG(persistent_list), (apply_func_arg_t) _close_pconn_with_res, (void *) Z_RES_P(pv_conn)); + zend_hash_apply_with_argument(&EG(persistent_list), (apply_func_arg_t) _close_pconn_with_res, (void *) Z_RES_P(pv_conn)); } } /* }}} */ @@ -2781,7 +2781,7 @@ PHP_FUNCTION(odbc_num_rows) odbc_result *result; SQLLEN rows; zval *pv_res; - + if (zend_parse_parameters(ZEND_NUM_ARGS(), "r", &pv_res) == FAILURE) { return; } @@ -2874,30 +2874,30 @@ PHP_FUNCTION(odbc_field_name) odbc_result *result; zval *pv_res; zend_long pv_num; - + if (zend_parse_parameters(ZEND_NUM_ARGS(), "rl", &pv_res, &pv_num) == FAILURE) { return; } - + if ((result = (odbc_result *)zend_fetch_resource(Z_RES_P(pv_res), "ODBC result", le_result)) == NULL) { RETURN_FALSE; } - + if (result->numcols == 0) { php_error_docref(NULL, E_WARNING, "No tuples available at this result index"); RETURN_FALSE; } - + if (pv_num > result->numcols) { php_error_docref(NULL, E_WARNING, "Field index larger than number of fields"); RETURN_FALSE; } - + if (pv_num < 1) { php_error_docref(NULL, E_WARNING, "Field numbering starts at 1"); RETURN_FALSE; } - + RETURN_STRING(result->values[pv_num - 1].name); } /* }}} */ @@ -2924,7 +2924,7 @@ PHP_FUNCTION(odbc_field_type) php_error_docref(NULL, E_WARNING, "No tuples available at this result index"); RETURN_FALSE; } - + if (pv_num > result->numcols) { php_error_docref(NULL, E_WARNING, "Field index larger than number of fields"); RETURN_FALSE; @@ -2952,7 +2952,7 @@ PHP_FUNCTION(odbc_field_len) Get the scale of a column */ PHP_FUNCTION(odbc_field_scale) { - odbc_column_lengths(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1); + odbc_column_lengths(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1); } /* }}} */ @@ -2968,11 +2968,11 @@ PHP_FUNCTION(odbc_field_num) if (zend_parse_parameters(ZEND_NUM_ARGS(), "rs", &pv_res, &fname, &fname_len) == FAILURE) { return; } - + if ((result = (odbc_result *)zend_fetch_resource(Z_RES_P(pv_res), "ODBC result", le_result)) == NULL) { RETURN_FALSE; } - + if (result->numcols == 0) { php_error_docref(NULL, E_WARNING, "No tuples available at this result index"); RETURN_FALSE; @@ -3009,7 +3009,7 @@ PHP_FUNCTION(odbc_autocommit) if (!(conn = (odbc_connection *)zend_fetch_resource2(Z_RES_P(pv_conn), "ODBC-Link", le_conn, le_pconn))) { RETURN_FALSE; } - + if (ZEND_NUM_ARGS() > 1) { rc = SQLSetConnectOption(conn->hdbc, SQL_AUTOCOMMIT, (pv_onoff) ? SQL_AUTOCOMMIT_ON : SQL_AUTOCOMMIT_OFF); if (rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO) { @@ -3134,7 +3134,7 @@ PHP_FUNCTION(odbc_setoption) if ((result = (odbc_result *)zend_fetch_resource(Z_RES_P(pv_handle), "ODBC result", le_result)) == NULL) { RETURN_FALSE; } - + rc = SQLSetStmtOption(result->stmt, (unsigned short) pv_opt, pv_val); if (rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO) { @@ -3167,7 +3167,7 @@ PHP_FUNCTION(odbc_tables) size_t cat_len = 0, schema_len = 0, table_len = 0, type_len = 0; RETCODE rc; - if (zend_parse_parameters(ZEND_NUM_ARGS(), "r|s!sss", &pv_conn, &cat, &cat_len, &schema, &schema_len, + if (zend_parse_parameters(ZEND_NUM_ARGS(), "r|s!sss", &pv_conn, &cat, &cat_len, &schema, &schema_len, &table, &table_len, &type, &type_len) == FAILURE) { return; } @@ -3177,7 +3177,7 @@ PHP_FUNCTION(odbc_tables) } result = (odbc_result *)ecalloc(1, sizeof(odbc_result)); - + rc = PHP_ODBC_SQLALLOCSTMT(conn->hdbc, &(result->stmt)); if (rc == SQL_INVALID_HANDLE) { efree(result); @@ -3196,9 +3196,9 @@ PHP_FUNCTION(odbc_tables) schema = NULL; } - rc = SQLTables(result->stmt, - cat, SAFE_SQL_NTS(cat), - schema, SAFE_SQL_NTS(schema), + rc = SQLTables(result->stmt, + cat, SAFE_SQL_NTS(cat), + schema, SAFE_SQL_NTS(schema), table, SAFE_SQL_NTS(table), type, SAFE_SQL_NTS(type)); @@ -3246,7 +3246,7 @@ PHP_FUNCTION(odbc_columns) } result = (odbc_result *)ecalloc(1, sizeof(odbc_result)); - + rc = PHP_ODBC_SQLALLOCSTMT(conn->hdbc, &(result->stmt)); if (rc == SQL_INVALID_HANDLE) { efree(result); @@ -3260,14 +3260,14 @@ PHP_FUNCTION(odbc_columns) RETURN_FALSE; } - /* + /* * Needed to make MS Access happy */ if (table && table_len && schema && schema_len == 0) { schema = NULL; } - rc = SQLColumns(result->stmt, + rc = SQLColumns(result->stmt, cat, (SQLSMALLINT) cat_len, schema, (SQLSMALLINT) schema_len, table, (SQLSMALLINT) table_len, @@ -3307,7 +3307,7 @@ PHP_FUNCTION(odbc_columnprivileges) char *cat = NULL, *schema, *table, *column; size_t cat_len = 0, schema_len, table_len, column_len; RETCODE rc; - + if (zend_parse_parameters(ZEND_NUM_ARGS(), "rs!sss", &pv_conn, &cat, &cat_len, &schema, &schema_len, &table, &table_len, &column, &column_len) == FAILURE) { return; @@ -3318,7 +3318,7 @@ PHP_FUNCTION(odbc_columnprivileges) } result = (odbc_result *)ecalloc(1, sizeof(odbc_result)); - + rc = PHP_ODBC_SQLALLOCSTMT(conn->hdbc, &(result->stmt)); if (rc == SQL_INVALID_HANDLE) { efree(result); @@ -3332,7 +3332,7 @@ PHP_FUNCTION(odbc_columnprivileges) RETURN_FALSE; } - rc = SQLColumnPrivileges(result->stmt, + rc = SQLColumnPrivileges(result->stmt, cat, SAFE_SQL_NTS(cat), schema, SAFE_SQL_NTS(schema), table, SAFE_SQL_NTS(table), @@ -3374,7 +3374,7 @@ PHP_FUNCTION(odbc_foreignkeys) size_t pcat_len = 0, pschema_len, ptable_len, fcat_len, fschema_len, ftable_len; RETCODE rc; - if (zend_parse_parameters(ZEND_NUM_ARGS(), "rs!sssss", &pv_conn, &pcat, &pcat_len, &pschema, &pschema_len, + if (zend_parse_parameters(ZEND_NUM_ARGS(), "rs!sssss", &pv_conn, &pcat, &pcat_len, &pschema, &pschema_len, &ptable, &ptable_len, &fcat, &fcat_len, &fschema, &fschema_len, &ftable, &ftable_len) == FAILURE) { return; } @@ -3396,7 +3396,7 @@ PHP_FUNCTION(odbc_foreignkeys) } result = (odbc_result *)ecalloc(1, sizeof(odbc_result)); - + rc = PHP_ODBC_SQLALLOCSTMT(conn->hdbc, &(result->stmt)); if (rc == SQL_INVALID_HANDLE) { efree(result); @@ -3410,12 +3410,12 @@ PHP_FUNCTION(odbc_foreignkeys) RETURN_FALSE; } - rc = SQLForeignKeys(result->stmt, - pcat, SAFE_SQL_NTS(pcat), - pschema, SAFE_SQL_NTS(pschema), - ptable, SAFE_SQL_NTS(ptable), - fcat, SAFE_SQL_NTS(fcat), - fschema, SAFE_SQL_NTS(fschema), + rc = SQLForeignKeys(result->stmt, + pcat, SAFE_SQL_NTS(pcat), + pschema, SAFE_SQL_NTS(pschema), + ptable, SAFE_SQL_NTS(ptable), + fcat, SAFE_SQL_NTS(fcat), + fschema, SAFE_SQL_NTS(fschema), ftable, SAFE_SQL_NTS(ftable) ); if (rc == SQL_ERROR) { @@ -3456,7 +3456,7 @@ PHP_FUNCTION(odbc_gettypeinfo) if (zend_parse_parameters(ZEND_NUM_ARGS(), "r|l", &pv_conn, &pv_data_type) == FAILURE) { return; } - + data_type = (SQLSMALLINT) pv_data_type; if (!(conn = (odbc_connection *)zend_fetch_resource2(Z_RES_P(pv_conn), "ODBC-Link", le_conn, le_pconn))) { @@ -3464,7 +3464,7 @@ PHP_FUNCTION(odbc_gettypeinfo) } result = (odbc_result *)ecalloc(1, sizeof(odbc_result)); - + rc = PHP_ODBC_SQLALLOCSTMT(conn->hdbc, &(result->stmt)); if (rc == SQL_INVALID_HANDLE) { efree(result); @@ -3523,7 +3523,7 @@ PHP_FUNCTION(odbc_primarykeys) } result = (odbc_result *)ecalloc(1, sizeof(odbc_result)); - + rc = PHP_ODBC_SQLALLOCSTMT(conn->hdbc, &(result->stmt)); if (rc == SQL_INVALID_HANDLE) { efree(result); @@ -3537,9 +3537,9 @@ PHP_FUNCTION(odbc_primarykeys) RETURN_FALSE; } - rc = SQLPrimaryKeys(result->stmt, - cat, SAFE_SQL_NTS(cat), - schema, SAFE_SQL_NTS(schema), + rc = SQLPrimaryKeys(result->stmt, + cat, SAFE_SQL_NTS(cat), + schema, SAFE_SQL_NTS(schema), table, SAFE_SQL_NTS(table) ); if (rc == SQL_ERROR) { @@ -3576,12 +3576,12 @@ PHP_FUNCTION(odbc_procedurecolumns) char *cat = NULL, *schema = NULL, *proc = NULL, *col = NULL; size_t cat_len = 0, schema_len = 0, proc_len = 0, col_len = 0; RETCODE rc; - + if (ZEND_NUM_ARGS() != 1 && ZEND_NUM_ARGS() != 5) { WRONG_PARAM_COUNT; } - if (zend_parse_parameters(ZEND_NUM_ARGS(), "r|s!sss", &pv_conn, &cat, &cat_len, &schema, &schema_len, + if (zend_parse_parameters(ZEND_NUM_ARGS(), "r|s!sss", &pv_conn, &cat, &cat_len, &schema, &schema_len, &proc, &proc_len, &col, &col_len) == FAILURE) { return; } @@ -3591,7 +3591,7 @@ PHP_FUNCTION(odbc_procedurecolumns) } result = (odbc_result *)ecalloc(1, sizeof(odbc_result)); - + rc = PHP_ODBC_SQLALLOCSTMT(conn->hdbc, &(result->stmt)); if (rc == SQL_INVALID_HANDLE) { efree(result); @@ -3605,10 +3605,10 @@ PHP_FUNCTION(odbc_procedurecolumns) RETURN_FALSE; } - rc = SQLProcedureColumns(result->stmt, - cat, SAFE_SQL_NTS(cat), - schema, SAFE_SQL_NTS(schema), - proc, SAFE_SQL_NTS(proc), + rc = SQLProcedureColumns(result->stmt, + cat, SAFE_SQL_NTS(cat), + schema, SAFE_SQL_NTS(schema), + proc, SAFE_SQL_NTS(proc), col, SAFE_SQL_NTS(col) ); if (rc == SQL_ERROR) { @@ -3650,7 +3650,7 @@ PHP_FUNCTION(odbc_procedures) if (ZEND_NUM_ARGS() != 1 && ZEND_NUM_ARGS() != 4) { WRONG_PARAM_COUNT; } - + if (zend_parse_parameters(ZEND_NUM_ARGS(), "r|s!ss", &pv_conn, &cat, &cat_len, &schema, &schema_len, &proc, &proc_len) == FAILURE) { return; } @@ -3660,7 +3660,7 @@ PHP_FUNCTION(odbc_procedures) } result = (odbc_result *)ecalloc(1, sizeof(odbc_result)); - + rc = PHP_ODBC_SQLALLOCSTMT(conn->hdbc, &(result->stmt)); if (rc == SQL_INVALID_HANDLE) { efree(result); @@ -3674,9 +3674,9 @@ PHP_FUNCTION(odbc_procedures) RETURN_FALSE; } - rc = SQLProcedures(result->stmt, - cat, SAFE_SQL_NTS(cat), - schema, SAFE_SQL_NTS(schema), + rc = SQLProcedures(result->stmt, + cat, SAFE_SQL_NTS(cat), + schema, SAFE_SQL_NTS(schema), proc, SAFE_SQL_NTS(proc) ); if (rc == SQL_ERROR) { @@ -3720,7 +3720,7 @@ PHP_FUNCTION(odbc_specialcolumns) &name, &name_len, &vscope, &vnullable) == FAILURE) { return; } - + type = (SQLUSMALLINT) vtype; scope = (SQLUSMALLINT) vscope; nullable = (SQLUSMALLINT) vnullable; @@ -3730,7 +3730,7 @@ PHP_FUNCTION(odbc_specialcolumns) } result = (odbc_result *)ecalloc(1, sizeof(odbc_result)); - + rc = PHP_ODBC_SQLALLOCSTMT(conn->hdbc, &(result->stmt)); if (rc == SQL_INVALID_HANDLE) { efree(result); @@ -3744,10 +3744,10 @@ PHP_FUNCTION(odbc_specialcolumns) RETURN_FALSE; } - rc = SQLSpecialColumns(result->stmt, + rc = SQLSpecialColumns(result->stmt, type, - cat, SAFE_SQL_NTS(cat), - schema, SAFE_SQL_NTS(schema), + cat, SAFE_SQL_NTS(cat), + schema, SAFE_SQL_NTS(schema), name, SAFE_SQL_NTS(name), scope, nullable); @@ -3792,7 +3792,7 @@ PHP_FUNCTION(odbc_statistics) &name, &name_len, &vunique, &vreserved) == FAILURE) { return; } - + unique = (SQLUSMALLINT) vunique; reserved = (SQLUSMALLINT) vreserved; @@ -3801,7 +3801,7 @@ PHP_FUNCTION(odbc_statistics) } result = (odbc_result *)ecalloc(1, sizeof(odbc_result)); - + rc = PHP_ODBC_SQLALLOCSTMT(conn->hdbc, &(result->stmt)); if (rc == SQL_INVALID_HANDLE) { efree(result); @@ -3815,9 +3815,9 @@ PHP_FUNCTION(odbc_statistics) RETURN_FALSE; } - rc = SQLStatistics(result->stmt, + rc = SQLStatistics(result->stmt, cat, SAFE_SQL_NTS(cat), - schema, SAFE_SQL_NTS(schema), + schema, SAFE_SQL_NTS(schema), name, SAFE_SQL_NTS(name), unique, reserved); @@ -3866,7 +3866,7 @@ PHP_FUNCTION(odbc_tableprivileges) } result = (odbc_result *)ecalloc(1, sizeof(odbc_result)); - + rc = PHP_ODBC_SQLALLOCSTMT(conn->hdbc, &(result->stmt)); if (rc == SQL_INVALID_HANDLE) { efree(result); @@ -3880,9 +3880,9 @@ PHP_FUNCTION(odbc_tableprivileges) RETURN_FALSE; } - rc = SQLTablePrivileges(result->stmt, - cat, SAFE_SQL_NTS(cat), - schema, SAFE_SQL_NTS(schema), + rc = SQLTablePrivileges(result->stmt, + cat, SAFE_SQL_NTS(cat), + schema, SAFE_SQL_NTS(schema), table, SAFE_SQL_NTS(table)); if (rc == SQL_ERROR) { |