From e5e725f82b68d9317c34f240d9a57dd4a3aa7d2b Mon Sep 17 00:00:00 2001 From: Indraneel Mukherjee Date: Wed, 26 Aug 2015 13:44:48 -0700 Subject: [PATCH] Added types field to MutableResultSet. This will allow inferring the types of RowData fields, which can be useful in different situations, e.g. converting the results to json format --- .../github/mauricio/async/db/general/MutableResultSet.scala | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/db-async-common/src/main/scala/com/github/mauricio/async/db/general/MutableResultSet.scala b/db-async-common/src/main/scala/com/github/mauricio/async/db/general/MutableResultSet.scala index 603e7602..00cc712b 100644 --- a/db-async-common/src/main/scala/com/github/mauricio/async/db/general/MutableResultSet.scala +++ b/db-async-common/src/main/scala/com/github/mauricio/async/db/general/MutableResultSet.scala @@ -31,10 +31,12 @@ class MutableResultSet[T <: ColumnData]( private val columnMapping: Map[String, Int] = this.columnTypes.indices.map( index => ( this.columnTypes(index).name, index ) ).toMap - + val columnNames : IndexedSeq[String] = this.columnTypes.map(c => c.name) + val types : IndexedSeq[Int] = this.columnTypes.map(c => c.dataType) + override def length: Int = this.rows.length override def apply(idx: Int): RowData = this.rows(idx) @@ -43,4 +45,4 @@ class MutableResultSet[T <: ColumnData]( this.rows += new ArrayRowData(this.rows.size, this.columnMapping, row) } -} \ No newline at end of file +}