+
+static zend_string *object_param_to_string(php_pq_params_t *p, zval *zobj, Oid type)
+{
+#if PHP_PQ_HAVE_PHP_JSON_H && defined(PHP_PQ_OID_JSON)
+ smart_str str = {0};
+#endif
+
+ switch (type) {
+#if PHP_PQ_HAVE_PHP_JSON_H && defined(PHP_PQ_OID_JSON)
+# ifdef PHP_PQ_OID_JSONB
+ case PHP_PQ_OID_JSONB:
+# endif
+ case PHP_PQ_OID_JSON:
+# if PHP_VERSION_ID >= 70100
+ JSON_G(encode_max_depth) = PHP_JSON_PARSER_DEFAULT_DEPTH;
+# endif
+ php_json_encode(&str, zobj, PHP_JSON_UNESCAPED_UNICODE);
+ smart_str_0(&str);
+ return str.s;
+#endif
+
+ case PHP_PQ_OID_DATE:
+ return php_pqdt_to_string(zobj, "Y-m-d");
+#ifdef PHP_PQ_OID_ABSTIME
+ case PHP_PQ_OID_ABSTIME:
+ return php_pqdt_to_string(zobj, "Y-m-d H:i:s");
+#endif
+ case PHP_PQ_OID_TIMESTAMP:
+ return php_pqdt_to_string(zobj, "Y-m-d H:i:s.u");
+
+ case PHP_PQ_OID_TIMESTAMPTZ:
+ return php_pqdt_to_string(zobj, "Y-m-d H:i:s.uO");
+ }
+
+ return zval_get_string(zobj);
+}
+
+struct apply_to_param_from_array_arg {
+ php_pq_params_t *params;
+ unsigned index;
+ smart_str *buffer;
+ Oid type;
+ char delim;
+ zval *zconv;
+};
+
+static int apply_to_param_from_array(zval *zparam, void *arg_ptr)