+#ifndef PHP_PQ_OID_TEXT
+# define PHP_PQ_OID_TEXT 25
+#endif
+
+static int apply_nsp(void *p TSRMLS_DC, int argc, va_list argv, zend_hash_key *key)
+{
+ zval **zp = p;
+ unsigned pcount, tcount;
+ php_pq_params_t *params = va_arg(argv, php_pq_params_t *);
+ smart_str *str = va_arg(argv, smart_str *);
+
+ tcount = php_pq_params_add_type_oid(params, PHP_PQ_OID_TEXT);
+ pcount = php_pq_params_add_param(params, *zp);
+
+ if (tcount != pcount) {
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Param/Type count mismatch");
+ return ZEND_HASH_APPLY_STOP;
+ }
+ if (pcount > 1) {
+ smart_str_appendc(str, ',');
+ }
+ smart_str_appendc(str, '$');
+ smart_str_append_unsigned(str, pcount);
+
+ return ZEND_HASH_APPLY_KEEP;
+}