Permalink
Browse files

[core] Append operation, to add a single value as row in row list:

```java
RowList1<String> list = new RowList1<String>();
list.append("row");
```
  • Loading branch information...
cchantep
cchantep committed Sep 12, 2013
1 parent 9c4a7f1 commit 18a2add4e33e7b5765e2af6d637c339343f89c2e
Showing with 26 additions and 0 deletions.
  1. +7 −0 core/src/main/java/acolyte/RowList1.java
  2. +10 −0 core/src/test/scala/acolyte/RowListSpec.scala
  3. +9 −0 readme.md
@@ -101,6 +101,13 @@ public RowList1(final Class<A> c1) {
return new RowList1<A>(this.c1, copy, this.colNames);
} // end of append
/**
* Convinience append.
*/
public RowList1<A> append(final A value) {
return append(new Row1<A>(value));
} // end of append
/**
* {@inheritDoc}
*/
@@ -228,6 +228,16 @@ object RowListSpec extends Specification with RowListTest {
}
}
"Single column row list" should {
"accept unwrapped value" in {
val rs = RowLists.booleanList.append(false).resultSet
(rs.getFetchSize aka "size" mustEqual 1).
and(rs.next aka "has row" must beTrue).
and(rs.getBoolean(1) aka "single col" must beFalse)
}
}
"Result set fetch size" should {
"be immutable" in {
new RowList1(classOf[String]).resultSet.setFetchSize(1).
View
@@ -232,6 +232,15 @@ RowLists.timeList().append(timeRow);
RowLists.timestampList().append(tsRow);
```
On single column row list, it's also possible to directly append unwrapped value, instead of row object wrapping a single value:
```java
RowLists.stringList().append("stringVal")
// ... instead of ...
//RowLists.stringList().append(Rows.row1("stringVal"))
```
#### SQL Warnings
Acolyte can also mock up SQL warnings, on update or query, so that `java.sql.Statement.getWarnings()` will returned expected instance.

0 comments on commit 18a2add

Please sign in to comment.