FileDocCategorySizeDatePackage
ColumnHelper.javaAPI DocHibernate 3.2.51559Tue Jul 12 15:27:30 BST 2005org.hibernate.hql.ast.util

ColumnHelper

public final class ColumnHelper extends Object
Provides utility methods for dealing with arrays of SQL column names.
author
josh Jan 3, 2005 9:08:47 AM

Fields Summary
Constructors Summary
private ColumnHelper()

deprecated
(tell clover to filter this out)

	
Methods Summary
public static voidgenerateScalarColumns(org.hibernate.hql.ast.tree.HqlSqlWalkerNode node, java.lang.String[] sqlColumns, int i)
Generates the scalar column AST nodes for a given array of SQL columns

		if ( sqlColumns.length == 1 ) {
			generateSingleScalarColumn( node, i );
		}
		else {
			ASTFactory factory = node.getASTFactory();
			AST n = node;
			n.setText( sqlColumns[0] );	// Use the DOT node to emit the first column name.
			// Create the column names, folled by the column aliases.
			for ( int j = 0; j < sqlColumns.length; j++ ) {
				if ( j > 0 ) {
					n = ASTUtil.createSibling( factory, SqlTokenTypes.SQL_TOKEN, sqlColumns[j], n );
				}
				n = ASTUtil.createSibling( factory, SqlTokenTypes.SELECT_COLUMNS, " as " + NameGenerator.scalarName( i, j ), n );
			}
		}
	
public static voidgenerateSingleScalarColumn(org.hibernate.hql.ast.tree.HqlSqlWalkerNode node, int i)

		ASTFactory factory = node.getASTFactory();
		ASTUtil.createSibling( factory, SqlTokenTypes.SELECT_COLUMNS, " as " + NameGenerator.scalarName( i, 0 ), node );