ScalaSQL: A simple JDBC interface for Scala
ScalaSQL is basically a component to handle simple interactions with databases via JDBC, getting connections from a DataSource (if it's really necessary I'll add direct connection support later on).
This is loosely based on the Groovy SQL component, with some important differences:
- Scala doesn't have string interpolation (and the one that's coming in 2.10 sucks anyway), so
?-type params are supported.
- Only DataSource support is available for now (direct connection support is really only useful for scripting, and sometimes even from a script you might want to handle transactions)
rowsmethod returns an immutable list of immutable maps, following Scala's conventions
firstRowmethod returns an optional immutable map
eachRowmethod passes an immutable Map to the closure
- The maps returned by all these methods will have
Noneas the value for NULL columns.
queryFor(Int|Long|String|BigDecimal|Date|Type)methods will all return Optional values.
executeInsert methods (should) work just like in Groovy.
I know there is already a project similar to this one, but it doesn't have transaction support and it's got a bunch of stuff I don't really need (although, it has already direct connection support, so if that's what you're looking for, it might be a better option for you).
I intend to use this for server-side applications, so thread safety and performance are very important aspects of this project.
This software is released under the Apache Software License version 2.0.