fix package.xml
[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 #include "php_pqres.h"
20
21 #define z_is_true zend_is_true
22 #define smart_str_s(ss) (ss)->s
23 #define smart_str_v(ss) (smart_str_s(ss)?(ss)->s->val:NULL)
24 #define smart_str_l(ss) (smart_str_s(ss)?(ss)->s->len:0)
25
26 /* clear result object associated with a result handle */
27 extern void php_pqres_clear(PGresult *r);
28 /* clear any asynchronous results */
29 extern void php_pqconn_clear(PGconn *conn);
30 /* safe wrappers to clear any asynchronous wrappers before querying synchronously */
31 extern PGresult *php_pq_exec(PGconn *conn, const char *query);
32 extern PGresult *php_pq_exec_params(PGconn *conn, const char *command, int nParams, const Oid *paramTypes, const char *const * paramValues, const int *paramLengths, const int *paramFormats, int resultFormat);
33 extern PGresult *php_pq_prepare(PGconn *conn, const char *stmtName, const char *query, int nParams, const Oid *paramTypes);
34 extern PGresult *php_pq_exec_prepared(PGconn *conn, const char *stmtName, int nParams, const char *const * paramValues, const int *paramLengths, const int *paramFormats, int resultFormat);
35
36
37 /* trim LF from EOL */
38 extern char *php_pq_rtrim(char *e);
39
40 /* R, W, RW */
41 extern const char *php_pq_strmode(long mode);
42
43 /* compare array index */
44 extern int php_pq_compare_index(const void *lptr, const void *rptr);
45
46 /* free zval ptr values (as hash dtor) */
47 extern void php_pq_hash_ptr_dtor(zval *p);
48
49 #define PHP_PQerrorMessage(c) php_pq_rtrim(PQerrorMessage((c)))
50 #define PHP_PQresultErrorMessage(r) php_pq_rtrim(PQresultErrorMessage((r)))
51
52 extern zend_class_entry *php_pqdt_class_entry;
53 extern zval *php_pqdt_from_string(zval *zv, char *input_fmt, char *dt_str, size_t dt_len, char *output_fmt, zval *ztimezone);
54 extern zend_string *php_pqdt_to_string(zval *zdt, const char *format);
55
56 extern zend_class_entry *php_pqconv_class_entry;
57
58 extern HashTable *php_pq_parse_array(php_pqres_t *res, const char *val_str, size_t val_len, Oid typ);
59
60
61 extern PHP_MINIT_FUNCTION(pq_misc);
62
63 #endif
64
65 /*
66 * Local variables:
67 * tab-width: 4
68 * c-basic-offset: 4
69 * End:
70 * vim600: noet sw=4 ts=4 fdm=marker
71 * vim<600: noet sw=4 ts=4
72 */