prepare v2.2.3
[m6w6/ext-pq] / src / php_pq_misc.c
index 70f32da7bcbfac48dd70612c97e74a86ecf9b29b..4d251d2b5415c1b0846a2a1dd89969a296ee416b 100644 (file)
 #undef PHP_PQ_TYPE
 #include "php_pq_type.h"
 
+/* convert version to string */
+extern void php_pq_version_to_string(int version, char *buffer, int len) {
+       if (version < 100000) {
+               slprintf(buffer, len, "%d.%d.%d", version/10000, version/100%100, version%100);
+       } else { /* since version 10 */
+               slprintf(buffer, len, "%d.%d", version/10000, version%100);
+       }
+}
 
 /* clear result object associated with a result handle */
 void php_pqres_clear(PGresult *r) {
@@ -138,7 +146,11 @@ ZEND_END_ARG_INFO()
 #define ai_pqdt_jsonserialize ai_pqdt_to_string
 #endif
 
+#if PHP_VERSION_ID >= 80200
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(ai_pqdt_to_string, 0, 0, IS_STRING, 0)
+#else
 ZEND_BEGIN_ARG_INFO_EX(ai_pqdt_to_string, 0, 0, 0)
+#endif
 ZEND_END_ARG_INFO();
 static PHP_METHOD(pqdt, __toString)
 {