org.eclipse.persistence.internal.helper.Helper.compareVersions()方法的使用及代码示例

x33g5p2x  于2022-01-20 转载在 其他  
字(9.8k)|赞(0)|评价(0)|浏览(162)

本文整理了Java中org.eclipse.persistence.internal.helper.Helper.compareVersions()方法的一些代码示例,展示了Helper.compareVersions()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Helper.compareVersions()方法的具体详情如下:
包路径:org.eclipse.persistence.internal.helper.Helper
类名称:Helper
方法名:compareVersions

Helper.compareVersions介绍

[英]INTERNAL: Compares two version in num.num.num.num.num*** format. -1, 0, 1 means the version1 is less than, equal, greater than version2. Example: compareVersions("11.1.0.6.0-Production", "11.1.0.7") == -1
[中]内部:比较num.num.num.num***格式的两个版本-1、0、1表示版本1小于、等于或大于版本2。示例:比较(“11.1.0.6.0-Production”、“11.1.0.7”)=-1

代码示例

代码示例来源:origin: org.eclipse.persistence/org.eclipse.persistence.core

@Override
public void initializeConnectionData(Connection connection) throws SQLException {
  if (this.isConnectionDataInitialized) {
    return;
  }
  DatabaseMetaData dmd = connection.getMetaData();
  String databaseVersion = dmd.getDatabaseProductVersion();
  this.isFractionalTimeSupported = Helper.compareVersions(databaseVersion, "5.6.4") >= 0;
  // Driver 5.1 supports NVARCHAR
  this.driverSupportsNationalCharacterVarying = Helper.compareVersions(dmd.getDriverVersion(), "5.1.0") >= 0;
  this.isConnectionDataInitialized = true;
}

代码示例来源:origin: com.haulmont.thirdparty/eclipselink

@Override
public void initializeConnectionData(Connection connection) throws SQLException {
  if (this.isConnectionDataInitialized) {
    return;
  }
  DatabaseMetaData dmd = connection.getMetaData();
  String databaseVersion = dmd.getDatabaseProductVersion();
  this.isFractionalTimeSupported = Helper.compareVersions(databaseVersion, "5.6.4") >= 0;
  // Driver 5.1 supports NVARCHAR
  this.driverSupportsNationalCharacterVarying = Helper.compareVersions(dmd.getDriverVersion(), "5.1.0") >= 0;
  this.isConnectionDataInitialized = true;
}

代码示例来源:origin: org.eclipse.persistence/org.eclipse.persistence.core

@Override
public void initializeConnectionData(Connection connection) throws SQLException {
  DatabaseMetaData dmd = connection.getMetaData();
  this.driverSupportsNationalCharacterVarying = Helper.compareVersions(dmd.getDriverVersion(), "7.0.0") >= 0;
}

代码示例来源:origin: org.eclipse.persistence/org.eclipse.persistence.core

@Override
public void initializeConnectionData(Connection connection) throws SQLException {
  DatabaseMetaData dmd = connection.getMetaData();
  // Tested with 11.1.0.6
  this.driverSupportsNationalCharacterVarying = Helper.compareVersions(dmd.getDriverVersion(), "11.1") >= 0;
}

代码示例来源:origin: com.haulmont.thirdparty/eclipselink

@Override
public void initializeConnectionData(Connection connection) throws SQLException {
  DatabaseMetaData dmd = connection.getMetaData();
  this.driverSupportsNationalCharacterVarying = Helper.compareVersions(dmd.getDriverVersion(), "7.0.0") >= 0;
}

代码示例来源:origin: com.haulmont.thirdparty/eclipselink

@Override
public void initializeConnectionData(Connection connection) throws SQLException {
  DatabaseMetaData dmd = connection.getMetaData();
  // Tested with 11.1.0.6
  this.driverSupportsNationalCharacterVarying = Helper.compareVersions(dmd.getDriverVersion(), "11.1") >= 0;
}

代码示例来源:origin: com.haulmont.thirdparty/eclipselink

