@Test public void testNamedQueryColumnProjection() throws Exception { context.setFilterString("a0c20s1d1o5"); context.getTupleDescription().get(1).setProjected(false); context.getTupleDescription().get(3).setProjected(false); context.getTupleDescription().get(4).setProjected(false); SQLQueryBuilder builder = new SQLQueryBuilder(context, mockMetaData, NAMED_QUERY_WHERE); String query = builder.buildSelectQuery(); assertEquals("SELECT id, amt FROM (SELECT a, b FROM c WHERE d = 'foo') pxfsubquery WHERE id = 1", query); }
public String buildSelectQuery() { StringBuilder sb = new StringBuilder("SELECT ") .append(buildColumnsQuery()) .append(" FROM ") .append(getSource()); buildWhereSQL(sb); buildFragmenterSql(context, dbProduct, quoteString, sb); return sb.toString(); }
SQLQueryBuilder { public String buildSelectQuery() { StringBuilder sb = new StringBuilder("SELECT ") .append(buildColumnsQuery()) .append(" FROM ") .append(getSource()); buildWhereSQL(sb); buildFragmenterSql(context, dbProduct, quoteString, sb); return sb.toString(); } }
SQLQueryBuilder { public String buildSelectQuery() { StringBuilder sb = new StringBuilder("SELECT ") .append(buildColumnsQuery()) .append(" FROM ") .append(getSource()); buildWhereSQL(sb); buildFragmenterSql(context, dbProduct, quoteString, sb); return sb.toString(); } SQLQueryBuilder(RequestContext context, DatabaseMetaData metaData);  SQLQueryBuilder(RequestContext context, DatabaseMetaData metaData, String subQuery); }
SQLQueryBuilder { public String buildSelectQuery() { StringBuilder sb = new StringBuilder("SELECT ") .append(buildColumnsQuery()) .append(" FROM ") .append(getSource()); buildWhereSQL(sb); buildFragmenterSql(context, dbProduct, quoteString, sb); return sb.toString(); } SQLQueryBuilder(RequestContext context, DatabaseMetaData metaData);  SQLQueryBuilder(RequestContext context, DatabaseMetaData metaData, String subQuery); String buildSelectQuery(); String buildInsertQuery(); void autoSetQuoteString(); void forceSetQuoteString(); void buildFragmenterSql(RequestContext context, DbProduct dbProduct, String quoteString, StringBuilder query); }
SQLQueryBuilder { public String buildSelectQuery() { StringBuilder sb = new StringBuilder("SELECT ") .append(buildColumnsQuery()) .append(" FROM ") .append(getSource()); buildWhereSQL(sb); buildFragmenterSql(context, dbProduct, quoteString, sb); return sb.toString(); } SQLQueryBuilder(RequestContext context, DatabaseMetaData metaData);  SQLQueryBuilder(RequestContext context, DatabaseMetaData metaData, String subQuery); String buildSelectQuery(); String buildInsertQuery(); void autoSetQuoteString(); void forceSetQuoteString(); void buildFragmenterSql(RequestContext context, DbProduct dbProduct, String quoteString, StringBuilder query);  }