Merge branch 'master' of git.php.net:/pecl/database/pq
[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 typedef int STATUS; /* SUCCESS/FAILURE */
20
21 #include "php_pqres.h"
22
23 /* TSRM morony */
24 #if PHP_VERSION_ID >= 50700
25 # define z_is_true(z) zend_is_true(z TSRMLS_CC)
26 #else
27 # define z_is_true zend_is_true
28 #endif
29
30 /* trim LF from EOL */
31 char *rtrim(char *e);
32
33 /* R, W, RW */
34 const char *strmode(long mode);
35
36 /* compare array index */
37 int compare_index(const void *lptr, const void *rptr TSRMLS_DC);
38
39 #define PHP_PQerrorMessage(c) rtrim(PQerrorMessage((c)))
40 #define PHP_PQresultErrorMessage(r) rtrim(PQresultErrorMessage((r)))
41
42 zend_class_entry *php_pqdt_class_entry;
43 zval *php_pqdt_from_string(char *datetime_str, size_t datetime_len, char *fmt, zval *zv TSRMLS_DC);
44 void php_pqdt_to_string(zval *zdt, const char *format, char **str_buf, size_t *str_len TSRMLS_DC);
45
46 zend_class_entry *php_pqconv_class_entry;
47
48 HashTable *php_pq_parse_array(php_pqres_t *res, const char *val_str, size_t val_len, Oid typ TSRMLS_DC);
49
50
51 PHP_MINIT_FUNCTION(pq_misc);
52
53 #endif
54
55 /*
56 * Local variables:
57 * tab-width: 4
58 * c-basic-offset: 4
59 * End:
60 * vim600: noet sw=4 ts=4 fdm=marker
61 * vim<600: noet sw=4 ts=4
62 */