Skip to content
This repository was archived by the owner on Jan 6, 2023. It is now read-only.

Commit 0dfa7bc

Browse files
author
ipropper
committed
fixed typo, and updated StringMapper.First -> StringColumnMapper.INSTANCE because StringMapper is deprecated.
1 parent be6559b commit 0dfa7bc

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

_posts/1000-1-1-five_minute_intro.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ h.execute("insert into something (id, name) values (?, ?)", 1, "Brian");
2121

2222
String name = h.createQuery("select name from something where id = :id")
2323
.bind("id", 1)
24-
.map(StringMapper.FIRST)
24+
.map(StringColumnMapper.INSTANCE)
2525
.first();
2626

2727
assertThat(name, equalTo("Brian"));
@@ -31,7 +31,7 @@ h.close();
3131

3232
The DBI type is analogous to a JDBC DataSource, and will usually be constructed by passing in a JDBC DataSource. There are alternate constructors which take JDBC URL and credentials, and other means. From the DBI instance you obtain Handle instances. A Handle represents a single connection to the database. Handles rely on an underlying JDBC connection object.
3333

34-
With a handle you may create and execute statements, queries, calls, batches, or prepared batches. In the above example we execute a statement to define a table, execute another statement, this time with two positional arguments to insert a value, and finally construct a query, bind a value to a named argument in the query, map the results to a a String, and take the first result which comes back.
34+
With a handle you may create and execute statements, queries, calls, batches, or prepared batches. In the above example we execute a statement to define a table, execute another statement, this time with two positional arguments to insert a value, and finally construct a query, bind a value to a named argument in the query, map the results to a String, and take the first result which comes back.
3535

3636
The named argument facility on statements and queries is provided by JDBI -- it parses out the SQL and uses positional parameters when actually constructing the prepared statements. The above example uses the default colon-demarcated parser, but an alternative hash delimited parser is included as well for use with databases which use colons in their grammars, such as [PostgreSQL](http://www.postgresql.org/).
3737

0 commit comments

Comments
 (0)