Class SqliteInstance
java.lang.Object
com.inductiveautomation.ignition.gateway.util.sqlite.SqliteInstance
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interface
static interface
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected org.sqlite.SQLiteConfig
@NotNull Path
getPath()
<T> @NotNull List<T>
query
(SqliteInstance.PreparedQueryProvider query, SqliteInstance.RowMapper<T> rowMapper) Executes a query that returns a result set, usingrowMapper
to translate each row of the result set into some domain type.<T> T
queryOne
(SqliteInstance.PreparedQueryProvider query, SqliteInstance.RowMapper<T> rowMapper) Executes a query that returns a single result, usingrowMapper
to translate the result set into some domain type.
-
Constructor Details
-
SqliteInstance
-
-
Method Details
-
createConfiguration
protected org.sqlite.SQLiteConfig createConfiguration() -
getConnection
- Throws:
SQLException
-
query
@NotNull public <T> @NotNull List<T> query(SqliteInstance.PreparedQueryProvider query, SqliteInstance.RowMapper<T> rowMapper) throws SQLException Executes a query that returns a result set, usingrowMapper
to translate each row of the result set into some domain type. Automatically closes the provided connection and result set.- Parameters:
query
- A function that accepts a connection and return a fully configured PreparedStatement, e.g. with parameters, if any, specified.rowMapper
- A function that accepts a ResultSet and returns an instance of type T.- Returns:
- An unmodifiable list of type T.
- Throws:
SQLException
- If an error occurs while executing the query, retrieving the connection, etc.
-
queryOne
@Nullable public <T> T queryOne(SqliteInstance.PreparedQueryProvider query, SqliteInstance.RowMapper<T> rowMapper) throws SQLException Executes a query that returns a single result, usingrowMapper
to translate the result set into some domain type. Automatically closes the provided connection and result set.- Parameters:
query
- A function that accepts a connection and return a fully configured PreparedStatement, e.g. with parameters, if any, specified.rowMapper
- A function that accepts a ResultSet and returns an instance of type T.- Returns:
- An instance of type T, or null if the result set is empty.
- Throws:
SQLException
- If an error occurs while executing the query, retrieving the connection, etc.
-
getPath
-