X-Git-Url: https://git.m6w6.name/?p=m6w6%2Fext-pq;a=blobdiff_plain;f=src%2Fphp_pqres.h;h=cc20ddbbc764e15524f71e0f494b40ac21c84611;hp=4afff3948776a303dc9919c59f02b01d04b3a122;hb=1e1d31873ad4283bd9acc3349107585f88161ea2;hpb=359b3471d6ed843d8ecf9d5fb0b85f06af446800 diff --git a/src/php_pqres.h b/src/php_pqres.h index 4afff39..cc20ddb 100644 --- a/src/php_pqres.h +++ b/src/php_pqres.h @@ -22,17 +22,18 @@ typedef enum php_pqres_fetch { PHP_PQRES_FETCH_OBJECT } php_pqres_fetch_t; -#define PHP_PQRES_CONV_BOOL 0x01 -#define PHP_PQRES_CONV_INT 0x02 -#define PHP_PQRES_CONV_FLOAT 0x04 -#define PHP_PQRES_CONV_SCALAR 0x0f -#define PHP_PQRES_CONV_ARRAY 0x10 -#define PHP_PQRES_CONV_DATETIME 0x20 -#define PHP_PQRES_CONV_ALL 0xff +#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; + zval current_val; unsigned index; php_pqres_fetch_t fetch_type; } php_pqres_iterator_t; @@ -47,33 +48,23 @@ typedef struct php_pqres { } php_pqres_t; typedef struct php_pqres_object { - zend_object zo; - zend_object_value zv; - HashTable *prophandler; - php_pqres_t *intern; + PHP_PQ_OBJ_DECL(php_pqres_t *) } php_pqres_object_t; -STATUS php_pqres_success(PGresult *res 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); +extern ZEND_RESULT_CODE php_pqres_success(PGresult *res); +extern php_pqres_object_t *php_pqres_init_instance_data(PGresult *res, php_pqconn_object_t *obj); +extern zval *php_pqres_row_to_zval(PGresult *res, unsigned row, php_pqres_fetch_t fetch_type, zval *data); +extern zval *php_pqres_typed_zval(php_pqres_t *res, Oid typ, zval *zv); +extern php_pqres_fetch_t php_pqres_fetch_type(php_pqres_t *res); #include "php_pq_object.h" #include "php_pqconn_event.h" -#define PHP_PQclear(_r) do { \ - php_pqres_object_t *_o = PQresultInstanceData((_r), php_pqconn_event); \ - if (_o) { \ - php_pq_object_delref(_o TSRMLS_CC); \ - } else { \ - PQclear(_r); \ - } \ -} while(0) -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); +extern zend_class_entry *php_pqres_class_entry; +extern php_pqres_object_t *php_pqres_create_object_ex(zend_class_entry *ce, php_pqres_t *intern); -PHP_MINIT_FUNCTION(pqres); -PHP_MSHUTDOWN_FUNCTION(pqres); +extern PHP_MINIT_FUNCTION(pqres); +extern PHP_MSHUTDOWN_FUNCTION(pqres); #endif