• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java Const类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.pentaho.pms.util.Const的典型用法代码示例。如果您正苦于以下问题:Java Const类的具体用法?Java Const怎么用?Java Const使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Const类属于org.pentaho.pms.util包,在下文中一共展示了Const类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: generateSelect

import org.pentaho.pms.util.Const; //导入依赖的package包/类
@Override
protected void generateSelect( SQLQueryModel query, StringBuilder sql ) {
  sql.append( "SELECT " );
  generateSelectPredicate( query, sql );
  sql.append( Const.CR );
  boolean first = true;
  for ( SQLSelection selection : query.getSelections() ) {
    if ( first ) {
      first = false;
      sql.append( "          " ); //$NON-NLS-1$
    } else {
      sql.append( "         ," ); //$NON-NLS-1$
    }
    sql.append( selection.getFormula() );

    if ( selection.getAlias() != null ) {
      sql.append( " AS " ); //$NON-NLS-1$
      sql.append( selection.getAlias() );
    }

    sql.append( Const.CR );
  }
}
 
开发者ID:pentaho,项目名称:pentaho-metadata,代码行数:24,代码来源:ImpalaDialect.java


示例2: generateSelect

import org.pentaho.pms.util.Const; //导入依赖的package包/类
/**
 * generates the SELECT portion of the SQL statement
 * 
 * @param query
 *          query model
 * @param sql
 *          string buffer
 */
protected void generateSelect( SQLQueryModel query, StringBuilder sql ) {
  sql.append( "SELECT " ); //$NON-NLS-1$
  generateSelectPredicate( query, sql );
  sql.append( Const.CR );
  boolean first = true;
  for ( SQLSelection selection : query.getSelections() ) {
    if ( first ) {
      first = false;
      sql.append( "          " ); //$NON-NLS-1$
    } else {
      sql.append( "         ," ); //$NON-NLS-1$
    }
    sql.append( selection.getFormula() );
    if ( selection.getAlias() != null ) {
      sql.append( " AS " ); //$NON-NLS-1$
      sql.append( selection.getAlias() );
    }
    sql.append( Const.CR );
  }
}
 
开发者ID:pentaho,项目名称:pentaho-metadata,代码行数:29,代码来源:DefaultSQLDialect.java


示例3: generateFrom

import org.pentaho.pms.util.Const; //导入依赖的package包/类
/**
 * generates the FROM portion of the SQL statement
 * 
 * @param query
 *          query model
 * @param sql
 *          string buffer
 */
protected void generateFrom( SQLQueryModel query, StringBuilder sql ) {
  sql.append( "FROM " ).append( Const.CR ); //$NON-NLS-1$
  boolean first = true;
  for ( SQLTable table : query.getTables() ) {
    if ( first ) {
      first = false;
      sql.append( "          " ); //$NON-NLS-1$
    } else {
      sql.append( "         ," ); //$NON-NLS-1$
    }
    sql.append( table.getTableName() );
    if ( table.getAlias() != null ) {
      sql.append( " " ); //$NON-NLS-1$
      sql.append( table.getAlias() );
    }
    sql.append( Const.CR );
  }
}
 
开发者ID:pentaho,项目名称:pentaho-metadata,代码行数:27,代码来源:DefaultSQLDialect.java


示例4: generateJoins

import org.pentaho.pms.util.Const; //导入依赖的package包/类
/**
 * Generates the WHERE clause portion of the SQL statement.<br>
 * In this case, we generate the joins between the tables.<br>
 * <br>
 * Important: this method only applies to regular models, not outer-join scenarios!<br>
 * 
 * @param query
 *          query model
 * @param sql
 *          string buffer
 */
protected void generateJoins( SQLQueryModel query, StringBuilder sql ) {
  if ( query.getJoins().size() > 0 ) {
    boolean first = true;
    sql.append( "WHERE " ).append( Const.CR ); //$NON-NLS-1$
    List<SQLJoin> sortedJoins = new ArrayList<SQLJoin>( query.getJoins() );
    Collections.sort( sortedJoins );
    for ( SQLJoin join : sortedJoins ) {
      if ( first ) {
        first = false;
        sql.append( "          ( " ); //$NON-NLS-1$
      } else {
        // You always "AND" join conditions...
        //
        sql.append( "      AND ( " ); //$NON-NLS-1$
      }
      sql.append( join.getSqlWhereFormula().getFormula() );
      sql.append( " )" ).append( Const.CR ); //$NON-NLS-1$
    }
  }
}
 
