java.lang.Object
io.helidon.dbclient.common.AbstractDbExecute
- All Implemented Interfaces:
DbExecute
- Direct Known Subclasses:
MongoDbExecute
Implements methods that do not require implementation for each provider.
-
Constructor Summary
ModifierConstructorDescriptionprotected
AbstractDbExecute
(DbStatements statements) Create an instance with configured statements. -
Method Summary
Modifier and TypeMethodDescriptioncreateDelete
(String statement) Create a delete statement using a statement text.createDmlStatement
(String statement) Create a data modification statement using a statement passed as an argument.Create a database query returning a single row using a statement passed as an argument.createInsert
(String statement) Create an insert statement using a statement text.createNamedDelete
(String statementName) Create andelete statement using a named statement.createNamedDmlStatement
(String statementName) Create a data modification statement using a statement defined in the configuration file.createNamedGet
(String statementName) Create a database query returning a single row using a statement defined in the configuration file.createNamedInsert
(String statementName) Create an insert statement using a named statement.createNamedQuery
(String statementName) Create a database query using a statement defined in the configuration file.createNamedUpdate
(String statementName) Create an update statement using a named statement.createQuery
(String statement) Create a database query using a statement passed as an argument.createUpdate
(String statement) Create an update statement using a statement text.protected String
generateName
(DbStatementType type, String statement) Generate a name for a statement.protected String
statementText
(String name) Return a statement text based on the statement name.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface io.helidon.dbclient.DbExecute
createNamedDelete, createNamedDmlStatement, createNamedGet, createNamedInsert, createNamedQuery, createNamedUpdate, delete, dml, get, insert, namedDelete, namedDml, namedGet, namedInsert, namedQuery, namedUpdate, query, unwrap, update
-
Constructor Details
-
AbstractDbExecute
Create an instance with configured statements.- Parameters:
statements
- statements to obtains named statements, esp. forstatementText(String)
.
-
-
Method Details
-
statementText
Return a statement text based on the statement name. This is a utility method that probably would useDbStatements
to retrieve the named statements.- Parameters:
name
- name of the statement- Returns:
- statement text
-
createNamedQuery
Description copied from interface:DbExecute
Create a database query using a statement defined in the configuration file.- Specified by:
createNamedQuery
in interfaceDbExecute
- Parameters:
statementName
- the name of the configuration node with statement- Returns:
- database statement that can process query returning multiple rows
-
createQuery
Description copied from interface:DbExecute
Create a database query using a statement passed as an argument.- Specified by:
createQuery
in interfaceDbExecute
- Parameters:
statement
- the query statement to be executed- Returns:
- database statement that can process the query returning multiple rows
-
createNamedGet
Description copied from interface:DbExecute
Create a database query returning a single row using a statement defined in the configuration file.- Specified by:
createNamedGet
in interfaceDbExecute
- Parameters:
statementName
- the name of the configuration node with statement- Returns:
- database statement that can process query returning a single row
-
createGet
Description copied from interface:DbExecute
Create a database query returning a single row using a statement passed as an argument. -
createNamedInsert
Description copied from interface:DbExecute
Create an insert statement using a named statement.- Specified by:
createNamedInsert
in interfaceDbExecute
- Parameters:
statementName
- the name of the statement- Returns:
- database statement that can insert data
-
createInsert
Description copied from interface:DbExecute
Create an insert statement using a statement text.- Specified by:
createInsert
in interfaceDbExecute
- Parameters:
statement
- the statement text- Returns:
- database statement that can insert data
-
createNamedUpdate
Description copied from interface:DbExecute
Create an update statement using a named statement.- Specified by:
createNamedUpdate
in interfaceDbExecute
- Parameters:
statementName
- the name of the statement- Returns:
- database statement that can update data
-
createUpdate
Description copied from interface:DbExecute
Create an update statement using a statement text.- Specified by:
createUpdate
in interfaceDbExecute
- Parameters:
statement
- the statement text- Returns:
- database statement that can update data
-
createNamedDelete
Description copied from interface:DbExecute
Create andelete statement using a named statement.- Specified by:
createNamedDelete
in interfaceDbExecute
- Parameters:
statementName
- the name of the statement- Returns:
- database statement that can delete data
-
createDelete
Description copied from interface:DbExecute
Create a delete statement using a statement text.- Specified by:
createDelete
in interfaceDbExecute
- Parameters:
statement
- the statement text- Returns:
- database statement that can delete data
-
createNamedDmlStatement
Description copied from interface:DbExecute
Create a data modification statement using a statement defined in the configuration file.- Specified by:
createNamedDmlStatement
in interfaceDbExecute
- Parameters:
statementName
- the name of the configuration node with statement- Returns:
- data modification statement
-
createDmlStatement
Description copied from interface:DbExecute
Create a data modification statement using a statement passed as an argument.- Specified by:
createDmlStatement
in interfaceDbExecute
- Parameters:
statement
- the data modification statement to be executed- Returns:
- data modification statement
-
generateName
Generate a name for a statement. The default implementation usesSHA-256
so the same name is always returned for the same statement.As there is always a small risk of duplicity, named statements are recommended!
- Parameters:
type
- type of the statementstatement
- statement that it going to be executed- Returns:
- name of the statement
-