@Override
public void initializeConnectionData(Connection connection) throws SQLException {
  if (isConnectionDataInitialized) {
    return;
  }
  DatabaseMetaData dmd = connection.getMetaData();
  int databaseVersion = dmd.getDatabaseMajorVersion();
  supportsSequenceObjects = databaseVersion >= 11;
  isConnectionDataInitialized = true;
  this.driverSupportsNationalCharacterVarying = Helper.compareVersions(dmd.getDriverVersion(), "4.0.0") >= 0;
}

代码示例来源:origin: org.eclipse.persistence/org.eclipse.persistence.core

@Override
public void initializeConnectionData(Connection connection) throws SQLException {
  if (isConnectionDataInitialized) {
    return;
  }
  DatabaseMetaData dmd = connection.getMetaData();
  int databaseVersion = dmd.getDatabaseMajorVersion();
  isVersion11OrHigher = databaseVersion >= 11;
  isConnectionDataInitialized = true;
  this.driverSupportsNationalCharacterVarying = Helper.compareVersions(dmd.getDriverVersion(), "4.0.0") >= 0;
}

代码示例来源:origin: com.haulmont.thirdparty/eclipselink

/**
   * INTERNAL:
   */
  @Override
  public void initializeConnectionData(Connection connection) throws SQLException {
    if (isConnectionDataInitialized) {
      return;
    }

    String databaseVersion = connection.getMetaData().getDatabaseProductVersion();
    if (Helper.compareVersions(databaseVersion, "10.6.1") >= 0) {
      isSequenceSupported = true;
      isOffsetFetchParameterSupported = true;
    }

    isConnectionDataInitialized = true;
  }
}

代码示例来源:origin: org.eclipse.persistence/org.eclipse.persistence.core

/**
   * INTERNAL:
   */
  @Override
  public void initializeConnectionData(Connection connection) throws SQLException {
    if (isConnectionDataInitialized) {
      return;
    }

    String databaseVersion = connection.getMetaData().getDatabaseProductVersion();
    if (Helper.compareVersions(databaseVersion, "10.6.1") >= 0) {
      isSequenceSupported = true;
      isOffsetFetchParameterSupported = true;
    }

    isConnectionDataInitialized = true;
  }
}

代码示例来源:origin: com.haulmont.thirdparty/eclipselink

/**
 * INTERNAL:
 */
@Override
public void initializeConnectionData(Connection connection) throws SQLException {
  if (this.isConnectionDataInitialized || (connection == null) || (connection.getMetaData() == null)) {
    return;
  }
  this.driverVersion = connection.getMetaData().getDriverVersion();
  // printCalendar for versions greater or equal 9 and less than 10.2.0.4
  this.shouldPrintCalendar = Helper.compareVersions("9", this.driverVersion) <= 0 && Helper.compareVersions(this.driverVersion, "10.2.0.4") < 0;
  if( Helper.compareVersions(this.driverVersion, "11.1.0.7") >= 0) {
    if(connection instanceof OracleConnection) {
      String timestampTzInGmtPropStr = ((OracleConnection)connection).getProperties().getProperty("oracle.jdbc.timestampTzInGmt", "true");
      this.isTimestampInGmt = timestampTzInGmtPropStr.equalsIgnoreCase("true");
    } else {
      this.isTimestampInGmt = true;
    }
    if (Helper.compareVersions(this.driverVersion, "11.2.0.2") >= 0) {
      this.isLtzTimestampInGmt = true;
    }
  }
  this.isConnectionDataInitialized = true;
}

代码示例来源:origin: org.eclipse.persistence/org.eclipse.persistence.oracle

/**
 * INTERNAL:
 */
