public final class Pql extends Object
ResultSet combinedResultSet = null
do {
ResultSet resultSet = pqlService.select(pagedStatement);
combinedResultSet = (combinedResultSet == null) ? resultSet :
Pql.combineResultSet(combinedResultSet, resultSet);
// ...
} while(!finishedCollectingResultSets)
//...
CsvFiles.writeCsv(Pql.resultSetToStringArrayList(combinedResultSet), filePath);
| Modifier and Type | Method and Description |
|---|---|
static ResultSet |
combineResultSets(ResultSet first,
ResultSet second)
Combines the first and second result sets, if and only if, the columns
of both result sets match.
|
static Value |
createValue(Object value)
Creates a
Value from the value i.e. |
static List<String> |
getColumnLabels(ResultSet resultSet)
Gets the column labels for the result set.
|
static List<String> |
getRowStringValues(Row row)
Gets the values in a row of the result set in the form of a string
list.
|
static String |
resultSetToString(ResultSet resultSet)
Gets the result set as a table representation in the form of:
|
static List<String[]> |
resultSetToStringArrayList(ResultSet resultSet)
Gets the result set as list of string arrays, which can be transformed to
a CSV using
CsvFiles such as |
static String |
toString(Value value)
Creates a String from the Value.
|
public static Value createValue(Object value)
Value from the value i.e. a TextValue for a
value of type String, BooleanValue for type
Boolean, NumberValue for type Double,
Long, or Integer, DateTimeValue for type
DateTime, and DateValue for type Date. If the value
is a Value, the value is returned. If the value is null, an
empty TextValue is returned.value - the value to convertIllegalArgumentException - if value cannot be convertedpublic static String toString(Value value)
DateTimes.toString(Date) and
DateTimes.toStringWithTimeZone(DateTime) respectively.value - the value to convertIllegalArgumentException - if value cannot be convertedpublic static List<String[]> resultSetToStringArrayList(ResultSet resultSet)
CsvFiles such as
ResultSet combinedResultSet = Pql.combineResultSet(resultSet1, resultSet2);
//...
combinedResultSet = Pql.combineResultSet(combinedResultSet, resultSet3);
CsvFiles.writeCsv(Pql.resultSetToStringArrayList(combinedResultSet), filePath);
resultSet - the result set to convert to a CSV compatible formatpublic static String resultSetToString(ResultSet resultSet) throws IllegalAccessException
+-------+-------+-------+ |column1|column2|column3| +-------+-------+-------+ |value1 |value2 |value3 | +-------+-------+-------+ |value1 |value2 |value3 | +-------+-------+-------+
resultSet - the result set to display as a stringIllegalAccessException - if the values of the result set cannot be
accessedpublic static List<String> getColumnLabels(ResultSet resultSet)
resultSet - the result set to get the column labels forpublic static List<String> getRowStringValues(Row row)
row - the row to get the values forpublic static ResultSet combineResultSets(ResultSet first, ResultSet second)
IllegalArgumentException - if the columns of the first result set
don't match the secondCopyright © 2013. All Rights Reserved.