diff options
Diffstat (limited to 'ext/odbc/birdstep.c')
| -rw-r--r-- | ext/odbc/birdstep.c | 120 |
1 files changed, 60 insertions, 60 deletions
diff --git a/ext/odbc/birdstep.c b/ext/odbc/birdstep.c index feb4006ccb..9ece945f4f 100644 --- a/ext/odbc/birdstep.c +++ b/ext/odbc/birdstep.c @@ -1,6 +1,6 @@ /* +----------------------------------------------------------------------+ - | PHP Version 5 | + | PHP Version 7 | +----------------------------------------------------------------------+ | Copyright (c) 1997-2016 The PHP Group | +----------------------------------------------------------------------+ @@ -34,9 +34,9 @@ # include "config.w32.h" # include "win95nt.h" # ifdef PHP_EXPORTS -# define PHPAPI __declspec(dllexport) +# define PHPAPI __declspec(dllexport) # else -# define PHPAPI __declspec(dllimport) +# define PHPAPI __declspec(dllimport) # endif #else # include <php_config.h> @@ -118,9 +118,9 @@ const zend_function_entry birdstep_functions[] = { PHP_FE(birdstep_fieldnum, arginfo_birdstep_fieldnum) PHP_FE(birdstep_fieldname, arginfo_birdstep_fieldname) /* - * Temporary Function aliases until the next major upgrade to PHP. - * These should allow users to continue to use their current scripts, - * but should in reality warn the user that this functionality is + * Temporary Function aliases until the next major upgrade to PHP. + * These should allow users to continue to use their current scripts, + * but should in reality warn the user that this functionality is * deprecated. */ PHP_FALIAS(velocis_connect, birdstep_connect, arginfo_birdstep_connect) @@ -148,7 +148,7 @@ zend_module_entry birdstep_module_entry = { PHP_RINIT(birdstep), NULL, PHP_MINFO(birdstep), - NO_VERSION_YET, + PHP_BIRDSTEP_VERSION, STANDARD_MODULE_PROPERTIES }; @@ -159,11 +159,11 @@ ZEND_GET_MODULE(birdstep) THREAD_LS birdstep_module php_birdstep_module; THREAD_LS static HENV henv; -#define PHP_GET_BIRDSTEP_RES_IDX(id) if (!(res = birdstep_find_result(list, id))) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Birdstep: Not result index (%ld)", id); RETURN_FALSE; } -#define PHP_BIRDSTEP_CHK_LNK(id) if (!(conn = birdstep_find_conn(list, id))) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Birdstep: Not connection index (%ld)", id); RETURN_FALSE; } - +#define PHP_GET_BIRDSTEP_RES_IDX(id) if (!(res = birdstep_find_result(list, id))) { php_error_docref(NULL, E_WARNING, "Birdstep: Not result index (%ld)", id); RETURN_FALSE; } +#define PHP_BIRDSTEP_CHK_LNK(id) if (!(conn = birdstep_find_conn(list, id))) { php_error_docref(NULL, E_WARNING, "Birdstep: Not connection index (%ld)", id); RETURN_FALSE; } -static void _close_birdstep_link(zend_rsrc_list_entry *rsrc TSRMLS_DC) + +static void _close_birdstep_link(zend_rsrc_list_entry *rsrc) { VConn *conn = (VConn *)rsrc->ptr; @@ -172,7 +172,7 @@ static void _close_birdstep_link(zend_rsrc_list_entry *rsrc TSRMLS_DC) } } -static void _free_birdstep_result(zend_rsrc_list_entry *rsrc TSRMLS_DC) +static void _free_birdstep_result(zend_rsrc_list_entry *rsrc) { Vresult *res = (Vresult *)rsrc->ptr; @@ -224,11 +224,11 @@ PHP_MSHUTDOWN_FUNCTION(birdstep) /* Some internal functions. Connections and result manupulate */ -static int birdstep_add_conn(HashTable *list,VConn *conn,HDBC hdbc TSRMLS_DC) +static int birdstep_add_conn(HashTable *list,VConn *conn,HDBC hdbc) { int ind; - ind = zend_list_insert(conn,php_birdstep_module.le_link TSRMLS_CC); + ind = zend_list_insert(conn,php_birdstep_module.le_link); conn->hdbc = hdbc; conn->index = ind; @@ -287,34 +287,34 @@ static void birdstep_del_result(HashTable *list,int ind) PHP_FUNCTION(birdstep_connect) { char *serv, *user, *pass; - int serv_len, user_len, pass_len; + size_t serv_len, user_len, pass_len; RETCODE stat; HDBC hdbc; VConn *new; - long ind; + zend_long ind; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sss", &serv, &serv_len, &user, &user_len, &pass, &pass_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS(), "sss", &serv, &serv_len, &user, &user_len, &pass, &pass_len) == FAILURE) { return; } - + if ( php_birdstep_module.max_links != -1 && php_birdstep_module.num_links == php_birdstep_module.max_links ) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Birdstep: Too many open connections (%d)",php_birdstep_module.num_links); + php_error_docref(NULL, E_WARNING, "Birdstep: Too many open connections (%d)",php_birdstep_module.num_links); RETURN_FALSE; } stat = SQLAllocConnect(henv,&hdbc); if ( stat != SQL_SUCCESS ) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Birdstep: Could not allocate connection handle"); + php_error_docref(NULL, E_WARNING, "Birdstep: Could not allocate connection handle"); RETURN_FALSE; } stat = SQLConnect(hdbc, serv, SQL_NTS, user, SQL_NTS, pass, SQL_NTS); if ( stat != SQL_SUCCESS && stat != SQL_SUCCESS_WITH_INFO ) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Birdstep: Could not connect to server \"%s\" for %s", serv, user); + php_error_docref(NULL, E_WARNING, "Birdstep: Could not connect to server \"%s\" for %s", serv, user); SQLFreeConnect(hdbc); RETURN_FALSE; } new = (VConn *)emalloc(sizeof(VConn)); - ind = birdstep_add_conn(list,new,hdbc TSRMLS_CC); + ind = birdstep_add_conn(list,new,hdbc); php_birdstep_module.num_links++; RETURN_LONG(ind); } @@ -324,10 +324,10 @@ PHP_FUNCTION(birdstep_connect) */ PHP_FUNCTION(birdstep_close) { - long id; + zend_long id; VConn *conn; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &id) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &id) == FAILURE) { return; } @@ -346,15 +346,15 @@ PHP_FUNCTION(birdstep_close) PHP_FUNCTION(birdstep_exec) { char *query; - long ind; - int query_len, indx; + zend_long ind; + size_t query_len, indx; VConn *conn; Vresult *res; RETCODE stat; SWORD cols,i,colnamelen; SDWORD rows,coldesc; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ls", &ind, &query, &query_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS(), "ls", &ind, &query, &query_len) == FAILURE) { return; } @@ -363,13 +363,13 @@ PHP_FUNCTION(birdstep_exec) res = (Vresult *)emalloc(sizeof(Vresult)); stat = SQLAllocStmt(conn->hdbc,&res->hstmt); if ( stat != SQL_SUCCESS && stat != SQL_SUCCESS_WITH_INFO ) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Birdstep: SQLAllocStmt return %d",stat); + php_error_docref(NULL, E_WARNING, "Birdstep: SQLAllocStmt return %d",stat); efree(res); RETURN_FALSE; } stat = SQLExecDirect(res->hstmt,query,SQL_NTS); if ( stat != SQL_SUCCESS && stat != SQL_SUCCESS_WITH_INFO ) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Birdstep: Cannot execute \"%s\" query",query); + php_error_docref(NULL, E_WARNING, "Birdstep: Cannot execute \"%s\" query",query); SQLFreeStmt(res->hstmt,SQL_DROP); efree(res); RETURN_FALSE; @@ -377,7 +377,7 @@ PHP_FUNCTION(birdstep_exec) /* Success query */ stat = SQLNumResultCols(res->hstmt,&cols); if ( stat != SQL_SUCCESS ) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Birdstep: SQLNumResultCols return %d",stat); + php_error_docref(NULL, E_WARNING, "Birdstep: SQLNumResultCols return %d",stat); SQLFreeStmt(res->hstmt,SQL_DROP); efree(res); RETURN_FALSE; @@ -385,7 +385,7 @@ PHP_FUNCTION(birdstep_exec) if ( !cols ) { /* Was INSERT, UPDATE, DELETE, etc. query */ stat = SQLRowCount(res->hstmt,&rows); if ( stat != SQL_SUCCESS ) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Birdstep: SQLNumResultCols return %d",stat); + php_error_docref(NULL, E_WARNING, "Birdstep: SQLNumResultCols return %d",stat); SQLFreeStmt(res->hstmt,SQL_DROP); efree(res); RETURN_FALSE; @@ -426,13 +426,13 @@ PHP_FUNCTION(birdstep_exec) */ PHP_FUNCTION(birdstep_fetch) { - long ind; + zend_long ind; Vresult *res; RETCODE stat; UDWORD row; UWORD RowStat[1]; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &ind) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &ind) == FAILURE) { return; } @@ -445,7 +445,7 @@ PHP_FUNCTION(birdstep_fetch) RETURN_FALSE; } if ( stat != SQL_SUCCESS && stat != SQL_SUCCESS_WITH_INFO ) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Birdstep: SQLFetch return error"); + php_error_docref(NULL, E_WARNING, "Birdstep: SQLFetch return error"); SQLFreeStmt(res->hstmt,SQL_DROP); birdstep_del_result(list,Z_LVAL_PP(ind)); RETURN_FALSE; @@ -460,7 +460,7 @@ PHP_FUNCTION(birdstep_fetch) PHP_FUNCTION(birdstep_result) { zval **col; - long ind; + zend_long ind; Vresult *res; RETCODE stat; int i,sql_c_type; @@ -469,7 +469,7 @@ PHP_FUNCTION(birdstep_result) SWORD indx = -1; char *field = NULL; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lZ", &ind, &col) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS(), "lZ", &ind, &col) == FAILURE) { return; } @@ -489,12 +489,12 @@ PHP_FUNCTION(birdstep_result) } } if ( indx < 0 ) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Field %s not found",field); + php_error_docref(NULL, E_WARNING, "Field %s not found",field); RETURN_FALSE; } } else { if ( indx < 0 || indx >= res->numcols ) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Birdstep: Field index not in range"); + php_error_docref(NULL, E_WARNING, "Birdstep: Field index not in range"); RETURN_FALSE; } } @@ -506,7 +506,7 @@ PHP_FUNCTION(birdstep_result) RETURN_FALSE; } if ( stat != SQL_SUCCESS && stat != SQL_SUCCESS_WITH_INFO ) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Birdstep: SQLFetch return error"); + php_error_docref(NULL, E_WARNING, "Birdstep: SQLFetch return error"); SQLFreeStmt(res->hstmt,SQL_DROP); birdstep_del_result(list,Z_LVAL_PP(ind)); RETURN_FALSE; @@ -531,7 +531,7 @@ l1: RETURN_FALSE; } if ( stat != SQL_SUCCESS && stat != SQL_SUCCESS_WITH_INFO ) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Birdstep: SQLGetData return error"); + php_error_docref(NULL, E_WARNING, "Birdstep: SQLGetData return error"); SQLFreeStmt(res->hstmt,SQL_DROP); birdstep_del_result(list,Z_LVAL_PP(ind)); RETURN_FALSE; @@ -539,7 +539,7 @@ l1: if ( res->values[indx].valtype == SQL_LONGVARCHAR ) { RETURN_STRING(res->values[indx].value,TRUE); } else { - RETURN_LONG((long)res->values[indx].value); + RETURN_LONG((zend_long)res->values[indx].value); } default: if ( res->values[indx].value != NULL ) { @@ -553,10 +553,10 @@ l1: */ PHP_FUNCTION(birdstep_freeresult) { - long ind; + zend_long ind; Vresult *res; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &ind) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &ind) == FAILURE) { return; } @@ -572,11 +572,11 @@ PHP_FUNCTION(birdstep_freeresult) */ PHP_FUNCTION(birdstep_autocommit) { - long id; + zend_long id; RETCODE stat; VConn *conn; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &id) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &id) == FAILURE) { return; } @@ -584,7 +584,7 @@ PHP_FUNCTION(birdstep_autocommit) stat = SQLSetConnectOption(conn->hdbc,SQL_AUTOCOMMIT,SQL_AUTOCOMMIT_ON); if ( stat != SQL_SUCCESS && stat != SQL_SUCCESS_WITH_INFO ) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Birdstep: Set autocommit_on option failure"); + php_error_docref(NULL, E_WARNING, "Birdstep: Set autocommit_on option failure"); RETURN_FALSE; } RETURN_TRUE; @@ -595,11 +595,11 @@ PHP_FUNCTION(birdstep_autocommit) */ PHP_FUNCTION(birdstep_off_autocommit) { - long id; + zend_long id; RETCODE stat; VConn *conn; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &id) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &id) == FAILURE) { return; } @@ -607,7 +607,7 @@ PHP_FUNCTION(birdstep_off_autocommit) stat = SQLSetConnectOption(conn->hdbc,SQL_AUTOCOMMIT,SQL_AUTOCOMMIT_OFF); if ( stat != SQL_SUCCESS && stat != SQL_SUCCESS_WITH_INFO ) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Birdstep: Set autocommit_off option failure"); + php_error_docref(NULL, E_WARNING, "Birdstep: Set autocommit_off option failure"); RETURN_FALSE; } RETURN_TRUE; @@ -618,11 +618,11 @@ PHP_FUNCTION(birdstep_off_autocommit) */ PHP_FUNCTION(birdstep_commit) { - long id; + zend_long id; RETCODE stat; VConn *conn; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &id) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &id) == FAILURE) { return; } @@ -630,7 +630,7 @@ PHP_FUNCTION(birdstep_commit) stat = SQLTransact(NULL,conn->hdbc,SQL_COMMIT); if ( stat != SQL_SUCCESS ) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Birdstep: Commit failure"); + php_error_docref(NULL, E_WARNING, "Birdstep: Commit failure"); RETURN_FALSE; } RETURN_TRUE; @@ -641,11 +641,11 @@ PHP_FUNCTION(birdstep_commit) */ PHP_FUNCTION(birdstep_rollback) { - long id; + zend_long id; RETCODE stat; VConn *conn; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &id) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &id) == FAILURE) { return; } @@ -653,7 +653,7 @@ PHP_FUNCTION(birdstep_rollback) stat = SQLTransact(NULL,conn->hdbc,SQL_ROLLBACK); if ( stat != SQL_SUCCESS ) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Birdstep: Rollback failure"); + php_error_docref(NULL, E_WARNING, "Birdstep: Rollback failure"); RETURN_FALSE; } RETURN_TRUE; @@ -664,11 +664,11 @@ PHP_FUNCTION(birdstep_rollback) */ PHP_FUNCTION(birdstep_fieldname) { - long ind, col; + zend_long ind, col; Vresult *res; SWORD indx; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ll", &ind, &col) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS(), "ll", &ind, &col) == FAILURE) { return; } @@ -676,7 +676,7 @@ PHP_FUNCTION(birdstep_fieldname) indx = col; if ( indx < 0 || indx >= res->numcols ) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Birdstep: Field index not in range"); + php_error_docref(NULL, E_WARNING, "Birdstep: Field index not in range"); RETURN_FALSE; } RETURN_STRING(res->values[indx].name,TRUE); @@ -687,10 +687,10 @@ PHP_FUNCTION(birdstep_fieldname) */ PHP_FUNCTION(birdstep_fieldnum) { - long ind; + zend_long ind; Vresult *res; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &ind) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &ind) == FAILURE) { return; } |