开发者ID:pentaho,项目名称:pentaho-metadata,代码行数:32,代码来源:DefaultSQLDialect.java


示例5: generateGroupBy

import org.pentaho.pms.util.Const; //导入依赖的package包/类
/**
 * generates the GROUP BY portion of the SQL statement
 * 
 * @param query
 *          query model
 * @param sql
 *          string buffer
 */
protected void generateGroupBy( SQLQueryModel query, StringBuilder sql ) {
  if ( query.getGroupBys().size() > 0 ) {
    sql.append( "GROUP BY " ).append( Const.CR ); //$NON-NLS-1$
    boolean first = true;
    for ( SQLSelection groupby : query.getGroupBys() ) {
      if ( first ) {
        first = false;
        sql.append( "          " ); //$NON-NLS-1$
      } else {
        sql.append( "         ," ); //$NON-NLS-1$
      }

      // only render the alias or the formula
      if ( groupby.getAlias() != null ) {
        sql.append( groupby.getAlias() );
      } else {
        sql.append( groupby.getFormula() );
      }
      sql.append( Const.CR );
    }
  }
}
 
开发者ID:pentaho,项目名称:pentaho-metadata,代码行数:31,代码来源:DefaultSQLDialect.java


示例6: compare

import org.pentaho.pms.util.Const; //导入依赖的package包/类
public int compare( SQLJoin left, SQLJoin right ) {
  // Case: no join order / no join order => equal
  if ( Const.isEmpty( left.getJoinOrderKey() ) && Const.isEmpty( right.getJoinOrderKey() ) ) {
    return 0;
  }
  // Case: join order / no join order => join order comes first
  if ( !Const.isEmpty( left.getJoinOrderKey() ) && Const.isEmpty( right.getJoinOrderKey() ) ) {
    return -1;
  }
  // Case: no join order / join order => join order comes first
  if ( Const.isEmpty( left.getJoinOrderKey() ) && !Const.isEmpty( right.getJoinOrderKey() ) ) {
    return 1;
  }
  // Case: join order / join order => natural order
  return left.getJoinOrderKey().compareTo( right.getJoinOrderKey() );
}
 
开发者ID:pentaho,项目名称:pentaho-metadata,代码行数:17,代码来源:BaseHiveDialect.java


示例7: generateSelect

import org.pentaho.pms.util.Const; //导入依赖的package包/类
@Override
protected void generateSelect( SQLQueryModel query, StringBuilder sql ) {
  sql.append( "SELECT " );
  generateSelectPredicate( query, sql );
  sql.append( Const.CR );
  boolean first = true;
  for ( SQLSelection selection : query.getSelections() ) {
    if ( first ) {
      first = false;
      sql.append( "          " ); //$NON-NLS-1$
    } else {
      sql.append( "         ," ); //$NON-NLS-1$
    }
    sql.append( selection.getFormula() );

    if ( isDriverVersion( 0, 6 ) ) {
      // Only Hive version 0.6 and beyond support column aliases
      if ( selection.getAlias() != null ) {
        sql.append( " AS " ); //$NON-NLS-1$
        sql.append( selection.getAlias() );
      }
    }
    sql.append( Const.CR );
  }
}
 
开发者ID:pentaho,项目名称:pentaho-metadata,代码行数:26,代码来源:BaseHiveDialect.java


示例8: getFromClauseWithTables

import org.pentaho.pms.util.Const; //导入依赖的package包/类
/**
 * Create a FROM clause by joining the tables of the model without any conditions.
 *
 * @param query Query Model
 * @return From clause built up by joining all tables together
 */
protected String getFromClauseWithTables( SQLQueryModel query ) {
  StringBuilder sql = new StringBuilder();
  Iterator<SQLTable> iter = query.getTables().iterator();
  SQLTable table = iter.next();
  sql.append( "          " ); //$NON-NLS-1$
  appendTableAndAlias( sql, table );
  while ( iter.hasNext() ) {
    // Hive does not support more than one table reference. When more than one table is
    // used we must explicitly join it.
    sql.append( Const.CR ).append( "     JOIN " );
    appendTableAndAlias( sql, iter.next() );
  }
  sql.append( Const.CR );
  return sql.toString();
}
 
