extern PGresult *php_pq_prepare(PGconn *conn, const char *stmtName, const char *query, int nParams, const Oid *paramTypes);
extern PGresult *php_pq_exec_prepared(PGconn *conn, const char *stmtName, int nParams, const char *const * paramValues, const int *paramLengths, const int *paramFormats, int resultFormat);
+/* convert version to string */
+extern void php_pq_version_to_string(int version, char *buffer, int len);
/* trim LF from EOL */
extern char *php_pq_rtrim(char *e);
/* R, W, RW */
extern const char *php_pq_strmode(long mode);
-/* compare array index */
-#if PHP_VERSION_ID >= 80000
-extern int php_pq_compare_index(Bucket *lptr, Bucket *rptr);
-#else
-extern int php_pq_compare_index(const void *lptr, const void *rptr);
-#endif
-
/* free zval ptr values (as hash dtor) */
extern void php_pq_hash_ptr_dtor(zval *p);
/* ZE compat */
#if PHP_VERSION_ID >= 80000
+extern int php_pq_compare_index(Bucket *lptr, Bucket *rptr);
+
# define php_pq_call_method(objval_ptr, method_name, num_args, ...) \
zend_call_method_with_ ## num_args ## _params( \
Z_OBJ_P(objval_ptr), Z_OBJCE_P(objval_ptr), NULL, \
(Z_OBJ_HT_P(objval_ptr)->cast_object && \
SUCCESS == Z_OBJ_HT_P(objval_ptr)->cast_object(Z_OBJ_P(objval_ptr), (retval_ptr), (cast_type)))
#else
+
+extern int php_pq_compare_index(const void *lptr, const void *rptr);
+
+# define zend_ce_countable spl_ce_Countable
+
# define php_pq_call_method(objval_ptr, method_name, num_args, ...) \
zend_call_method_with_ ## num_args ## _params( \
(objval_ptr), NULL, NULL, \
#define php_pq_cast_object(objval_ptr, cast_type, retval_ptr) \
(Z_OBJ_HT_P(objval_ptr)->cast_object && \
SUCCESS == Z_OBJ_HT_P(objval_ptr)->cast_object(objval_ptr, (retval_ptr), (cast_type)))
-# if PHP_VERSION_ID <= 70200
-zval *zend_std_read_property(zval *object, zval *member, int type, void **cache_slot, zval *rv);
-# endif
#endif
+#if PHP_VERSION_ID < 80100
+# define ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(name, return_reference, required_num_args, type, allow_null) \
+ ZEND_BEGIN_ARG_INFO_EX(name, 0, return_reference, required_num_args)
+# define ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_OBJ_INFO_EX(name, return_reference, required_num_args, type, allow_null) \
+ ZEND_BEGIN_ARG_INFO_EX(name, 0, return_reference, required_num_args)
+#endif
-
+#ifndef ZEND_ACC_READONLY
+#define ZEND_ACC_READONLY 0
+#endif
extern PHP_MINIT_FUNCTION(pq_misc);