// Path: rxjava2-jdbc/src/main/java/org/davidmoten/rx/jdbc/pool/internal/HealthCheckPredicate.java
// public final class HealthCheckPredicate implements Predicate<Connection> {
// 
//         private final String sql;
// 
//         public HealthCheckPredicate(String sql) {
//             this.sql = sql;
//         }
// 
//         @Override
//         public boolean test(Connection c) throws Exception {
//             try (Statement s = c.createStatement()) {
//                 s.executeQuery(sql).close();
//                 return true;
//             } catch (Throwable t) {
//                 return false;
//             }
//         }
//     }


import java.sql.Connection;
import org.davidmoten.rx.jdbc.pool.internal.HealthCheckPredicate;
import io.reactivex.functions.Predicate;
package org.davidmoten.rx.jdbc.pool;




public enum DatabaseType {

    ORACLE("select 1 from dual"), //
    HSQLDB("SELECT 1 FROM INFORMATION_SCHEMA.SYSTEM_USERS"), //
    H2("select 1"), //
    SQL_SERVER("select 1"), //
    MYSQL("select 1"), //
    POSTGRES("select 1"), //
    SQLITE("select 1"), //
    DB2("select 1 from sysibm.sysdummy1"), //
    DERBY("SELECT 1 FROM SYSIBM.SYSDUMMY1"), //
    INFORMIX("select count(*) from systables"), //
    OTHER("select 1");

    private final String healthCheckSql;

    private DatabaseType(String healthCheckSql) {
        this.healthCheckSql = healthCheckSql;
    }

    public Predicate<Connection >healthCheck() {
// Path: rxjava2-jdbc/src/main/java/org/davidmoten/rx/jdbc/pool/internal/HealthCheckPredicate.java
// public final class HealthCheckPredicate implements Predicate<Connection> {
// 
//         private final String sql;
// 
//         public HealthCheckPredicate(String sql) {
//             this.sql = sql;
//         }
// 
//         @Override
//         public boolean test(Connection c) throws Exception {
//             try (Statement s = c.createStatement()) {
//                 s.executeQuery(sql).close();
//                 return true;
//             } catch (Throwable t) {
//                 return false;
//             }
//         }
//     }


// Path: rxjava2-jdbc/src/main/java/org/davidmoten/rx/jdbc/pool/DatabaseType.java
import java.sql.Connection;
import org.davidmoten.rx.jdbc.pool.internal.HealthCheckPredicate;
import io.reactivex.functions.Predicate;

package org.davidmoten.rx.jdbc.pool;




public enum DatabaseType {

    ORACLE("select 1 from dual"), //
    HSQLDB("SELECT 1 FROM INFORMATION_SCHEMA.SYSTEM_USERS"), //
    H2("select 1"), //
    SQL_SERVER("select 1"), //
    MYSQL("select 1"), //
    POSTGRES("select 1"), //
    SQLITE("select 1"), //
    DB2("select 1 from sysibm.sysdummy1"), //
    DERBY("SELECT 1 FROM SYSIBM.SYSDUMMY1"), //
    INFORMIX("select count(*) from systables"), //
    OTHER("select 1");

    private final String healthCheckSql;

    private DatabaseType(String healthCheckSql) {
        this.healthCheckSql = healthCheckSql;
    }

    public Predicate<Connection >healthCheck() {
        return new HealthCheckPredicate(healthCheckSql);