Provides interface to incrementally build and execute SQL statements.
import java.sql.Connection
import scala.language.implicitConversions
import little.sql.{ *, given }
given Connection = ???
// Set parameters and execute query
QueryBuilder("select * from users where group = ? and enabled = ?")
.params("staff", true)
.maxRows(10)
.foreach { rs => printf(s"uid=%d%n", rs.getInt("id")) }
// Same as above except use mapped parameters
QueryBuilder("select * from users where group = ${group} and enabled = ${enabled}")
.params("group" -> "staff", "enabled" -> true)
.maxRows(10)
.foreach { rs => printf(s"uid=%d%n", rs.getInt("id")) }
Attributes
- Companion
- object
- Graph
-
- Supertypes
-
class Objecttrait Matchableclass Any
Members list
Value members
Abstract methods
Executes statement and passes result to supplied handler.
Executes statement and passes result to supplied handler.
Value parameters
- conn
-
connection to execute statement
- handler
-
execution handler
Attributes
Gets fetch size.
Gets fetch size.
Attributes
Sets fetch size.
Sets fetch size.
Attributes
Gets max rows.
Gets max rows.
Attributes
Sets max rows.
Sets max rows.
Attributes
Sets parameters.
Sets parameters.
Attributes
Sets parameters using mapped values.
Sets parameters using mapped values.
Attributes
Executes query and passes result set to supplied function.
Executes query and passes result set to supplied function.
Value parameters
- conn
-
connection to execute query
- f
-
function
Attributes
Gets query timeout.
Gets query timeout.
Attributes
Sets query timeout.
Sets query timeout.
Attributes
Gets SQL.
Gets SQL.
Attributes
Executes update and passes update count to supplied function.
Executes update and passes update count to supplied function.
Value parameters
- conn
-
connection to execute update
- f
-
function
Attributes
Concrete methods
Executes update and returns update count.
Executes update and returns update count.
Value parameters
- conn
-
connection to execute update
Attributes
Executes query and maps first row of result set using supplied function.
Executes query and maps first row of result set using supplied function.
If the result set is not empty, and if the supplied function's return value is not null, then Some
value is returned; otherwise, None
is returned.
Value parameters
- conn
-
connection to execute query
- f
-
function
Attributes
Executes query and builds collection using elements mapped from each row of result set.
Executes query and builds collection using elements mapped from each row of result set.
Value parameters
- conn
-
connection to execute query
- f
-
map function
Attributes
Executes query and folds result set to single value using given initial value and binary operator.
Executes query and folds result set to single value using given initial value and binary operator.
Value parameters
- conn
-
connection to execute query
- init
-
initial value
- op
-
binary operator
Attributes
Executes query and invokes supplied function for each row of result set.
Executes query and invokes supplied function for each row of result set.
Value parameters
- conn
-
connection to execute query
- f
-
function
Attributes
Executes query and maps each row of result set using supplied function.
Executes query and maps each row of result set using supplied function.
Value parameters
- conn
-
connection to execute query
- f
-
map function
Attributes
Sets parameters.
Sets parameters.
Attributes
Sets parameters using mapped values.
Sets parameters using mapped values.