X-Git-Url: https://git.m6w6.name/?p=m6w6%2Fext-pq;a=blobdiff_plain;f=src%2Fphp_pq_params.c;h=1ae7dd654ad1a54fb674b306c449ebc16436ea62;hp=6ac55af7c14c56f6c03ef48f96a545d0fe375d63;hb=d3fbce1b02b41d7ee1f3d0b60dc8df411aae7d79;hpb=c62ffa9e8cf262c412efeb84c2523d1c78897282 diff --git a/src/php_pq_params.c b/src/php_pq_params.c index 6ac55af..1ae7dd6 100644 --- a/src/php_pq_params.c +++ b/src/php_pq_params.c @@ -17,8 +17,8 @@ #include #include #include -#ifdef HAVE_JSON -#include +#if PHP_PQ_HAVE_PHP_JSON_H +#include /* we've added the include directory to INCLUDES */ #endif #include @@ -88,7 +88,7 @@ static zval *object_param_to_string(php_pq_params_t *p, zval *zobj, Oid type TSR smart_str str = {0}; switch (type) { -#if HAVE_JSON && defined(PHP_PQ_OID_JSON) +#if PHP_PQ_HAVE_PHP_JSON_H && defined(PHP_PQ_OID_JSON) # ifdef PHP_PQ_OID_JSONB case PHP_PQ_OID_JSONB: # endif @@ -134,6 +134,7 @@ struct apply_to_param_from_array_arg { unsigned index; smart_str *buffer; Oid type; + char delim; zval **zconv; }; @@ -146,7 +147,7 @@ static int apply_to_param_from_array(void *ptr, void *arg_ptr TSRMLS_DC) int tmp_len; if (arg->index++) { - smart_str_appendc(arg->buffer, ','); + smart_str_appendc(arg->buffer, arg->delim); } if (arg->zconv) { @@ -227,7 +228,7 @@ static zval *array_param_to_string(php_pq_params_t *p, zval *zarr, Oid type TSRM struct apply_to_param_from_array_arg arg = {NULL}; switch (type) { -#if HAVE_JSON && defined(PHP_PQ_OID_JSON) +#if PHP_PQ_HAVE_PHP_JSON_H && defined(PHP_PQ_OID_JSON) # ifdef PHP_PQ_OID_JSONB case PHP_PQ_OID_JSONB: # endif @@ -241,6 +242,7 @@ static zval *array_param_to_string(php_pq_params_t *p, zval *zarr, Oid type TSRM arg.params = p; arg.buffer = &s; arg.type = PHP_PQ_TYPE_OF_ARRAY(type); + arg.delim = PHP_PQ_DELIM_OF_ARRAY(type); zend_hash_index_find(&p->type.conv, PHP_PQ_TYPE_OF_ARRAY(type), (void *) &arg.zconv); smart_str_appendc(arg.buffer, '{'); MAKE_STD_ZVAL(zcopy);