X-Git-Url: https://git.m6w6.name/?p=m6w6%2Fext-pq;a=blobdiff_plain;f=src%2Fphp_pqres.h;h=d2d35d465fa85cdcd73977a5f2e33531b3056366;hp=80a3d44391eef0bb4f7671ca59e32add6a9f0b7e;hb=da7b5981c5ae28504434c492d468913645111d66;hpb=9f5cecf26bd70a92ed013f31afec59e272623ac1 diff --git a/src/php_pqres.h b/src/php_pqres.h index 80a3d44..d2d35d4 100644 --- a/src/php_pqres.h +++ b/src/php_pqres.h @@ -14,12 +14,23 @@ #ifndef PHP_PQRES_H #define PHP_PQRES_H +#include "php_pqconn.h" + typedef enum php_pqres_fetch { PHP_PQRES_FETCH_ARRAY, PHP_PQRES_FETCH_ASSOC, PHP_PQRES_FETCH_OBJECT } php_pqres_fetch_t; +#define PHP_PQRES_CONV_BOOL 0x0001 +#define PHP_PQRES_CONV_INT 0x0002 +#define PHP_PQRES_CONV_FLOAT 0x0004 +#define PHP_PQRES_CONV_SCALAR 0x000f +#define PHP_PQRES_CONV_ARRAY 0x0010 +#define PHP_PQRES_CONV_DATETIME 0x0020 +#define PHP_PQRES_CONV_JSON 0x0100 +#define PHP_PQRES_CONV_ALL 0xffff + typedef struct php_pqres_iterator { zend_object_iterator zi; zval *current_val; @@ -31,6 +42,9 @@ typedef struct php_pqres { PGresult *res; php_pqres_iterator_t *iter; HashTable bound; + HashTable converters; + unsigned auto_convert; + php_pqres_fetch_t default_fetch_type; } php_pqres_t; typedef struct php_pqres_object { @@ -41,8 +55,9 @@ typedef struct php_pqres_object { } php_pqres_object_t; STATUS php_pqres_success(PGresult *res TSRMLS_DC); -void php_pqres_init_instance_data(PGresult *res, php_pqres_object_t **ptr TSRMLS_DC); +void php_pqres_init_instance_data(PGresult *res, php_pqconn_object_t *obj, php_pqres_object_t **ptr TSRMLS_DC); zval *php_pqres_row_to_zval(PGresult *res, unsigned row, php_pqres_fetch_t fetch_type, zval **data_ptr TSRMLS_DC); +zval *php_pqres_typed_zval(php_pqres_t *res, char *val, size_t len, Oid typ TSRMLS_DC); #include "php_pq_object.h" #include "php_pqconn_event.h" @@ -59,6 +74,7 @@ zend_class_entry *php_pqres_class_entry; zend_object_value php_pqres_create_object_ex(zend_class_entry *ce, php_pqres_t *intern, php_pqres_object_t **ptr TSRMLS_DC); PHP_MINIT_FUNCTION(pqres); +PHP_MSHUTDOWN_FUNCTION(pqres); #endif