JetBrains/kotlin — pull request #113 by cy6erGn0m (2012-07-27 21:17:13+00:00)
Title: Additional extenstions to work with ResultSet

Additional methods to extract data from ResultSet and to create connection with no DataSource.

The methods to create connection and one method to use it. Sometimes DataSource, connection pools, etc are not required: you just need to open connection and execute sometings. I often use it to test or find something in database. Now I use Groovy for this. But with these extension I will be able to use kotlin instead.

Also added methods to works with result set.

The first added method is getMapped. It returns jet.Iterable. User of this API can provide mapper-function that will be used to produce elements for iterable. (see testMapIterator in JdbcTest for usage example).

The second group of methods are related to cursor metadata and specific row handling.

getColumnNames provides array of column names

getValues and getValuesAsMap extracts values from ResultSet and produces array and map for the specified list of columns or for all columns by default.

And the last group of methods are useful to get single result from result set. For example if we want just to extract result of "count(*)" we don't need iterate over rows, etc but we can just use singleInt(): Int instead.

Also few tests added to check methods works and to show usage examples.