开发者ID:pentaho,项目名称:pentaho-metadata,代码行数:22,代码来源:BaseHiveDialect.java


示例9: generateInnerJoinWhereConditions

import org.pentaho.pms.util.Const; //导入依赖的package包/类
/**
 * Add join conditions that contain operators other than equalities to the WHERE condition.
 *
 * @param query Query Model
 * @param sql   In-progress query string being built
 * @param joins {@link SQLJoin}s with WHERE conditions that have not been used in any ON clauses
 */
protected void generateInnerJoinWhereConditions( SQLQueryModel query, StringBuilder sql, List<SQLJoin> joins ) {
  if ( !joins.isEmpty() ) {
    boolean first = true;
    sql.append( "WHERE" ).append( Const.CR ); //$NON-NLS-1$
    for ( SQLJoin join : joins ) {
      if ( first ) {
        sql.append( "          ( " ); //$NON-NLS-1$
        first = false;
      } else {
        sql.append( "      AND ( " ); //$NON-NLS-1$
      }
      sql.append( join.getSqlWhereFormula().getFormula() );
      sql.append( " )" ).append( Const.CR ); //$NON-NLS-1$
    }
  }
}
 
开发者ID:pentaho,项目名称:pentaho-metadata,代码行数:24,代码来源:BaseHiveDialect.java


示例10: generateGroupBy

import org.pentaho.pms.util.Const; //导入依赖的package包/类
protected void generateGroupBy( SQLQueryModel query, StringBuilder sql ) {
  if ( query.getGroupBys().size() > 0 ) {
    sql.append( "GROUP BY " ).append( Const.CR ); //$NON-NLS-1$
    boolean first = true;
    for ( SQLSelection groupby : query.getGroupBys() ) {
      if ( first ) {
        first = false;
        sql.append( "          " ); //$NON-NLS-1$
      } else {
        sql.append( "         ," ); //$NON-NLS-1$
      }

      // Hive does not support column aliases
      // if (groupby.getAlias() != null) {
      // sql.append(groupby.getAlias());
      // } else {
      sql.append( groupby.getFormula() );
      // }
      sql.append( Const.CR );
    }
  }
}
 
开发者ID:pentaho,项目名称:pentaho-metadata,代码行数:23,代码来源:BaseHiveDialect.java


示例11: getLocale

import org.pentaho.pms.util.Const; //导入依赖的package包/类
/**
 * Create a new locale by reading it from a CWM meta-data model
 *
 * @param cwm          The CWM model to read from
 * @param cwmParameter The CwmParameter object to use
 * @return a newly created LocaleInterface class (LocaleMeta)
 */
public LocaleInterface getLocale( CWM cwm, CwmParameter cwmParameter ) {
  LocaleInterface locale = new LocaleMeta();
  locale.setCode( cwmParameter.getName() );

  // The description
  String description = cwm.getFirstTaggedValue( cwmParameter, CWM.TAG_LOCALE_DESCRIPTION );
  if ( !Const.isEmpty( description ) ) {
    locale.setDescription( description );
  }

  // The order
  String strOrder = cwm.getFirstTaggedValue( cwmParameter, CWM.TAG_LOCALE_ORDER );
  locale.setOrder( Const.toInt( strOrder, -1 ) );

  // Active?
  boolean active =
    "Y".equalsIgnoreCase( cwm.getFirstTaggedValue( cwmParameter, CWM.TAG_LOCALE_IS_ACTIVE ) ); //$NON-NLS-1$
  locale.setActive( active );

  return locale;
}
 
开发者ID:pentaho,项目名称:pentaho-metadata,代码行数:29,代码来源:CwmSchemaFactory.java


示例12: toXML

import org.pentaho.pms.util.Const; //导入依赖的package包/类
public String toXML() {
  StringBuffer xml = new StringBuffer();

  xml.append( "<security>" ).append( Const.CR ); //$NON-NLS-1$

  List owners = getOwners();
  for ( int i = 0; i < owners.size(); i++ ) {
    xml.append( "  <owner-rights>" ).append( Const.CR ); //$NON-NLS-1$
    SecurityOwner owner = (SecurityOwner) owners.get( i );
    int rights = getOwnerRights( owner );
    xml.append( "  " + owner.toXML() + " <rights>" + rights + "</rights>" ).append( Const.CR ); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
    xml.append( "  </owner-rights>" ).append( Const.CR ); //$NON-NLS-1$
  }

  xml.append( "</security>" ).append( Const.CR ); //$NON-NLS-1$

  return xml.toString();
}
 
