Author: aadamchik
Date: Wed Aug 30 12:05:38 2006
New Revision: 438590
URL: http://svn.apache.org/viewvc?rev=438590&view=rev
Log:
more utility methods for the itests
Modified:
incubator/cayenne/main/trunk/integration-test/itest-common/src/main/java/org/apache/cayenne/jpa/itest/ItestDBUtils.java
Modified:
incubator/cayenne/main/trunk/integration-test/itest-common/src/main/java/org/apache/cayenne/jpa/itest/ItestDBUtils.java
URL:
http://svn.apache.org/viewvc/incubator/cayenne/main/trunk/integration-test/itest-common/src/main/java/org/apache/cayenne/jpa/itest/ItestDBUtils.java?rev=438590&r1=438589&r2=438590&view=diff
==============================================================================
---
incubator/cayenne/main/trunk/integration-test/itest-common/src/main/java/org/apache/cayenne/jpa/itest/ItestDBUtils.java
(original)
+++
incubator/cayenne/main/trunk/integration-test/itest-common/src/main/java/org/apache/cayenne/jpa/itest/ItestDBUtils.java
Wed Aug 30 12:05:38 2006
@@ -58,6 +58,40 @@
template.execute(sql);
return result[0];
}
+
+ public static byte getSingleByte(String table, String column) throws
SQLException {
+ final String sql = "select " + column + " from " + table;
+
+ final byte[] result = new byte[1];
+
+ RowTemplate template = new RowTemplate() {
+
+ @Override
+ void readRow(ResultSet rs, String sql) throws SQLException {
+ result[0] = rs.getByte(1);
+ }
+ };
+
+ template.execute(sql);
+ return result[0];
+ }
+
+ public static byte[] getSingleBytes(String table, String column) throws
SQLException {
+ final String sql = "select " + column + " from " + table;
+
+ final byte[][] result = new byte[1][];
+
+ RowTemplate template = new RowTemplate() {
+
+ @Override
+ void readRow(ResultSet rs, String sql) throws SQLException {
+ result[0] = rs.getBytes(1);
+ }
+ };
+
+ template.execute(sql);
+ return result[0];
+ }
public static int getSingleInt(String table, String column) throws
SQLException {
final String sql = "select " + column + " from " + table;
@@ -69,6 +103,23 @@
@Override
void readRow(ResultSet rs, String sql) throws SQLException {
result[0] = rs.getInt(1);
+ }
+ };
+
+ template.execute(sql);
+ return result[0];
+ }
+
+ public static boolean getSingleBoolean(String table, String column) throws
SQLException {
+ final String sql = "select " + column + " from " + table;
+
+ final boolean[] result = new boolean[1];
+
+ RowTemplate template = new RowTemplate() {
+
+ @Override
+ void readRow(ResultSet rs, String sql) throws SQLException {
+ result[0] = rs.getBoolean(1);
}
};