Java Code Examples for com.healthmarketscience.sqlbuilder.SelectQuery#addCustomization()

The following examples show how to use com.healthmarketscience.sqlbuilder.SelectQuery#addCustomization() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: PgLimitClause.java    From sqlbuilder with Apache License 2.0 4 votes vote down vote up
@Override
public void apply(SelectQuery query) {
  query.addCustomization(SelectQuery.Hook.FOR_UPDATE, HookType.BEFORE, this);
}
 
Example 2
Source File: PgOffsetClause.java    From sqlbuilder with Apache License 2.0 4 votes vote down vote up
@Override
public void apply(SelectQuery query) {
  query.addCustomization(SelectQuery.Hook.FOR_UPDATE, HookType.BEFORE, this);
}
 
Example 3
Source File: MssTopClause.java    From sqlbuilder with Apache License 2.0 4 votes vote down vote up
@Override
public void apply(SelectQuery query) {
  query.addCustomization(SelectQuery.Hook.DISTINCT, HookType.AFTER, this);
}
 
Example 4
Source File: MysLimitClause.java    From sqlbuilder with Apache License 2.0 4 votes vote down vote up
@Override
public void apply(SelectQuery query) {
  query.addCustomization(SelectQuery.Hook.FOR_UPDATE, HookType.BEFORE, this);
}
 
Example 5
Source File: SqlMembersQuery.java    From olaper with MIT License 3 votes vote down vote up
public void generateQuery() throws OlapException {
	
	DimensionTable dtable = physicalSchema.findDimensionTable(level.getDimension());
	if(dtable==null)
		throw new OlapException("Not found dimension mapping: "+level.getDimension());
	TableColumn column = dtable.findColumnByAttribute(level.getName());
	if(column==null)
		throw new OlapException("Not found column mapping: "+level.getName());
	
	TableColumn id_column = column.identified_by==null ? column : dtable.findColumnByName(column.identified_by);
	TableColumn sort_column = column.sorted_by==null ? column : dtable.findColumnByName(column.sorted_by);
	
	
	sql = new SelectQuery();
	
	sql.addAliasedColumn(id_column.getDbColumn(), ID_ALIAS);
	sql.addAliasedColumn(column.getDbColumn(), NAME_ALIAS);		
	
	sql.addGroupings(id_column.getDbColumn());	
	
	if(id_column!=column){
		sql.addGroupings(column.getDbColumn());
	}
	
	if(sort_column!=column && sort_column!=id_column){
		sql.addGroupings(sort_column.getDbColumn());
	}
	
	sql.addOrderings(sort_column.getDbColumn());		
	sql.addCustomization(new MysLimitClause(1000));

	
}