X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;ds=sidebyside;f=src%2Fphp_pq_misc.c;h=9acef342576603ac693610a7224da8d66b6ac0bd;hb=HEAD;hp=70f32da7bcbfac48dd70612c97e74a86ecf9b29b;hpb=aaf7e8976c03dd38dcab4fbde35c5b0e6253c9d4;p=m6w6%2Fext-pq diff --git a/src/php_pq_misc.c b/src/php_pq_misc.c index 70f32da..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) { @@ -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) {