开发者ID:pentaho,项目名称:pentaho-metadata,代码行数:19,代码来源:Security.java


示例13: toXML

import org.pentaho.pms.util.Const; //导入依赖的package包/类
public String toXML() throws Exception {
  List users = securityService.getUsers();
  List roles = securityService.getRoles();
  StringBuffer xml = new StringBuffer();

  xml.append( "<content>" ).append( Const.CR ); //$NON-NLS-1$

  xml.append( "  <users>" ).append( Const.CR ); //$NON-NLS-1$
  for ( int i = 0; i < users.size(); i++ ) {
    xml.append( "    " ).append( XMLHandler.addTagValue( "user", (String) users.get( i ) ) ); //$NON-NLS-1$ //$NON-NLS-2$
  }
  xml.append( "  </users>" ).append( Const.CR ); //$NON-NLS-1$

  xml.append( "  <roles>" ).append( Const.CR ); //$NON-NLS-1$
  for ( int i = 0; i < roles.size(); i++ ) {
    xml.append( "    " ).append( XMLHandler.addTagValue( "role", (String) roles.get( i ) ) ); //$NON-NLS-1$ //$NON-NLS-2$
  }
  xml.append( "  </roles>" ).append( Const.CR ); //$NON-NLS-1$
  xml.append( "</content>" ).append( Const.CR ); //$NON-NLS-1$

  return xml.toString();
}
 
开发者ID:pentaho,项目名称:pentaho-metadata,代码行数:23,代码来源:SecurityReference.java


示例14: getXML

import org.pentaho.pms.util.Const; //导入依赖的package包/类
public String getXML() {
  String retval = ""; //$NON-NLS-1$

  retval += "      <relationship>" + Const.CR; //$NON-NLS-1$
  retval += "        " + XMLHandler.addTagValue( "table_from", table_from.getId() ); //$NON-NLS-1$ //$NON-NLS-2$
  retval += "        " + XMLHandler.addTagValue( "table_to", table_to.getId() ); //$NON-NLS-1$ //$NON-NLS-2$
  retval += "        " + XMLHandler.addTagValue( "field_from", field_from != null ? field_from.getId() : "" ); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
  retval += "        " + XMLHandler.addTagValue( "field_to", field_to != null ? field_to.getId() : "" ); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
  retval += "        " + XMLHandler.addTagValue( "type", getTypeDesc() ); //$NON-NLS-1$ //$NON-NLS-2$
  retval += "        " + XMLHandler.addTagValue( "complex", complex ); //$NON-NLS-1$ //$NON-NLS-2$
  retval += "        " + XMLHandler.addTagValue( "complex_join", complex_join ); //$NON-NLS-1$ //$NON-NLS-2$
  retval += "        " + XMLHandler.addTagValue( "join_order_key", joinOrderKey ); //$NON-NLS-1$ //$NON-NLS-2$
  retval += "        " + XMLHandler.addTagValue( "description", description ); //$NON-NLS-1$ //$NON-NLS-2$
  retval += "      </relationship>" + Const.CR; //$NON-NLS-1$

  return retval;
}
 
开发者ID:pentaho,项目名称:pentaho-metadata,代码行数:18,代码来源:RelationshipMeta.java


示例15: fromString

import org.pentaho.pms.util.Const; //导入依赖的package包/类
public static FontSettings fromString( String value ) {
  String[] pieces = value.split( SEPARATOR );
  switch ( pieces.length ) {
    case 0:
      return null;
    case 1:
      return new FontSettings( pieces[0], 10, false, false );
    case 2:
      return new FontSettings( pieces[0], Const.toInt( pieces[1], 10 ), false, false );
    case 3:
      return new FontSettings( pieces[0], Const.toInt( pieces[1], 10 ), BOLD.equalsIgnoreCase( pieces[2] ), ITALIC
          .equalsIgnoreCase( pieces[2] ) );
    case 4:
      return new FontSettings( pieces[0], Const.toInt( pieces[1], 10 ), true, true );
    default:
      return null;
  }
}
 
开发者ID:pentaho,项目名称:pentaho-metadata,代码行数:19,代码来源:FontSettings.java


示例16: getWhereClause

import org.pentaho.pms.util.Const; //导入依赖的package包/类
/**
 * generate the SQL condition
 * 
 * @param locale
 *          locale for generating sql
 * @param useOperator
 *          appends operator if true
 * @return where clause
 */
