X-Git-Url: https://git.m6w6.name/?p=m6w6%2Fext-pq;a=blobdiff_plain;f=src%2Fphp_pq_misc.c;h=3e334c6e5e6fcbbe47c1804bf9aac6275131e968;hp=9e622b41339aed2cf9ea5ec8da14f0468e7a07ef;hb=HEAD;hpb=54542ca3e96ba72090f188692995047ae70d5d28 diff --git a/src/php_pq_misc.c b/src/php_pq_misc.c index 9e622b4..4d251d2 100644 --- a/src/php_pq_misc.c +++ b/src/php_pq_misc.c @@ -29,6 +29,14 @@ #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) { @@ -133,12 +141,16 @@ zend_class_entry *php_pqdt_class_entry; #if PHP_VERSION_ID >= 80100 ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(ai_pqdt_jsonserialize, 0, 0, IS_MIXED, 0) +ZEND_END_ARG_INFO() #else #define ai_pqdt_jsonserialize ai_pqdt_to_string #endif -ZEND_END_ARG_INFO() +#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) {