예제 #1
0
  private static String isFunction(TSourceToken token, EDbVendor targetVendor)
      throws FunctionIdentifierException {
    if (token.toString().equalsIgnoreCase("CURRENT_DATE")
        && token.getDbvendor() == EDbVendor.dbvoracle) {
      switch (targetVendor) {
        case dbvmssql:
          return "SYSDATETIME()";
      }
      throw new FunctionIdentifierException();
    }
    if (token.toString().equalsIgnoreCase("LOCALTIMESTAMP")
        && token.getDbvendor() == EDbVendor.dbvoracle) {
      switch (targetVendor) {
        case dbvmssql:
          return "SYSDATETIME()";
      }
      throw new FunctionIdentifierException();
    }
    if (token.toString().equalsIgnoreCase("SYSTIMESTAMP")
        && token.getDbvendor() == EDbVendor.dbvoracle) {
      switch (targetVendor) {
        case dbvmssql:
          return "SYSDATETIMEOFFSET()";
      }
      throw new FunctionIdentifierException();
    }

    return null;
  }
예제 #2
0
 private static String isSpecial(TSourceToken token, EDbVendor targetVendor)
     throws SpecialIdentifierException {
   if (token.toString().equalsIgnoreCase("DUAL") && token.getDbvendor() == EDbVendor.dbvoracle) {
     switch (targetVendor) {
       case dbvmssql:
         throw new SpecialIdentifierException(
             "Dual is a table that is created by Oracle together with data dictionary. There is no DUAL table in SQL Server.");
       default:
         throw new SpecialIdentifierException(
             "Dual is a table that is created by Oracle together with data dictionary.");
     }
   }
   return null;
 }