3ce172d666d20083e08f79facd6e60409f9f0ed6
[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 /* trim LF from EOL */
22 char *rtrim(char *e);
23
24 /* R, W, RW */
25 const char *strmode(long mode);
26
27 /* compare array index */
28 int compare_index(const void *lptr, const void *rptr TSRMLS_DC);
29
30 #define PHP_PQerrorMessage(c) rtrim(PQerrorMessage((c)))
31 #define PHP_PQresultErrorMessage(r) rtrim(PQresultErrorMessage((r)))
32
33 int php_pq_types_to_array(HashTable *ht, Oid **types TSRMLS_DC);
34 int php_pq_params_to_array(HashTable *ht, char ***params, HashTable *zdtor TSRMLS_DC);
35
36 zval *php_pq_date_from_string(char *datetime_str, size_t datetime_len, zval *zv TSRMLS_DC);
37
38 #endif
39
40 /*
41 * Local variables:
42 * tab-width: 4
43 * c-basic-offset: 4
44 * End:
45 * vim600: noet sw=4 ts=4 fdm=marker
46 * vim<600: noet sw=4 ts=4
47 */