Skip to content

Commit e77cbc6

Browse files
committed
Merge branch 'release/0.3.3'
2 parents 23e26e0 + 5d6a01a commit e77cbc6

File tree

3 files changed

+16
-2
lines changed

3 files changed

+16
-2
lines changed

core/src/main/scala/scalikejdbc/async/internal/AsyncResultSetImpl.scala

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,13 @@ private[scalikejdbc] class AsyncResultSetImpl(rows: IndexedSeq[RowData])
3838

3939
// WrappedResultSet API
4040

41-
override def any(columnIndex: Int): Any = currentRow.map(_.apply(columnIndex)).orNull[Any]
41+
override def any(columnIndex: Int): Any = {
42+
// To be compatible with JDBC, index should be 1-origin
43+
// But postgresql-async/mysql-async is 0-origin
44+
val index0origin = columnIndex - 1
45+
currentRow.map(_.apply(index0origin)).orNull[Any]
46+
}
47+
4248
override def any(columnLabel: String): Any = currentRow.map(_.apply(columnLabel)).orNull[Any]
4349

4450
override def bigDecimal(columnIndex: Int): java.math.BigDecimal = any(columnIndex) match {

core/src/test/scala/sample/PostgreSQLSampleSpec.scala

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,14 @@ class PostgreSQLSampleSpec extends FlatSpec with ShouldMatchers with DBSettings
1313
val createdTime = DateTime.now.withMillisOfSecond(0)
1414
val al = AsyncLover.syntax("al")
1515

16+
it should "count" in {
17+
val countFuture: Future[Long] = AsyncDB.withPool { implicit s =>
18+
withSQL { select(sqls.count).from(AsyncLover as al) }.map(_.long(1)).single.future().map(_.get)
19+
}
20+
val c = Await.result(countFuture, 5.seconds)
21+
c should be > 0L
22+
}
23+
1624
it should "select a single value" in {
1725
val resultFuture: Future[Option[AsyncLover]] = AsyncDB.withPool { implicit s =>
1826
withSQL { select.from(AsyncLover as al).where.eq(al.id, 1) }.map(AsyncLover(al)).single.future()

project/Build.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import play.Project._
44

55
object ScalikeJDBCAsyncProject extends Build {
66

7-
lazy val _version = "0.3.2"
7+
lazy val _version = "0.3.3"
88
lazy val scalikejdbcVersion = "1.7.0"
99
lazy val mauricioVersion = "0.2.8"
1010
lazy val defaultPlayVersion = "2.2.1"

0 commit comments

Comments
 (0)