Skip to content

Commit e34305d

Browse files
committed
add pdo_firebird_check_liveness
1 parent d7d3a1c commit e34305d

File tree

1 file changed

+20
-1
lines changed

1 file changed

+20
-1
lines changed

ext/pdo_firebird/firebird_driver.c

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1045,6 +1045,21 @@ static int pdo_firebird_get_attribute(pdo_dbh_t *dbh, zend_long attr, zval *val)
10451045
}
10461046
/* }}} */
10471047

1048+
#if FB_API_VER >= 30
1049+
/* called by PDO to check liveness */
1050+
static zend_result pdo_firebird_check_liveness(pdo_dbh_t *dbh) /* {{{ */
1051+
{
1052+
pdo_firebird_db_handle *H = (pdo_firebird_db_handle *)dbh->driver_data;
1053+
1054+
/* return 0 if the connection is alive */
1055+
if (fb_ping(H->isc_status, &H->db)) {
1056+
return FAILURE;
1057+
}
1058+
return SUCCESS;
1059+
}
1060+
/* }}} */
1061+
#endif
1062+
10481063
/* called by PDO to retrieve driver-specific information about an error that has occurred */
10491064
static void pdo_firebird_fetch_error_func(pdo_dbh_t *dbh, pdo_stmt_t *stmt, zval *info) /* {{{ */
10501065
{
@@ -1070,7 +1085,11 @@ static const struct pdo_dbh_methods firebird_methods = { /* {{{ */
10701085
NULL, /* last_id not supported */
10711086
pdo_firebird_fetch_error_func,
10721087
pdo_firebird_get_attribute,
1073-
NULL, /* check_liveness */
1088+
#if FB_API_VER >= 30
1089+
pdo_firebird_check_liveness,
1090+
#else
1091+
NULL,
1092+
#endif
10741093
NULL, /* get driver methods */
10751094
NULL, /* request shutdown */
10761095
NULL, /* in transaction, use PDO's internal tracking mechanism */

0 commit comments

Comments
 (0)