private boolean driverUsesSpFkeys(Database database) throws DatabaseException {
        if (!(database instanceof MSSQLDatabase)) {
            return false;
        }
        DatabaseConnection connection = database.getConnection();
        if (!(connection instanceof JdbcConnection)) {
            return false;
        }

        try {
            DatabaseMetaData metaData = ((JdbcConnection) connection).getMetaData();
            int driverMajorVersion = metaData.getDriverMajorVersion();
            int driverMinorVersion= metaData.getDriverMinorVersion();
            String driverName = metaData.getDriverName();

            if (!driverName.startsWith("Microsoft")) {
                return false;
            }

            if (driverMajorVersion > 6 || (driverMajorVersion == 6 && driverMinorVersion >= 3)) {
                return false;
            }

            return true;
        } catch (SQLException e) {
            throw new DatabaseException(e);
        }
    }
private boolean driverUsesSpFkeys(Database database) throws DatabaseException {
        if (!(database instanceof MSSQLDatabase)) {
            return false;
        }
        DatabaseConnection connection = database.getConnection();
        if (!(connection instanceof JdbcConnection)) {
            return false;
        }

        try {
            DatabaseMetaData metaData = ((JdbcConnection) connection).getMetaData();
            int driverMajorVersion = metaData.getDriverMajorVersion();
            int driverMinorVersion= metaData.getDriverMinorVersion();
            String driverName = metaData.getDriverName();

            if (!driverName.startsWith("Microsoft")) {
                return false;
            }

            if (driverMajorVersion > 6 || (driverMajorVersion == 6 && driverMinorVersion >= 3)) {
                return false;
            }

            return true;
        } catch (SQLException e) {
            throw new DatabaseException(e);
        }
    }
private boolean driverUsesSpFkeys ( Database database ) throws DatabaseException { if ( ! ( database instanceof MSSQLDatabase ) ) { return false ; } DatabaseConnection connection = database . getConnection ( ) ; if ( ! ( connection instanceof JdbcConnection ) ) { return false ; } try { DatabaseMetaData metaData = ( ( JdbcConnection ) connection ) . getMetaData ( ) ; int driverMajorVersion = metaData . getDriverMajorVersion ( ) ; int driverMinorVersion = metaData . getDriverMinorVersion ( ) ; String driverName = metaData . getDriverName ( ) ; if ( ! driverName . startsWith ( "Microsoft" ) ) { return false ; } if ( driverMajorVersion > 6 || ( driverMajorVersion == 6 && driverMinorVersion >= 3 ) ) { return false ; } return true ; } catch ( SQLException e ) { throw new DatabaseException ( e ) ; } }
/*
Sql server JDBC drivers prior to 6.3.3 used sp_fkeys to determine the delete/cascade metadata.
The sp_fkeys stored procedure spec says that returned integer values of 0, 1, 2, or 4
translate to cascade, noAction, SetNull, or SetDefault which are not the values in the JDBC
standard.

If this method returns true, the sp_fkeys values should be used. Otherwise use the standard jdbc logic

The change in logic went in with https://github.com/Microsoft/mssql-jdbc/pull/490
/ * Sql server JDBC drivers prior to 6 . 3 . 3 used sp_fkeys to determine the delete / cascade metadata . The sp_fkeys stored procedure spec says that returned integer values of 0 1 2 or 4 translate to cascade noAction SetNull or SetDefault which are not the values in the JDBC standard .