Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
mgramin committed Aug 14, 2019
1 parent 0d3fe86 commit fa381b4
Showing 1 changed file with 12 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ import com.github.mgramin.sqlboot.sql.select.SelectQuery
import com.github.mgramin.sqlboot.template.generator.impl.JinjaTemplateGenerator
import org.slf4j.LoggerFactory
import org.springframework.jdbc.core.JdbcTemplate
import org.springframework.jdbc.support.rowset.SqlRowSetMetaData
import reactor.core.publisher.Flux
import reactor.core.publisher.Mono
import reactor.core.publisher.toFlux
Expand Down Expand Up @@ -78,11 +79,17 @@ class JdbcSelectQuery(
}

override fun next(): Map<String, Any> {
return rowSet
.metaData
.columnNames
.map { it.toLowerCase() to (rowSet.getObject(it) ?: nullAlias) }
.toMap()
val metaData: SqlRowSetMetaData = rowSet.metaData

return (1..metaData.columnCount).asSequence().map {
if (metaData.getColumnTypeName(it).equals("timestamptz", true)) {
println(metaData.getColumnName(it) + " - " + rowSet.getTimestamp (it))
metaData.getColumnName(it) to rowSet.getTimestamp (it)
} else {
metaData.getColumnName(it) to (rowSet.getObject(it) ?: nullAlias)
}

}.toMap()
}
}
}
Expand Down

0 comments on commit fa381b4

Please sign in to comment.