com.healthmarketscience.sqlbuilder.dbspec.basic.DbTable Java Examples
The following examples show how to use
com.healthmarketscience.sqlbuilder.dbspec.basic.DbTable.
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: SqlBuilderTest.java From sqlbuilder with Apache License 2.0 | 5 votes |
public void testCustomPrefix() throws Exception { DbTable table = new DbSpec("pre_").addDefaultSchema().addTable("NewTable"); table.addColumn("col1"); table.addColumn("col2"); String sqlStr = new SelectQuery().addAllTableColumns(table) .validate().toString(); checkResult(sqlStr, "SELECT pre_0.* FROM NewTable pre_0"); }
Example #2
Source File: DimensionTable.java From olaper with MIT License | 4 votes |
public DbTable getDbTable() { return dbTable; }
Example #3
Source File: AggregateTable.java From olaper with MIT License | 4 votes |
public DbTable getDbTable() { return dbTable; }
Example #4
Source File: SqlQuery.java From olaper with MIT License | 4 votes |
protected void buildColumns() throws OlapException { DbTable fromTable = null; for(ResultAxis axis : resultAxes){ for(LevelMemberSet layer : axis.getLayers()){ if(layer.isMeasure()){ for(Member m : layer.getMembers()){ TableMapping.MeasureMapping mmap = mapping.getMapping((ServerMeasure) m); sql.addAliasedColumn(mmap.column.getExpression(), mmap.alias); } }else if(layer.getLevel() instanceof ServerLevel){ TableMapping.LevelMapping lmap = mapping.getMapping(layer.getLevel()); fromTable = lmap.name_column.getDbColumn().getTable(); sql.addAliasedColumn(lmap.name_column.getDbColumn(), lmap.name_alias); if(lmap.key_column!=lmap.name_column){ if(lmap.key_column==null) throw new OlapException("Key column for name:"+lmap.name_column.column+" not defined in tables.json, layer "+layer.toString()); sql.addAliasedColumn(lmap.key_column.getDbColumn(), lmap.key_alias); addGroupedBy(lmap.key_column.getDbColumn()); } if(lmap.order_column!=lmap.name_column && lmap.order_column!=lmap.key_column){ addGroupedBy(lmap.order_column.getDbColumn()); } layer.setSorter(new Sorter(lmap.order_column.getDbColumn(), lmap.order_column.sort_direction)); addGroupedBy(lmap.name_column.getDbColumn()); addJoin(lmap.join); } } } if(fromTable==null){ log.debug("Adding from table:"+mapping.getAggregate().getDbTable().getName()); sql.addFromTable(mapping.getAggregate().getDbTable()); } }