public class QueryReader extends Object
// example where another class is generating the actual query QueryReader reader = new QueryReader(); QueryReader.Column col1 = reader.getNewColumn(); QueryReader.Column col2 = reader.getNewColumn(); String queryStr = otherObj.createQuery(col1, col2); Statement stmt = conn.createStatement(); ResultSet rs = stmt.executeQuery(queryStr); while(rs.hasNext()) { String col1Str = col1.getString(rs); int col2Int = col2.getInt(rs); // ... handle results ... } // example query generation QueryReader.Column rCol1; QueryReader.Column rCol2; Column col1, col2, idCol; String queryStr = new SelectQuery() .addCustomColumns(rCol1.setColumnObject(col1), rCol2.setColumnObject(col2)) .setCondition( UnaryCondition.isNotNull(idCol)).validate().toString();
Modifier and Type | Class and Description |
---|---|
static class |
QueryReader.Column
A SqlObject which outputs the passed in SqlObject, and records the
current index at the time the
appendTo method is called. |
Modifier and Type | Field and Description |
---|---|
static int |
DEFAULT_START_INDEX
the default first index that will be assigned to a column
|
Constructor and Description |
---|
QueryReader() |
QueryReader(int startIndex)
Creates a QueryReader with a different startIndex from the default.
|
Modifier and Type | Method and Description |
---|---|
QueryReader.Column |
getNewColumn() |
public static final int DEFAULT_START_INDEX
public QueryReader()
public QueryReader(int startIndex)
public QueryReader.Column getNewColumn()
Copyright © 2006–2021 OpenHMS. All rights reserved.