summaryrefslogtreecommitdiff
path: root/ext/odbc/php_odbc.c
diff options
context:
space:
mode:
authorJeroen van Wolffelaar <jeroen@php.net>2001-09-25 21:58:48 +0000
committerJeroen van Wolffelaar <jeroen@php.net>2001-09-25 21:58:48 +0000
commitc03328857394bef36ffa9678d33079ad96e4a4e4 (patch)
treec0fb250db3b1bb996fc305bf56c2b74eb6d00935 /ext/odbc/php_odbc.c
parent158d34c9a57816326e141e88e1409d9f377dc2ea (diff)
downloadphp-git-c03328857394bef36ffa9678d33079ad96e4a4e4.tar.gz
Back-substitute for Z_* macro's. If it breaks some extension (the script isn't optimal, it parses for example var->zval.value incorrect) please let me know.
Diffstat (limited to 'ext/odbc/php_odbc.c')
-rw-r--r--ext/odbc/php_odbc.c250
1 files changed, 125 insertions, 125 deletions
diff --git a/ext/odbc/php_odbc.c b/ext/odbc/php_odbc.c
index 1d68dc7516..7a5ff39c9a 100644
--- a/ext/odbc/php_odbc.c
+++ b/ext/odbc/php_odbc.c
@@ -372,7 +372,7 @@ PHP_MINIT_FUNCTION(odbc)
le_result = zend_register_list_destructors_ex(_free_odbc_result, NULL, "odbc result", module_number);
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;
+ Z_TYPE(odbc_module_entry) = type;
REGISTER_STRING_CONSTANT("ODBC_TYPE", PHP_ODBC_TYPE, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("ODBC_BINMODE_PASSTHRU", 0, CONST_CS | CONST_PERSISTENT);
@@ -549,17 +549,17 @@ void php_odbc_fetch_attribs(INTERNAL_FUNCTION_PARAMETERS, int mode)
convert_to_long_ex(pv_flag);
- if ((*pv_res)->value.lval) {
+ if (Z_LVAL_PP(pv_res)) {
ZEND_FETCH_RESOURCE(result, odbc_result *, pv_res, -1, "ODBC result", le_result);
if (mode)
- result->longreadlen = (*pv_flag)->value.lval;
+ result->longreadlen = Z_LVAL_PP(pv_flag);
else
- result->binmode = (*pv_flag)->value.lval;
+ result->binmode = Z_LVAL_PP(pv_flag);
} else {
if (mode)
- ODBCG(defaultlrl) = (*pv_flag)->value.lval;
+ ODBCG(defaultlrl) = Z_LVAL_PP(pv_flag);
else
- ODBCG(defaultbinmode) = (*pv_flag)->value.lval;
+ ODBCG(defaultbinmode) = Z_LVAL_PP(pv_flag);
}
RETURN_TRUE;
}
@@ -649,7 +649,7 @@ void odbc_transact(INTERNAL_FUNCTION_PARAMETERS, int type)
static int _close_pconn_with_id(list_entry *le, int *id TSRMLS_DC)
{
- if(le->type == le_pconn && (((odbc_connection *)(le->ptr))->id == *id)){
+ if(Z_TYPE_P(le) == le_pconn && (((odbc_connection *)(le->ptr))->id == *id)){
return 1;
}else{
return 0;
@@ -685,17 +685,17 @@ void odbc_column_lengths(INTERNAL_FUNCTION_PARAMETERS, int type)
RETURN_FALSE;
}
- if ((*pv_num)->value.lval > result->numcols) {
+ if (Z_LVAL_PP(pv_num) > result->numcols) {
php_error(E_WARNING, "Field index larger than number of fields");
RETURN_FALSE;
}
- if ((*pv_num)->value.lval < 1) {
+ if (Z_LVAL_PP(pv_num) < 1) {
php_error(E_WARNING, "Field numbering starts at 1");
RETURN_FALSE;
}
- SQLColAttributes(result->stmt, (UWORD)(*pv_num)->value.lval,
+ SQLColAttributes(result->stmt, (UWORD)Z_LVAL_PP(pv_num),
(SQLUSMALLINT) (type?SQL_COLUMN_SCALE:SQL_COLUMN_PRECISION),
NULL, 0, NULL, &len);
@@ -783,7 +783,7 @@ PHP_FUNCTION(odbc_prepare)
ZEND_FETCH_RESOURCE2(conn, odbc_connection *, pv_conn, -1, "ODBC-Link", le_conn, le_pconn);
convert_to_string_ex(pv_query);
- query = (*pv_query)->value.str.val;
+ query = Z_STRVAL_PP(pv_query);
result = (odbc_result *)emalloc(sizeof(odbc_result));
if (result == NULL) {
@@ -889,7 +889,7 @@ PHP_FUNCTION(odbc_execute)
case 2:
if (zend_get_parameters_ex(2, &pv_res, &pv_param_arr) == FAILURE)
WRONG_PARAM_COUNT;
- if ((*pv_param_arr)->type != IS_ARRAY) {
+ if (Z_TYPE_PP(pv_param_arr) != IS_ARRAY) {
php_error(E_WARNING, "No array passed to odbc_execute()");
return;
}
@@ -907,24 +907,24 @@ PHP_FUNCTION(odbc_execute)
}
if (result->numparams > 0) {
- if ((ne = zend_hash_num_elements((*pv_param_arr)->value.ht)) < result->numparams) {
+ if ((ne = zend_hash_num_elements(Z_ARRVAL_PP(pv_param_arr))) < result->numparams) {
php_error(E_WARNING,"Not enough parameters (%d should be %d) given",
ne, result->numparams);
RETURN_FALSE;
}
- zend_hash_internal_pointer_reset((*pv_param_arr)->value.ht);
+ zend_hash_internal_pointer_reset(Z_ARRVAL_PP(pv_param_arr));
params = (params_t *)emalloc(sizeof(params_t) * result->numparams);
for(i = 1; i <= result->numparams; i++) {
- if (zend_hash_get_current_data((*pv_param_arr)->value.ht, (void **) &tmp) == FAILURE) {
+ if (zend_hash_get_current_data(Z_ARRVAL_PP(pv_param_arr), (void **) &tmp) == FAILURE) {
php_error(E_WARNING,"Error getting parameter");
SQLFreeStmt(result->stmt,SQL_RESET_PARAMS);
efree(params);
RETURN_FALSE;
}
convert_to_string(*tmp);
- if ((*tmp)->type != IS_STRING) {
+ if (Z_TYPE_PP(tmp) != IS_STRING) {
php_error(E_WARNING,"Error converting parameter");
SQLFreeStmt(result->stmt, SQL_RESET_PARAMS);
efree(params);
@@ -933,7 +933,7 @@ PHP_FUNCTION(odbc_execute)
SQLDescribeParam(result->stmt, (UWORD)i, &sqltype, &precision,
&scale, &nullable);
- params[i-1].vallen = (*tmp)->value.str.len;
+ params[i-1].vallen = Z_STRLEN_PP(tmp);
params[i-1].fp = -1;
if (IS_SQL_BINARY(sqltype))
@@ -941,10 +941,10 @@ PHP_FUNCTION(odbc_execute)
else
ctype = SQL_C_CHAR;
- if ((*tmp)->value.str.val[0] == '\'' &&
- (*tmp)->value.str.val[(*tmp)->value.str.len - 1] == '\'') {
- filename = &(*tmp)->value.str.val[1];
- filename[(*tmp)->value.str.len - 2] = '\0';
+ if (Z_STRVAL_PP(tmp)[0] == '\'' &&
+ Z_STRVAL_PP(tmp)[Z_STRLEN_PP(tmp) - 1] == '\'') {
+ filename = &Z_STRVAL_PP(tmp)[1];
+ filename[Z_STRLEN_PP(tmp) - 2] = '\0';
if ((params[i-1].fp = open(filename,O_RDONLY)) == -1) {
php_error(E_WARNING,"Can't open file %s", filename);
@@ -970,10 +970,10 @@ PHP_FUNCTION(odbc_execute)
#endif
rc = SQLBindParameter(result->stmt, (UWORD)i, SQL_PARAM_INPUT,
ctype, sqltype, precision, scale,
- (*tmp)->value.str.val, 0,
+ Z_STRVAL_PP(tmp), 0,
&params[i-1].vallen);
}
- zend_hash_move_forward((*pv_param_arr)->value.ht);
+ zend_hash_move_forward(Z_ARRVAL_PP(pv_param_arr));
}
}
/* Close cursor, needed for doing multiple selects */
@@ -1126,7 +1126,7 @@ PHP_FUNCTION(odbc_exec)
ZEND_FETCH_RESOURCE2(conn, odbc_connection *, pv_conn, -1, "ODBC-Link", le_conn, le_pconn);
convert_to_string_ex(pv_query);
- query = (*pv_query)->value.str.val;
+ query = Z_STRVAL_PP(pv_query);
result = (odbc_result *)emalloc(sizeof(odbc_result));
if (result == NULL) {
@@ -1228,7 +1228,7 @@ static void php_odbc_fetch_hash(INTERNAL_FUNCTION_PARAMETERS, int result_type)
if (zend_get_parameters_ex(2, &pv_res, &pv_row) == FAILURE)
WRONG_PARAM_COUNT;
convert_to_long_ex(pv_row);
- rownum = (*pv_row)->value.lval;
+ rownum = Z_LVAL_PP(pv_row);
break;
default:
WRONG_PARAM_COUNT;
@@ -1276,8 +1276,8 @@ static void php_odbc_fetch_hash(INTERNAL_FUNCTION_PARAMETERS, int result_type)
for(i = 0; i < result->numcols; i++) {
ALLOC_ZVAL(tmp);
tmp->refcount = 1;
- tmp->type = IS_STRING;
- tmp->value.str.len = 0;
+ Z_TYPE_P(tmp) = IS_STRING;
+ Z_STRLEN_P(tmp) = 0;
sql_c_type = SQL_C_CHAR;
switch(result->values[i].coltype) {
@@ -1285,14 +1285,14 @@ static void php_odbc_fetch_hash(INTERNAL_FUNCTION_PARAMETERS, int result_type)
case SQL_VARBINARY:
case SQL_LONGVARBINARY:
if (result->binmode <= 0) {
- tmp->value.str.val = empty_string;
+ Z_STRVAL_P(tmp) = empty_string;
break;
}
if (result->binmode == 1) sql_c_type = SQL_C_BINARY;
case SQL_LONGVARCHAR:
if (IS_SQL_LONG(result->values[i].coltype) &&
result->longreadlen <= 0) {
- tmp->value.str.val = empty_string;
+ Z_STRVAL_P(tmp) = empty_string;
break;
}
@@ -1306,29 +1306,29 @@ static void php_odbc_fetch_hash(INTERNAL_FUNCTION_PARAMETERS, int result_type)
RETURN_FALSE;
}
if (rc == SQL_SUCCESS_WITH_INFO) {
- tmp->value.str.len = result->longreadlen;
+ Z_STRLEN_P(tmp) = result->longreadlen;
} else if (result->values[i].vallen == SQL_NULL_DATA) {
- tmp->value.str.val = empty_string;
+ Z_STRVAL_P(tmp) = empty_string;
break;
} else {
- tmp->value.str.len = result->values[i].vallen;
+ Z_STRLEN_P(tmp) = result->values[i].vallen;
}
- tmp->value.str.val = estrndup(buf, tmp->value.str.len);
+ Z_STRVAL_P(tmp) = estrndup(buf, Z_STRLEN_P(tmp));
break;
default:
if (result->values[i].vallen == SQL_NULL_DATA) {
- tmp->value.str.val = empty_string;
+ Z_STRVAL_P(tmp) = empty_string;
break;
}
- tmp->value.str.len = result->values[i].vallen;
- tmp->value.str.val = estrndup(result->values[i].value,tmp->value.str.len);
+ Z_STRLEN_P(tmp) = result->values[i].vallen;
+ Z_STRVAL_P(tmp) = estrndup(result->values[i].value,Z_STRLEN_P(tmp));
break;
}
if (result_type & ODBC_NUM) {
- zend_hash_index_update(return_value->value.ht, i, &tmp, sizeof(pval *), NULL);
+ zend_hash_index_update(Z_ARRVAL_P(return_value), i, &tmp, sizeof(pval *), NULL);
} else {
- zend_hash_update(return_value->value.ht, result->values[i].name, strlen(result->values[i].name)+1, &tmp, sizeof(pval *), NULL);
+ zend_hash_update(Z_ARRVAL_P(return_value), result->values[i].name, strlen(result->values[i].name)+1, &tmp, sizeof(pval *), NULL);
}
}
if (buf) efree(buf);
@@ -1341,7 +1341,7 @@ PHP_FUNCTION(odbc_fetch_object)
{
php_odbc_fetch_hash(INTERNAL_FUNCTION_PARAM_PASSTHRU, ODBC_OBJECT);
if (Z_TYPE_P(return_value) == IS_ARRAY) {
- object_and_properties_init(return_value, &zend_standard_class_def, return_value->value.ht);
+ object_and_properties_init(return_value, &zend_standard_class_def, Z_ARRVAL_P(return_value));
}
}
/* }}} */
@@ -1382,7 +1382,7 @@ PHP_FUNCTION(odbc_fetch_into)
WRONG_PARAM_COUNT;
SEPARATE_ZVAL(pv_row);
convert_to_long_ex(pv_row);
- rownum = (*pv_row)->value.lval;
+ rownum = Z_LVAL_PP(pv_row);
break;
default:
WRONG_PARAM_COUNT;
@@ -1405,7 +1405,7 @@ PHP_FUNCTION(odbc_fetch_into)
RETURN_FALSE;
}
- if ((*pv_res_arr)->type != IS_ARRAY) {
+ if (Z_TYPE_PP(pv_res_arr) != IS_ARRAY) {
if (array_init(*pv_res_arr) == FAILURE) {
php_error(E_WARNING, "Can't convert to type Array");
RETURN_FALSE;
@@ -1435,8 +1435,8 @@ PHP_FUNCTION(odbc_fetch_into)
for(i = 0; i < result->numcols; i++) {
ALLOC_ZVAL(tmp);
tmp->refcount = 1;
- tmp->type = IS_STRING;
- tmp->value.str.len = 0;
+ Z_TYPE_P(tmp) = IS_STRING;
+ Z_STRLEN_P(tmp) = 0;
sql_c_type = SQL_C_CHAR;
switch(result->values[i].coltype) {
@@ -1444,14 +1444,14 @@ PHP_FUNCTION(odbc_fetch_into)
case SQL_VARBINARY:
case SQL_LONGVARBINARY:
if (result->binmode <= 0) {
- tmp->value.str.val = empty_string;
+ Z_STRVAL_P(tmp) = empty_string;
break;
}
if (result->binmode == 1) sql_c_type = SQL_C_BINARY;
case SQL_LONGVARCHAR:
if (IS_SQL_LONG(result->values[i].coltype) &&
result->longreadlen <= 0) {
- tmp->value.str.val = empty_string;
+ Z_STRVAL_P(tmp) = empty_string;
break;
}
@@ -1465,26 +1465,26 @@ PHP_FUNCTION(odbc_fetch_into)
RETURN_FALSE;
}
if (rc == SQL_SUCCESS_WITH_INFO) {
- tmp->value.str.len = result->longreadlen;
+ Z_STRLEN_P(tmp) = result->longreadlen;
} else if (result->values[i].vallen == SQL_NULL_DATA) {
- tmp->value.str.val = empty_string;
+ Z_STRVAL_P(tmp) = empty_string;
break;
} else {
- tmp->value.str.len = result->values[i].vallen;
+ Z_STRLEN_P(tmp) = result->values[i].vallen;
}
- tmp->value.str.val = estrndup(buf, tmp->value.str.len);
+ Z_STRVAL_P(tmp) = estrndup(buf, Z_STRLEN_P(tmp));
break;
default:
if (result->values[i].vallen == SQL_NULL_DATA) {
- tmp->value.str.val = empty_string;
+ Z_STRVAL_P(tmp) = empty_string;
break;
}
- tmp->value.str.len = result->values[i].vallen;
- tmp->value.str.val = estrndup(result->values[i].value,tmp->value.str.len);
+ Z_STRLEN_P(tmp) = result->values[i].vallen;
+ Z_STRVAL_P(tmp) = estrndup(result->values[i].value,Z_STRLEN_P(tmp));
break;
}
- zend_hash_index_update((*pv_res_arr)->value.ht, i, &tmp, sizeof(pval *), NULL);
+ zend_hash_index_update(Z_ARRVAL_PP(pv_res_arr), i, &tmp, sizeof(pval *), NULL);
}
if (buf) efree(buf);
RETURN_LONG(result->numcols);
@@ -1540,7 +1540,7 @@ PHP_FUNCTION(odbc_fetch_row)
if (zend_get_parameters_ex(2, &pv_res, &pv_row) == FAILURE)
WRONG_PARAM_COUNT;
convert_to_long_ex(pv_row);
- rownum = (*pv_row)->value.lval;
+ rownum = Z_LVAL_PP(pv_row);
}
ZEND_FETCH_RESOURCE(result, odbc_result *, pv_res, -1, "ODBC result", le_result);
@@ -1598,11 +1598,11 @@ PHP_FUNCTION(odbc_result)
WRONG_PARAM_COUNT;
}
- if ((*pv_field)->type == IS_STRING) {
- field = (*pv_field)->value.str.val;
+ if (Z_TYPE_PP(pv_field) == IS_STRING) {
+ field = Z_STRVAL_PP(pv_field);
} else {
convert_to_long_ex(pv_field);
- field_ind = (*pv_field)->value.lval - 1;
+ field_ind = Z_LVAL_PP(pv_field) - 1;
}
ZEND_FETCH_RESOURCE(result, odbc_result *, pv_res, -1, "ODBC result", le_result);
@@ -1792,7 +1792,7 @@ PHP_FUNCTION(odbc_result_all)
php_printf("<table><tr>");
} else {
convert_to_string_ex(pv_format);
- php_printf("<table %s ><tr>",(*pv_format)->value.str.val);
+ php_printf("<table %s ><tr>",Z_STRVAL_PP(pv_format));
}
for(i = 0; i < result->numcols; i++)
@@ -2029,7 +2029,7 @@ void odbc_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent)
WRONG_PARAM_COUNT;
}
convert_to_long_ex(pv_opt);
- cur_opt = (*pv_opt)->value.lval;
+ cur_opt = Z_LVAL_PP(pv_opt);
/* Confirm the cur_opt range */
if (! (cur_opt == SQL_CUR_USE_IF_NEEDED ||
@@ -2049,9 +2049,9 @@ void odbc_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent)
convert_to_string_ex(pv_uid);
convert_to_string_ex(pv_pwd);
- db = (*pv_db)->value.str.val;
- uid = (*pv_uid)->value.str.val;
- pwd = (*pv_pwd)->value.str.val;
+ db = Z_STRVAL_PP(pv_db);
+ uid = Z_STRVAL_PP(pv_uid);
+ pwd = Z_STRVAL_PP(pv_pwd);
if (ODBCG(allow_persistent) <= 0) {
persistent = 0;
@@ -2099,7 +2099,7 @@ try_and_get_another_connection:
RETURN_FALSE;
}
- new_le.type = le_pconn;
+ Z_TYPE(new_le) = le_pconn;
new_le.ptr = db_conn;
if (zend_hash_update(&EG(persistent_list), hashed_details, hashed_len + 1, &new_le,
sizeof(list_entry), NULL) == FAILURE) {
@@ -2111,7 +2111,7 @@ try_and_get_another_connection:
ODBCG(num_links)++;
db_conn->id = ZEND_REGISTER_RESOURCE(return_value, db_conn, le_pconn);
} else { /* found connection */
- if (le->type != le_pconn) {
+ if (Z_TYPE_P(le) != le_pconn) {
RETURN_FALSE;
}
/*
@@ -2147,15 +2147,15 @@ try_and_get_another_connection:
(void **) &index_ptr) == SUCCESS) {
int type, conn_id;
void *ptr;
- if (index_ptr->type != le_index_ptr) {
+ if (Z_TYPE_P(index_ptr) != le_index_ptr) {
RETURN_FALSE;
}
conn_id = (int)index_ptr->ptr;
ptr = zend_list_find(conn_id, &type); /* check if the connection is still there */
if (ptr && (type == le_conn || type == le_pconn)) {
zend_list_addref(conn_id);
- return_value->value.lval = conn_id;
- return_value->type = IS_RESOURCE;
+ Z_LVAL_P(return_value) = conn_id;
+ Z_TYPE_P(return_value) = IS_RESOURCE;
efree(hashed_details);
return;
} else {
@@ -2173,8 +2173,8 @@ try_and_get_another_connection:
RETURN_FALSE;
}
db_conn->id = ZEND_REGISTER_RESOURCE(return_value, db_conn, le_conn);
- new_index_ptr.ptr = (void *) return_value->value.lval;
- new_index_ptr.type = le_index_ptr;
+ new_index_ptr.ptr = (void *) Z_LVAL_P(return_value);
+ Z_TYPE(new_index_ptr) = le_index_ptr;
if (zend_hash_update(&EG(regular_list), hashed_details, hashed_len + 1, (void *) &new_index_ptr,
sizeof(list_entry), NULL) == FAILURE) {
efree(hashed_details);
@@ -2221,11 +2221,11 @@ PHP_FUNCTION(odbc_close)
}
}
- zend_list_delete((*pv_conn)->value.lval);
+ zend_list_delete(Z_LVAL_PP(pv_conn));
if(is_pconn){
zend_hash_apply_with_argument(&EG(persistent_list),
- (apply_func_arg_t) _close_pconn_with_id, (void *) &((*pv_conn)->value.lval) TSRMLS_CC);
+ (apply_func_arg_t) _close_pconn_with_id, (void *) &(Z_LVAL_PP(pv_conn)) TSRMLS_CC);
}
}
/* }}} */
@@ -2333,17 +2333,17 @@ PHP_FUNCTION(odbc_field_name)
RETURN_FALSE;
}
- if ((*pv_num)->value.lval > result->numcols) {
+ if (Z_LVAL_PP(pv_num) > result->numcols) {
php_error(E_WARNING, "Field index larger than number of fields");
RETURN_FALSE;
}
- if ((*pv_num)->value.lval < 1) {
+ if (Z_LVAL_PP(pv_num) < 1) {
php_error(E_WARNING, "Field numbering starts at 1");
RETURN_FALSE;
}
- RETURN_STRING(result->values[(*pv_num)->value.lval - 1].name, 1)
+ RETURN_STRING(result->values[Z_LVAL_PP(pv_num) - 1].name, 1)
}
/* }}} */
@@ -2369,17 +2369,17 @@ PHP_FUNCTION(odbc_field_type)
RETURN_FALSE;
}
- if ((*pv_num)->value.lval > result->numcols) {
+ if (Z_LVAL_PP(pv_num) > result->numcols) {
php_error(E_WARNING, "Field index larger than number of fields");
RETURN_FALSE;
}
- if ((*pv_num)->value.lval < 1) {
+ if (Z_LVAL_PP(pv_num) < 1) {
php_error(E_WARNING, "Field numbering starts at 1");
RETURN_FALSE;
}
- SQLColAttributes(result->stmt, (UWORD)(*pv_num)->value.lval,
+ SQLColAttributes(result->stmt, (UWORD)Z_LVAL_PP(pv_num),
SQL_COLUMN_TYPE_NAME, tmp, 31, &tmplen, NULL);
RETURN_STRING(tmp,1)
}
@@ -2423,7 +2423,7 @@ PHP_FUNCTION(odbc_field_num)
}
convert_to_string_ex(pv_name);
- fname = (*pv_name)->value.str.val;
+ fname = Z_STRVAL_PP(pv_name);
field_ind = -1;
for(i = 0; i < result->numcols; i++) {
@@ -2465,7 +2465,7 @@ PHP_FUNCTION(odbc_autocommit)
if (pv_onoff && (*pv_onoff)) {
convert_to_long_ex(pv_onoff);
rc = SQLSetConnectOption(conn->hdbc, SQL_AUTOCOMMIT,
- ((*pv_onoff)->value.lval) ?
+ (Z_LVAL_PP(pv_onoff)) ?
SQL_AUTOCOMMIT_ON : SQL_AUTOCOMMIT_OFF);
if (rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO) {
odbc_sql_error(conn, SQL_NULL_HSTMT, "Set autocommit");
@@ -2576,14 +2576,14 @@ PHP_FUNCTION(odbc_setoption)
convert_to_long_ex(pv_opt);
convert_to_long_ex(pv_val);
- switch ((*pv_which)->value.lval) {
+ switch (Z_LVAL_PP(pv_which)) {
case 1: /* SQLSetConnectOption */
ZEND_FETCH_RESOURCE2(conn, odbc_connection *, pv_handle, -1, "ODBC-Link", le_conn, le_pconn);
if (conn->persistent) {
php_error(E_WARNING, "Can't set option for persistent connection");
RETURN_FALSE;
}
- rc = SQLSetConnectOption(conn->hdbc, (unsigned short)((*pv_opt)->value.lval), (*pv_val)->value.lval);
+ rc = SQLSetConnectOption(conn->hdbc, (unsigned short)(Z_LVAL_PP(pv_opt)), Z_LVAL_PP(pv_val));
if (rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO) {
odbc_sql_error(conn, SQL_NULL_HSTMT, "SetConnectOption");
RETURN_FALSE;
@@ -2592,7 +2592,7 @@ PHP_FUNCTION(odbc_setoption)
case 2: /* SQLSetStmtOption */
ZEND_FETCH_RESOURCE(result, odbc_result *, pv_handle, -1, "ODBC result", le_result);
- rc = SQLSetStmtOption(result->stmt, (unsigned short)((*pv_opt)->value.lval), ((*pv_val)->value.lval));
+ rc = SQLSetStmtOption(result->stmt, (unsigned short)(Z_LVAL_PP(pv_opt)), (Z_LVAL_PP(pv_val)));
if (rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO) {
odbc_sql_error(result->conn_ptr, result->stmt, "SetStmtOption");
@@ -2631,16 +2631,16 @@ PHP_FUNCTION(odbc_tables)
switch (argc) {
case 5:
convert_to_string_ex(pv_type);
- type = (*pv_type)->value.str.val;
+ type = Z_STRVAL_PP(pv_type);
case 4:
convert_to_string_ex(pv_table);
- table = (*pv_table)->value.str.val;
+ table = Z_STRVAL_PP(pv_table);
case 3:
convert_to_string_ex(pv_schema);
- schema = (*pv_schema)->value.str.val;
+ schema = Z_STRVAL_PP(pv_schema);
case 2:
convert_to_string_ex(pv_cat);
- cat = (*pv_cat)->value.str.val;
+ cat = Z_STRVAL_PP(pv_cat);
}
ZEND_FETCH_RESOURCE2(conn, odbc_connection *, pv_conn, -1, "ODBC-Link", le_conn, le_pconn);
@@ -2714,16 +2714,16 @@ PHP_FUNCTION(odbc_columns)
switch (argc) {
case 5:
convert_to_string_ex(pv_column);
- column = (*pv_column)->value.str.val;
+ column = Z_STRVAL_PP(pv_column);
case 4:
convert_to_string_ex(pv_table);
- table = (*pv_table)->value.str.val;
+ table = Z_STRVAL_PP(pv_table);
case 3:
convert_to_string_ex(pv_schema);
- schema = (*pv_schema)->value.str.val;
+ schema = Z_STRVAL_PP(pv_schema);
case 2:
convert_to_string_ex(pv_cat);
- cat = (*pv_cat)->value.str.val;
+ cat = Z_STRVAL_PP(pv_cat);
}
ZEND_FETCH_RESOURCE2(conn, odbc_connection *, pv_conn, -1, "ODBC-Link", le_conn, le_pconn);
@@ -2794,13 +2794,13 @@ PHP_FUNCTION(odbc_columnprivileges)
WRONG_PARAM_COUNT;
}
convert_to_string_ex(pv_cat);
- cat = (*pv_cat)->value.str.val;
+ cat = Z_STRVAL_PP(pv_cat);
convert_to_string_ex(pv_schema);
- schema = (*pv_schema)->value.str.val;
+ schema = Z_STRVAL_PP(pv_schema);
convert_to_string_ex(pv_table);
- table = (*pv_table)->value.str.val;
+ table = Z_STRVAL_PP(pv_table);
convert_to_string_ex(pv_column);
- column = (*pv_column)->value.str.val;
+ column = Z_STRVAL_PP(pv_column);
} else {
WRONG_PARAM_COUNT;
}
@@ -2877,17 +2877,17 @@ PHP_FUNCTION(odbc_foreignkeys)
WRONG_PARAM_COUNT;
}
convert_to_string_ex(pv_pcat);
- pcat = (*pv_pcat)->value.str.val;
+ pcat = Z_STRVAL_PP(pv_pcat);
convert_to_string_ex(pv_pschema);
- pschema = (*pv_pschema)->value.str.val;
+ pschema = Z_STRVAL_PP(pv_pschema);
convert_to_string_ex(pv_ptable);
- ptable = (*pv_ptable)->value.str.val;
+ ptable = Z_STRVAL_PP(pv_ptable);
convert_to_string_ex(pv_fcat);
- fcat = (*pv_fcat)->value.str.val;
+ fcat = Z_STRVAL_PP(pv_fcat);
convert_to_string_ex(pv_fschema);
- fschema = (*pv_fschema)->value.str.val;
+ fschema = Z_STRVAL_PP(pv_fschema);
convert_to_string_ex(pv_ftable);
- ftable = (*pv_ftable)->value.str.val;
+ ftable = Z_STRVAL_PP(pv_ftable);
#ifdef HAVE_DBMAKER
#define EMPTY_TO_NULL(xstr) \
if ((int)strlen((xstr)) == 0) (xstr) = NULL
@@ -2977,7 +2977,7 @@ PHP_FUNCTION(odbc_gettypeinfo)
WRONG_PARAM_COUNT;
}
convert_to_long_ex(pv_data_type);
- data_type = (SWORD) (*pv_data_type)->value.lval;
+ data_type = (SWORD) Z_LVAL_PP(pv_data_type);
} else {
WRONG_PARAM_COUNT;
}
@@ -3045,11 +3045,11 @@ PHP_FUNCTION(odbc_primarykeys)
WRONG_PARAM_COUNT;
}
convert_to_string_ex(pv_cat);
- cat = (*pv_cat)->value.str.val;
+ cat = Z_STRVAL_PP(pv_cat);
convert_to_string_ex(pv_schema);
- schema = (*pv_schema)->value.str.val;
+ schema = Z_STRVAL_PP(pv_schema);
convert_to_string_ex(pv_table);
- table = (*pv_table)->value.str.val;
+ table = Z_STRVAL_PP(pv_table);
} else {
WRONG_PARAM_COUNT;
}
@@ -3125,13 +3125,13 @@ PHP_FUNCTION(odbc_procedurecolumns)
WRONG_PARAM_COUNT;
}
convert_to_string_ex(pv_cat);
- cat = (*pv_cat)->value.str.val;
+ cat = Z_STRVAL_PP(pv_cat);
convert_to_string_ex(pv_schema);
- schema = (*pv_schema)->value.str.val;
+ schema = Z_STRVAL_PP(pv_schema);
convert_to_string_ex(pv_proc);
- proc = (*pv_proc)->value.str.val;
+ proc = Z_STRVAL_PP(pv_proc);
convert_to_string_ex(pv_col);
- col = (*pv_col)->value.str.val;
+ col = Z_STRVAL_PP(pv_col);
} else {
WRONG_PARAM_COUNT;
}
@@ -3209,11 +3209,11 @@ PHP_FUNCTION(odbc_procedures)
WRONG_PARAM_COUNT;
}
convert_to_string_ex(pv_cat);
- cat = (*pv_cat)->value.str.val;
+ cat = Z_STRVAL_PP(pv_cat);
convert_to_string_ex(pv_schema);
- schema = (*pv_schema)->value.str.val;
+ schema = Z_STRVAL_PP(pv_schema);
convert_to_string_ex(pv_proc);
- proc = (*pv_proc)->value.str.val;
+ proc = Z_STRVAL_PP(pv_proc);
} else {
WRONG_PARAM_COUNT;
}
@@ -3289,17 +3289,17 @@ PHP_FUNCTION(odbc_specialcolumns)
WRONG_PARAM_COUNT;
}
convert_to_long_ex(pv_type);
- type = (UWORD) (*pv_type)->value.lval;
+ type = (UWORD) Z_LVAL_PP(pv_type);
convert_to_string_ex(pv_cat);
- cat = (*pv_cat)->value.str.val;
+ cat = Z_STRVAL_PP(pv_cat);
convert_to_string_ex(pv_schema);
- schema = (*pv_schema)->value.str.val;
+ schema = Z_STRVAL_PP(pv_schema);
convert_to_string_ex(pv_name);
- name = (*pv_name)->value.str.val;
+ name = Z_STRVAL_PP(pv_name);
convert_to_long_ex(pv_scope);
- scope = (UWORD) (*pv_scope)->value.lval;
+ scope = (UWORD) Z_LVAL_PP(pv_scope);
convert_to_long_ex(pv_nullable);
- nullable = (UWORD) (*pv_nullable)->value.lval;
+ nullable = (UWORD) Z_LVAL_PP(pv_nullable);
} else {
WRONG_PARAM_COUNT;
}
@@ -3376,15 +3376,15 @@ PHP_FUNCTION(odbc_statistics)
WRONG_PARAM_COUNT;
}
convert_to_string_ex(pv_cat);
- cat = (*pv_cat)->value.str.val;
+ cat = Z_STRVAL_PP(pv_cat);
convert_to_string_ex(pv_schema);
- schema = (*pv_schema)->value.str.val;
+ schema = Z_STRVAL_PP(pv_schema);
convert_to_string_ex(pv_name);
- name = (*pv_name)->value.str.val;
+ name = Z_STRVAL_PP(pv_name);
convert_to_long_ex(pv_unique);
- unique = (UWORD) (*pv_unique)->value.lval;
+ unique = (UWORD) Z_LVAL_PP(pv_unique);
convert_to_long_ex(pv_reserved);
- reserved = (UWORD) (*pv_reserved)->value.lval;
+ reserved = (UWORD) Z_LVAL_PP(pv_reserved);
} else {
WRONG_PARAM_COUNT;
}
@@ -3458,11 +3458,11 @@ PHP_FUNCTION(odbc_tableprivileges)
WRONG_PARAM_COUNT;
}
convert_to_string_ex(pv_cat);
- cat = (*pv_cat)->value.str.val;
+ cat = Z_STRVAL_PP(pv_cat);
convert_to_string_ex(pv_schema);
- schema = (*pv_schema)->value.str.val;
+ schema = Z_STRVAL_PP(pv_schema);
convert_to_string_ex(pv_table);
- table = (*pv_table)->value.str.val;
+ table = Z_STRVAL_PP(pv_table);
} else {
WRONG_PARAM_COUNT;
}