static int oracle_check_conn(void *theconn) { int ret; #ifdef HAVE_OCIPING struct ora_conn *conn = (struct ora_conn*) theconn; sword result; gw_assert(conn != NULL); result = OCIPing(conn->svchp, conn->errhp, OCI_DEFAULT); if (result != OCI_SUCCESS) { oracle_checkerr(conn->errhp, result); ret = -1; } else { ret = 0; } #else Octstr *sql; List *res; /* TODO Check for appropriate OCI function */ sql = octstr_create("SELECT 1 FROM DUAL"); ret = oracle_select(conn, sql, NULL, &res); if (ret != -1 && gwlist_len(res) > 0) { List *row = gwlist_extract_first(res); gwlist_destroy(row, octstr_destroy_item); } if (ret != -1) gwlist_destroy(res, NULL); octstr_destroy(sql); #endif return ret; }
int OracleConnection_ping(T C) { assert(C); C->lastError = OCIPing(C->svc, C->err, OCI_DEFAULT); return (C->lastError == OCI_SUCCESS); }