projects
/
m6w6
/
ext-pq
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
|
github
raw
|
inline
| side by side
fix bitmask
[m6w6/ext-pq]
/
src
/
php_pqconn.c
diff --git
a/src/php_pqconn.c
b/src/php_pqconn.c
index 2588d42f0fb09d9739f072bce180503b7630bb70..3b920e77aeba9ec17e8cd50b67cc62e418cb71f5 100644
(file)
--- a/
src/php_pqconn.c
+++ b/
src/php_pqconn.c
@@
-372,7
+372,7
@@
static void php_pqconn_object_write_def_fetch_type(zval *object, void *o, zval *
}
}
}
}
- obj->intern->default_fetch_type = Z_LVAL_P(zft) & 0x
2
; /* two bits only */
+ obj->intern->default_fetch_type = Z_LVAL_P(zft) & 0x
3
; /* two bits only */
if (zft != value) {
zval_ptr_dtor(&zft);
if (zft != value) {
zval_ptr_dtor(&zft);
@@
-402,7
+402,7
@@
static void php_pqconn_object_write_def_txn_isolation(zval *object, void *o, zva
}
}
}
}
- obj->intern->default_txn_isolation = Z_LVAL_P(zti) & 0x
2
; /* two bits only */
+ obj->intern->default_txn_isolation = Z_LVAL_P(zti) & 0x
3
; /* two bits only */
if (zti != value) {
zval_ptr_dtor(&zti);
if (zti != value) {
zval_ptr_dtor(&zti);
@@
-541,7
+541,12
@@
php_resource_factory_ops_t *php_pqconn_get_resource_factory_ops(void)
static void php_pqconn_wakeup(php_persistent_handle_factory_t *f, void **handle TSRMLS_DC)
{
static void php_pqconn_wakeup(php_persistent_handle_factory_t *f, void **handle TSRMLS_DC)
{
- // FIXME: ping server
+ PGresult *res = PQexec(*handle, "");
+ PHP_PQclear(res);
+
+ if (CONNECTION_OK != PQstatus(*handle)) {
+ PQreset(*handle);
+ }
}
static inline PGresult *unlisten(PGconn *conn, const char *channel_str, size_t channel_len TSRMLS_DC)
}
static inline PGresult *unlisten(PGconn *conn, const char *channel_str, size_t channel_len TSRMLS_DC)