summaryrefslogtreecommitdiff
path: root/ext/pgsql/pgsql.c
diff options
context:
space:
mode:
Diffstat (limited to 'ext/pgsql/pgsql.c')
-rw-r--r--ext/pgsql/pgsql.c654
1 files changed, 326 insertions, 328 deletions
diff --git a/ext/pgsql/pgsql.c b/ext/pgsql/pgsql.c
index 7916afc3fc..f8635298fc 100644
--- a/ext/pgsql/pgsql.c
+++ b/ext/pgsql/pgsql.c
@@ -86,7 +86,7 @@
#define PQ_SETNONBLOCKING(pg_link, flag) 0
#endif
-#define CHECK_DEFAULT_LINK(x) if ((x) == -1) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "No PostgreSQL link opened yet"); }
+#define CHECK_DEFAULT_LINK(x) if ((x) == -1) { php_error_docref(NULL, E_WARNING, "No PostgreSQL link opened yet"); }
#define FETCH_DEFAULT_LINK() PGG(default_link) ? (int)PGG(default_link)->handle : -1
#ifndef HAVE_PQFREEMEM
@@ -838,9 +838,8 @@ static char *php_pgsql_PQescapeInternal(PGconn *conn, const char *str, size_t le
!strncmp(encoding, "GBK", sizeof("GBK")-1) ||
!strncmp(encoding, "JOHAB", sizeof("JOHAB")-1) ||
!strncmp(encoding, "UHC", sizeof("UHC")-1) ) {
- TSRMLS_FETCH();
-
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unsafe encoding is used. Do not use '%s' encoding or use PostgreSQL 9.0 or later libpq.", encoding);
+
+ php_error_docref(NULL, E_WARNING, "Unsafe encoding is used. Do not use '%s' encoding or use PostgreSQL 9.0 or later libpq.", encoding);
}
/* check backslashes */
tmp_len = strspn(str, "\\");
@@ -910,13 +909,13 @@ static inline char * _php_pgsql_trim_result(PGconn * pgsql, char **buf)
#define PHP_PQ_ERROR(text, pgsql) { \
char *msgbuf = _php_pgsql_trim_message(PQerrorMessage(pgsql), NULL); \
- php_error_docref(NULL TSRMLS_CC, E_WARNING, text, msgbuf); \
+ php_error_docref(NULL, E_WARNING, text, msgbuf); \
efree(msgbuf); \
} \
/* {{{ php_pgsql_set_default_link
*/
-static void php_pgsql_set_default_link(zend_resource *res TSRMLS_DC)
+static void php_pgsql_set_default_link(zend_resource *res)
{
GC_REFCOUNT(res)++;
@@ -930,7 +929,7 @@ static void php_pgsql_set_default_link(zend_resource *res TSRMLS_DC)
/* {{{ _close_pgsql_link
*/
-static void _close_pgsql_link(zend_resource *rsrc TSRMLS_DC)
+static void _close_pgsql_link(zend_resource *rsrc)
{
PGconn *link = (PGconn *)rsrc->ptr;
PGresult *res;
@@ -945,7 +944,7 @@ static void _close_pgsql_link(zend_resource *rsrc TSRMLS_DC)
/* {{{ _close_pgsql_plink
*/
-static void _close_pgsql_plink(zend_resource *rsrc TSRMLS_DC)
+static void _close_pgsql_plink(zend_resource *rsrc)
{
PGconn *link = (PGconn *)rsrc->ptr;
PGresult *res;
@@ -965,12 +964,11 @@ static void _php_pgsql_notice_handler(void *resource_id, const char *message)
{
php_pgsql_notice *notice;
- TSRMLS_FETCH();
if (! PGG(ignore_notices)) {
notice = (php_pgsql_notice *)emalloc(sizeof(php_pgsql_notice));
notice->message = _php_pgsql_trim_message(message, &notice->len);
if (PGG(log_notices)) {
- php_error_docref(NULL TSRMLS_CC, E_NOTICE, "%s", notice->message);
+ php_error_docref(NULL, E_NOTICE, "%s", notice->message);
}
zend_hash_index_update_ptr(&PGG(notices), (zend_ulong)resource_id, notice);
}
@@ -993,7 +991,7 @@ static void _php_pgsql_notice_ptr_dtor(zval *el)
/* {{{ _rollback_transactions
*/
-static int _rollback_transactions(zval *el TSRMLS_DC)
+static int _rollback_transactions(zval *el)
{
PGconn *link;
PGresult *res;
@@ -1006,7 +1004,7 @@ static int _rollback_transactions(zval *el TSRMLS_DC)
link = (PGconn *) rsrc->ptr;
if (PQ_SETNONBLOCKING(link, 0)) {
- php_error_docref("ref.pgsql" TSRMLS_CC, E_NOTICE, "Cannot set connection to blocking mode");
+ php_error_docref("ref.pgsql", E_NOTICE, "Cannot set connection to blocking mode");
return -1;
}
@@ -1036,7 +1034,7 @@ static int _rollback_transactions(zval *el TSRMLS_DC)
/* {{{ _free_ptr
*/
-static void _free_ptr(zend_resource *rsrc TSRMLS_DC)
+static void _free_ptr(zend_resource *rsrc)
{
pgLofp *lofp = (pgLofp *)rsrc->ptr;
efree(lofp);
@@ -1045,7 +1043,7 @@ static void _free_ptr(zend_resource *rsrc TSRMLS_DC)
/* {{{ _free_result
*/
-static void _free_result(zend_resource *rsrc TSRMLS_DC)
+static void _free_result(zend_resource *rsrc)
{
pgsql_result_handle *pg_result = (pgsql_result_handle *)rsrc->ptr;
@@ -1234,7 +1232,7 @@ PHP_RSHUTDOWN_FUNCTION(pgsql)
/* clean up notice messages */
zend_hash_clean(&PGG(notices));
/* clean up persistent connection */
- zend_hash_apply(&EG(persistent_list), (apply_func_t) _rollback_transactions TSRMLS_CC);
+ zend_hash_apply(&EG(persistent_list), (apply_func_t) _rollback_transactions);
return SUCCESS;
}
/* }}} */
@@ -1340,12 +1338,12 @@ static void php_pgsql_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent)
zend_resource new_le;
if (PGG(max_links) != -1 && PGG(num_links) >= PGG(max_links)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING,
+ php_error_docref(NULL, E_WARNING,
"Cannot create new link. Too many open links (%pd)", PGG(num_links));
goto err;
}
if (PGG(max_persistent) != -1 && PGG(num_persistent) >= PGG(max_persistent)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING,
+ php_error_docref(NULL, E_WARNING,
"Cannot create new link. Too many open persistent links (%pd)", PGG(num_persistent));
goto err;
}
@@ -1396,7 +1394,7 @@ static void php_pgsql_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent)
PQreset(le->ptr);
}
if (le->ptr == NULL || PQstatus(le->ptr) == CONNECTION_BAD) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING,"PostgreSQL link lost, unable to reconnect");
+ php_error_docref(NULL, E_WARNING,"PostgreSQL link lost, unable to reconnect");
zend_hash_del(&EG(persistent_list), str.s);
goto err;
}
@@ -1430,7 +1428,7 @@ static void php_pgsql_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent)
link = (zend_resource *)index_ptr->ptr;
if (link->ptr && (link->type == le_link || link->type == le_plink)) {
- php_pgsql_set_default_link(link TSRMLS_CC);
+ php_pgsql_set_default_link(link);
GC_REFCOUNT(link)++;
RETVAL_RES(link);
goto cleanup;
@@ -1439,7 +1437,7 @@ static void php_pgsql_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent)
}
}
if (PGG(max_links) != -1 && PGG(num_links) >= PGG(max_links)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot create new link. Too many open links (%pd)", PGG(num_links));
+ php_error_docref(NULL, E_WARNING, "Cannot create new link. Too many open links (%pd)", PGG(num_links));
goto err;
}
@@ -1455,7 +1453,7 @@ static void php_pgsql_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent)
goto err;
}
} else {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Connection string required for async connections");
+ php_error_docref(NULL, E_WARNING, "Connection string required for async connections");
goto err;
}
} else {
@@ -1488,7 +1486,7 @@ static void php_pgsql_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent)
if (! PGG(ignore_notices) && Z_TYPE_P(return_value) == IS_RESOURCE) {
PQsetNoticeProcessor(pgsql, _php_pgsql_notice_handler, (void*)Z_RES_HANDLE_P(return_value));
}
- php_pgsql_set_default_link(Z_RES_P(return_value) TSRMLS_CC);
+ php_pgsql_set_default_link(Z_RES_P(return_value));
cleanup:
smart_str_free(&str);
@@ -1531,7 +1529,7 @@ PHP_FUNCTION(pg_connect_poll)
PGconn *pgsql;
int ret;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &pgsql_link) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "r", &pgsql_link) == FAILURE) {
return;
}
@@ -1563,7 +1561,7 @@ PHP_FUNCTION(pg_close)
int id = -1, argc = ZEND_NUM_ARGS();
PGconn *pgsql;
- if (zend_parse_parameters(argc TSRMLS_CC, "|r", &pgsql_link) == FAILURE) {
+ if (zend_parse_parameters(argc, "|r", &pgsql_link) == FAILURE) {
return;
}
@@ -1610,7 +1608,7 @@ static void php_pgsql_get_link_info(INTERNAL_FUNCTION_PARAMETERS, int entry_type
char *msgbuf;
char *result;
- if (zend_parse_parameters(argc TSRMLS_CC, "|r", &pgsql_link) == FAILURE) {
+ if (zend_parse_parameters(argc, "|r", &pgsql_link) == FAILURE) {
return;
}
@@ -1758,9 +1756,9 @@ PHP_FUNCTION(pg_parameter_status)
char *param;
size_t len;
- if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "rs", &pgsql_link, &param, &len) == SUCCESS) {
+ if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS(), "rs", &pgsql_link, &param, &len) == SUCCESS) {
id = -1;
- } else if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &param, &len) == SUCCESS) {
+ } else if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &param, &len) == SUCCESS) {
pgsql_link = NULL;
id = FETCH_DEFAULT_LINK();
} else {
@@ -1791,7 +1789,7 @@ PHP_FUNCTION(pg_ping)
PGconn *pgsql;
PGresult *res;
- if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "r", &pgsql_link) == SUCCESS) {
+ if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS(), "r", &pgsql_link) == SUCCESS) {
id = -1;
} else {
pgsql_link = NULL;
@@ -1835,13 +1833,13 @@ PHP_FUNCTION(pg_query)
pgsql_result_handle *pg_result;
if (argc == 1) {
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &query, &query_len) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &query, &query_len) == FAILURE) {
return;
}
id = FETCH_DEFAULT_LINK();
CHECK_DEFAULT_LINK(id);
} else {
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs", &pgsql_link, &query, &query_len) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "rs", &pgsql_link, &query, &query_len) == FAILURE) {
return;
}
}
@@ -1853,7 +1851,7 @@ PHP_FUNCTION(pg_query)
ZEND_FETCH_RESOURCE2(pgsql, PGconn *, pgsql_link, id, "PostgreSQL link", le_link, le_plink);
if (PQ_SETNONBLOCKING(pgsql, 0)) {
- php_error_docref(NULL TSRMLS_CC, E_NOTICE,"Cannot set connection to blocking mode");
+ php_error_docref(NULL, E_NOTICE,"Cannot set connection to blocking mode");
RETURN_FALSE;
}
while ((pgsql_result = PQgetResult(pgsql))) {
@@ -1861,7 +1859,7 @@ PHP_FUNCTION(pg_query)
leftover = 1;
}
if (leftover) {
- php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Found results on this connection. Use pg_get_result() to get these results first");
+ php_error_docref(NULL, E_NOTICE, "Found results on this connection. Use pg_get_result() to get these results first");
}
pgsql_result = PQexec(pgsql, query);
if ((PGG(auto_reset_persistent) & 2) && PQstatus(pgsql) != CONNECTION_OK) {
@@ -1938,13 +1936,13 @@ PHP_FUNCTION(pg_query_params)
pgsql_result_handle *pg_result;
if (argc == 2) {
- if (zend_parse_parameters(argc TSRMLS_CC, "sa", &query, &query_len, &pv_param_arr) == FAILURE) {
+ if (zend_parse_parameters(argc, "sa", &query, &query_len, &pv_param_arr) == FAILURE) {
return;
}
id = FETCH_DEFAULT_LINK();
CHECK_DEFAULT_LINK(id);
} else {
- if (zend_parse_parameters(argc TSRMLS_CC, "rsa", &pgsql_link, &query, &query_len, &pv_param_arr) == FAILURE) {
+ if (zend_parse_parameters(argc, "rsa", &pgsql_link, &query, &query_len, &pv_param_arr) == FAILURE) {
return;
}
}
@@ -1956,7 +1954,7 @@ PHP_FUNCTION(pg_query_params)
ZEND_FETCH_RESOURCE2(pgsql, PGconn *, pgsql_link, id, "PostgreSQL link", le_link, le_plink);
if (PQ_SETNONBLOCKING(pgsql, 0)) {
- php_error_docref(NULL TSRMLS_CC, E_NOTICE,"Cannot set connection to blocking mode");
+ php_error_docref(NULL, E_NOTICE,"Cannot set connection to blocking mode");
RETURN_FALSE;
}
while ((pgsql_result = PQgetResult(pgsql))) {
@@ -1964,7 +1962,7 @@ PHP_FUNCTION(pg_query_params)
leftover = 1;
}
if (leftover) {
- php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Found results on this connection. Use pg_get_result() to get these results first");
+ php_error_docref(NULL, E_NOTICE, "Found results on this connection. Use pg_get_result() to get these results first");
}
num_params = zend_hash_num_elements(Z_ARRVAL_P(pv_param_arr));
@@ -1982,7 +1980,7 @@ PHP_FUNCTION(pg_query_params)
ZVAL_COPY(&tmp_val, tmp);
convert_to_cstring(&tmp_val);
if (Z_TYPE(tmp_val) != IS_STRING) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING,"Error converting parameter");
+ php_error_docref(NULL, E_WARNING,"Error converting parameter");
zval_ptr_dtor(&tmp_val);
_php_pgsql_free_params(params, num_params);
RETURN_FALSE;
@@ -2054,13 +2052,13 @@ PHP_FUNCTION(pg_prepare)
pgsql_result_handle *pg_result;
if (argc == 2) {
- if (zend_parse_parameters(argc TSRMLS_CC, "ss", &stmtname, &stmtname_len, &query, &query_len) == FAILURE) {
+ if (zend_parse_parameters(argc, "ss", &stmtname, &stmtname_len, &query, &query_len) == FAILURE) {
return;
}
id = FETCH_DEFAULT_LINK();
CHECK_DEFAULT_LINK(id);
} else {
- if (zend_parse_parameters(argc TSRMLS_CC, "rss", &pgsql_link, &stmtname, &stmtname_len, &query, &query_len) == FAILURE) {
+ if (zend_parse_parameters(argc, "rss", &pgsql_link, &stmtname, &stmtname_len, &query, &query_len) == FAILURE) {
return;
}
}
@@ -2072,7 +2070,7 @@ PHP_FUNCTION(pg_prepare)
ZEND_FETCH_RESOURCE2(pgsql, PGconn *, pgsql_link, id, "PostgreSQL link", le_link, le_plink);
if (PQ_SETNONBLOCKING(pgsql, 0)) {
- php_error_docref(NULL TSRMLS_CC, E_NOTICE,"Cannot set connection to blocking mode");
+ php_error_docref(NULL, E_NOTICE,"Cannot set connection to blocking mode");
RETURN_FALSE;
}
while ((pgsql_result = PQgetResult(pgsql))) {
@@ -2080,7 +2078,7 @@ PHP_FUNCTION(pg_prepare)
leftover = 1;
}
if (leftover) {
- php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Found results on this connection. Use pg_get_result() to get these results first");
+ php_error_docref(NULL, E_NOTICE, "Found results on this connection. Use pg_get_result() to get these results first");
}
pgsql_result = PQprepare(pgsql, stmtname, query, 0, NULL);
if ((PGG(auto_reset_persistent) & 2) && PQstatus(pgsql) != CONNECTION_OK) {
@@ -2141,13 +2139,13 @@ PHP_FUNCTION(pg_execute)
pgsql_result_handle *pg_result;
if (argc == 2) {
- if (zend_parse_parameters(argc TSRMLS_CC, "sa/", &stmtname, &stmtname_len, &pv_param_arr)==FAILURE) {
+ if (zend_parse_parameters(argc, "sa/", &stmtname, &stmtname_len, &pv_param_arr)==FAILURE) {
return;
}
id = FETCH_DEFAULT_LINK();
CHECK_DEFAULT_LINK(id);
} else {
- if (zend_parse_parameters(argc TSRMLS_CC, "rsa/", &pgsql_link, &stmtname, &stmtname_len, &pv_param_arr) == FAILURE) {
+ if (zend_parse_parameters(argc, "rsa/", &pgsql_link, &stmtname, &stmtname_len, &pv_param_arr) == FAILURE) {
return;
}
}
@@ -2159,7 +2157,7 @@ PHP_FUNCTION(pg_execute)
ZEND_FETCH_RESOURCE2(pgsql, PGconn *, pgsql_link, id, "PostgreSQL link", le_link, le_plink);
if (PQ_SETNONBLOCKING(pgsql, 0)) {
- php_error_docref(NULL TSRMLS_CC, E_NOTICE,"Cannot set connection to blocking mode");
+ php_error_docref(NULL, E_NOTICE,"Cannot set connection to blocking mode");
RETURN_FALSE;
}
while ((pgsql_result = PQgetResult(pgsql))) {
@@ -2167,7 +2165,7 @@ PHP_FUNCTION(pg_execute)
leftover = 1;
}
if (leftover) {
- php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Found results on this connection. Use pg_get_result() to get these results first");
+ php_error_docref(NULL, E_NOTICE, "Found results on this connection. Use pg_get_result() to get these results first");
}
num_params = zend_hash_num_elements(Z_ARRVAL_P(pv_param_arr));
@@ -2185,7 +2183,7 @@ PHP_FUNCTION(pg_execute)
ZVAL_COPY(&tmp_val, tmp);
convert_to_string(&tmp_val);
if (Z_TYPE(tmp_val) != IS_STRING) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING,"Error converting parameter");
+ php_error_docref(NULL, E_WARNING,"Error converting parameter");
zval_ptr_dtor(&tmp_val);
_php_pgsql_free_params(params, num_params);
RETURN_FALSE;
@@ -2254,7 +2252,7 @@ static void php_pgsql_get_result_info(INTERNAL_FUNCTION_PARAMETERS, int entry_ty
PGresult *pgsql_result;
pgsql_result_handle *pg_result;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &result) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "r", &result) == FAILURE) {
return;
}
@@ -2273,7 +2271,7 @@ static void php_pgsql_get_result_info(INTERNAL_FUNCTION_PARAMETERS, int entry_ty
#if HAVE_PQCMDTUPLES
RETVAL_LONG(atoi(PQcmdTuples(pgsql_result)));
#else
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Not supported under this build");
+ php_error_docref(NULL, E_WARNING, "Not supported under this build");
RETVAL_LONG(0);
#endif
break;
@@ -2318,7 +2316,7 @@ PHP_FUNCTION(pg_last_notice)
int id = -1;
php_pgsql_notice *notice;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &pgsql_link) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "r", &pgsql_link) == FAILURE) {
return;
}
@@ -2338,7 +2336,7 @@ PHP_FUNCTION(pg_last_notice)
/* {{{ get_field_name
*/
-static char *get_field_name(PGconn *pgsql, Oid oid, HashTable *list TSRMLS_DC)
+static char *get_field_name(PGconn *pgsql, Oid oid, HashTable *list)
{
PGresult *result;
smart_str str = {0};
@@ -2411,14 +2409,14 @@ PHP_FUNCTION(pg_field_table)
char *table_name;
zend_resource *field_table;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl|b", &result, &fnum, &return_oid) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "rl|b", &result, &fnum, &return_oid) == FAILURE) {
return;
}
ZEND_FETCH_RESOURCE(pg_result, pgsql_result_handle *, result, -1, "PostgreSQL result", le_result);
if (fnum < 0 || fnum >= PQnfields(pg_result->result)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Bad field offset specified");
+ php_error_docref(NULL, E_WARNING, "Bad field offset specified");
RETURN_FALSE;
}
@@ -2502,7 +2500,7 @@ static void php_pgsql_get_field_info(INTERNAL_FUNCTION_PARAMETERS, int entry_typ
pgsql_result_handle *pg_result;
Oid oid;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl", &result, &field) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "rl", &result, &field) == FAILURE) {
return;
}
@@ -2511,7 +2509,7 @@ static void php_pgsql_get_field_info(INTERNAL_FUNCTION_PARAMETERS, int entry_typ
pgsql_result = pg_result->result;
if (field < 0 || field >= PQnfields(pgsql_result)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Bad field offset specified");
+ php_error_docref(NULL, E_WARNING, "Bad field offset specified");
RETURN_FALSE;
}
@@ -2523,7 +2521,7 @@ static void php_pgsql_get_field_info(INTERNAL_FUNCTION_PARAMETERS, int entry_typ
RETURN_LONG(PQfsize(pgsql_result, (int)field));
break;
case PHP_PG_FIELD_TYPE: {
- char *name = get_field_name(pg_result->conn, PQftype(pgsql_result, (int)field), &EG(regular_list) TSRMLS_CC);
+ char *name = get_field_name(pg_result->conn, PQftype(pgsql_result, (int)field), &EG(regular_list));
RETVAL_STRING(name);
efree(name);
}
@@ -2591,7 +2589,7 @@ PHP_FUNCTION(pg_field_num)
PGresult *pgsql_result;
pgsql_result_handle *pg_result;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs", &result, &field, &field_len) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "rs", &result, &field, &field_len) == FAILURE) {
return;
}
@@ -2614,11 +2612,11 @@ PHP_FUNCTION(pg_fetch_result)
int field_offset, pgsql_row, argc = ZEND_NUM_ARGS();
if (argc == 2) {
- if (zend_parse_parameters(argc TSRMLS_CC, "rz", &result, &field) == FAILURE) {
+ if (zend_parse_parameters(argc, "rz", &result, &field) == FAILURE) {
return;
}
} else {
- if (zend_parse_parameters(argc TSRMLS_CC, "rlz", &result, &row, &field) == FAILURE) {
+ if (zend_parse_parameters(argc, "rlz", &result, &row, &field) == FAILURE) {
return;
}
}
@@ -2636,7 +2634,7 @@ PHP_FUNCTION(pg_fetch_result)
}
} else {
if (row < 0 || row >= PQntuples(pgsql_result)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to jump to row %pd on PostgreSQL result index %pd",
+ php_error_docref(NULL, E_WARNING, "Unable to jump to row %pd on PostgreSQL result index %pd",
row, Z_LVAL_P(result));
RETURN_FALSE;
}
@@ -2646,14 +2644,14 @@ PHP_FUNCTION(pg_fetch_result)
case IS_STRING:
field_offset = PQfnumber(pgsql_result, Z_STRVAL_P(field));
if (field_offset < 0 || field_offset >= PQnfields(pgsql_result)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Bad column offset specified");
+ php_error_docref(NULL, E_WARNING, "Bad column offset specified");
RETURN_FALSE;
}
break;
default:
convert_to_long_ex(field);
if (Z_LVAL_P(field) < 0 || Z_LVAL_P(field) >= PQnfields(pgsql_result)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Bad column offset specified");
+ php_error_docref(NULL, E_WARNING, "Bad column offset specified");
RETURN_FALSE;
}
field_offset = (int)Z_LVAL_P(field);
@@ -2684,21 +2682,21 @@ static void php_pgsql_fetch_hash(INTERNAL_FUNCTION_PARAMETERS, zend_long result_
if (into_object) {
zend_string *class_name = NULL;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|z!Sz", &result, &zrow, &class_name, &ctor_params) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "r|z!Sz", &result, &zrow, &class_name, &ctor_params) == FAILURE) {
return;
}
if (!class_name) {
ce = zend_standard_class_def;
} else {
- ce = zend_fetch_class(class_name, ZEND_FETCH_CLASS_AUTO TSRMLS_CC);
+ ce = zend_fetch_class(class_name, ZEND_FETCH_CLASS_AUTO);
}
if (!ce) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Could not find class '%s'", class_name->val);
+ php_error_docref(NULL, E_WARNING, "Could not find class '%s'", class_name->val);
return;
}
result_type = PGSQL_ASSOC;
} else {
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|z!l", &result, &zrow, &result_type) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "r|z!l", &result, &zrow, &result_type) == FAILURE) {
return;
}
}
@@ -2708,14 +2706,14 @@ static void php_pgsql_fetch_hash(INTERNAL_FUNCTION_PARAMETERS, zend_long result_
convert_to_long(zrow);
row = Z_LVAL_P(zrow);
if (row < 0) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "The row parameter must be greater or equal to zero");
+ php_error_docref(NULL, E_WARNING, "The row parameter must be greater or equal to zero");
RETURN_FALSE;
}
}
use_row = ZEND_NUM_ARGS() > 1 && row != -1;
if (!(result_type & PGSQL_BOTH)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid result type");
+ php_error_docref(NULL, E_WARNING, "Invalid result type");
RETURN_FALSE;
}
@@ -2725,7 +2723,7 @@ static void php_pgsql_fetch_hash(INTERNAL_FUNCTION_PARAMETERS, zend_long result_
if (use_row) {
if (row < 0 || row >= PQntuples(pgsql_result)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to jump to row %pd on PostgreSQL result index %pd",
+ php_error_docref(NULL, E_WARNING, "Unable to jump to row %pd on PostgreSQL result index %pd",
row, Z_LVAL_P(result));
RETURN_FALSE;
}
@@ -2780,7 +2778,7 @@ static void php_pgsql_fetch_hash(INTERNAL_FUNCTION_PARAMETERS, zend_long result_
*Z_OBJ_P(return_value)->properties = *Z_ARRVAL(dataset);
efree(Z_ARR(dataset));
} else {
- zend_merge_properties(return_value, Z_ARRVAL(dataset) TSRMLS_CC);
+ zend_merge_properties(return_value, Z_ARRVAL(dataset));
zval_ptr_dtor(&dataset);
}
@@ -2796,14 +2794,14 @@ static void php_pgsql_fetch_hash(INTERNAL_FUNCTION_PARAMETERS, zend_long result_
fci.no_separation = 1;
if (ctor_params && Z_TYPE_P(ctor_params) != IS_NULL) {
- if (zend_fcall_info_args(&fci, ctor_params TSRMLS_CC) == FAILURE) {
+ if (zend_fcall_info_args(&fci, ctor_params) == FAILURE) {
/* Two problems why we throw exceptions here: PHP is typeless
* and hence passing one argument that's not an array could be
* by mistake and the other way round is possible, too. The
* single value is an array. Also we'd have to make that one
* argument passed by reference.
*/
- zend_throw_exception(zend_exception_get_default(TSRMLS_C), "Parameter ctor_params must be an array", 0 TSRMLS_CC);
+ zend_throw_exception(zend_exception_get_default(), "Parameter ctor_params must be an array", 0);
return;
}
}
@@ -2814,8 +2812,8 @@ static void php_pgsql_fetch_hash(INTERNAL_FUNCTION_PARAMETERS, zend_long result_
fcc.called_scope = Z_OBJCE_P(return_value);
fcc.object = Z_OBJ_P(return_value);
- if (zend_call_function(&fci, &fcc TSRMLS_CC) == FAILURE) {
- zend_throw_exception_ex(zend_exception_get_default(TSRMLS_C), 0 TSRMLS_CC, "Could not execute %s::%s()", ce->name, ce->constructor->common.function_name);
+ if (zend_call_function(&fci, &fcc) == FAILURE) {
+ zend_throw_exception_ex(zend_exception_get_default(), 0, "Could not execute %s::%s()", ce->name, ce->constructor->common.function_name);
} else {
zval_ptr_dtor(&retval);
}
@@ -2823,7 +2821,7 @@ static void php_pgsql_fetch_hash(INTERNAL_FUNCTION_PARAMETERS, zend_long result_
efree(fci.params);
}
} else if (ctor_params) {
- zend_throw_exception_ex(zend_exception_get_default(TSRMLS_C), 0 TSRMLS_CC, "Class %s does not have a constructor hence you cannot use ctor_params", ce->name);
+ zend_throw_exception_ex(zend_exception_get_default(), 0, "Class %s does not have a constructor hence you cannot use ctor_params", ce->name);
}
}
}
@@ -2875,7 +2873,7 @@ PHP_FUNCTION(pg_fetch_all)
PGresult *pgsql_result;
pgsql_result_handle *pg_result;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &result) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "r", &result) == FAILURE) {
return;
}
@@ -2883,7 +2881,7 @@ PHP_FUNCTION(pg_fetch_all)
pgsql_result = pg_result->result;
array_init(return_value);
- if (php_pgsql_result2array(pgsql_result, return_value TSRMLS_CC) == FAILURE) {
+ if (php_pgsql_result2array(pgsql_result, return_value) == FAILURE) {
zval_dtor(return_value);
RETURN_FALSE;
}
@@ -2901,7 +2899,7 @@ PHP_FUNCTION(pg_fetch_all_columns)
int pg_numrows, pg_row;
size_t num_fields;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|l", &result, &colno) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "r|l", &result, &colno) == FAILURE) {
RETURN_FALSE;
}
@@ -2911,7 +2909,7 @@ PHP_FUNCTION(pg_fetch_all_columns)
num_fields = PQnfields(pgsql_result);
if (colno >= (zend_long)num_fields || colno < 0) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid column number '%pd'", colno);
+ php_error_docref(NULL, E_WARNING, "Invalid column number '%pd'", colno);
RETURN_FALSE;
}
@@ -2939,7 +2937,7 @@ PHP_FUNCTION(pg_result_seek)
zend_long row;
pgsql_result_handle *pg_result;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl", &result, &row) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "rl", &result, &row) == FAILURE) {
return;
}
@@ -2969,11 +2967,11 @@ static void php_pgsql_data_info(INTERNAL_FUNCTION_PARAMETERS, int entry_type)
int field_offset, pgsql_row, argc = ZEND_NUM_ARGS();
if (argc == 2) {
- if (zend_parse_parameters(argc TSRMLS_CC, "rz", &result, &field) == FAILURE) {
+ if (zend_parse_parameters(argc, "rz", &result, &field) == FAILURE) {
return;
}
} else {
- if (zend_parse_parameters(argc TSRMLS_CC, "rlz", &result, &row, &field) == FAILURE) {
+ if (zend_parse_parameters(argc, "rlz", &result, &row, &field) == FAILURE) {
return;
}
}
@@ -2991,7 +2989,7 @@ static void php_pgsql_data_info(INTERNAL_FUNCTION_PARAMETERS, int entry_type)
}
} else {
if (row < 0 || row >= PQntuples(pgsql_result)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to jump to row %pd on PostgreSQL result index %pd",
+ php_error_docref(NULL, E_WARNING, "Unable to jump to row %pd on PostgreSQL result index %pd",
row, Z_LVAL_P(result));
RETURN_FALSE;
}
@@ -3003,14 +3001,14 @@ static void php_pgsql_data_info(INTERNAL_FUNCTION_PARAMETERS, int entry_type)
convert_to_string_ex(field);
field_offset = PQfnumber(pgsql_result, Z_STRVAL_P(field));
if (field_offset < 0 || field_offset >= PQnfields(pgsql_result)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Bad column offset specified");
+ php_error_docref(NULL, E_WARNING, "Bad column offset specified");
RETURN_FALSE;
}
break;
default:
convert_to_long_ex(field);
if (Z_LVAL_P(field) < 0 || Z_LVAL_P(field) >= PQnfields(pgsql_result)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Bad column offset specified");
+ php_error_docref(NULL, E_WARNING, "Bad column offset specified");
RETURN_FALSE;
}
field_offset = (int)Z_LVAL_P(field);
@@ -3051,7 +3049,7 @@ PHP_FUNCTION(pg_free_result)
zval *result;
pgsql_result_handle *pg_result;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &result) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "r", &result) == FAILURE) {
return;
}
@@ -3075,7 +3073,7 @@ PHP_FUNCTION(pg_last_oid)
Oid oid;
#endif
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &result) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "r", &result) == FAILURE) {
return;
}
@@ -3110,7 +3108,7 @@ PHP_FUNCTION(pg_trace)
php_stream *stream;
id = FETCH_DEFAULT_LINK();
- if (zend_parse_parameters(argc TSRMLS_CC, "s|sr", &z_filename, &z_filename_len, &mode, &mode_len, &pgsql_link) == FAILURE) {
+ if (zend_parse_parameters(argc, "s|sr", &z_filename, &z_filename_len, &mode, &mode_len, &pgsql_link) == FAILURE) {
return;
}
@@ -3148,7 +3146,7 @@ PHP_FUNCTION(pg_untrace)
int id = -1, argc = ZEND_NUM_ARGS();
PGconn *pgsql;
- if (zend_parse_parameters(argc TSRMLS_CC, "|r", &pgsql_link) == FAILURE) {
+ if (zend_parse_parameters(argc, "|r", &pgsql_link) == FAILURE) {
return;
}
@@ -3176,7 +3174,7 @@ PHP_FUNCTION(pg_lo_create)
Oid pgsql_oid, wanted_oid = InvalidOid;
int id = -1, argc = ZEND_NUM_ARGS();
- if (zend_parse_parameters(argc TSRMLS_CC, "|zz", &pgsql_link, &oid) == FAILURE) {
+ if (zend_parse_parameters(argc, "|zz", &pgsql_link, &oid) == FAILURE) {
return;
}
@@ -3197,7 +3195,7 @@ PHP_FUNCTION(pg_lo_create)
if (oid) {
#ifndef HAVE_PG_LO_CREATE
- php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Passing OID value is not supported. Upgrade your PostgreSQL");
+ php_error_docref(NULL, E_NOTICE, "Passing OID value is not supported. Upgrade your PostgreSQL");
#else
switch (Z_TYPE_P(oid)) {
case IS_STRING:
@@ -3206,24 +3204,24 @@ PHP_FUNCTION(pg_lo_create)
wanted_oid = (Oid)strtoul(Z_STRVAL_P(oid), &end_ptr, 10);
if ((Z_STRVAL_P(oid)+Z_STRLEN_P(oid)) != end_ptr) {
/* wrong integer format */
- php_error_docref(NULL TSRMLS_CC, E_NOTICE, "invalid OID value passed");
+ php_error_docref(NULL, E_NOTICE, "invalid OID value passed");
RETURN_FALSE;
}
}
break;
case IS_LONG:
if (Z_LVAL_P(oid) < (zend_long)InvalidOid) {
- php_error_docref(NULL TSRMLS_CC, E_NOTICE, "invalid OID value passed");
+ php_error_docref(NULL, E_NOTICE, "invalid OID value passed");
RETURN_FALSE;
}
wanted_oid = (Oid)Z_LVAL_P(oid);
break;
default:
- php_error_docref(NULL TSRMLS_CC, E_NOTICE, "invalid OID value passed");
+ php_error_docref(NULL, E_NOTICE, "invalid OID value passed");
RETURN_FALSE;
}
if ((pgsql_oid = lo_create(pgsql, wanted_oid)) == InvalidOid) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to create PostgreSQL large object");
+ php_error_docref(NULL, E_WARNING, "Unable to create PostgreSQL large object");
RETURN_FALSE;
}
@@ -3232,7 +3230,7 @@ PHP_FUNCTION(pg_lo_create)
}
if ((pgsql_oid = lo_creat(pgsql, INV_READ|INV_WRITE)) == InvalidOid) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to create PostgreSQL large object");
+ php_error_docref(NULL, E_WARNING, "Unable to create PostgreSQL large object");
RETURN_FALSE;
}
@@ -3254,38 +3252,38 @@ PHP_FUNCTION(pg_lo_unlink)
int argc = ZEND_NUM_ARGS();
/* accept string type since Oid type is unsigned int */
- if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, argc TSRMLS_CC,
+ if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, argc,
"rs", &pgsql_link, &oid_string, &oid_strlen) == SUCCESS) {
oid = (Oid)strtoul(oid_string, &end_ptr, 10);
if ((oid_string+oid_strlen) != end_ptr) {
/* wrong integer format */
- php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Wrong OID value passed");
+ php_error_docref(NULL, E_NOTICE, "Wrong OID value passed");
RETURN_FALSE;
}
}
- else if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, argc TSRMLS_CC,
+ else if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, argc,
"rl", &pgsql_link, &oid_long) == SUCCESS) {
if (oid_long <= InvalidOid) {
- php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Invalid OID specified");
+ php_error_docref(NULL, E_NOTICE, "Invalid OID specified");
RETURN_FALSE;
}
oid = (Oid)oid_long;
}
- else if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, argc TSRMLS_CC,
+ else if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, argc,
"s", &oid_string, &oid_strlen) == SUCCESS) {
oid = (Oid)strtoul(oid_string, &end_ptr, 10);
if ((oid_string+oid_strlen) != end_ptr) {
/* wrong integer format */
- php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Wrong OID value passed");
+ php_error_docref(NULL, E_NOTICE, "Wrong OID value passed");
RETURN_FALSE;
}
id = FETCH_DEFAULT_LINK();
CHECK_DEFAULT_LINK(id);
}
- else if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, argc TSRMLS_CC,
+ else if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, argc,
"l", &oid_long) == SUCCESS) {
if (oid_long <= InvalidOid) {
- php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Invalid OID is specified");
+ php_error_docref(NULL, E_NOTICE, "Invalid OID is specified");
RETURN_FALSE;
}
oid = (Oid)oid_long;
@@ -3293,7 +3291,7 @@ PHP_FUNCTION(pg_lo_unlink)
CHECK_DEFAULT_LINK(id);
}
else {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Requires 1 or 2 arguments");
+ php_error_docref(NULL, E_WARNING, "Requires 1 or 2 arguments");
RETURN_FALSE;
}
if (pgsql_link == NULL && id == -1) {
@@ -3303,7 +3301,7 @@ PHP_FUNCTION(pg_lo_unlink)
ZEND_FETCH_RESOURCE2(pgsql, PGconn *, pgsql_link, id, "PostgreSQL link", le_link, le_plink);
if (lo_unlink(pgsql, oid) == -1) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to delete PostgreSQL large object %u", oid);
+ php_error_docref(NULL, E_WARNING, "Unable to delete PostgreSQL large object %u", oid);
RETURN_FALSE;
}
RETURN_TRUE;
@@ -3326,38 +3324,38 @@ PHP_FUNCTION(pg_lo_open)
int argc = ZEND_NUM_ARGS();
/* accept string type since Oid is unsigned int */
- if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, argc TSRMLS_CC,
+ if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, argc,
"rss", &pgsql_link, &oid_string, &oid_strlen, &mode_string, &mode_strlen) == SUCCESS) {
oid = (Oid)strtoul(oid_string, &end_ptr, 10);
if ((oid_string+oid_strlen) != end_ptr) {
/* wrong integer format */
- php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Wrong OID value passed");
+ php_error_docref(NULL, E_NOTICE, "Wrong OID value passed");
RETURN_FALSE;
}
}
- else if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, argc TSRMLS_CC,
+ else if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, argc,
"rls", &pgsql_link, &oid_long, &mode_string, &mode_strlen) == SUCCESS) {
if (oid_long <= InvalidOid) {
- php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Invalid OID specified");
+ php_error_docref(NULL, E_NOTICE, "Invalid OID specified");
RETURN_FALSE;
}
oid = (Oid)oid_long;
}
- else if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, argc TSRMLS_CC,
+ else if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, argc,
"ss", &oid_string, &oid_strlen, &mode_string, &mode_strlen) == SUCCESS) {
oid = (Oid)strtoul(oid_string, &end_ptr, 10);
if ((oid_string+oid_strlen) != end_ptr) {
/* wrong integer format */
- php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Wrong OID value passed");
+ php_error_docref(NULL, E_NOTICE, "Wrong OID value passed");
RETURN_FALSE;
}
id = FETCH_DEFAULT_LINK();
CHECK_DEFAULT_LINK(id);
}
- else if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, argc TSRMLS_CC,
+ else if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, argc,
"ls", &oid_long, &mode_string, &mode_strlen) == SUCCESS) {
if (oid_long <= InvalidOid) {
- php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Invalid OID specified");
+ php_error_docref(NULL, E_NOTICE, "Invalid OID specified");
RETURN_FALSE;
}
oid = (Oid)oid_long;
@@ -3365,7 +3363,7 @@ PHP_FUNCTION(pg_lo_open)
CHECK_DEFAULT_LINK(id);
}
else {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Requires 1 or 2 arguments");
+ php_error_docref(NULL, E_WARNING, "Requires 1 or 2 arguments");
RETURN_FALSE;
}
if (pgsql_link == NULL && id == -1) {
@@ -3399,17 +3397,17 @@ PHP_FUNCTION(pg_lo_open)
if (create) {
if ((oid = lo_creat(pgsql, INV_READ|INV_WRITE)) == 0) {
efree(pgsql_lofp);
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to create PostgreSQL large object");
+ php_error_docref(NULL, E_WARNING, "Unable to create PostgreSQL large object");
RETURN_FALSE;
} else {
if ((pgsql_lofd = lo_open(pgsql, oid, pgsql_mode)) == -1) {
if (lo_unlink(pgsql, oid) == -1) {
efree(pgsql_lofp);
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Something is really messed up! Your database is badly corrupted in a way NOT related to PHP");
+ php_error_docref(NULL, E_WARNING, "Something is really messed up! Your database is badly corrupted in a way NOT related to PHP");
RETURN_FALSE;
}
efree(pgsql_lofp);
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to open PostgreSQL large object");
+ php_error_docref(NULL, E_WARNING, "Unable to open PostgreSQL large object");
RETURN_FALSE;
} else {
pgsql_lofp->conn = pgsql;
@@ -3419,7 +3417,7 @@ PHP_FUNCTION(pg_lo_open)
}
} else {
efree(pgsql_lofp);
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to open PostgreSQL large object");
+ php_error_docref(NULL, E_WARNING, "Unable to open PostgreSQL large object");
RETURN_FALSE;
}
} else {
@@ -3437,14 +3435,14 @@ PHP_FUNCTION(pg_lo_close)
zval *pgsql_lofp;
pgLofp *pgsql;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &pgsql_lofp) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "r", &pgsql_lofp) == FAILURE) {
return;
}
ZEND_FETCH_RESOURCE(pgsql, pgLofp *, pgsql_lofp, -1, "PostgreSQL large object", le_lofp);
if (lo_close((PGconn *)pgsql->conn, pgsql->lofd) < 0) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to close PostgreSQL large object descriptor %d", pgsql->lofd);
+ php_error_docref(NULL, E_WARNING, "Unable to close PostgreSQL large object descriptor %d", pgsql->lofd);
RETVAL_FALSE;
} else {
RETVAL_TRUE;
@@ -3468,7 +3466,7 @@ PHP_FUNCTION(pg_lo_read)
zend_string *buf;
pgLofp *pgsql;
- if (zend_parse_parameters(argc TSRMLS_CC, "r|l", &pgsql_id, &len) == FAILURE) {
+ if (zend_parse_parameters(argc, "r|l", &pgsql_id, &len) == FAILURE) {
return;
}
@@ -3502,17 +3500,17 @@ PHP_FUNCTION(pg_lo_write)
pgLofp *pgsql;
int argc = ZEND_NUM_ARGS();
- if (zend_parse_parameters(argc TSRMLS_CC, "rs|l", &pgsql_id, &str, &str_len, &z_len) == FAILURE) {
+ if (zend_parse_parameters(argc, "rs|l", &pgsql_id, &str, &str_len, &z_len) == FAILURE) {
return;
}
if (argc > 2) {
if (z_len > (zend_long)str_len) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot write more than buffer size %d. Tried to write %pd", str_len, z_len);
+ php_error_docref(NULL, E_WARNING, "Cannot write more than buffer size %d. Tried to write %pd", str_len, z_len);
RETURN_FALSE;
}
if (z_len < 0) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Buffer size must be larger than 0, but %pd was specified", z_len);
+ php_error_docref(NULL, E_WARNING, "Buffer size must be larger than 0, but %pd was specified", z_len);
RETURN_FALSE;
}
len = z_len;
@@ -3541,7 +3539,7 @@ PHP_FUNCTION(pg_lo_read_all)
char buf[PGSQL_LO_READ_BUF_SIZE];
pgLofp *pgsql;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &pgsql_id) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "r", &pgsql_id) == FAILURE) {
return;
}
@@ -3568,25 +3566,25 @@ PHP_FUNCTION(pg_lo_import)
PGconn *pgsql;
Oid returned_oid;
- if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, argc TSRMLS_CC,
+ if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, argc,
"rp|z", &pgsql_link, &file_in, &name_len, &oid) == SUCCESS) {
;
}
- else if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, argc TSRMLS_CC,
+ else if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, argc,
"p|z", &file_in, &name_len, &oid) == SUCCESS) {
id = FETCH_DEFAULT_LINK();
CHECK_DEFAULT_LINK(id);
}
/* old calling convention, deprecated since PHP 4.2 */
- else if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, argc TSRMLS_CC,
+ else if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, argc,
"pr", &file_in, &name_len, &pgsql_link ) == SUCCESS) {
- php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Old API is used");
+ php_error_docref(NULL, E_NOTICE, "Old API is used");
}
else {
WRONG_PARAM_COUNT;
}
- if (php_check_open_basedir(file_in TSRMLS_CC)) {
+ if (php_check_open_basedir(file_in)) {
RETURN_FALSE;
}
@@ -3598,7 +3596,7 @@ PHP_FUNCTION(pg_lo_import)
if (oid) {
#ifndef HAVE_PG_LO_IMPORT_WITH_OID
- php_error_docref(NULL TSRMLS_CC, E_NOTICE, "OID value passing not supported");
+ php_error_docref(NULL, E_NOTICE, "OID value passing not supported");
#else
Oid wanted_oid;
switch (Z_TYPE_P(oid)) {
@@ -3608,20 +3606,20 @@ PHP_FUNCTION(pg_lo_import)
wanted_oid = (Oid)strtoul(Z_STRVAL_P(oid), &end_ptr, 10);
if ((Z_STRVAL_P(oid)+Z_STRLEN_P(oid)) != end_ptr) {
/* wrong integer format */
- php_error_docref(NULL TSRMLS_CC, E_NOTICE, "invalid OID value passed");
+ php_error_docref(NULL, E_NOTICE, "invalid OID value passed");
RETURN_FALSE;
}
}
break;
case IS_LONG:
if (Z_LVAL_P(oid) < (zend_long)InvalidOid) {
- php_error_docref(NULL TSRMLS_CC, E_NOTICE, "invalid OID value passed");
+ php_error_docref(NULL, E_NOTICE, "invalid OID value passed");
RETURN_FALSE;
}
wanted_oid = (Oid)Z_LVAL_P(oid);
break;
default:
- php_error_docref(NULL TSRMLS_CC, E_NOTICE, "invalid OID value passed");
+ php_error_docref(NULL, E_NOTICE, "invalid OID value passed");
RETURN_FALSE;
}
@@ -3659,68 +3657,68 @@ PHP_FUNCTION(pg_lo_export)
int argc = ZEND_NUM_ARGS();
/* allow string to handle large OID value correctly */
- if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, argc TSRMLS_CC,
+ if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, argc,
"rlp", &pgsql_link, &oid_long, &file_out, &name_len) == SUCCESS) {
if (oid_long <= InvalidOid) {
- php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Invalid OID specified");
+ php_error_docref(NULL, E_NOTICE, "Invalid OID specified");
RETURN_FALSE;
}
oid = (Oid)oid_long;
}
- else if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, argc TSRMLS_CC,
+ else if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, argc,
"rss", &pgsql_link, &oid_string, &oid_strlen, &file_out, &name_len) == SUCCESS) {
oid = (Oid)strtoul(oid_string, &end_ptr, 10);
if ((oid_string+oid_strlen) != end_ptr) {
/* wrong integer format */
- php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Wrong OID value passed");
+ php_error_docref(NULL, E_NOTICE, "Wrong OID value passed");
RETURN_FALSE;
}
}
- else if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, argc TSRMLS_CC,
+ else if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, argc,
"lp", &oid_long, &file_out, &name_len) == SUCCESS) {
if (oid_long <= InvalidOid) {
- php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Invalid OID specified");
+ php_error_docref(NULL, E_NOTICE, "Invalid OID specified");
RETURN_FALSE;
}
oid = (Oid)oid_long;
id = FETCH_DEFAULT_LINK();
CHECK_DEFAULT_LINK(id);
}
- else if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, argc TSRMLS_CC,
+ else if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, argc,
"sp", &oid_string, &oid_strlen, &file_out, &name_len) == SUCCESS) {
oid = (Oid)strtoul(oid_string, &end_ptr, 10);
if ((oid_string+oid_strlen) != end_ptr) {
/* wrong integer format */
- php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Wrong OID value passed");
+ php_error_docref(NULL, E_NOTICE, "Wrong OID value passed");
RETURN_FALSE;
}
id = FETCH_DEFAULT_LINK();
CHECK_DEFAULT_LINK(id);
}
- else if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, argc TSRMLS_CC,
+ else if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, argc,
"spr", &oid_string, &oid_strlen, &file_out, &name_len, &pgsql_link) == SUCCESS) {
oid = (Oid)strtoul(oid_string, &end_ptr, 10);
if ((oid_string+oid_strlen) != end_ptr) {
/* wrong integer format */
- php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Wrong OID value passed");
+ php_error_docref(NULL, E_NOTICE, "Wrong OID value passed");
RETURN_FALSE;
}
}
- else if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, argc TSRMLS_CC,
+ else if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, argc,
"lpr", &oid_long, &file_out, &name_len, &pgsql_link) == SUCCESS) {
- php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Old API is used");
+ php_error_docref(NULL, E_NOTICE, "Old API is used");
if (oid_long <= InvalidOid) {
- php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Invalid OID specified");
+ php_error_docref(NULL, E_NOTICE, "Invalid OID specified");
RETURN_FALSE;
}
oid = (Oid)oid_long;
}
else {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Requires 2 or 3 arguments");
+ php_error_docref(NULL, E_WARNING, "Requires 2 or 3 arguments");
RETURN_FALSE;
}
- if (php_check_open_basedir(file_out TSRMLS_CC)) {
+ if (php_check_open_basedir(file_out)) {
RETURN_FALSE;
}
@@ -3746,11 +3744,11 @@ PHP_FUNCTION(pg_lo_seek)
pgLofp *pgsql;
int argc = ZEND_NUM_ARGS();
- if (zend_parse_parameters(argc TSRMLS_CC, "rl|l", &pgsql_id, &offset, &whence) == FAILURE) {
+ if (zend_parse_parameters(argc, "rl|l", &pgsql_id, &offset, &whence) == FAILURE) {
return;
}
if (whence != SEEK_SET && whence != SEEK_CUR && whence != SEEK_END) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid whence parameter");
+ php_error_docref(NULL, E_WARNING, "Invalid whence parameter");
return;
}
@@ -3782,7 +3780,7 @@ PHP_FUNCTION(pg_lo_tell)
pgLofp *pgsql;
int argc = ZEND_NUM_ARGS();
- if (zend_parse_parameters(argc TSRMLS_CC, "r", &pgsql_id) == FAILURE) {
+ if (zend_parse_parameters(argc, "r", &pgsql_id) == FAILURE) {
return;
}
@@ -3812,7 +3810,7 @@ PHP_FUNCTION(pg_lo_truncate)
int argc = ZEND_NUM_ARGS();
int result;
- if (zend_parse_parameters(argc TSRMLS_CC, "rl", &pgsql_id, &size) == FAILURE) {
+ if (zend_parse_parameters(argc, "rl", &pgsql_id, &size) == FAILURE) {
return;
}
@@ -3847,13 +3845,13 @@ PHP_FUNCTION(pg_set_error_verbosity)
PGconn *pgsql;
if (argc == 1) {
- if (zend_parse_parameters(argc TSRMLS_CC, "l", &verbosity) == FAILURE) {
+ if (zend_parse_parameters(argc, "l", &verbosity) == FAILURE) {
return;
}
id = FETCH_DEFAULT_LINK();
CHECK_DEFAULT_LINK(id);
} else {
- if (zend_parse_parameters(argc TSRMLS_CC, "rl", &pgsql_link, &verbosity) == FAILURE) {
+ if (zend_parse_parameters(argc, "rl", &pgsql_link, &verbosity) == FAILURE) {
return;
}
}
@@ -3885,13 +3883,13 @@ PHP_FUNCTION(pg_set_client_encoding)
PGconn *pgsql;
if (argc == 1) {
- if (zend_parse_parameters(argc TSRMLS_CC, "s", &encoding, &encoding_len) == FAILURE) {
+ if (zend_parse_parameters(argc, "s", &encoding, &encoding_len) == FAILURE) {
return;
}
id = FETCH_DEFAULT_LINK();
CHECK_DEFAULT_LINK(id);
} else {
- if (zend_parse_parameters(argc TSRMLS_CC, "rs", &pgsql_link, &encoding, &encoding_len) == FAILURE) {
+ if (zend_parse_parameters(argc, "rs", &pgsql_link, &encoding, &encoding_len) == FAILURE) {
return;
}
}
@@ -3914,7 +3912,7 @@ PHP_FUNCTION(pg_client_encoding)
int id = -1, argc = ZEND_NUM_ARGS();
PGconn *pgsql;
- if (zend_parse_parameters(argc TSRMLS_CC, "|r", &pgsql_link) == FAILURE) {
+ if (zend_parse_parameters(argc, "|r", &pgsql_link) == FAILURE) {
return;
}
@@ -3949,7 +3947,7 @@ PHP_FUNCTION(pg_end_copy)
PGconn *pgsql;
int result = 0;
- if (zend_parse_parameters(argc TSRMLS_CC, "|r", &pgsql_link) == FAILURE) {
+ if (zend_parse_parameters(argc, "|r", &pgsql_link) == FAILURE) {
return;
}
@@ -3986,13 +3984,13 @@ PHP_FUNCTION(pg_put_line)
int result = 0, argc = ZEND_NUM_ARGS();
if (argc == 1) {
- if (zend_parse_parameters(argc TSRMLS_CC, "s", &query, &query_len) == FAILURE) {
+ if (zend_parse_parameters(argc, "s", &query, &query_len) == FAILURE) {
return;
}
id = FETCH_DEFAULT_LINK();
CHECK_DEFAULT_LINK(id);
} else {
- if (zend_parse_parameters(argc TSRMLS_CC, "rs", &pgsql_link, &query, &query_len) == FAILURE) {
+ if (zend_parse_parameters(argc, "rs", &pgsql_link, &query, &query_len) == FAILURE) {
return;
}
}
@@ -4032,7 +4030,7 @@ PHP_FUNCTION(pg_copy_to)
int ret;
int argc = ZEND_NUM_ARGS();
- if (zend_parse_parameters(argc TSRMLS_CC, "rs|ss",
+ if (zend_parse_parameters(argc, "rs|ss",
&pgsql_link, &table_name, &table_name_len,
&pg_delim, &pg_delim_len, &pg_null_as, &pg_null_as_len) == FAILURE) {
return;
@@ -4164,7 +4162,7 @@ PHP_FUNCTION(pg_copy_from)
ExecStatusType status;
int argc = ZEND_NUM_ARGS();
- if (zend_parse_parameters(argc TSRMLS_CC, "rsa|ss",
+ if (zend_parse_parameters(argc, "rsa|ss",
&pgsql_link, &table_name, &table_name_len, &pg_rows,
&pg_delim, &pg_delim_len, &pg_null_as, &pg_null_as_len) == FAILURE) {
return;
@@ -4283,7 +4281,7 @@ PHP_FUNCTION(pg_escape_string)
switch (ZEND_NUM_ARGS()) {
case 1:
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S", &from) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "S", &from) == FAILURE) {
return;
}
pgsql_link = NULL;
@@ -4291,7 +4289,7 @@ PHP_FUNCTION(pg_escape_string)
break;
default:
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rS", &pgsql_link, &from) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "rS", &pgsql_link, &from) == FAILURE) {
return;
}
break;
@@ -4328,7 +4326,7 @@ PHP_FUNCTION(pg_escape_bytea)
switch (ZEND_NUM_ARGS()) {
case 1:
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &from, &from_len) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &from, &from_len) == FAILURE) {
return;
}
pgsql_link = NULL;
@@ -4336,7 +4334,7 @@ PHP_FUNCTION(pg_escape_bytea)
break;
default:
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs", &pgsql_link, &from, &from_len) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "rs", &pgsql_link, &from, &from_len) == FAILURE) {
return;
}
break;
@@ -4468,7 +4466,7 @@ PHP_FUNCTION(pg_unescape_bytea)
char *from = NULL, *to = NULL, *tmp = NULL;
size_t to_len;
size_t from_len;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s",
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "s",
&from, &from_len) == FAILURE) {
return;
}
@@ -4481,7 +4479,7 @@ PHP_FUNCTION(pg_unescape_bytea)
to = (char *)php_pgsql_unescape_bytea((unsigned char*)from, &to_len);
#endif
if (!to) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING,"Invalid parameter");
+ php_error_docref(NULL, E_WARNING,"Invalid parameter");
RETURN_FALSE;
}
RETVAL_STRINGL(to, to_len);
@@ -4501,7 +4499,7 @@ static void php_pgsql_escape_internal(INTERNAL_FUNCTION_PARAMETERS, int escape_l
switch (ZEND_NUM_ARGS()) {
case 1:
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &from, &from_len) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &from, &from_len) == FAILURE) {
return;
}
pgsql_link = NULL;
@@ -4509,20 +4507,20 @@ static void php_pgsql_escape_internal(INTERNAL_FUNCTION_PARAMETERS, int escape_l
break;
default:
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs", &pgsql_link, &from, &from_len) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "rs", &pgsql_link, &from, &from_len) == FAILURE) {
return;
}
break;
}
if (pgsql_link == NULL && id == -1) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING,"Cannot get default pgsql link");
+ php_error_docref(NULL, E_WARNING,"Cannot get default pgsql link");
RETURN_FALSE;
}
ZEND_FETCH_RESOURCE2(pgsql, PGconn *, pgsql_link, id, "PostgreSQL link", le_link, le_plink);
if (pgsql == NULL) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING,"Cannot get pgsql link");
+ php_error_docref(NULL, E_WARNING,"Cannot get pgsql link");
RETURN_FALSE;
}
@@ -4532,7 +4530,7 @@ static void php_pgsql_escape_internal(INTERNAL_FUNCTION_PARAMETERS, int escape_l
tmp = PGSQLescapeIdentifier(pgsql, from, (size_t)from_len);
}
if (!tmp) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING,"Failed to escape");
+ php_error_docref(NULL, E_WARNING,"Failed to escape");
RETURN_FALSE;
}
@@ -4567,7 +4565,7 @@ PHP_FUNCTION(pg_result_error)
pgsql_result_handle *pg_result;
char *err = NULL;
- if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "r",
+ if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS(), "r",
&result) == FAILURE) {
RETURN_FALSE;
}
@@ -4594,7 +4592,7 @@ PHP_FUNCTION(pg_result_error_field)
pgsql_result_handle *pg_result;
char *field = NULL;
- if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "rl",
+ if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS(), "rl",
&result, &fieldcode) == FAILURE) {
RETURN_FALSE;
}
@@ -4636,7 +4634,7 @@ PHP_FUNCTION(pg_connection_status)
int id = -1;
PGconn *pgsql;
- if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "r",
+ if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS(), "r",
&pgsql_link) == FAILURE) {
RETURN_FALSE;
}
@@ -4657,7 +4655,7 @@ PHP_FUNCTION(pg_transaction_status)
int id = -1;
PGconn *pgsql;
- if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "r",
+ if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS(), "r",
&pgsql_link) == FAILURE) {
RETURN_FALSE;
}
@@ -4678,7 +4676,7 @@ PHP_FUNCTION(pg_connection_reset)
int id = -1;
PGconn *pgsql;
- if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "r",
+ if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS(), "r",
&pgsql_link) == FAILURE) {
RETURN_FALSE;
}
@@ -4698,13 +4696,13 @@ PHP_FUNCTION(pg_connection_reset)
/* {{{ php_pgsql_flush_query
*/
-static int php_pgsql_flush_query(PGconn *pgsql TSRMLS_DC)
+static int php_pgsql_flush_query(PGconn *pgsql)
{
PGresult *res;
int leftover = 0;
if (PQ_SETNONBLOCKING(pgsql, 1)) {
- php_error_docref(NULL TSRMLS_CC, E_NOTICE,"Cannot set connection to nonblocking mode");
+ php_error_docref(NULL, E_NOTICE,"Cannot set connection to nonblocking mode");
return -1;
}
while ((res = PQgetResult(pgsql))) {
@@ -4725,7 +4723,7 @@ static void php_pgsql_do_async(INTERNAL_FUNCTION_PARAMETERS, int entry_type)
PGconn *pgsql;
PGresult *pgsql_result;
- if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "r",
+ if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS(), "r",
&pgsql_link) == FAILURE) {
RETURN_FALSE;
}
@@ -4733,7 +4731,7 @@ static void php_pgsql_do_async(INTERNAL_FUNCTION_PARAMETERS, int entry_type)
ZEND_FETCH_RESOURCE2(pgsql, PGconn *, pgsql_link, id, "PostgreSQL link", le_link, le_plink);
if (PQ_SETNONBLOCKING(pgsql, 1)) {
- php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Cannot set connection to nonblocking mode");
+ php_error_docref(NULL, E_NOTICE, "Cannot set connection to nonblocking mode");
RETURN_FALSE;
}
switch(entry_type) {
@@ -4748,11 +4746,11 @@ static void php_pgsql_do_async(INTERNAL_FUNCTION_PARAMETERS, int entry_type)
}
break;
default:
- php_error_docref(NULL TSRMLS_CC, E_ERROR, "PostgreSQL module error, please report this error");
+ php_error_docref(NULL, E_ERROR, "PostgreSQL module error, please report this error");
break;
}
if (PQ_SETNONBLOCKING(pgsql, 0)) {
- php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Cannot set connection to blocking mode");
+ php_error_docref(NULL, E_NOTICE, "Cannot set connection to blocking mode");
}
convert_to_boolean_ex(return_value);
}
@@ -4797,7 +4795,7 @@ PHP_FUNCTION(pg_send_query)
int is_non_blocking;
int ret;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs", &pgsql_link, &query, &len) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "rs", &pgsql_link, &query, &len) == FAILURE) {
return;
}
@@ -4806,12 +4804,12 @@ PHP_FUNCTION(pg_send_query)
is_non_blocking = PQisnonblocking(pgsql);
if (is_non_blocking == 0 && PQ_SETNONBLOCKING(pgsql, 1) == -1) {
- php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Cannot set connection to nonblocking mode");
+ php_error_docref(NULL, E_NOTICE, "Cannot set connection to nonblocking mode");
RETURN_FALSE;
}
if (_php_pgsql_link_has_results(pgsql)) {
- php_error_docref(NULL TSRMLS_CC, E_NOTICE,
+ php_error_docref(NULL, E_NOTICE,
"There are results on this connection. Call pg_get_result() until it returns FALSE");
}
@@ -4833,14 +4831,14 @@ PHP_FUNCTION(pg_send_query)
/* Wait to finish sending buffer */
while ((ret = PQflush(pgsql))) {
if (ret == -1) {
- php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Could not empty PostgreSQL send buffer");
+ php_error_docref(NULL, E_NOTICE, "Could not empty PostgreSQL send buffer");
break;
}
usleep(10000);
}
if (PQ_SETNONBLOCKING(pgsql, 0)) {
- php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Cannot set connection to blocking mode");
+ php_error_docref(NULL, E_NOTICE, "Cannot set connection to blocking mode");
}
}
@@ -4869,7 +4867,7 @@ PHP_FUNCTION(pg_send_query_params)
int is_non_blocking;
int ret;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rsa/", &pgsql_link, &query, &query_len, &pv_param_arr) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "rsa/", &pgsql_link, &query, &query_len, &pv_param_arr) == FAILURE) {
return;
}
@@ -4882,12 +4880,12 @@ PHP_FUNCTION(pg_send_query_params)
is_non_blocking = PQisnonblocking(pgsql);
if (is_non_blocking == 0 && PQ_SETNONBLOCKING(pgsql, 1) == -1) {
- php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Cannot set connection to nonblocking mode");
+ php_error_docref(NULL, E_NOTICE, "Cannot set connection to nonblocking mode");
RETURN_FALSE;
}
if (_php_pgsql_link_has_results(pgsql)) {
- php_error_docref(NULL TSRMLS_CC, E_NOTICE,
+ php_error_docref(NULL, E_NOTICE,
"There are results on this connection. Call pg_get_result() until it returns FALSE");
}
@@ -4905,7 +4903,7 @@ PHP_FUNCTION(pg_send_query_params)
ZVAL_COPY(&tmp_val, tmp);
convert_to_string(&tmp_val);
if (Z_TYPE(tmp_val) != IS_STRING) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING,"Error converting parameter");
+ php_error_docref(NULL, E_WARNING,"Error converting parameter");
zval_ptr_dtor(&tmp_val);
_php_pgsql_free_params(params, num_params);
RETURN_FALSE;
@@ -4939,14 +4937,14 @@ PHP_FUNCTION(pg_send_query_params)
/* Wait to finish sending buffer */
while ((ret = PQflush(pgsql))) {
if (ret == -1) {
- php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Could not empty PostgreSQL send buffer");
+ php_error_docref(NULL, E_NOTICE, "Could not empty PostgreSQL send buffer");
break;
}
usleep(10000);
}
if (PQ_SETNONBLOCKING(pgsql, 0) != 0) {
- php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Cannot set connection to blocking mode");
+ php_error_docref(NULL, E_NOTICE, "Cannot set connection to blocking mode");
}
}
@@ -4974,7 +4972,7 @@ PHP_FUNCTION(pg_send_prepare)
int is_non_blocking;
int ret;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rss", &pgsql_link, &stmtname, &stmtname_len, &query, &query_len) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "rss", &pgsql_link, &stmtname, &stmtname_len, &query, &query_len) == FAILURE) {
return;
}
@@ -4987,12 +4985,12 @@ PHP_FUNCTION(pg_send_prepare)
is_non_blocking = PQisnonblocking(pgsql);
if (is_non_blocking == 0 && PQ_SETNONBLOCKING(pgsql, 1) == -1) {
- php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Cannot set connection to nonblocking mode");
+ php_error_docref(NULL, E_NOTICE, "Cannot set connection to nonblocking mode");
RETURN_FALSE;
}
if (_php_pgsql_link_has_results(pgsql)) {
- php_error_docref(NULL TSRMLS_CC, E_NOTICE,
+ php_error_docref(NULL, E_NOTICE,
"There are results on this connection. Call pg_get_result() until it returns FALSE");
}
@@ -5015,13 +5013,13 @@ PHP_FUNCTION(pg_send_prepare)
/* Wait to finish sending buffer */
while ((ret = PQflush(pgsql))) {
if (ret == -1) {
- php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Could not empty PostgreSQL send buffer");
+ php_error_docref(NULL, E_NOTICE, "Could not empty PostgreSQL send buffer");
break;
}
usleep(10000);
}
if (PQ_SETNONBLOCKING(pgsql, 0) != 0) {
- php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Cannot set connection to blocking mode");
+ php_error_docref(NULL, E_NOTICE, "Cannot set connection to blocking mode");
}
}
@@ -5052,7 +5050,7 @@ PHP_FUNCTION(pg_send_execute)
int is_non_blocking;
int ret;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rsa", &pgsql_link, &stmtname, &stmtname_len, &pv_param_arr) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "rsa", &pgsql_link, &stmtname, &stmtname_len, &pv_param_arr) == FAILURE) {
return;
}
@@ -5065,12 +5063,12 @@ PHP_FUNCTION(pg_send_execute)
is_non_blocking = PQisnonblocking(pgsql);
if (is_non_blocking == 0 && PQ_SETNONBLOCKING(pgsql, 1) == -1) {
- php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Cannot set connection to nonblocking mode");
+ php_error_docref(NULL, E_NOTICE, "Cannot set connection to nonblocking mode");
RETURN_FALSE;
}
if (_php_pgsql_link_has_results(pgsql)) {
- php_error_docref(NULL TSRMLS_CC, E_NOTICE,
+ php_error_docref(NULL, E_NOTICE,
"There are results on this connection. Call pg_get_result() until it returns FALSE");
}
@@ -5088,7 +5086,7 @@ PHP_FUNCTION(pg_send_execute)
ZVAL_COPY(&tmp_val, tmp);
convert_to_string(&tmp_val);
if (Z_TYPE(tmp_val) != IS_STRING) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING,"Error converting parameter");
+ php_error_docref(NULL, E_WARNING,"Error converting parameter");
zval_ptr_dtor(&tmp_val);
_php_pgsql_free_params(params, num_params);
RETURN_FALSE;
@@ -5122,13 +5120,13 @@ PHP_FUNCTION(pg_send_execute)
/* Wait to finish sending buffer */
while ((ret = PQflush(pgsql))) {
if (ret == -1) {
- php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Could not empty PostgreSQL send buffer");
+ php_error_docref(NULL, E_NOTICE, "Could not empty PostgreSQL send buffer");
break;
}
usleep(10000);
}
if (PQ_SETNONBLOCKING(pgsql, 0) != 0) {
- php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Cannot set connection to blocking mode");
+ php_error_docref(NULL, E_NOTICE, "Cannot set connection to blocking mode");
}
}
@@ -5153,7 +5151,7 @@ PHP_FUNCTION(pg_get_result)
PGresult *pgsql_result;
pgsql_result_handle *pg_result;
- if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "r", &pgsql_link) == FAILURE) {
+ if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS(), "r", &pgsql_link) == FAILURE) {
RETURN_FALSE;
}
@@ -5182,7 +5180,7 @@ PHP_FUNCTION(pg_result_status)
PGresult *pgsql_result;
pgsql_result_handle *pg_result;
- if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "r|l",
+ if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS(), "r|l",
&result, &result_type) == FAILURE) {
RETURN_FALSE;
}
@@ -5198,7 +5196,7 @@ PHP_FUNCTION(pg_result_status)
RETURN_STRING(PQcmdStatus(pgsql_result));
}
else {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Optional 2nd parameter should be PGSQL_STATUS_LONG or PGSQL_STATUS_STRING");
+ php_error_docref(NULL, E_WARNING, "Optional 2nd parameter should be PGSQL_STATUS_LONG or PGSQL_STATUS_STRING");
RETURN_FALSE;
}
}
@@ -5214,7 +5212,7 @@ PHP_FUNCTION(pg_get_notify)
PGconn *pgsql;
PGnotify *pgsql_notify;
- if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "r|l",
+ if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS(), "r|l",
&pgsql_link, &result_type) == FAILURE) {
RETURN_FALSE;
}
@@ -5222,7 +5220,7 @@ PHP_FUNCTION(pg_get_notify)
ZEND_FETCH_RESOURCE2(pgsql, PGconn *, pgsql_link, id, "PostgreSQL link", le_link, le_plink);
if (!(result_type & PGSQL_BOTH)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid result type");
+ php_error_docref(NULL, E_WARNING, "Invalid result type");
RETURN_FALSE;
}
@@ -5271,7 +5269,7 @@ PHP_FUNCTION(pg_get_pid)
int id = -1;
PGconn *pgsql;
- if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "r",
+ if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS(), "r",
&pgsql_link) == FAILURE) {
RETURN_FALSE;
}
@@ -5282,31 +5280,31 @@ PHP_FUNCTION(pg_get_pid)
}
/* }}} */
-static size_t php_pgsql_fd_write(php_stream *stream, const char *buf, size_t count TSRMLS_DC) /* {{{ */
+static size_t php_pgsql_fd_write(php_stream *stream, const char *buf, size_t count) /* {{{ */
{
return 0;
}
/* }}} */
-static size_t php_pgsql_fd_read(php_stream *stream, char *buf, size_t count TSRMLS_DC) /* {{{ */
+static size_t php_pgsql_fd_read(php_stream *stream, char *buf, size_t count) /* {{{ */
{
return 0;
}
/* }}} */
-static int php_pgsql_fd_close(php_stream *stream, int close_handle TSRMLS_DC) /* {{{ */
+static int php_pgsql_fd_close(php_stream *stream, int close_handle) /* {{{ */
{
return EOF;
}
/* }}} */
-static int php_pgsql_fd_flush(php_stream *stream TSRMLS_DC) /* {{{ */
+static int php_pgsql_fd_flush(php_stream *stream) /* {{{ */
{
return FAILURE;
}
/* }}} */
-static int php_pgsql_fd_set_option(php_stream *stream, int option, int value, void *ptrparam TSRMLS_DC) /* {{{ */
+static int php_pgsql_fd_set_option(php_stream *stream, int option, int value, void *ptrparam) /* {{{ */
{
PGconn *pgsql = (PGconn *) stream->abstract;
switch (option) {
@@ -5318,7 +5316,7 @@ static int php_pgsql_fd_set_option(php_stream *stream, int option, int value, vo
}
/* }}} */
-static int php_pgsql_fd_cast(php_stream *stream, int cast_as, void **ret TSRMLS_DC) /* {{{ */
+static int php_pgsql_fd_cast(php_stream *stream, int cast_as, void **ret) /* {{{ */
{
PGconn *pgsql = (PGconn *) stream->abstract;
int fd_number;
@@ -5351,7 +5349,7 @@ PHP_FUNCTION(pg_socket)
PGconn *pgsql;
int id = -1;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &pgsql_link) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "r", &pgsql_link) == FAILURE) {
return;
}
@@ -5376,7 +5374,7 @@ PHP_FUNCTION(pg_consume_input)
int id = -1;
PGconn *pgsql;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &pgsql_link) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "r", &pgsql_link) == FAILURE) {
return;
}
@@ -5396,7 +5394,7 @@ PHP_FUNCTION(pg_flush)
int ret;
int is_non_blocking;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &pgsql_link) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "r", &pgsql_link) == FAILURE) {
return;
}
@@ -5405,14 +5403,14 @@ PHP_FUNCTION(pg_flush)
is_non_blocking = PQisnonblocking(pgsql);
if (is_non_blocking == 0 && PQ_SETNONBLOCKING(pgsql, 1) == -1) {
- php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Cannot set connection to nonblocking mode");
+ php_error_docref(NULL, E_NOTICE, "Cannot set connection to nonblocking mode");
RETURN_FALSE;
}
ret = PQflush(pgsql);
if (is_non_blocking == 0 && PQ_SETNONBLOCKING(pgsql, 0) == -1) {
- php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Failed resetting connection to blocking mode");
+ php_error_docref(NULL, E_NOTICE, "Failed resetting connection to blocking mode");
}
switch (ret) {
@@ -5426,7 +5424,7 @@ PHP_FUNCTION(pg_flush)
/* {{{ php_pgsql_meta_data
* TODO: Add meta_data cache for better performance
*/
-PHP_PGSQL_API int php_pgsql_meta_data(PGconn *pg_link, const char *table_name, zval *meta, zend_bool extended TSRMLS_DC)
+PHP_PGSQL_API int php_pgsql_meta_data(PGconn *pg_link, const char *table_name, zval *meta, zend_bool extended)
{
PGresult *pg_result;
char *src, *tmp_name, *tmp_name2 = NULL;
@@ -5437,7 +5435,7 @@ PHP_PGSQL_API int php_pgsql_meta_data(PGconn *pg_link, const char *table_name, z
zval elem;
if (!*table_name) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "The table name must be specified");
+ php_error_docref(NULL, E_WARNING, "The table name must be specified");
return FAILURE;
}
@@ -5490,7 +5488,7 @@ PHP_PGSQL_API int php_pgsql_meta_data(PGconn *pg_link, const char *table_name, z
pg_result = PQexec(pg_link, querystr.s->val);
if (PQresultStatus(pg_result) != PGRES_TUPLES_OK || (num_rows = PQntuples(pg_result)) == 0) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Table '%s' doesn't exists", table_name);
+ php_error_docref(NULL, E_WARNING, "Table '%s' doesn't exists", table_name);
smart_str_free(&querystr);
PQclear(pg_result);
return FAILURE;
@@ -5544,7 +5542,7 @@ PHP_FUNCTION(pg_meta_data)
PGconn *pgsql;
int id = -1;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs|b",
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "rs|b",
&pgsql_link, &table_name, &table_name_len, &extended) == FAILURE) {
return;
}
@@ -5552,7 +5550,7 @@ PHP_FUNCTION(pg_meta_data)
ZEND_FETCH_RESOURCE2(pgsql, PGconn *, pgsql_link, id, "PostgreSQL link", le_link, le_plink);
array_init(return_value);
- if (php_pgsql_meta_data(pgsql, table_name, return_value, extended TSRMLS_CC) == FAILURE) {
+ if (php_pgsql_meta_data(pgsql, table_name, return_value, extended) == FAILURE) {
zval_dtor(return_value); /* destroy array */
RETURN_FALSE;
}
@@ -5652,7 +5650,7 @@ static php_pgsql_data_type php_pgsql_get_data_type(const char *type_name, size_t
/* {{{ php_pgsql_convert_match
* test field value with regular expression specified.
*/
-static int php_pgsql_convert_match(const char *str, size_t str_len, const char *regex , int icase TSRMLS_DC)
+static int php_pgsql_convert_match(const char *str, size_t str_len, const char *regex , int icase)
{
regex_t re;
regmatch_t *subs;
@@ -5675,7 +5673,7 @@ static int php_pgsql_convert_match(const char *str, size_t str_len, const char *
regerr = regcomp(&re, regex, regopt);
if (regerr) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot compile regex");
+ php_error_docref(NULL, E_WARNING, "Cannot compile regex");
regfree(&re);
return FAILURE;
}
@@ -5684,12 +5682,12 @@ static int php_pgsql_convert_match(const char *str, size_t str_len, const char *
regerr = regexec(&re, str, re.re_nsub+1, subs, 0);
if (regerr == REG_NOMATCH) {
#ifdef PHP_DEBUG
- php_error_docref(NULL TSRMLS_CC, E_NOTICE, "'%s' does not match with '%s'", str, regex);
+ php_error_docref(NULL, E_NOTICE, "'%s' does not match with '%s'", str, regex);
#endif
ret = FAILURE;
}
else if (regerr) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot exec regex");
+ php_error_docref(NULL, E_WARNING, "Cannot exec regex");
ret = FAILURE;
}
regfree(&re);
@@ -5702,7 +5700,7 @@ static int php_pgsql_convert_match(const char *str, size_t str_len, const char *
/* {{{ php_pgsql_add_quote
* add quotes around string.
*/
-static int php_pgsql_add_quotes(zval *src, zend_bool should_free TSRMLS_DC)
+static int php_pgsql_add_quotes(zval *src, zend_bool should_free)
{
smart_str str = {0};
@@ -5733,7 +5731,7 @@ static int php_pgsql_add_quotes(zval *src, zend_bool should_free TSRMLS_DC)
} \
/* raise error if it's not null and cannot be ignored */ \
else if (!(opt & PGSQL_CONV_IGNORE_NOT_NULL) && Z_TYPE_P(not_null) == IS_TRUE) { \
- php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Detected NULL for 'NOT NULL' field '%s'", field->val); \
+ php_error_docref(NULL, E_NOTICE, "Detected NULL for 'NOT NULL' field '%s'", field->val); \
err = 1; \
} \
}
@@ -5741,7 +5739,7 @@ static int php_pgsql_add_quotes(zval *src, zend_bool should_free TSRMLS_DC)
/* {{{ php_pgsql_convert
* check and convert array values (fieldname=>vlaue pair) for sql
*/
-PHP_PGSQL_API int php_pgsql_convert(PGconn *pg_link, const char *table_name, const zval *values, zval *result, zend_ulong opt TSRMLS_DC)
+PHP_PGSQL_API int php_pgsql_convert(PGconn *pg_link, const char *table_name, const zval *values, zval *result, zend_ulong opt)
{
zend_string *field = NULL;
zend_ulong num_idx = -1;
@@ -5760,7 +5758,7 @@ PHP_PGSQL_API int php_pgsql_convert(PGconn *pg_link, const char *table_name, con
array_init(&meta);
/* table_name is escaped by php_pgsql_meta_data */
- if (php_pgsql_meta_data(pg_link, table_name, &meta, 0 TSRMLS_CC) == FAILURE) {
+ if (php_pgsql_meta_data(pg_link, table_name, &meta, 0) == FAILURE) {
zval_ptr_dtor(&meta);
return FAILURE;
}
@@ -5770,32 +5768,32 @@ PHP_PGSQL_API int php_pgsql_convert(PGconn *pg_link, const char *table_name, con
ZVAL_NULL(&new_val);
if (!err && field == NULL) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Accepts only string key for values");
+ php_error_docref(NULL, E_WARNING, "Accepts only string key for values");
err = 1;
}
if (!err && (def = zend_hash_find(Z_ARRVAL(meta), field)) == NULL) {
- php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Invalid field name (%s) in values", field->val);
+ php_error_docref(NULL, E_NOTICE, "Invalid field name (%s) in values", field->val);
err = 1;
}
if (!err && (type = zend_hash_str_find(Z_ARRVAL_P(def), "type", sizeof("type") - 1)) == NULL) {
- php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Detected broken meta data. Missing 'type'");
+ php_error_docref(NULL, E_NOTICE, "Detected broken meta data. Missing 'type'");
err = 1;
}
if (!err && (not_null = zend_hash_str_find(Z_ARRVAL_P(def), "not null", sizeof("not null") - 1)) == NULL) {
- php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Detected broken meta data. Missing 'not null'");
+ php_error_docref(NULL, E_NOTICE, "Detected broken meta data. Missing 'not null'");
err = 1;
}
if (!err && (has_default = zend_hash_str_find(Z_ARRVAL_P(def), "has default", sizeof("has default") - 1)) == NULL) {
- php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Detected broken meta data. Missing 'has default'");
+ php_error_docref(NULL, E_NOTICE, "Detected broken meta data. Missing 'has default'");
err = 1;
}
if (!err && (is_enum = zend_hash_str_find(Z_ARRVAL_P(def), "is enum", sizeof("is enum") - 1)) == NULL) {
- php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Detected broken meta data. Missing 'is enum'");
+ php_error_docref(NULL, E_NOTICE, "Detected broken meta data. Missing 'is enum'");
err = 1;
}
if (!err && (Z_TYPE_P(val) == IS_ARRAY || Z_TYPE_P(val) == IS_OBJECT)) {
- php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Expects scalar values as field values");
+ php_error_docref(NULL, E_NOTICE, "Expects scalar values as field values");
err = 1;
}
if (err) {
@@ -5834,7 +5832,7 @@ PHP_PGSQL_API int php_pgsql_convert(PGconn *pg_link, const char *table_name, con
ZVAL_STRINGL(&new_val, "'f'", sizeof("'f'")-1);
}
else {
- php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Detected invalid value (%s) for PostgreSQL %s field (%s)", Z_STRVAL_P(val), Z_STRVAL_P(type), field->val);
+ php_error_docref(NULL, E_NOTICE, "Detected invalid value (%s) for PostgreSQL %s field (%s)", Z_STRVAL_P(val), Z_STRVAL_P(type), field->val);
err = 1;
}
}
@@ -5866,7 +5864,7 @@ PHP_PGSQL_API int php_pgsql_convert(PGconn *pg_link, const char *table_name, con
}
PGSQL_CONV_CHECK_IGNORE();
if (err) {
- php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Expects string, null, long or boolelan value for PostgreSQL '%s' (%s)", Z_STRVAL_P(type), field->val);
+ php_error_docref(NULL, E_NOTICE, "Expects string, null, long or boolelan value for PostgreSQL '%s' (%s)", Z_STRVAL_P(type), field->val);
}
break;
@@ -5881,7 +5879,7 @@ PHP_PGSQL_API int php_pgsql_convert(PGconn *pg_link, const char *table_name, con
}
else {
/* FIXME: better regex must be used */
- if (php_pgsql_convert_match(Z_STRVAL_P(val), Z_STRLEN_P(val), "^([+-]{0,1}[0-9]+)$", 0 TSRMLS_CC) == FAILURE) {
+ if (php_pgsql_convert_match(Z_STRVAL_P(val), Z_STRLEN_P(val), "^([+-]{0,1}[0-9]+)$", 0) == FAILURE) {
err = 1;
}
else {
@@ -5908,7 +5906,7 @@ PHP_PGSQL_API int php_pgsql_convert(PGconn *pg_link, const char *table_name, con
}
PGSQL_CONV_CHECK_IGNORE();
if (err) {
- php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Expects NULL, string, long or double value for pgsql '%s' (%s)", Z_STRVAL_P(type), field->val);
+ php_error_docref(NULL, E_NOTICE, "Expects NULL, string, long or double value for pgsql '%s' (%s)", Z_STRVAL_P(type), field->val);
}
break;
@@ -5923,7 +5921,7 @@ PHP_PGSQL_API int php_pgsql_convert(PGconn *pg_link, const char *table_name, con
}
else {
/* better regex? */
- if (php_pgsql_convert_match(Z_STRVAL_P(val), Z_STRLEN_P(val), "^[-+]?[0-9]*\\.?[0-9]+([eE][-+]?[0-9]+)?$", 0 TSRMLS_CC) == FAILURE) {
+ if (php_pgsql_convert_match(Z_STRVAL_P(val), Z_STRLEN_P(val), "^[-+]?[0-9]*\\.?[0-9]+([eE][-+]?[0-9]+)?$", 0) == FAILURE) {
err = 1;
}
else {
@@ -5949,7 +5947,7 @@ PHP_PGSQL_API int php_pgsql_convert(PGconn *pg_link, const char *table_name, con
}
PGSQL_CONV_CHECK_IGNORE();
if (err) {
- php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Expects NULL, string, long or double value for PostgreSQL '%s' (%s)", Z_STRVAL_P(type), field->val);
+ php_error_docref(NULL, E_NOTICE, "Expects NULL, string, long or double value for PostgreSQL '%s' (%s)", Z_STRVAL_P(type), field->val);
}
break;
@@ -5989,7 +5987,7 @@ PHP_PGSQL_API int php_pgsql_convert(PGconn *pg_link, const char *table_name, con
str->len = PQescapeStringConn(pg_link, str->val, Z_STRVAL_P(val), Z_STRLEN_P(val), NULL);
str = zend_string_realloc(str, str->len, 0);
ZVAL_NEW_STR(&new_val, str);
- php_pgsql_add_quotes(&new_val, 1 TSRMLS_CC);
+ php_pgsql_add_quotes(&new_val, 1);
}
break;
@@ -6012,7 +6010,7 @@ PHP_PGSQL_API int php_pgsql_convert(PGconn *pg_link, const char *table_name, con
}
PGSQL_CONV_CHECK_IGNORE();
if (err) {
- php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Expects NULL, string, long or double value for PostgreSQL '%s' (%s)", Z_STRVAL_P(type), field->val);
+ php_error_docref(NULL, E_NOTICE, "Expects NULL, string, long or double value for PostgreSQL '%s' (%s)", Z_STRVAL_P(type), field->val);
}
break;
@@ -6026,7 +6024,7 @@ PHP_PGSQL_API int php_pgsql_convert(PGconn *pg_link, const char *table_name, con
}
else {
/* better regex? */
- if (php_pgsql_convert_match(Z_STRVAL_P(val), Z_STRLEN_P(val), "^[0-9]+$", 0 TSRMLS_CC) == FAILURE) {
+ if (php_pgsql_convert_match(Z_STRVAL_P(val), Z_STRLEN_P(val), "^[0-9]+$", 0) == FAILURE) {
err = 1;
}
else {
@@ -6054,7 +6052,7 @@ PHP_PGSQL_API int php_pgsql_convert(PGconn *pg_link, const char *table_name, con
}
PGSQL_CONV_CHECK_IGNORE();
if (err) {
- php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Expects NULL, string, long or double value for '%s' (%s)", Z_STRVAL_P(type), field->val);
+ php_error_docref(NULL, E_NOTICE, "Expects NULL, string, long or double value for '%s' (%s)", Z_STRVAL_P(type), field->val);
}
break;
@@ -6067,12 +6065,12 @@ PHP_PGSQL_API int php_pgsql_convert(PGconn *pg_link, const char *table_name, con
}
else {
/* better regex? IPV6 and IPV4 */
- if (php_pgsql_convert_match(Z_STRVAL_P(val), Z_STRLEN_P(val), "^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]).){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]).){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$", 0 TSRMLS_CC) == FAILURE) {
+ if (php_pgsql_convert_match(Z_STRVAL_P(val), Z_STRLEN_P(val), "^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]).){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]).){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$", 0) == FAILURE) {
err = 1;
}
else {
ZVAL_STRINGL(&new_val, Z_STRVAL_P(val), Z_STRLEN_P(val));
- php_pgsql_add_quotes(&new_val, 1 TSRMLS_CC);
+ php_pgsql_add_quotes(&new_val, 1);
}
}
break;
@@ -6086,7 +6084,7 @@ PHP_PGSQL_API int php_pgsql_convert(PGconn *pg_link, const char *table_name, con
}
PGSQL_CONV_CHECK_IGNORE();
if (err) {
- php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Expects NULL or string for '%s' (%s)", Z_STRVAL_P(type), field->val);
+ php_error_docref(NULL, E_NOTICE, "Expects NULL or string for '%s' (%s)", Z_STRVAL_P(type), field->val);
}
break;
@@ -6101,11 +6099,11 @@ PHP_PGSQL_API int php_pgsql_convert(PGconn *pg_link, const char *table_name, con
ZVAL_STRINGL(&new_val, "NOW()", sizeof("NOW()")-1);
} else {
/* better regex? */
- if (php_pgsql_convert_match(Z_STRVAL_P(val), Z_STRLEN_P(val), "^([0-9]{4}[/-][0-9]{1,2}[/-][0-9]{1,2})([ \\t]+(([0-9]{1,2}:[0-9]{1,2}){1}(:[0-9]{1,2}){0,1}(\\.[0-9]+){0,1}([ \\t]*([+-][0-9]{1,4}(:[0-9]{1,2}){0,1}|[-a-zA-Z_/+]{1,50})){0,1})){0,1}$", 1 TSRMLS_CC) == FAILURE) {
+ if (php_pgsql_convert_match(Z_STRVAL_P(val), Z_STRLEN_P(val), "^([0-9]{4}[/-][0-9]{1,2}[/-][0-9]{1,2})([ \\t]+(([0-9]{1,2}:[0-9]{1,2}){1}(:[0-9]{1,2}){0,1}(\\.[0-9]+){0,1}([ \\t]*([+-][0-9]{1,4}(:[0-9]{1,2}){0,1}|[-a-zA-Z_/+]{1,50})){0,1})){0,1}$", 1) == FAILURE) {
err = 1;
} else {
ZVAL_STRING(&new_val, Z_STRVAL_P(val));
- php_pgsql_add_quotes(&new_val, 1 TSRMLS_CC);
+ php_pgsql_add_quotes(&new_val, 1);
}
}
break;
@@ -6119,7 +6117,7 @@ PHP_PGSQL_API int php_pgsql_convert(PGconn *pg_link, const char *table_name, con
}
PGSQL_CONV_CHECK_IGNORE();
if (err) {
- php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Expects NULL or string for PostgreSQL %s field (%s)", Z_STRVAL_P(type), field->val);
+ php_error_docref(NULL, E_NOTICE, "Expects NULL or string for PostgreSQL %s field (%s)", Z_STRVAL_P(type), field->val);
}
break;
@@ -6131,12 +6129,12 @@ PHP_PGSQL_API int php_pgsql_convert(PGconn *pg_link, const char *table_name, con
}
else {
/* FIXME: better regex must be used */
- if (php_pgsql_convert_match(Z_STRVAL_P(val), Z_STRLEN_P(val), "^([0-9]{4}[/-][0-9]{1,2}[/-][0-9]{1,2})$", 1 TSRMLS_CC) == FAILURE) {
+ if (php_pgsql_convert_match(Z_STRVAL_P(val), Z_STRLEN_P(val), "^([0-9]{4}[/-][0-9]{1,2}[/-][0-9]{1,2})$", 1) == FAILURE) {
err = 1;
}
else {
ZVAL_STRINGL(&new_val, Z_STRVAL_P(val), Z_STRLEN_P(val));
- php_pgsql_add_quotes(&new_val, 1 TSRMLS_CC);
+ php_pgsql_add_quotes(&new_val, 1);
}
}
break;
@@ -6150,7 +6148,7 @@ PHP_PGSQL_API int php_pgsql_convert(PGconn *pg_link, const char *table_name, con
}
PGSQL_CONV_CHECK_IGNORE();
if (err) {
- php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Expects NULL or string for PostgreSQL %s field (%s)", Z_STRVAL_P(type), field->val);
+ php_error_docref(NULL, E_NOTICE, "Expects NULL or string for PostgreSQL %s field (%s)", Z_STRVAL_P(type), field->val);
}
break;
@@ -6162,12 +6160,12 @@ PHP_PGSQL_API int php_pgsql_convert(PGconn *pg_link, const char *table_name, con
}
else {
/* FIXME: better regex must be used */
- if (php_pgsql_convert_match(Z_STRVAL_P(val), Z_STRLEN_P(val), "^(([0-9]{1,2}:[0-9]{1,2}){1}(:[0-9]{1,2}){0,1})){0,1}$", 1 TSRMLS_CC) == FAILURE) {
+ if (php_pgsql_convert_match(Z_STRVAL_P(val), Z_STRLEN_P(val), "^(([0-9]{1,2}:[0-9]{1,2}){1}(:[0-9]{1,2}){0,1})){0,1}$", 1) == FAILURE) {
err = 1;
}
else {
ZVAL_STRINGL(&new_val, Z_STRVAL_P(val), Z_STRLEN_P(val));
- php_pgsql_add_quotes(&new_val, 1 TSRMLS_CC);
+ php_pgsql_add_quotes(&new_val, 1);
}
}
break;
@@ -6181,7 +6179,7 @@ PHP_PGSQL_API int php_pgsql_convert(PGconn *pg_link, const char *table_name, con
}
PGSQL_CONV_CHECK_IGNORE();
if (err) {
- php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Expects NULL or string for PostgreSQL %s field (%s)", Z_STRVAL_P(type), field->val);
+ php_error_docref(NULL, E_NOTICE, "Expects NULL or string for PostgreSQL %s field (%s)", Z_STRVAL_P(type), field->val);
}
break;
@@ -6241,12 +6239,12 @@ PHP_PGSQL_API int php_pgsql_convert(PGconn *pg_link, const char *table_name, con
"(([0-9]{1,2}:){0,2}[0-9]{0,2})" /* hh:[mm:[ss]] */
")?))"
"([ \\t]+ago)?$",
- 1 TSRMLS_CC) == FAILURE) {
+ 1) == FAILURE) {
err = 1;
}
else {
ZVAL_STRING(&new_val, Z_STRVAL_P(val));
- php_pgsql_add_quotes(&new_val, 1 TSRMLS_CC);
+ php_pgsql_add_quotes(&new_val, 1);
}
}
break;
@@ -6260,7 +6258,7 @@ PHP_PGSQL_API int php_pgsql_convert(PGconn *pg_link, const char *table_name, con
}
PGSQL_CONV_CHECK_IGNORE();
if (err) {
- php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Expects NULL or string for PostgreSQL %s field (%s)", Z_STRVAL_P(type), field->val);
+ php_error_docref(NULL, E_NOTICE, "Expects NULL or string for PostgreSQL %s field (%s)", Z_STRVAL_P(type), field->val);
}
break;
#ifdef HAVE_PQESCAPE
@@ -6281,7 +6279,7 @@ PHP_PGSQL_API int php_pgsql_convert(PGconn *pg_link, const char *table_name, con
#endif
ZVAL_STRINGL(&new_val, (char *)tmp, to_len - 1); /* PQescapeBytea's to_len includes additional '\0' */
PQfreemem(tmp);
- php_pgsql_add_quotes(&new_val, 1 TSRMLS_CC);
+ php_pgsql_add_quotes(&new_val, 1);
smart_str_appendl(&s, Z_STRVAL(new_val), Z_STRLEN(new_val));
smart_str_0(&s);
zval_ptr_dtor(&new_val);
@@ -6308,7 +6306,7 @@ PHP_PGSQL_API int php_pgsql_convert(PGconn *pg_link, const char *table_name, con
}
PGSQL_CONV_CHECK_IGNORE();
if (err) {
- php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Expects NULL, string, long or double value for PostgreSQL '%s' (%s)", Z_STRVAL_P(type), field->val);
+ php_error_docref(NULL, E_NOTICE, "Expects NULL, string, long or double value for PostgreSQL '%s' (%s)", Z_STRVAL_P(type), field->val);
}
break;
@@ -6320,12 +6318,12 @@ PHP_PGSQL_API int php_pgsql_convert(PGconn *pg_link, const char *table_name, con
ZVAL_STRINGL(&new_val, "NULL", sizeof("NULL")-1);
}
else {
- if (php_pgsql_convert_match(Z_STRVAL_P(val), Z_STRLEN_P(val), "^([0-9a-f]{2,2}:){5,5}[0-9a-f]{2,2}$", 1 TSRMLS_CC) == FAILURE) {
+ if (php_pgsql_convert_match(Z_STRVAL_P(val), Z_STRLEN_P(val), "^([0-9a-f]{2,2}:){5,5}[0-9a-f]{2,2}$", 1) == FAILURE) {
err = 1;
}
else {
ZVAL_STRINGL(&new_val, Z_STRVAL_P(val), Z_STRLEN_P(val));
- php_pgsql_add_quotes(&new_val, 1 TSRMLS_CC);
+ php_pgsql_add_quotes(&new_val, 1);
}
}
break;
@@ -6339,13 +6337,13 @@ PHP_PGSQL_API int php_pgsql_convert(PGconn *pg_link, const char *table_name, con
}
PGSQL_CONV_CHECK_IGNORE();
if (err) {
- php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Expects NULL or string for PostgreSQL %s field (%s)", Z_STRVAL_P(type), field->val);
+ php_error_docref(NULL, E_NOTICE, "Expects NULL or string for PostgreSQL %s field (%s)", Z_STRVAL_P(type), field->val);
}
break;
default:
/* should not happen */
- php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Unknown or system data type '%s' for '%s'. Report error", Z_STRVAL_P(type), field->val);
+ php_error_docref(NULL, E_NOTICE, "Unknown or system data type '%s' for '%s'. Report error", Z_STRVAL_P(type), field->val);
err = 1;
break;
} /* switch */
@@ -6389,33 +6387,33 @@ PHP_FUNCTION(pg_convert)
PGconn *pg_link;
int id = -1;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC,
+ if (zend_parse_parameters(ZEND_NUM_ARGS(),
"rsa|l", &pgsql_link, &table_name, &table_name_len, &values, &option) == FAILURE) {
return;
}
if (option & ~PGSQL_CONV_OPTS) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid option is specified");
+ php_error_docref(NULL, E_WARNING, "Invalid option is specified");
RETURN_FALSE;
}
if (!table_name_len) {
- php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Table name is invalid");
+ php_error_docref(NULL, E_NOTICE, "Table name is invalid");
RETURN_FALSE;
}
ZEND_FETCH_RESOURCE2(pg_link, PGconn *, pgsql_link, id, "PostgreSQL link", le_link, le_plink);
- if (php_pgsql_flush_query(pg_link TSRMLS_CC)) {
- php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Detected unhandled result(s) in connection");
+ if (php_pgsql_flush_query(pg_link)) {
+ php_error_docref(NULL, E_NOTICE, "Detected unhandled result(s) in connection");
}
array_init(return_value);
- if (php_pgsql_convert(pg_link, table_name, values, return_value, option TSRMLS_CC) == FAILURE) {
+ if (php_pgsql_convert(pg_link, table_name, values, return_value, option) == FAILURE) {
zval_dtor(return_value);
RETURN_FALSE;
}
}
/* }}} */
-static int do_exec(smart_str *querystr, int expect, PGconn *pg_link, zend_ulong opt TSRMLS_DC) /* {{{ */
+static int do_exec(smart_str *querystr, int expect, PGconn *pg_link, zend_ulong opt) /* {{{ */
{
if (opt & PGSQL_DML_ASYNC) {
if (PQsendQuery(pg_link, querystr->s->val)) {
@@ -6430,7 +6428,7 @@ static int do_exec(smart_str *querystr, int expect, PGconn *pg_link, zend_ulong
PQclear(pg_result);
return 0;
} else {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", PQresultErrorMessage(pg_result));
+ php_error_docref(NULL, E_WARNING, "%s", PQresultErrorMessage(pg_result));
PQclear(pg_result);
}
}
@@ -6474,7 +6472,7 @@ static inline void build_tablename(smart_str *querystr, PGconn *pg_link, const c
/* {{{ php_pgsql_insert
*/
-PHP_PGSQL_API int php_pgsql_insert(PGconn *pg_link, const char *table, zval *var_array, zend_ulong opt, zend_string **sql TSRMLS_DC)
+PHP_PGSQL_API int php_pgsql_insert(PGconn *pg_link, const char *table, zval *var_array, zend_ulong opt, zend_string **sql)
{
zval *val, converted;
char buf[256];
@@ -6500,7 +6498,7 @@ PHP_PGSQL_API int php_pgsql_insert(PGconn *pg_link, const char *table, zval *var
/* convert input array if needed */
if (!(opt & (PGSQL_DML_NO_CONV|PGSQL_DML_ESCAPE))) {
array_init(&converted);
- if (php_pgsql_convert(pg_link, table, var_array, &converted, (opt & PGSQL_CONV_OPTS) TSRMLS_CC) == FAILURE) {
+ if (php_pgsql_convert(pg_link, table, var_array, &converted, (opt & PGSQL_CONV_OPTS)) == FAILURE) {
goto cleanup;
}
var_array = &converted;
@@ -6512,7 +6510,7 @@ PHP_PGSQL_API int php_pgsql_insert(PGconn *pg_link, const char *table, zval *var
ZEND_HASH_FOREACH_KEY(Z_ARRVAL_P(var_array), num_idx, fld) {
if (fld == NULL) {
- php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Expects associative array for values to be inserted");
+ php_error_docref(NULL, E_NOTICE, "Expects associative array for values to be inserted");
goto cleanup;
}
if (opt & PGSQL_DML_ESCAPE) {
@@ -6555,7 +6553,7 @@ PHP_PGSQL_API int php_pgsql_insert(PGconn *pg_link, const char *table, zval *var
smart_str_appendl(&querystr, "NULL", sizeof("NULL")-1);
break;
default:
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Expects scaler values. type = %d", Z_TYPE_P(val));
+ php_error_docref(NULL, E_WARNING, "Expects scaler values. type = %d", Z_TYPE_P(val));
goto cleanup;
break;
}
@@ -6570,7 +6568,7 @@ no_values:
smart_str_0(&querystr);
if ((opt & (PGSQL_DML_EXEC|PGSQL_DML_ASYNC)) &&
- do_exec(&querystr, PGRES_COMMAND_OK, pg_link, (opt & PGSQL_CONV_OPTS) TSRMLS_CC) == 0) {
+ do_exec(&querystr, PGRES_COMMAND_OK, pg_link, (opt & PGSQL_CONV_OPTS)) == 0) {
ret = SUCCESS;
}
else if (opt & PGSQL_DML_STRING) {
@@ -6604,25 +6602,25 @@ PHP_FUNCTION(pg_insert)
zend_string *sql = NULL;
int id = -1, argc = ZEND_NUM_ARGS();
- if (zend_parse_parameters(argc TSRMLS_CC, "rsa|l",
+ if (zend_parse_parameters(argc, "rsa|l",
&pgsql_link, &table, &table_len, &values, &option) == FAILURE) {
return;
}
if (option & ~(PGSQL_CONV_OPTS|PGSQL_DML_NO_CONV|PGSQL_DML_EXEC|PGSQL_DML_ASYNC|PGSQL_DML_STRING|PGSQL_DML_ESCAPE)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid option is specified");
+ php_error_docref(NULL, E_WARNING, "Invalid option is specified");
RETURN_FALSE;
}
ZEND_FETCH_RESOURCE2(pg_link, PGconn *, pgsql_link, id, "PostgreSQL link", le_link, le_plink);
- if (php_pgsql_flush_query(pg_link TSRMLS_CC)) {
- php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Detected unhandled result(s) in connection");
+ if (php_pgsql_flush_query(pg_link)) {
+ php_error_docref(NULL, E_NOTICE, "Detected unhandled result(s) in connection");
}
return_sql = option & PGSQL_DML_STRING;
if (option & PGSQL_DML_EXEC) {
/* return resource when executed */
option = option & ~PGSQL_DML_EXEC;
- if (php_pgsql_insert(pg_link, table, values, option|PGSQL_DML_STRING, &sql TSRMLS_CC) == FAILURE) {
+ if (php_pgsql_insert(pg_link, table, values, option|PGSQL_DML_STRING, &sql) == FAILURE) {
RETURN_FALSE;
}
pg_result = PQexec(pg_link, sql->val);
@@ -6663,7 +6661,7 @@ PHP_FUNCTION(pg_insert)
}
break;
}
- } else if (php_pgsql_insert(pg_link, table, values, option, &sql TSRMLS_CC) == FAILURE) {
+ } else if (php_pgsql_insert(pg_link, table, values, option, &sql) == FAILURE) {
RETURN_FALSE;
}
if (return_sql) {
@@ -6674,7 +6672,7 @@ PHP_FUNCTION(pg_insert)
}
/* }}} */
-static inline int build_assignment_string(PGconn *pg_link, smart_str *querystr, HashTable *ht, int where_cond, const char *pad, int pad_len, zend_ulong opt TSRMLS_DC) /* {{{ */
+static inline int build_assignment_string(PGconn *pg_link, smart_str *querystr, HashTable *ht, int where_cond, const char *pad, int pad_len, zend_ulong opt) /* {{{ */
{
char *tmp;
char buf[256];
@@ -6684,7 +6682,7 @@ static inline int build_assignment_string(PGconn *pg_link, smart_str *querystr,
ZEND_HASH_FOREACH_KEY_VAL(ht, num_idx, fld, val) {
if (fld == NULL) {
- php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Expects associative array for values to be inserted");
+ php_error_docref(NULL, E_NOTICE, "Expects associative array for values to be inserted");
return -1;
}
if (opt & PGSQL_DML_ESCAPE) {
@@ -6724,7 +6722,7 @@ static inline int build_assignment_string(PGconn *pg_link, smart_str *querystr,
smart_str_appendl(querystr, "NULL", sizeof("NULL")-1);
break;
default:
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Expects scaler values. type=%d", Z_TYPE_P(val));
+ php_error_docref(NULL, E_WARNING, "Expects scaler values. type=%d", Z_TYPE_P(val));
return -1;
}
smart_str_appendl(querystr, pad, pad_len);
@@ -6739,7 +6737,7 @@ static inline int build_assignment_string(PGconn *pg_link, smart_str *querystr,
/* {{{ php_pgsql_update
*/
-PHP_PGSQL_API int php_pgsql_update(PGconn *pg_link, const char *table, zval *var_array, zval *ids_array, zend_ulong opt, zend_string **sql TSRMLS_DC)
+PHP_PGSQL_API int php_pgsql_update(PGconn *pg_link, const char *table, zval *var_array, zval *ids_array, zend_ulong opt, zend_string **sql)
{
zval var_converted, ids_converted;
smart_str querystr = {0};
@@ -6760,12 +6758,12 @@ PHP_PGSQL_API int php_pgsql_update(PGconn *pg_link, const char *table, zval *var
ZVAL_UNDEF(&ids_converted);
if (!(opt & (PGSQL_DML_NO_CONV|PGSQL_DML_ESCAPE))) {
array_init(&var_converted);
- if (php_pgsql_convert(pg_link, table, var_array, &var_converted, (opt & PGSQL_CONV_OPTS) TSRMLS_CC) == FAILURE) {
+ if (php_pgsql_convert(pg_link, table, var_array, &var_converted, (opt & PGSQL_CONV_OPTS)) == FAILURE) {
goto cleanup;
}
var_array = &var_converted;
array_init(&ids_converted);
- if (php_pgsql_convert(pg_link, table, ids_array, &ids_converted, (opt & PGSQL_CONV_OPTS) TSRMLS_CC) == FAILURE) {
+ if (php_pgsql_convert(pg_link, table, ids_array, &ids_converted, (opt & PGSQL_CONV_OPTS)) == FAILURE) {
goto cleanup;
}
ids_array = &ids_converted;
@@ -6775,18 +6773,18 @@ PHP_PGSQL_API int php_pgsql_update(PGconn *pg_link, const char *table, zval *var
build_tablename(&querystr, pg_link, table);
smart_str_appends(&querystr, " SET ");
- if (build_assignment_string(pg_link, &querystr, Z_ARRVAL_P(var_array), 0, ",", 1, opt TSRMLS_CC))
+ if (build_assignment_string(pg_link, &querystr, Z_ARRVAL_P(var_array), 0, ",", 1, opt))
goto cleanup;
smart_str_appends(&querystr, " WHERE ");
- if (build_assignment_string(pg_link, &querystr, Z_ARRVAL_P(ids_array), 1, " AND ", sizeof(" AND ")-1, opt TSRMLS_CC))
+ if (build_assignment_string(pg_link, &querystr, Z_ARRVAL_P(ids_array), 1, " AND ", sizeof(" AND ")-1, opt))
goto cleanup;
smart_str_appendc(&querystr, ';');
smart_str_0(&querystr);
- if ((opt & PGSQL_DML_EXEC) && do_exec(&querystr, PGRES_COMMAND_OK, pg_link, opt TSRMLS_CC) == 0) {
+ if ((opt & PGSQL_DML_EXEC) && do_exec(&querystr, PGRES_COMMAND_OK, pg_link, opt) == 0) {
ret = SUCCESS;
} else if (opt & PGSQL_DML_STRING) {
ret = SUCCESS;
@@ -6817,21 +6815,21 @@ PHP_FUNCTION(pg_update)
zend_string *sql = NULL;
int id = -1, argc = ZEND_NUM_ARGS();
- if (zend_parse_parameters(argc TSRMLS_CC, "rsaa|l",
+ if (zend_parse_parameters(argc, "rsaa|l",
&pgsql_link, &table, &table_len, &values, &ids, &option) == FAILURE) {
return;
}
if (option & ~(PGSQL_CONV_OPTS|PGSQL_DML_NO_CONV|PGSQL_DML_EXEC|PGSQL_DML_STRING|PGSQL_DML_ESCAPE)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid option is specified");
+ php_error_docref(NULL, E_WARNING, "Invalid option is specified");
RETURN_FALSE;
}
ZEND_FETCH_RESOURCE2(pg_link, PGconn *, pgsql_link, id, "PostgreSQL link", le_link, le_plink);
- if (php_pgsql_flush_query(pg_link TSRMLS_CC)) {
- php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Detected unhandled result(s) in connection");
+ if (php_pgsql_flush_query(pg_link)) {
+ php_error_docref(NULL, E_NOTICE, "Detected unhandled result(s) in connection");
}
- if (php_pgsql_update(pg_link, table, values, ids, option, &sql TSRMLS_CC) == FAILURE) {
+ if (php_pgsql_update(pg_link, table, values, ids, option, &sql) == FAILURE) {
RETURN_FALSE;
}
if (option & PGSQL_DML_STRING) {
@@ -6843,7 +6841,7 @@ PHP_FUNCTION(pg_update)
/* {{{ php_pgsql_delete
*/
-PHP_PGSQL_API int php_pgsql_delete(PGconn *pg_link, const char *table, zval *ids_array, zend_ulong opt, zend_string **sql TSRMLS_DC)
+PHP_PGSQL_API int php_pgsql_delete(PGconn *pg_link, const char *table, zval *ids_array, zend_ulong opt, zend_string **sql)
{
zval ids_converted;
smart_str querystr = {0};
@@ -6861,7 +6859,7 @@ PHP_PGSQL_API int php_pgsql_delete(PGconn *pg_link, const char *table, zval *ids
ZVAL_UNDEF(&ids_converted);
if (!(opt & (PGSQL_DML_NO_CONV|PGSQL_DML_ESCAPE))) {
array_init(&ids_converted);
- if (php_pgsql_convert(pg_link, table, ids_array, &ids_converted, (opt & PGSQL_CONV_OPTS) TSRMLS_CC) == FAILURE) {
+ if (php_pgsql_convert(pg_link, table, ids_array, &ids_converted, (opt & PGSQL_CONV_OPTS)) == FAILURE) {
goto cleanup;
}
ids_array = &ids_converted;
@@ -6871,13 +6869,13 @@ PHP_PGSQL_API int php_pgsql_delete(PGconn *pg_link, const char *table, zval *ids
build_tablename(&querystr, pg_link, table);
smart_str_appends(&querystr, " WHERE ");
- if (build_assignment_string(pg_link, &querystr, Z_ARRVAL_P(ids_array), 1, " AND ", sizeof(" AND ")-1, opt TSRMLS_CC))
+ if (build_assignment_string(pg_link, &querystr, Z_ARRVAL_P(ids_array), 1, " AND ", sizeof(" AND ")-1, opt))
goto cleanup;
smart_str_appendc(&querystr, ';');
smart_str_0(&querystr);
- if ((opt & PGSQL_DML_EXEC) && do_exec(&querystr, PGRES_COMMAND_OK, pg_link, opt TSRMLS_CC) == 0) {
+ if ((opt & PGSQL_DML_EXEC) && do_exec(&querystr, PGRES_COMMAND_OK, pg_link, opt) == 0) {
ret = SUCCESS;
} else if (opt & PGSQL_DML_STRING) {
ret = SUCCESS;
@@ -6907,21 +6905,21 @@ PHP_FUNCTION(pg_delete)
zend_string *sql;
int id = -1, argc = ZEND_NUM_ARGS();
- if (zend_parse_parameters(argc TSRMLS_CC, "rsa|l",
+ if (zend_parse_parameters(argc, "rsa|l",
&pgsql_link, &table, &table_len, &ids, &option) == FAILURE) {
return;
}
if (option & ~(PGSQL_CONV_FORCE_NULL|PGSQL_DML_NO_CONV|PGSQL_DML_EXEC|PGSQL_DML_STRING|PGSQL_DML_ESCAPE)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid option is specified");
+ php_error_docref(NULL, E_WARNING, "Invalid option is specified");
RETURN_FALSE;
}
ZEND_FETCH_RESOURCE2(pg_link, PGconn *, pgsql_link, id, "PostgreSQL link", le_link, le_plink);
- if (php_pgsql_flush_query(pg_link TSRMLS_CC)) {
- php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Detected unhandled result(s) in connection");
+ if (php_pgsql_flush_query(pg_link)) {
+ php_error_docref(NULL, E_NOTICE, "Detected unhandled result(s) in connection");
}
- if (php_pgsql_delete(pg_link, table, ids, option, &sql TSRMLS_CC) == FAILURE) {
+ if (php_pgsql_delete(pg_link, table, ids, option, &sql) == FAILURE) {
RETURN_FALSE;
}
if (option & PGSQL_DML_STRING) {
@@ -6933,7 +6931,7 @@ PHP_FUNCTION(pg_delete)
/* {{{ php_pgsql_result2array
*/
-PHP_PGSQL_API int php_pgsql_result2array(PGresult *pg_result, zval *ret_array TSRMLS_DC)
+PHP_PGSQL_API int php_pgsql_result2array(PGresult *pg_result, zval *ret_array)
{
zval row;
char *field_name;
@@ -6969,7 +6967,7 @@ PHP_PGSQL_API int php_pgsql_result2array(PGresult *pg_result, zval *ret_array TS
/* {{{ php_pgsql_select
*/
-PHP_PGSQL_API int php_pgsql_select(PGconn *pg_link, const char *table, zval *ids_array, zval *ret_array, zend_ulong opt, zend_string **sql TSRMLS_DC)
+PHP_PGSQL_API int php_pgsql_select(PGconn *pg_link, const char *table, zval *ids_array, zval *ret_array, zend_ulong opt, zend_string **sql)
{
zval ids_converted;
smart_str querystr = {0};
@@ -6989,7 +6987,7 @@ PHP_PGSQL_API int php_pgsql_select(PGconn *pg_link, const char *table, zval *ids
ZVAL_UNDEF(&ids_converted);
if (!(opt & (PGSQL_DML_NO_CONV|PGSQL_DML_ESCAPE))) {
array_init(&ids_converted);
- if (php_pgsql_convert(pg_link, table, ids_array, &ids_converted, (opt & PGSQL_CONV_OPTS) TSRMLS_CC) == FAILURE) {
+ if (php_pgsql_convert(pg_link, table, ids_array, &ids_converted, (opt & PGSQL_CONV_OPTS)) == FAILURE) {
goto cleanup;
}
ids_array = &ids_converted;
@@ -6999,7 +6997,7 @@ PHP_PGSQL_API int php_pgsql_select(PGconn *pg_link, const char *table, zval *ids
build_tablename(&querystr, pg_link, table);
smart_str_appends(&querystr, " WHERE ");
- if (build_assignment_string(pg_link, &querystr, Z_ARRVAL_P(ids_array), 1, " AND ", sizeof(" AND ")-1, opt TSRMLS_CC))
+ if (build_assignment_string(pg_link, &querystr, Z_ARRVAL_P(ids_array), 1, " AND ", sizeof(" AND ")-1, opt))
goto cleanup;
smart_str_appendc(&querystr, ';');
@@ -7007,9 +7005,9 @@ PHP_PGSQL_API int php_pgsql_select(PGconn *pg_link, const char *table, zval *ids
pg_result = PQexec(pg_link, querystr.s->val);
if (PQresultStatus(pg_result) == PGRES_TUPLES_OK) {
- ret = php_pgsql_result2array(pg_result, ret_array TSRMLS_CC);
+ ret = php_pgsql_result2array(pg_result, ret_array);
} else {
- php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Failed to execute '%s'", querystr.s->val);
+ php_error_docref(NULL, E_NOTICE, "Failed to execute '%s'", querystr.s->val);
}
PQclear(pg_result);
@@ -7037,22 +7035,22 @@ PHP_FUNCTION(pg_select)
zend_string *sql = NULL;
int id = -1, argc = ZEND_NUM_ARGS();
- if (zend_parse_parameters(argc TSRMLS_CC, "rsa|l",
+ if (zend_parse_parameters(argc, "rsa|l",
&pgsql_link, &table, &table_len, &ids, &option) == FAILURE) {
return;
}
if (option & ~(PGSQL_CONV_FORCE_NULL|PGSQL_DML_NO_CONV|PGSQL_DML_EXEC|PGSQL_DML_ASYNC|PGSQL_DML_STRING|PGSQL_DML_ESCAPE)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid option is specified");
+ php_error_docref(NULL, E_WARNING, "Invalid option is specified");
RETURN_FALSE;
}
ZEND_FETCH_RESOURCE2(pg_link, PGconn *, pgsql_link, id, "PostgreSQL link", le_link, le_plink);
- if (php_pgsql_flush_query(pg_link TSRMLS_CC)) {
- php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Detected unhandled result(s) in connection");
+ if (php_pgsql_flush_query(pg_link)) {
+ php_error_docref(NULL, E_NOTICE, "Detected unhandled result(s) in connection");
}
array_init(return_value);
- if (php_pgsql_select(pg_link, table, ids, return_value, option, &sql TSRMLS_CC) == FAILURE) {
+ if (php_pgsql_select(pg_link, table, ids, return_value, option, &sql) == FAILURE) {
zval_ptr_dtor(return_value);
RETURN_FALSE;
}