use of org.h2.tools.SimpleResultSet in project h2database by h2database.
the class TestFunctions method varArgsFunctionTable.
/**
* This method is called via reflection from the database.
*
* @param values the value array
* @return a result set
*/
public static ResultSet varArgsFunctionTable(int... values) throws SQLException {
if (values.length != 6) {
throw new SQLException("Unexpected argument count");
}
SimpleResultSet result = new SimpleResultSet();
result.addColumn("A", Types.INTEGER, 0, 0);
for (int value : values) {
result.addRow(value);
}
return result;
}
use of org.h2.tools.SimpleResultSet in project h2database by h2database.
the class TestFunctions method simpleFunctionTable.
/**
* This method is called via reflection from the database.
*
* @param conn the connection
* @return a result set
*/
public static ResultSet simpleFunctionTable(@SuppressWarnings("unused") Connection conn) {
SimpleResultSet result = new SimpleResultSet();
result.addColumn("A", Types.INTEGER, 0, 0);
result.addColumn("B", Types.CHAR, 0, 0);
result.addRow(42, 'X');
return result;
}
use of org.h2.tools.SimpleResultSet in project h2database by h2database.
the class TestSpatial method pointTable.
/**
* This method is called via reflection from the database.
*
* @param x the x position of the point
* @param y the y position of the point
* @return a result set with this point
*/
public static ResultSet pointTable(double x, double y) {
GeometryFactory factory = new GeometryFactory();
SimpleResultSet rs = new SimpleResultSet();
rs.addColumn("THE_GEOM", Types.JAVA_OBJECT, "GEOMETRY", 0, 0);
rs.addRow(factory.createPoint(new Coordinate(x, y)));
return rs;
}
use of org.h2.tools.SimpleResultSet in project spring-integration by spring-projects.
the class H2StoredProcedures method getPrimes.
public static ResultSet getPrimes(int beginRange, int endRange) throws SQLException {
SimpleResultSet rs = new SimpleResultSet();
rs.addColumn("PRIME", Types.INTEGER, 10, 0);
for (int i = beginRange; i <= endRange; i++) {
if (new BigInteger(String.valueOf(i)).isProbablePrime(100)) {
rs.addRow(i);
}
}
return rs;
}
use of org.h2.tools.SimpleResultSet in project siena by mandubian.
the class FullText method createResultSet.
/**
* Create an empty search result and initialize the columns.
*
* @param data true if the result set should contain the primary key data as
* an array.
* @return the empty result set
*/
protected static SimpleResultSet createResultSet(boolean data) {
SimpleResultSet result = new SimpleResultSet();
if (data) {
result.addColumn(FullText.FIELD_SCHEMA, Types.VARCHAR, 0, 0);
result.addColumn(FullText.FIELD_TABLE, Types.VARCHAR, 0, 0);
result.addColumn(FullText.FIELD_COLUMNS, Types.ARRAY, 0, 0);
result.addColumn(FullText.FIELD_KEYS, Types.ARRAY, 0, 0);
} else {
result.addColumn(FullText.FIELD_QUERY, Types.VARCHAR, 0, 0);
}
result.addColumn(FullText.FIELD_SCORE, Types.FLOAT, 0, 0);
return result;
}
Aggregations