release 2.0.0
[m6w6/ext-pq] / src / php_pq_misc.h
1 /*
2 +--------------------------------------------------------------------+
3 | PECL :: pq |
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 +--------------------------------------------------------------------+
11 */
12
13
14 #ifndef PHP_PQ_ERROR_H
15 #define PHP_PQ_ERROR_H
16
17 #include <libpq-fe.h>
18
19 #if PHP_VERSION_ID < 50500
20 #undef SUCCESS
21 #undef FAILURE
22 typedef enum {
23 SUCCESS = 0,
24 FAILURE = -1
25 } ZEND_RESULT_CODE;
26 #endif
27
28 #include "php_pqres.h"
29
30 #define z_is_true zend_is_true
31 #define smart_str_s(ss) (ss)->s
32 #define smart_str_v(ss) (ss)->s->val
33 #define smart_str_l(ss) (ss)->s->len
34
35 /* trim LF from EOL */
36 extern char *php_pq_rtrim(char *e);
37
38 /* R, W, RW */
39 extern const char *php_pq_strmode(long mode);
40
41 /* compare array index */
42 extern int php_pq_compare_index(const void *lptr, const void *rptr);
43
44 /* free zval ptr values (as hash dtor) */
45 extern void php_pq_hash_ptr_dtor(zval *p);
46
47 #define PHP_PQerrorMessage(c) php_pq_rtrim(PQerrorMessage((c)))
48 #define PHP_PQresultErrorMessage(r) php_pq_rtrim(PQresultErrorMessage((r)))
49
50 extern zend_class_entry *php_pqdt_class_entry;
51 extern zval *php_pqdt_from_string(zval *zv, char *input_fmt, char *dt_str, size_t dt_len, char *output_fmt, zval *ztimezone);
52 extern zend_string *php_pqdt_to_string(zval *zdt, const char *format);
53
54 extern zend_class_entry *php_pqconv_class_entry;
55
56 extern HashTable *php_pq_parse_array(php_pqres_t *res, const char *val_str, size_t val_len, Oid typ);
57
58
59 extern PHP_MINIT_FUNCTION(pq_misc);
60
61 #endif
62
63 /*
64 * Local variables:
65 * tab-width: 4
66 * c-basic-offset: 4
67 * End:
68 * vim600: noet sw=4 ts=4 fdm=marker
69 * vim<600: noet sw=4 ts=4
70 */