Package org.h2.test.db
Class Db
java.lang.Object
org.h2.test.db.Db
A simple wrapper around the JDBC API.
Currently used for testing.
Features:
- No checked exceptions
- Easy to use, fluent API
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classThis class represents a prepared statement. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Close the database connection.voidcommit()Commit a pending transaction.voidExecute a SQL statement.Prepare a SQL statement.Execute a SQL statement.voidsetAutoCommit(boolean autoCommit)
-
Constructor Details
-
Db
Create a database object using the given connection.- Parameters:
conn- the database connection
-
-
Method Details
-
prepare
Prepare a SQL statement.- Parameters:
sql- the SQL statement- Returns:
- the prepared statement
-
execute
Execute a SQL statement.- Parameters:
sql- the SQL statement
-
query
Execute a SQL statement.- Parameters:
sql- the SQL statement- Returns:
- a list of maps
-
close
public void close()Close the database connection. -
setAutoCommit
public void setAutoCommit(boolean autoCommit) -
commit
public void commit()Commit a pending transaction.
-