Skip to content
This repository was archived by the owner on Dec 3, 2019. It is now read-only.

Commit e5e725f

Browse files
author
Indraneel Mukherjee
committed
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
1 parent 936afcf commit e5e725f

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

db-async-common/src/main/scala/com/github/mauricio/async/db/general/MutableResultSet.scala

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,12 @@ class MutableResultSet[T <: ColumnData](
3131
private val columnMapping: Map[String, Int] = this.columnTypes.indices.map(
3232
index =>
3333
( this.columnTypes(index).name, index ) ).toMap
34-
34+
3535

3636
val columnNames : IndexedSeq[String] = this.columnTypes.map(c => c.name)
3737

38+
val types : IndexedSeq[Int] = this.columnTypes.map(c => c.dataType)
39+
3840
override def length: Int = this.rows.length
3941

4042
override def apply(idx: Int): RowData = this.rows(idx)
@@ -43,4 +45,4 @@ class MutableResultSet[T <: ColumnData](
4345
this.rows += new ArrayRowData(this.rows.size, this.columnMapping, row)
4446
}
4547

46-
}
48+
}

0 commit comments

Comments
 (0)