2 +--------------------------------------------------------------------+
4 +--------------------------------------------------------------------+
5 | Redistribution and use in source and binary forms, with or without |
6 | modification, are permitted provided that the conditions mentioned |
7 | in the accompanying LICENSE file are met. |
8 +--------------------------------------------------------------------+
9 | Copyright (c) 2013, Michael Wallner <mike@php.net> |
10 +--------------------------------------------------------------------+
17 #include "php_pqconn.h"
18 typedef enum php_pqres_fetch
{
19 PHP_PQRES_FETCH_ARRAY
,
20 PHP_PQRES_FETCH_ASSOC
,
21 PHP_PQRES_FETCH_OBJECT
24 #define PHP_PQRES_CONV_BOOL 0x01
25 #define PHP_PQRES_CONV_INT 0x02
26 #define PHP_PQRES_CONV_FLOAT 0x04
27 #define PHP_PQRES_CONV_ARRAY 0x08
28 #define PHP_PQRES_CONV_DATETIME 0x10
30 typedef struct php_pqres_iterator
{
31 zend_object_iterator zi
;
34 php_pqres_fetch_t fetch_type
;
35 } php_pqres_iterator_t
;
37 typedef struct php_pqres
{
39 php_pqres_iterator_t
*iter
;
42 unsigned default_fetch_type
:2;
43 unsigned auto_convert
:6;
46 typedef struct php_pqres_object
{
49 HashTable
*prophandler
;
53 STATUS
php_pqres_success(PGresult
*res TSRMLS_DC
);
54 void php_pqres_init_instance_data(PGresult
*res
, php_pqconn_object_t
*obj
, php_pqres_object_t
**ptr TSRMLS_DC
);
55 zval
*php_pqres_row_to_zval(PGresult
*res
, unsigned row
, php_pqres_fetch_t fetch_type
, zval
**data_ptr TSRMLS_DC
);
56 zval
*php_pqres_typed_zval(php_pqres_t
*res
, char *val
, size_t len
, Oid typ TSRMLS_DC
);
58 #include "php_pq_object.h"
59 #include "php_pqconn_event.h"
60 #define PHP_PQclear(_r) do { \
61 php_pqres_object_t *_o = PQresultInstanceData((_r), php_pqconn_event); \
63 php_pq_object_delref(_o TSRMLS_CC); \
69 zend_class_entry
*php_pqres_class_entry
;
70 zend_object_value
php_pqres_create_object_ex(zend_class_entry
*ce
, php_pqres_t
*intern
, php_pqres_object_t
**ptr TSRMLS_DC
);
72 PHP_MINIT_FUNCTION(pqres
);
73 PHP_MSHUTDOWN_FUNCTION(pqres
);
82 * vim600: noet sw=4 ts=4 fdm=marker
83 * vim<600: noet sw=4 ts=4