mirror of
https://github.com/php/php-src.git
synced 2024-11-25 02:44:58 +08:00
Apply PHP7 firebird fixes after API Cleanup from 8c920a22ac
This commit is contained in:
parent
03ded8c7ea
commit
8f968c5416
@ -229,8 +229,8 @@ PHP_FUNCTION(ibase_blob_create)
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
ZEND_REGISTER_RESOURCE(return_value, ib_blob, le_blob);
|
||||
Z_ADDREF_P(return_value);
|
||||
RETVAL_RES(zend_register_resource(ib_blob, le_blob));
|
||||
Z_TRY_ADDREF_P(return_value);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
@ -280,8 +280,8 @@ PHP_FUNCTION(ibase_blob_open)
|
||||
break;
|
||||
}
|
||||
|
||||
ZEND_REGISTER_RESOURCE(return_value, ib_blob, le_blob);
|
||||
Z_ADDREF_P(return_value);
|
||||
RETVAL_RES(zend_register_resource(ib_blob, le_blob));
|
||||
Z_TRY_ADDREF_P(return_value);
|
||||
return;
|
||||
|
||||
} while (0);
|
||||
@ -300,11 +300,11 @@ PHP_FUNCTION(ibase_blob_add)
|
||||
|
||||
RESET_ERRMSG;
|
||||
|
||||
if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &blob_arg, &string_arg) == FAILURE) {
|
||||
WRONG_PARAM_COUNT;
|
||||
if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rr", &blob_arg, &string_arg)) {
|
||||
return;
|
||||
}
|
||||
|
||||
ZEND_FETCH_RESOURCE(ib_blob, ibase_blob *, blob_arg, -1, "Interbase blob", le_blob);
|
||||
ib_blob = (ibase_blob *)zend_fetch_resource_ex(blob_arg, "Interbase blob", le_blob);
|
||||
|
||||
if (ib_blob->type != BLOB_INPUT) {
|
||||
_php_ibase_module_error("BLOB is not open for input");
|
||||
@ -321,25 +321,24 @@ PHP_FUNCTION(ibase_blob_add)
|
||||
Get len bytes data from open blob */
|
||||
PHP_FUNCTION(ibase_blob_get)
|
||||
{
|
||||
zval *blob_arg, *len_arg;
|
||||
zval *blob_arg;
|
||||
unsigned long len_arg;
|
||||
ibase_blob *ib_blob;
|
||||
|
||||
RESET_ERRMSG;
|
||||
|
||||
if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &blob_arg, &len_arg) == FAILURE) {
|
||||
WRONG_PARAM_COUNT;
|
||||
if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl", &blob_arg, &len_arg)) {
|
||||
return;
|
||||
}
|
||||
|
||||
ZEND_FETCH_RESOURCE(ib_blob, ibase_blob *, blob_arg, -1, "Interbase blob", le_blob);
|
||||
ib_blob = (ibase_blob *)zend_fetch_resource_ex(blob_arg, "Interbase blob", le_blob);
|
||||
|
||||
if (ib_blob->type != BLOB_OUTPUT) {
|
||||
_php_ibase_module_error("BLOB is not open for output");
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
convert_to_long_ex(len_arg);
|
||||
|
||||
if (_php_ibase_blob_get(return_value, ib_blob, Z_LVAL_P(len_arg)) != SUCCESS) {
|
||||
if (_php_ibase_blob_get(return_value, ib_blob, len_arg) != SUCCESS) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
}
|
||||
@ -353,11 +352,11 @@ static void _php_ibase_blob_end(INTERNAL_FUNCTION_PARAMETERS, int bl_end) /* {{{
|
||||
|
||||
RESET_ERRMSG;
|
||||
|
||||
if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &blob_arg) == FAILURE) {
|
||||
WRONG_PARAM_COUNT;
|
||||
if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &blob_arg)) {
|
||||
return;
|
||||
}
|
||||
|
||||
ZEND_FETCH_RESOURCE(ib_blob, ibase_blob *, blob_arg, -1, "Interbase blob", le_blob);
|
||||
ib_blob = (ibase_blob *)zend_fetch_resource_ex(blob_arg, "Interbase blob", le_blob);
|
||||
|
||||
if (bl_end == BLOB_CLOSE) { /* return id here */
|
||||
|
||||
|
@ -142,7 +142,7 @@ PHP_FUNCTION(ibase_wait_event)
|
||||
}
|
||||
|
||||
if (Z_TYPE(args[0]) == IS_RESOURCE) {
|
||||
if (!ZEND_FETCH_RESOURCE2_NO_RETURN(ib_link, ibase_db_link *, &args[0], -1, "InterBase link", le_link, le_plink)) {
|
||||
if ((ib_link = (ibase_db_link *)zend_fetch_resource2_ex(&args[0], "InterBase link", le_link, le_plink)) == NULL) {
|
||||
efree(args);
|
||||
RETURN_FALSE;
|
||||
}
|
||||
@ -152,7 +152,7 @@ PHP_FUNCTION(ibase_wait_event)
|
||||
efree(args);
|
||||
WRONG_PARAM_COUNT;
|
||||
}
|
||||
if (!ZEND_FETCH_RESOURCE2_NO_RETURN(ib_link, ibase_db_link *, NULL, IBG(default_link), "InterBase link", le_link, le_plink)) {
|
||||
if ((ib_link = (ibase_db_link *)zend_fetch_resource2_ex(IBG(default_link), "InterBase link", le_link, le_plink)) == NULL) {
|
||||
efree(args);
|
||||
RETURN_FALSE;
|
||||
}
|
||||
@ -293,7 +293,7 @@ PHP_FUNCTION(ibase_set_event_handler)
|
||||
cb_arg = &args[1];
|
||||
i = 2;
|
||||
|
||||
if (!ZEND_FETCH_RESOURCE2_NO_RETURN(ib_link, ibase_db_link *, &args[0], -1, "InterBase link", le_link, le_plink)) {
|
||||
if ((ib_link = (ibase_db_link *)zend_fetch_resource2_ex(&args[0], "InterBase link", le_link, le_plink)) == NULL) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
@ -310,7 +310,7 @@ PHP_FUNCTION(ibase_set_event_handler)
|
||||
|
||||
cb_arg = &args[0];
|
||||
|
||||
if (!ZEND_FETCH_RESOURCE2_NO_RETURN(ib_link, ibase_db_link *, NULL, IBG(default_link), "InterBase link", le_link, le_plink)) {
|
||||
if ((ib_link = (ibase_db_link *)zend_fetch_resource2_ex(IBG(default_link), "InterBase link", le_link, le_plink)) == NULL) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
link_res_id = IBG(default_link);
|
||||
@ -356,8 +356,8 @@ PHP_FUNCTION(ibase_set_event_handler)
|
||||
event->event_next = ib_link->event_head;
|
||||
ib_link->event_head = event;
|
||||
|
||||
ZEND_REGISTER_RESOURCE(return_value, event, le_event);
|
||||
Z_ADDREF_P(return_value);
|
||||
RETVAL_RES(zend_register_resource(event, le_event));
|
||||
Z_TRY_ADDREF_P(return_value);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
@ -372,7 +372,7 @@ PHP_FUNCTION(ibase_free_event_handler)
|
||||
if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS(), "r", &event_arg)) {
|
||||
ibase_event *event;
|
||||
|
||||
ZEND_FETCH_RESOURCE(event, ibase_event *, event_arg, -1, "Interbase event", le_event);
|
||||
event = (ibase_event *)zend_fetch_resource_ex(event_arg, "Interbase event", le_event);
|
||||
|
||||
event->state = DEAD;
|
||||
|
||||
|
@ -910,8 +910,8 @@ static int _php_ibase_exec(INTERNAL_FUNCTION_PARAMETERS, ibase_result **ib_resul
|
||||
(*l)->trans = trans;
|
||||
(*l)->next = NULL;
|
||||
|
||||
ZEND_REGISTER_RESOURCE(return_value, trans, le_trans);
|
||||
Z_ADDREF_P(return_value);
|
||||
RETVAL_RES(zend_register_resource(trans, le_trans));
|
||||
Z_TRY_ADDREF_P(return_value);
|
||||
|
||||
return SUCCESS;
|
||||
|
||||
@ -1080,8 +1080,8 @@ PHP_FUNCTION(ibase_query)
|
||||
if (SUCCESS == zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, 3, "rrs",
|
||||
&zlink, &ztrans, &query, &query_len)) {
|
||||
|
||||
ZEND_FETCH_RESOURCE2(ib_link, ibase_db_link*, zlink, -1, LE_LINK, le_link, le_plink);
|
||||
ZEND_FETCH_RESOURCE(trans, ibase_trans*, ztrans, -1, LE_TRANS, le_trans);
|
||||
ib_link = (ibase_db_link*)zend_fetch_resource2_ex(zlink, LE_LINK, le_link, le_plink);
|
||||
trans = (ibase_trans*)zend_fetch_resource_ex(ztrans, LE_TRANS, le_trans);
|
||||
|
||||
trans_res_id = Z_RES_P(ztrans)->handle;
|
||||
bind_i = 3;
|
||||
@ -1131,8 +1131,8 @@ PHP_FUNCTION(ibase_query)
|
||||
ib_link->tr_list = NULL;
|
||||
ib_link->event_head = NULL;
|
||||
|
||||
ZEND_REGISTER_RESOURCE(return_value, ib_link, le_link);
|
||||
Z_ADDREF_P(return_value);
|
||||
RETVAL_RES(zend_register_resource(ib_link, le_link));
|
||||
Z_TRY_ADDREF_P(return_value);
|
||||
IBG(default_link) = Z_RES_P(return_value)->handle;
|
||||
++IBG(num_links);
|
||||
}
|
||||
@ -1142,7 +1142,7 @@ PHP_FUNCTION(ibase_query)
|
||||
case 0:
|
||||
if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() ? 1 : 0, "s", &query,
|
||||
&query_len)) {
|
||||
ZEND_FETCH_RESOURCE2(ib_link, ibase_db_link *, NULL, IBG(default_link), LE_LINK,
|
||||
ib_link = (ibase_db_link *)zend_fetch_resource2_ex(IBG(default_link), LE_LINK,
|
||||
le_link, le_plink);
|
||||
|
||||
bind_i = 1;
|
||||
@ -1186,8 +1186,8 @@ PHP_FUNCTION(ibase_query)
|
||||
if (ib_query.statement_type != isc_info_sql_stmt_exec_procedure) {
|
||||
ib_query.stmt = NULL; /* keep stmt when free query */
|
||||
}
|
||||
ZEND_REGISTER_RESOURCE(return_value, result, le_result);
|
||||
Z_ADDREF_P(return_value);
|
||||
RETVAL_RES(zend_register_resource(result, le_result));
|
||||
Z_TRY_ADDREF_P(return_value);
|
||||
}
|
||||
} while (0);
|
||||
|
||||
@ -1211,7 +1211,7 @@ PHP_FUNCTION(ibase_affected_rows)
|
||||
}
|
||||
|
||||
if (!arg) {
|
||||
ZEND_FETCH_RESOURCE2(ib_link, ibase_db_link *, NULL, IBG(default_link), LE_LINK, le_link, le_plink);
|
||||
ib_link = (ibase_db_link *)zend_fetch_resource2_ex(IBG(default_link), LE_LINK, le_link, le_plink);
|
||||
if (ib_link->tr_list == NULL || ib_link->tr_list->trans == NULL) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
@ -1220,7 +1220,7 @@ PHP_FUNCTION(ibase_affected_rows)
|
||||
/* one id was passed, could be db or trans id */
|
||||
_php_ibase_get_link_trans(INTERNAL_FUNCTION_PARAM_PASSTHRU, arg, &ib_link, &trans);
|
||||
if (trans == NULL) {
|
||||
ZEND_FETCH_RESOURCE2(ib_link, ibase_db_link *, arg, -1, LE_LINK, le_link, le_plink);
|
||||
ib_link = (ibase_db_link *)zend_fetch_resource2_ex(arg, LE_LINK, le_link, le_plink);
|
||||
|
||||
if (ib_link->tr_list == NULL || ib_link->tr_list->trans == NULL) {
|
||||
RETURN_FALSE;
|
||||
@ -1268,7 +1268,7 @@ PHP_FUNCTION(ibase_num_rows)
|
||||
return;
|
||||
}
|
||||
|
||||
ZEND_FETCH_RESOURCE(ib_result, ibase_result *, &result_arg, -1, LE_RESULT, le_result);
|
||||
ib_result = (ibase_result *)zend_fetch_resource_ex(&result_arg, LE_RESULT, le_result);
|
||||
|
||||
if (isc_dsql_sql_info(IB_STATUS, &ib_result->stmt, sizeof(info_count), info_count, sizeof(result), result)) {
|
||||
_php_ibase_error();
|
||||
@ -1335,7 +1335,7 @@ static int _php_ibase_var_zval(zval *val, void *data, int type, int len, /* {{{
|
||||
#else
|
||||
if (scale == 0) {
|
||||
l = slprintf(string_data, sizeof(string_data), "%" LL_MASK "d", *(ISC_INT64 *) data);
|
||||
ZVAL_STRINGL(val,string_data,l,1);
|
||||
ZVAL_STRINGL(val,string_data,l);
|
||||
} else {
|
||||
ISC_INT64 n = *(ISC_INT64 *) data, f = scales[-scale];
|
||||
|
||||
@ -1346,7 +1346,7 @@ static int _php_ibase_var_zval(zval *val, void *data, int type, int len, /* {{{
|
||||
} else {
|
||||
l = slprintf(string_data, sizeof(string_data), "-0.%0*" LL_MASK "d", -scale, -n % f);
|
||||
}
|
||||
ZVAL_STRINGL(val,string_data,l,1);
|
||||
ZVAL_STRINGL(val,string_data,l);
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
@ -1482,7 +1482,7 @@ static void _php_ibase_fetch_hash(INTERNAL_FUNCTION_PARAMETERS, int fetch_type)
|
||||
return;
|
||||
}
|
||||
|
||||
ZEND_FETCH_RESOURCE(ib_result, ibase_result *, result_arg, -1, LE_RESULT, le_result);
|
||||
ib_result = (ibase_result *)zend_fetch_resource_ex(result_arg, LE_RESULT, le_result);
|
||||
|
||||
if (ib_result->out_sqlda == NULL || !ib_result->has_more_rows) {
|
||||
RETURN_FALSE;
|
||||
@ -1698,7 +1698,7 @@ PHP_FUNCTION(ibase_name_result)
|
||||
return;
|
||||
}
|
||||
|
||||
ZEND_FETCH_RESOURCE(ib_result, ibase_result *, result_arg, -1, LE_RESULT, le_result);
|
||||
ib_result = (ibase_result *)zend_fetch_resource_ex(result_arg, LE_RESULT, le_result);
|
||||
|
||||
if (isc_dsql_set_cursor_name(IB_STATUS, &ib_result->stmt, name_arg, 0)) {
|
||||
_php_ibase_error();
|
||||
@ -1722,7 +1722,7 @@ PHP_FUNCTION(ibase_free_result)
|
||||
return;
|
||||
}
|
||||
|
||||
ZEND_FETCH_RESOURCE(ib_result, ibase_result *, result_arg, -1, LE_RESULT, le_result);
|
||||
ib_result = (ibase_result *)zend_fetch_resource_ex(result_arg, LE_RESULT, le_result);
|
||||
zend_list_delete(Z_RES_P(result_arg));
|
||||
RETURN_TRUE;
|
||||
}
|
||||
@ -1745,7 +1745,7 @@ PHP_FUNCTION(ibase_prepare)
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &query, &query_len) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
ZEND_FETCH_RESOURCE2(ib_link, ibase_db_link *, NULL, IBG(default_link), LE_LINK, le_link, le_plink);
|
||||
ib_link = (ibase_db_link *)zend_fetch_resource2_ex(IBG(default_link), LE_LINK, le_link, le_plink);
|
||||
} else if (ZEND_NUM_ARGS() == 2) {
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS(), "rs", &link_arg, &query, &query_len) == FAILURE) {
|
||||
return;
|
||||
@ -1759,8 +1759,8 @@ PHP_FUNCTION(ibase_prepare)
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS(), "rrs", &link_arg, &trans_arg, &query, &query_len) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
ZEND_FETCH_RESOURCE2(ib_link, ibase_db_link *, link_arg, -1, LE_LINK, le_link, le_plink);
|
||||
ZEND_FETCH_RESOURCE(trans, ibase_trans *, trans_arg, -1, LE_TRANS, le_trans);
|
||||
ib_link = (ibase_db_link *)zend_fetch_resource2_ex(link_arg, LE_LINK, le_link, le_plink);
|
||||
trans = (ibase_trans *)zend_fetch_resource_ex(trans_arg, LE_TRANS, le_trans);
|
||||
trans_res_id = Z_RES_P(trans_arg)->handle;
|
||||
}
|
||||
|
||||
@ -1774,8 +1774,8 @@ PHP_FUNCTION(ibase_prepare)
|
||||
efree(ib_query);
|
||||
RETURN_FALSE;
|
||||
}
|
||||
ZEND_REGISTER_RESOURCE(return_value, ib_query, le_query);
|
||||
Z_ADDREF_P(return_value);
|
||||
RETVAL_RES(zend_register_resource(ib_query, le_query));
|
||||
Z_TRY_ADDREF_P(return_value);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
@ -1796,7 +1796,7 @@ PHP_FUNCTION(ibase_execute)
|
||||
return;
|
||||
}
|
||||
|
||||
ZEND_FETCH_RESOURCE(ib_query, ibase_query *, query, -1, LE_QUERY, le_query);
|
||||
ib_query = (ibase_query *)zend_fetch_resource_ex(query, LE_QUERY, le_query);
|
||||
|
||||
do {
|
||||
int expected_n = ib_query->in_sqlda ? ib_query->in_sqlda->sqld : 0;
|
||||
@ -1849,8 +1849,8 @@ PHP_FUNCTION(ibase_execute)
|
||||
ret = zend_list_insert(result, le_result);
|
||||
ib_query->result_res_id = Z_RES_HANDLE_P(ret);
|
||||
ZVAL_COPY_VALUE(return_value, ret);
|
||||
Z_ADDREF_P(return_value);
|
||||
Z_ADDREF_P(return_value);
|
||||
Z_TRY_ADDREF_P(return_value);
|
||||
Z_TRY_ADDREF_P(return_value);
|
||||
}
|
||||
} while (0);
|
||||
}
|
||||
@ -1869,7 +1869,7 @@ PHP_FUNCTION(ibase_free_query)
|
||||
return;
|
||||
}
|
||||
|
||||
ZEND_FETCH_RESOURCE(ib_query, ibase_query *, query_arg, -1, LE_QUERY, le_query);
|
||||
ib_query = (ibase_query *)zend_fetch_resource_ex(query_arg, LE_QUERY, le_query);
|
||||
zend_list_close(Z_RES_P(query_arg));
|
||||
RETURN_TRUE;
|
||||
}
|
||||
@ -1893,13 +1893,13 @@ PHP_FUNCTION(ibase_num_fields)
|
||||
|
||||
if (type == le_query) {
|
||||
ibase_query *ib_query;
|
||||
|
||||
ZEND_FETCH_RESOURCE(ib_query, ibase_query *, result, -1, LE_QUERY, le_query);
|
||||
|
||||
ib_query = (ibase_query *)zend_fetch_resource_ex(result, LE_QUERY, le_query);
|
||||
sqlda = ib_query->out_sqlda;
|
||||
} else {
|
||||
ibase_result *ib_result;
|
||||
|
||||
ZEND_FETCH_RESOURCE(ib_result, ibase_result *, result, -1, LE_RESULT, le_result);
|
||||
ib_result = (ibase_result *)zend_fetch_resource_ex(result, LE_RESULT, le_result);
|
||||
sqlda = ib_result->out_sqlda;
|
||||
}
|
||||
|
||||
@ -2018,12 +2018,12 @@ PHP_FUNCTION(ibase_field_info)
|
||||
if (type == le_query) {
|
||||
ibase_query *ib_query;
|
||||
|
||||
ZEND_FETCH_RESOURCE(ib_query, ibase_query *, result_arg, -1, LE_QUERY, le_query);
|
||||
ib_query= (ibase_query *)zend_fetch_resource_ex(result_arg, LE_QUERY, le_query);
|
||||
sqlda = ib_query->out_sqlda;
|
||||
} else {
|
||||
ibase_result *ib_result;
|
||||
|
||||
ZEND_FETCH_RESOURCE(ib_result, ibase_result *, result_arg, -1, LE_RESULT, le_result);
|
||||
ib_result = (ibase_result *)zend_fetch_resource_ex(result_arg, LE_RESULT, le_result);
|
||||
sqlda = ib_result->out_sqlda;
|
||||
}
|
||||
|
||||
@ -2052,7 +2052,7 @@ PHP_FUNCTION(ibase_num_params)
|
||||
return;
|
||||
}
|
||||
|
||||
ZEND_FETCH_RESOURCE(ib_query, ibase_query *, result, -1, LE_QUERY, le_query);
|
||||
ib_query = (ibase_query *)zend_fetch_resource_ex(result, LE_QUERY, le_query);
|
||||
|
||||
if (ib_query->in_sqlda == NULL) {
|
||||
RETURN_LONG(0);
|
||||
@ -2076,7 +2076,7 @@ PHP_FUNCTION(ibase_param_info)
|
||||
return;
|
||||
}
|
||||
|
||||
ZEND_FETCH_RESOURCE(ib_query, ibase_query *, result_arg, -1, LE_QUERY, le_query);
|
||||
ib_query = (ibase_query *)zend_fetch_resource_ex(result_arg, LE_QUERY, le_query);
|
||||
|
||||
if (ib_query->in_sqlda == NULL) {
|
||||
RETURN_FALSE;
|
||||
|
@ -151,7 +151,7 @@ static void _php_ibase_user(INTERNAL_FUNCTION_PARAMETERS, char operation) /* {{{
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
ZEND_FETCH_RESOURCE(svm, ibase_service *, res, -1, "Interbase service manager handle",
|
||||
svm = (ibase_service *)zend_fetch_resource_ex(res, "Interbase service manager handle",
|
||||
le_service);
|
||||
|
||||
buf[0] = operation;
|
||||
@ -245,8 +245,8 @@ PHP_FUNCTION(ibase_service_attach)
|
||||
svm->hostname = estrdup(host);
|
||||
svm->username = estrdup(user);
|
||||
|
||||
ZEND_REGISTER_RESOURCE(return_value, svm, le_service);
|
||||
Z_ADDREF_P(return_value);
|
||||
RETVAL_RES(zend_register_resource(svm, le_service));
|
||||
Z_TRY_ADDREF_P(return_value);
|
||||
svm->res = Z_RES_P(return_value);
|
||||
}
|
||||
/* }}} */
|
||||
@ -437,7 +437,7 @@ static void _php_ibase_backup_restore(INTERNAL_FUNCTION_PARAMETERS, char operati
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
ZEND_FETCH_RESOURCE(svm, ibase_service *, res, -1,
|
||||
svm = (ibase_service *)zend_fetch_resource_ex(res,
|
||||
"Interbase service manager handle", le_service);
|
||||
|
||||
/* fill the param buffer */
|
||||
@ -500,7 +500,7 @@ static void _php_ibase_service_action(INTERNAL_FUNCTION_PARAMETERS, char svc_act
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
ZEND_FETCH_RESOURCE(svm, ibase_service *, res, -1,
|
||||
svm = (ibase_service *)zend_fetch_resource_ex(res,
|
||||
"Interbase service manager handle", le_service);
|
||||
|
||||
if (svc_action == isc_action_svc_db_stats) {
|
||||
@ -606,7 +606,7 @@ PHP_FUNCTION(ibase_server_info)
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
ZEND_FETCH_RESOURCE(svm, ibase_service *, res, -1,
|
||||
svm = (ibase_service *)zend_fetch_resource_ex(res,
|
||||
"Interbase service manager handle", le_service);
|
||||
|
||||
_php_ibase_service_query(INTERNAL_FUNCTION_PARAM_PASSTHRU, svm, (char)action);
|
||||
|
@ -505,11 +505,11 @@ PHP_FUNCTION(ibase_errcode)
|
||||
void _php_ibase_error(void) /* {{{ */
|
||||
{
|
||||
char *s = IBG(errmsg);
|
||||
ISC_STATUS *statusp = IB_STATUS;
|
||||
const ISC_STATUS *statusp = IB_STATUS;
|
||||
|
||||
IBG(sql_code) = isc_sqlcode(IB_STATUS);
|
||||
|
||||
while ((s - IBG(errmsg)) < MAX_ERRMSG - (IBASE_MSGSIZE + 2) && isc_interprete(s, &statusp)) {
|
||||
while ((s - IBG(errmsg)) < MAX_ERRMSG - (IBASE_MSGSIZE + 2) && fb_interpret(s, MAX_ERRMSG, &statusp)) {
|
||||
strcat(IBG(errmsg), " ");
|
||||
s = IBG(errmsg) + strlen(IBG(errmsg));
|
||||
}
|
||||
@ -553,7 +553,7 @@ void _php_ibase_get_link_trans(INTERNAL_FUNCTION_PARAMETERS, /* {{{ */
|
||||
/* Transaction resource: make sure it refers to one link only, then
|
||||
fetch it; database link is stored in ib_trans->db_link[]. */
|
||||
IBDEBUG("Type is le_trans");
|
||||
ZEND_FETCH_RESOURCE(*trans, ibase_trans *, link_id, -1, LE_TRANS, le_trans);
|
||||
*trans = (ibase_trans *)zend_fetch_resource_ex(link_id, LE_TRANS, le_trans);
|
||||
if ((*trans)->link_cnt > 1) {
|
||||
_php_ibase_module_error("Link id is ambiguous: transaction spans multiple connections."
|
||||
);
|
||||
@ -565,7 +565,7 @@ void _php_ibase_get_link_trans(INTERNAL_FUNCTION_PARAMETERS, /* {{{ */
|
||||
IBDEBUG("Type is le_[p]link or id not found");
|
||||
/* Database link resource, use default transaction. */
|
||||
*trans = NULL;
|
||||
ZEND_FETCH_RESOURCE2(*ib_link, ibase_db_link *, link_id, -1, LE_LINK, le_link, le_plink);
|
||||
*ib_link = (ibase_db_link *)zend_fetch_resource2_ex(link_id, LE_LINK, le_link, le_plink);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
@ -941,7 +941,7 @@ static void _php_ibase_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent) /*
|
||||
xlink->gc.refcount++;
|
||||
xlink->gc.refcount++;
|
||||
IBG(default_link) = xlink->handle;
|
||||
RETURN_RES(xlink);
|
||||
RETVAL_RES(xlink);
|
||||
} else {
|
||||
zend_hash_str_del(&EG(regular_list), hash, sizeof(hash)-1);
|
||||
}
|
||||
@ -961,7 +961,7 @@ static void _php_ibase_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent) /*
|
||||
/* check if connection has timed out */
|
||||
ib_link = (ibase_db_link *) le->ptr;
|
||||
if (!isc_database_info(status, &ib_link->handle, sizeof(info), info, sizeof(result), result)) {
|
||||
ZEND_REGISTER_RESOURCE(return_value, ib_link, le_plink);
|
||||
RETVAL_RES(zend_register_resource(ib_link, le_plink));
|
||||
break;
|
||||
}
|
||||
zend_hash_str_del(&EG(persistent_list), hash, sizeof(hash)-1);
|
||||
@ -982,7 +982,7 @@ static void _php_ibase_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent) /*
|
||||
/* use non-persistent if allowed number of persistent links is exceeded */
|
||||
if (!persistent || ((l = INI_INT("ibase.max_persistent") != -1) && IBG(num_persistent) >= l)) {
|
||||
ib_link = (ibase_db_link *) emalloc(sizeof(ibase_db_link));
|
||||
ZEND_REGISTER_RESOURCE(return_value, ib_link, le_link);
|
||||
RETVAL_RES(zend_register_resource(ib_link, le_link));
|
||||
} else {
|
||||
zend_resource new_le;
|
||||
|
||||
@ -999,7 +999,7 @@ static void _php_ibase_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent) /*
|
||||
free(ib_link);
|
||||
RETURN_FALSE;
|
||||
}
|
||||
ZEND_REGISTER_RESOURCE(return_value, ib_link, le_plink);
|
||||
RETVAL_RES(zend_register_resource(ib_link, le_plink));
|
||||
++IBG(num_persistent);
|
||||
}
|
||||
ib_link->handle = db_handle;
|
||||
@ -1024,8 +1024,8 @@ static void _php_ibase_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent) /*
|
||||
}
|
||||
}
|
||||
IBG(default_link) = Z_RES_P(return_value)->handle;
|
||||
Z_ADDREF_P(return_value);
|
||||
Z_ADDREF_P(return_value);
|
||||
Z_TRY_ADDREF_P(return_value);
|
||||
Z_TRY_ADDREF_P(return_value);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
@ -1067,7 +1067,7 @@ PHP_FUNCTION(ibase_close)
|
||||
link_id = Z_RES_P(link_arg)->handle;
|
||||
}
|
||||
|
||||
ZEND_FETCH_RESOURCE2(ib_link, ibase_db_link *, link_arg, link_id, LE_LINK, le_link, le_plink);
|
||||
ib_link = (ibase_db_link *)zend_fetch_resource2_ex(link_arg, LE_LINK, le_link, le_plink);
|
||||
if (!link_arg) {
|
||||
link_arg = zend_hash_index_find(&EG(regular_list), link_id);
|
||||
zend_list_delete(Z_RES_P(link_arg));
|
||||
@ -1105,7 +1105,7 @@ PHP_FUNCTION(ibase_drop_db)
|
||||
link_id = Z_RES_P(link_arg)->handle;
|
||||
}
|
||||
|
||||
ZEND_FETCH_RESOURCE2(ib_link, ibase_db_link *, link_arg, link_id, LE_LINK, le_link, le_plink);
|
||||
ib_link = (ibase_db_link *)zend_fetch_resource2_ex(link_arg, LE_LINK, le_link, le_plink);
|
||||
|
||||
if (isc_drop_database(IB_STATUS, &ib_link->handle)) {
|
||||
_php_ibase_error();
|
||||
@ -1168,7 +1168,7 @@ PHP_FUNCTION(ibase_trans)
|
||||
|
||||
if (Z_TYPE(args[i]) == IS_RESOURCE) {
|
||||
|
||||
if (!ZEND_FETCH_RESOURCE2_NO_RETURN(ib_link[link_cnt], ibase_db_link *, &args[i], -1, LE_LINK, le_link, le_plink)) {
|
||||
if ((ib_link[link_cnt] = (ibase_db_link *)zend_fetch_resource2_ex(&args[i], LE_LINK, le_link, le_plink)) == NULL) {
|
||||
efree(teb);
|
||||
efree(tpb);
|
||||
efree(ib_link);
|
||||
@ -1236,7 +1236,7 @@ PHP_FUNCTION(ibase_trans)
|
||||
|
||||
if (link_cnt == 0) {
|
||||
link_cnt = 1;
|
||||
if (!ZEND_FETCH_RESOURCE2_NO_RETURN(ib_link[0], ibase_db_link *, NULL, IBG(default_link), LE_LINK, le_link, le_plink)) {
|
||||
if ((ib_link[0] = (ibase_db_link *)zend_fetch_resource2_ex(IBG(default_link), LE_LINK, le_link, le_plink)) == NULL) {
|
||||
efree(ib_link);
|
||||
RETURN_FALSE;
|
||||
}
|
||||
@ -1273,8 +1273,8 @@ PHP_FUNCTION(ibase_trans)
|
||||
(*l)->next = NULL;
|
||||
}
|
||||
efree(ib_link);
|
||||
ZEND_REGISTER_RESOURCE(return_value, ib_trans, le_trans);
|
||||
Z_ADDREF_P(return_value);
|
||||
RETVAL_RES(zend_register_resource(ib_trans, le_trans));
|
||||
Z_TRY_ADDREF_P(return_value);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
@ -1330,7 +1330,7 @@ static void _php_ibase_trans_end(INTERNAL_FUNCTION_PARAMETERS, int commit) /* {{
|
||||
}
|
||||
|
||||
if (ZEND_NUM_ARGS() == 0) {
|
||||
ZEND_FETCH_RESOURCE2(ib_link, ibase_db_link *, NULL, IBG(default_link), LE_LINK, le_link, le_plink);
|
||||
ib_link = (ibase_db_link *)zend_fetch_resource2_ex(IBG(default_link), LE_LINK, le_link, le_plink);
|
||||
if (ib_link->tr_list == NULL || ib_link->tr_list->trans == NULL) {
|
||||
/* this link doesn't have a default transaction */
|
||||
_php_ibase_module_error("Default link has no default transaction");
|
||||
@ -1340,10 +1340,10 @@ static void _php_ibase_trans_end(INTERNAL_FUNCTION_PARAMETERS, int commit) /* {{
|
||||
} else {
|
||||
/* one id was passed, could be db or trans id */
|
||||
if (Z_RES_P(arg)->type == le_trans) {
|
||||
ZEND_FETCH_RESOURCE(trans, ibase_trans *, arg, -1, LE_TRANS, le_trans);
|
||||
trans = (ibase_trans *)zend_fetch_resource_ex(arg, LE_TRANS, le_trans);
|
||||
res_id = Z_RES_P(arg)->handle;
|
||||
} else {
|
||||
ZEND_FETCH_RESOURCE2(ib_link, ibase_db_link *, arg, -1, LE_LINK, le_link, le_plink);
|
||||
ib_link = (ibase_db_link *)zend_fetch_resource2_ex(arg, LE_LINK, le_link, le_plink);
|
||||
|
||||
if (ib_link->tr_list == NULL || ib_link->tr_list->trans == NULL) {
|
||||
/* this link doesn't have a default transaction */
|
||||
@ -1467,7 +1467,7 @@ PHP_FUNCTION(ibase_gen_id)
|
||||
int l;
|
||||
|
||||
l = spprintf(&res, 0, "%" LL_MASK "d", result);
|
||||
RETURN_STRINGL(res, l, 0);
|
||||
RETURN_STRINGL(res, l);
|
||||
}
|
||||
#endif
|
||||
RETURN_LONG((long)result);
|
||||
|
@ -101,7 +101,7 @@ typedef struct event {
|
||||
char **events;
|
||||
char *event_buffer, *result_buffer;
|
||||
zval callback;
|
||||
void **thread_ctx;
|
||||
void *thread_ctx;
|
||||
struct event *event_next;
|
||||
enum event_state { NEW, ACTIVE, DEAD } state;
|
||||
} ibase_event;
|
||||
@ -128,7 +128,14 @@ enum php_interbase_option {
|
||||
};
|
||||
|
||||
#ifdef ZTS
|
||||
#define IBG(v) TSRMG(ibase_globals_id, zend_ibase_globals *, v)
|
||||
#else
|
||||
#endif
|
||||
|
||||
#ifdef ZTS
|
||||
# define IBG(v) ZEND_TSRMG(ibase_globals_id, zend_ibase_globals *, v)
|
||||
# ifdef COMPILE_DL_INTERBASE
|
||||
ZEND_TSRMLS_CACHE_EXTERN;
|
||||
# endif
|
||||
#else
|
||||
#define IBG(v) (ibase_globals.v)
|
||||
#endif
|
||||
@ -155,9 +162,9 @@ void _php_ibase_module_error(char *, ...)
|
||||
|
||||
/* determine if a resource is a link or transaction handle */
|
||||
#define PHP_IBASE_LINK_TRANS(zv, lh, th) \
|
||||
do { if (!zv) { \
|
||||
ZEND_FETCH_RESOURCE2(lh, ibase_db_link *, NULL, IBG(default_link), \
|
||||
"InterBase link", le_link, le_plink) } \
|
||||
do { if (!zv) { \
|
||||
lh = (ibase_db_link *)zend_fetch_resource2(IBG(default_link), \
|
||||
"InterBase link", le_link, le_plink); } \
|
||||
else \
|
||||
_php_ibase_get_link_trans(INTERNAL_FUNCTION_PARAM_PASSTHRU, zv, &lh, &th); \
|
||||
if (SUCCESS != _php_ibase_def_trans(lh, &th)) { RETURN_FALSE; } \
|
||||
|
Loading…
Reference in New Issue
Block a user