Skip to content

Commit 6f5e79d

Browse files
committed
add pdo_firebird_check_liveness
1 parent ab5edb6 commit 6f5e79d

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
@@ -1216,6 +1216,21 @@ static int pdo_firebird_get_attribute(pdo_dbh_t *dbh, zend_long attr, zval *val)
12161216
}
12171217
/* }}} */
12181218

1219+
#if FB_API_VER >= 30
1220+
/* called by PDO to check liveness */
1221+
static zend_result pdo_firebird_check_liveness(pdo_dbh_t *dbh) /* {{{ */
1222+
{
1223+
pdo_firebird_db_handle *H = (pdo_firebird_db_handle *)dbh->driver_data;
1224+
1225+
/* return 0 if the connection is alive */
1226+
if (fb_ping(H->isc_status, &H->db)) {
1227+
return FAILURE;
1228+
}
1229+
return SUCCESS;
1230+
}
1231+
/* }}} */
1232+
#endif
1233+
12191234
/* called by PDO to retrieve driver-specific information about an error that has occurred */
12201235
static void pdo_firebird_fetch_error_func(pdo_dbh_t *dbh, pdo_stmt_t *stmt, zval *info) /* {{{ */
12211236
{
@@ -1254,7 +1269,11 @@ static const struct pdo_dbh_methods firebird_methods = { /* {{{ */
12541269
NULL, /* last_id not supported */
12551270
pdo_firebird_fetch_error_func,
12561271
pdo_firebird_get_attribute,
1257-
NULL, /* check_liveness */
1272+
#if FB_API_VER >= 30
1273+
pdo_firebird_check_liveness,
1274+
#else
1275+
NULL,
1276+
#endif
12581277
NULL, /* get driver methods */
12591278
NULL, /* request shutdown */
12601279
pdo_firebird_in_manually_transaction,

0 commit comments

Comments
 (0)