Merge branch 'meta/travis'
[m6w6/ext-pq] / src / php_pqres.h
index 507c3a4d9960c97ce9c130fd051fd28aac129672..ca22aa1815b83c3ad83034f1cc5cdbd9b40aea0e 100644 (file)
 #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            0x01
-#define PHP_PQRES_CONV_INT             0x02
-#define PHP_PQRES_CONV_FLOAT   0x04
-#define PHP_PQRES_CONV_ARRAY   0x08
-#define PHP_PQRES_CONV_DATETIME        0x10
+#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;
@@ -39,8 +43,8 @@ typedef struct php_pqres {
        php_pqres_iterator_t *iter;
        HashTable bound;
        HashTable converters;
-       unsigned default_fetch_type:2;
-       unsigned auto_convert:6;
+       unsigned auto_convert;
+       php_pqres_fetch_t default_fetch_type;
 } php_pqres_t;
 
 typedef struct php_pqres_object {
@@ -50,10 +54,11 @@ typedef struct php_pqres_object {
        php_pqres_t *intern;
 } 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 STATUS php_pqres_success(PGresult *res TSRMLS_DC);
+extern void php_pqres_init_instance_data(PGresult *res, php_pqconn_object_t *obj, php_pqres_object_t **ptr TSRMLS_DC);
+extern zval *php_pqres_row_to_zval(PGresult *res, unsigned row, php_pqres_fetch_t fetch_type, zval **data_ptr TSRMLS_DC);
+extern zval *php_pqres_typed_zval(php_pqres_t *res, char *val, size_t len, Oid typ TSRMLS_DC);
+extern php_pqres_fetch_t php_pqres_fetch_type(php_pqres_t *res);
 
 #include "php_pq_object.h"
 #include "php_pqconn_event.h"
@@ -66,11 +71,11 @@ zval *php_pqres_typed_zval(php_pqres_t *res, char *val, size_t len, Oid typ TSRM
        } \
 } 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 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);
+extern PHP_MINIT_FUNCTION(pqres);
+extern PHP_MSHUTDOWN_FUNCTION(pqres);
 
 #endif