コード例 #1
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;
 }
コード例 #2
0
 private static boolean isAliasToken(TSourceToken token) {
   int dbObjType = token.getDbObjType();
   if (dbObjType != TObjectName.ttobjColumnAlias
       && dbObjType != TObjectName.ttObjTableAlias
       && dbObjType != TObjectName.ttobjAliasName) {
     return false;
   }
   return true;
 }
コード例 #3
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;
  }