@Override
public void initializeConnectionData(Connection connection) throws SQLException {
  if (this.isConnectionDataInitialized || (connection == null) || (connection.getMetaData() == null)) {
    return;
  }
  this.driverVersion = connection.getMetaData().getDriverVersion();
  // printCalendar for versions greater or equal 9 and less than 10.2.0.4
  this.shouldPrintCalendar = Helper.compareVersions("9", this.driverVersion) <= 0 && Helper.compareVersions(this.driverVersion, "10.2.0.4") < 0;
  if (Helper.compareVersions(this.driverVersion, "11.1.0.7") >= 0) {
    if( connection instanceof OracleConnection ) {
      final OracleConnection oraConn = (OracleConnection)connection;
      String timestampTzInGmtPropStr = oraConn.getProperties().getProperty("oracle.jdbc.timestampTzInGmt", "true");
      this.connectionUserName = oraConn.getUserName();
      this.isTimestampInGmt = timestampTzInGmtPropStr.equalsIgnoreCase("true");
    } else {
      this.connectionUserName = connection.getMetaData().getUserName();
      this.isTimestampInGmt = true;
    }
    if (Helper.compareVersions(this.driverVersion, "11.2.0.2") >= 0) {
      this.isLtzTimestampInGmt = true;
    }
  }
  this.isConnectionDataInitialized = true;
}

代码示例来源:origin: org.eclipse.persistence/com.springsource.org.eclipse.persistence

/**
 * INTERNAL:
 * Compares two version in num.num.num.num.num*** format.
 * -1, 0, 1 means the version1 is less than, equal, greater than version2.
 * Example: compareVersions("11.1.0.6.0-Production", "11.1.0.7") == -1 
 */
public static int compareVersions(String version1, String version2) {
  return compareVersions(version(version1), version(version2));
}

代码示例来源:origin: org.eclipse.persistence/org.eclipse.persistence.core

/**
 * INTERNAL:
 * Compares two version in num.num.num.num.num*** format.
 * -1, 0, 1 means the version1 is less than, equal, greater than version2.
 * Example: compareVersions("11.1.0.6.0-Production", "11.1.0.7") == -1
 * Example: compareVersions("WebLogic Server 10.3.4", "10.3.3.0") == 1
 */
public static int compareVersions(String version1, String version2) {
  return compareVersions(version(version1), version(version2));
}

代码示例来源:origin: com.haulmont.thirdparty/eclipselink

/**
 * INTERNAL:
 * Compares two version in num.num.num.num.num*** format.
 * -1, 0, 1 means the version1 is less than, equal, greater than version2.
 * Example: compareVersions("11.1.0.6.0-Production", "11.1.0.7") == -1 
 * Example: compareVersions("WebLogic Server 10.3.4", "10.3.3.0") == 1
 */
public static int compareVersions(String version1, String version2) {
  return compareVersions(version(version1), version(version2));
}

代码示例来源:origin: org.eclipse.persistence/org.eclipse.persistence.core

/**
 * INTERNAL: Set the WLS version number through reflection.
 */
public void initializeServerNameAndVersion() {
  try {
    Class clazz = PrivilegedAccessHelper.getClassForName("weblogic.version");
    Method method = PrivilegedAccessHelper.getMethod(clazz, "getReleaseBuildVersion", null, false);
    this.serverNameAndVersion = (String) PrivilegedAccessHelper.invokeMethod(method, null, null);
    this.shouldClearStatementCache = Helper.compareVersions(this.serverNameAndVersion, "10.3.4") < 0;
  } catch (Exception exception) {
    getDatabaseSession().getSessionLog().logThrowable(SessionLog.WARNING, SessionLog.SERVER, exception);
  }
}

代码示例来源:origin: com.haulmont.thirdparty/eclipselink

/**
 * INTERNAL: Set the WLS version number through reflection.
 */
public void initializeServerNameAndVersion() {
  try {
    Class clazz = PrivilegedAccessHelper.getClassForName("weblogic.version");
    Method method = PrivilegedAccessHelper.getMethod(clazz, "getReleaseBuildVersion", null, false);
    this.serverNameAndVersion = (String) PrivilegedAccessHelper.invokeMethod(method, null, null);
    this.shouldClearStatementCache = Helper.compareVersions(this.serverNameAndVersion, "10.3.4") < 0;
  } catch (Exception exception) {
    getDatabaseSession().getSessionLog().logThrowable(SessionLog.WARNING, SessionLog.SERVER, exception);
  }
}

相关文章

Helper类方法