public String getWhereClause( String locale, boolean useOperator ) throws PentahoMetadataException {
  String retval = ""; //$NON-NLS-1$
  if ( condition != null ) {
    if ( Const.isEmpty( operator ) || !useOperator ) {
      retval += Const.rightPad( " ", 9 ) + " "; //$NON-NLS-1$ //$NON-NLS-2$
    } else {
      retval += Const.rightPad( operator, 9 ) + " "; //$NON-NLS-1$
    }

    retval += " ( " + formula.generateSQL( locale ) + " ) "; //$NON-NLS-1$ //$NON-NLS-2$
  }
  return retval;
}
 
开发者ID:pentaho,项目名称:pentaho-metadata,代码行数:23,代码来源:WhereCondition.java


示例17: getFromAndWhereClauseWithInnerJoins

import org.pentaho.pms.util.Const; //导入依赖的package包/类
/**
 * Creates a FROM clause by joining tables and their WHERE conditions optimized for Impala. The basic logic is:
 * 
 * 1. Honor the user defined Join Order if possible. 2. Include WHERE condition if only equalities are used. 3. Joins
 * with WHERE conditions that contain operators other than '=' should be joined without a condition and the conditions
 * be placed in the WHERE clause of the query.
 * 
 * @param query
 *          Query Model
 * @return String representing FROM and WHERE clause based on the Inner Joins of the query model.
 */
protected String getFromAndWhereClauseWithInnerJoins( SQLQueryModel query ) {
  StringBuilder sql = new StringBuilder();
  // Copy of joins so we can manipulate the list
  List<SQLJoin> joins = new ArrayList<SQLJoin>( query.getJoins() );
  // Tables already used in join conditions (this is required to ensure tables are not duplicated)
  Set<String> usedTables = new HashSet<String>();
  // SQLJoins with WHERE conditions that must be included in the WHERE clause of the query
  List<SQLJoin> joinsForWhereClause = new LinkedList<SQLJoin>();
  // Honor the sorting order given by Join Order Key
  Collections.sort( joins, InnerJoinComparator.getInstance() );
  SQLJoin join = joins.get( 0 );
  // Use the LHS of the first join as the anchor table to start the query
  String firstTable = getTableAndAlias( join.getLeftTablename(), join.getLeftTableAlias() );
  sql.append( "          " ).append( firstTable ); //$NON-NLS-1$
  sql.append( Const.CR );
  // The first table has now been used in the query
  usedTables.add( firstTable );
  // Connect SQLJoin nodes until we can't connect any more
  connectNode( sql, usedTables, joins, joinsForWhereClause );
  // If there are joins left after we're done connecting nodes they are unreachable
  if ( !joins.isEmpty() ) {
    throw new RuntimeException( String.format( Messages.getErrorString(
        "ImpalaDialect.ERROR_0002_JOIN_PATH_NOT_FOUND", //$NON-NLS-1$
        getTableAndAlias( join.getLeftTablename(), join.getLeftTableAlias() ), getTableAndAlias( join
            .getRightTablename(), join.getRightTableAlias() ) ) ) );
  }
  // Add any joins that have where conditions that cannot be put into the ON clause because of Impala's join syntax
  generateInnerJoinWhereConditions( query, sql, joinsForWhereClause );
  return sql.toString();
}
 
开发者ID:pentaho,项目名称:pentaho-metadata,代码行数:42,代码来源:ImpalaDialect.java


示例18: generateOrderBy

import org.pentaho.pms.util.Const; //导入依赖的package包/类
protected void generateOrderBy( SQLQueryModel query, StringBuilder sql ) {

    if ( query.getOrderBys().size() > 0 ) {
      sql.append( "ORDER BY " ).append( Const.CR ); //$NON-NLS-1$
      boolean first = true;
      for ( SQLOrderBy orderby : query.getOrderBys() ) {
        if ( first ) {
          first = false;
          sql.append( "          " ); //$NON-NLS-1$
        } else {
          sql.append( "         ," ); //$NON-NLS-1$
        }

        if ( orderby.getSelection().getAlias() != null ) {
          sql.append( orderby.getSelection().getAlias() );
        } else {
          sql.append( orderby.getSelection().getFormula() );
        }

        if ( orderby.getOrder() != null ) {
          sql.append( " " ); //$NON-NLS-1$
          switch ( orderby.getOrder() ) {
            case ASCENDING:
              sql.append( "ASC" ); //$NON-NLS-1$
              break;
            case DESCENDING:
              sql.append( "DESC" ); //$NON-NLS-1$
              break;
            default:
              throw new RuntimeException( "unsupported order type: " + orderby.getOrder() ); //$NON-NLS-1$
          }
        }
        sql.append( Const.CR );
      }
    }
  }
 
