Skip to content

Commit

Permalink
Merge branch 'release/0.3.3'
Browse files Browse the repository at this point in the history
  • Loading branch information
seratch committed Nov 29, 2013
2 parents 23e26e0 + 5d6a01a commit e77cbc6
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,13 @@ private[scalikejdbc] class AsyncResultSetImpl(rows: IndexedSeq[RowData])

// WrappedResultSet API

override def any(columnIndex: Int): Any = currentRow.map(_.apply(columnIndex)).orNull[Any]
override def any(columnIndex: Int): Any = {
// To be compatible with JDBC, index should be 1-origin
// But postgresql-async/mysql-async is 0-origin
val index0origin = columnIndex - 1
currentRow.map(_.apply(index0origin)).orNull[Any]
}

override def any(columnLabel: String): Any = currentRow.map(_.apply(columnLabel)).orNull[Any]

override def bigDecimal(columnIndex: Int): java.math.BigDecimal = any(columnIndex) match {
Expand Down
8 changes: 8 additions & 0 deletions core/src/test/scala/sample/PostgreSQLSampleSpec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,14 @@ class PostgreSQLSampleSpec extends FlatSpec with ShouldMatchers with DBSettings
val createdTime = DateTime.now.withMillisOfSecond(0)
val al = AsyncLover.syntax("al")

it should "count" in {
val countFuture: Future[Long] = AsyncDB.withPool { implicit s =>
withSQL { select(sqls.count).from(AsyncLover as al) }.map(_.long(1)).single.future().map(_.get)
}
val c = Await.result(countFuture, 5.seconds)
c should be > 0L
}

it should "select a single value" in {
val resultFuture: Future[Option[AsyncLover]] = AsyncDB.withPool { implicit s =>
withSQL { select.from(AsyncLover as al).where.eq(al.id, 1) }.map(AsyncLover(al)).single.future()
Expand Down
2 changes: 1 addition & 1 deletion project/Build.scala
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import play.Project._

object ScalikeJDBCAsyncProject extends Build {

lazy val _version = "0.3.2"
lazy val _version = "0.3.3"
lazy val scalikejdbcVersion = "1.7.0"
lazy val mauricioVersion = "0.2.8"
lazy val defaultPlayVersion = "2.2.1"
Expand Down

0 comments on commit e77cbc6

Please sign in to comment.