#include <php.h>
#include <ext/standard/php_string.h>
#include <ext/standard/php_smart_str.h>
-#ifdef HAVE_JSON
-#include <ext/json/php_json.h>
+#if PHP_PQ_HAVE_PHP_JSON_H
+#include <php_json.h> /* we've added the include directory to INCLUDES */
#endif
#include <Zend/zend_interfaces.h>
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
unsigned index;
smart_str *buffer;
Oid type;
+ char delim;
zval **zconv;
};
int tmp_len;
if (arg->index++) {
- smart_str_appendc(arg->buffer, ',');
+ smart_str_appendc(arg->buffer, arg->delim);
}
if (arg->zconv) {
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
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);