File tree Expand file tree Collapse file tree 3 files changed +16
-2
lines changed
main/scala/scalikejdbc/async/internal Expand file tree Collapse file tree 3 files changed +16
-2
lines changed Original file line number Diff line number Diff 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 {
Original file line number Diff line number Diff 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()
Original file line number Diff line number Diff line change @@ -4,7 +4,7 @@ import play.Project._
44
55object 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"
You can’t perform that action at this time.
0 commit comments