Class AbstractDBInterface
java.lang.Object
com.inductiveautomation.ignition.gateway.localdb.AbstractDBInterface
- All Implemented Interfaces:
DBInterface
- Direct Known Subclasses:
PersistenceSession.PersistenceSessionDBInterface
Created by colby.clegg on 11/17/2015.
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.inductiveautomation.ignition.gateway.localdb.DBInterface
DBInterface.Transaction -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract ConnectionlongGets the next value in a sequence.longgetSeq(String seqName, Connection connection) Like the other getSeq, but operates against a particular local db connection, which may be necessary if the sequence generation is part of a transaction.runPrepQuery(String stmt, Object... args) Runs the given SELECT query as a prepared statement, after setting the arguments in the varargs list.runPrepQuery(Connection con, String stmt, Object... args) intrunPrepUpdate(String stmt, Serializable... args) Runs the given UPDATE/INSERT/DELETE query as a prepared statement, after setting the arguments in the varargs list.static intrunPrepUpdate(Connection con, String stmt, Serializable... args) Runs the given SELECT query, and returns the results in a List of Lists of Objects.runQuery(Connection con, String query) runScalarQuery(String query) Runs the given query.Runs the given transaction with a new connection.intrunUpdateQuery(String query) Runs the given update query, and returns the number of rows affected.static intrunUpdateQuery(Connection con, String query) protected boolean
-
Constructor Details
-
AbstractDBInterface
public AbstractDBInterface()
-
-
Method Details
-
getConnection
- Specified by:
getConnectionin interfaceDBInterface- Throws:
SQLException
-
shouldCloseConnection
protected boolean shouldCloseConnection() -
resultSetToListNatural
- Throws:
SQLException
-
getSeq
Gets the next value in a sequence.- Specified by:
getSeqin interfaceDBInterface- Throws:
SQLException
-
getSeq
Description copied from interface:DBInterfaceLike the other getSeq, but operates against a particular local db connection, which may be necessary if the sequence generation is part of a transaction.- Specified by:
getSeqin interfaceDBInterface- Throws:
SQLException
-
runPrepQuery
public static List<List<Object>> runPrepQuery(Connection con, String stmt, Object... args) throws SQLException - Throws:
SQLException
-
runPrepQuery
Description copied from interface:DBInterfaceRuns the given SELECT query as a prepared statement, after setting the arguments in the varargs list. Returns the results in a List of Lists of Objects.- Specified by:
runPrepQueryin interfaceDBInterface- Throws:
SQLException
-
runPrepUpdate
public static int runPrepUpdate(Connection con, String stmt, Serializable... args) throws SQLException - Throws:
SQLException
-
runPrepUpdate
Description copied from interface:DBInterfaceRuns the given UPDATE/INSERT/DELETE query as a prepared statement, after setting the arguments in the varargs list. Returns the number of rows affected.- Specified by:
runPrepUpdatein interfaceDBInterface- Throws:
SQLException
-
runQuery
- Throws:
SQLException
-
runQuery
Description copied from interface:DBInterfaceRuns the given SELECT query, and returns the results in a List of Lists of Objects.- Specified by:
runQueryin interfaceDBInterface- Throws:
SQLException
-
runScalarQuery
Runs the given query. Returns null if no rows are returned, or the value at row 1 column 1 as a string if rows are returned.- Specified by:
runScalarQueryin interfaceDBInterface- Throws:
SQLException
-
runTransaction
Runs the given transaction with a new connection. Closes the connection if the transaction doesn't do it.- Specified by:
runTransactionin interfaceDBInterface- Throws:
SQLException
-
runUpdateQuery
- Throws:
SQLException
-
runUpdateQuery
Runs the given update query, and returns the number of rows affected.- Specified by:
runUpdateQueryin interfaceDBInterface- Throws:
SQLException
-