开发者ID:pentaho,项目名称:pentaho-metadata,代码行数:37,代码来源:ImpalaDialect.java


示例19: generateOrderBy

import org.pentaho.pms.util.Const; //导入依赖的package包/类
/**
 * generates the HAVING portion of the SQL statement
 * 
 * @param query
 *          query model
 * @param sql
 *          string buffer
 */
protected void generateOrderBy( SQLQueryModel query, StringBuilder sql ) {
  if ( query.getOrderBys().size() > 0 ) {
    sql.append( "ORDER BY " ).append( Const.CR ); //$NON-NLS-1$
    boolean first = true;
    for ( SQLOrderBy orderby : query.getOrderBys() ) {
      if ( first ) {
        first = false;
        sql.append( "          " ); //$NON-NLS-1$
      } else {
        sql.append( "         ," ); //$NON-NLS-1$
      }
      if ( orderby.getSelection().getAlias() != null ) {
        sql.append( orderby.getSelection().getAlias() );
      } else {
        sql.append( orderby.getSelection().getFormula() );
      }
      if ( orderby.getOrder() != null ) {
        sql.append( " " ); //$NON-NLS-1$
        switch ( orderby.getOrder() ) {
          case ASCENDING:
            sql.append( "ASC" ); //$NON-NLS-1$
            break;
          case DESCENDING:
            sql.append( "DESC" ); //$NON-NLS-1$
            break;
          default:
            throw new RuntimeException( "unsupported order type: " + orderby.getOrder() );
        }
      }
      sql.append( Const.CR );
    }
  }
}
 
开发者ID:pentaho,项目名称:pentaho-metadata,代码行数:42,代码来源:DefaultSQLDialect.java


示例20: generateOuterJoin

import org.pentaho.pms.util.Const; //导入依赖的package包/类
/**
 * Generates the outer joins portion of the query.<br>
 * <br>
 * We added the joins in a particular order that we simply unroll here.<br>
 * 
 * @param query
 *          query model
 * @param sql
 *          string buffer
 * @return
 */
protected List<SQLWhereFormula> generateOuterJoin( SQLQueryModel query, StringBuilder sql ) {

  // Keep track of the SQL where formula we used in the joins
  //
  List<SQLWhereFormula> usedSQLWhereFormula = new ArrayList<SQLWhereFormula>();

  // If there are no joins, we just stop right here: return empty list.
  //
  if ( query.getJoins().size() == 0 ) {
    return usedSQLWhereFormula;
  }

  // Before this location we had the "SELECT x,y,z" part of the query in sql.
  // Now we're going to add the join syntax
  // It's important that we sort the joins to make sure the join order, intended by the model designer is used.
  // The rule is:
  // - If there is no sort order key specified and it's an inner join, we take the inner joins first
  // - If there is a sort order key specified, we sort on that.
  //
  // Obviously, it's possible to get hybrid situations, but there is little we can do about that.
  // It might be a good idea to include a model verification system module that checks this.
  //

  // First the sort: reverse ordered by join order key (or inner join capability)
  //
  List<SQLJoin> sortedJoins = new ArrayList<SQLJoin>( query.getJoins() );
  Collections.sort( sortedJoins );

  // OK, so we need to create a recursive call to add the nested Join statements...
  //
  String joinClause = getJoinClause( query, sortedJoins, 0, new ArrayList<String>(), usedSQLWhereFormula );

  sql.append( Const.CR ).append( "FROM " ).append( joinClause ).append( Const.CR ); //$NON-NLS-1$

  return usedSQLWhereFormula;
}
 
开发者ID:pentaho,项目名称:pentaho-metadata,代码行数:48,代码来源:DefaultSQLDialect.java



注:本文中的org.pentaho.pms.util.Const类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java JavaWithIfSurrounder类代码示例发布时间:2022-05-16
下一篇:
Java GridCell类代码示例发布时间:2022-05-16
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap