Class AbstractDBInterface
- java.lang.Object
- 
- com.inductiveautomation.ignition.gateway.localdb.AbstractDBInterface
 
- 
- All Implemented Interfaces:
- DBInterface
 - Direct Known Subclasses:
- PersistenceSession.PersistenceSessionDBInterface
 
 public abstract class AbstractDBInterface extends java.lang.Object implements DBInterface Created by colby.clegg on 11/17/2015.
- 
- 
Nested Class Summary- 
Nested classes/interfaces inherited from interface com.inductiveautomation.ignition.gateway.localdb.DBInterfaceDBInterface.Transaction
 
- 
 - 
Constructor SummaryConstructors Constructor Description AbstractDBInterface()
 - 
Method SummaryAll Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract java.sql.ConnectiongetConnection()longgetSeq(java.lang.String seqName)Gets the next value in a sequence.longgetSeq(java.lang.String seqName, java.sql.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.static java.util.List<java.util.List<java.lang.Object>>resultSetToListNatural(java.sql.ResultSet rs)java.util.List<java.util.List<java.lang.Object>>runPrepQuery(java.lang.String stmt, java.lang.Object... args)Runs the given SELECT query as a prepared statement, after setting the arguments in the varargs list.static java.util.List<java.util.List<java.lang.Object>>runPrepQuery(java.sql.Connection con, java.lang.String stmt, java.lang.Object... args)intrunPrepUpdate(java.lang.String stmt, java.io.Serializable... args)Runs the given UPDATE/INSERT/DELETE query as a prepared statement, after setting the arguments in the varargs list.static intrunPrepUpdate(java.sql.Connection con, java.lang.String stmt, java.io.Serializable... args)java.util.List<java.util.List<java.lang.Object>>runQuery(java.lang.String query)Runs the given SELECT query, and returns the results in a List of Lists of Objects.static java.util.List<java.util.List<java.lang.Object>>runQuery(java.sql.Connection con, java.lang.String query)java.lang.ObjectrunScalarQuery(java.lang.String query)Runs the given query.java.lang.ObjectrunTransaction(DBInterface.Transaction tx)Runs the given transaction with a new connection.intrunUpdateQuery(java.lang.String query)Runs the given update query, and returns the number of rows affected.static intrunUpdateQuery(java.sql.Connection con, java.lang.String query)protected booleanshouldCloseConnection()
 
- 
- 
- 
Method Detail- 
getConnectionpublic abstract java.sql.Connection getConnection() throws java.sql.SQLException- Specified by:
- getConnectionin interface- DBInterface
- Throws:
- java.sql.SQLException
 
 - 
shouldCloseConnectionprotected boolean shouldCloseConnection() 
 - 
resultSetToListNaturalpublic static java.util.List<java.util.List<java.lang.Object>> resultSetToListNatural(java.sql.ResultSet rs) throws java.sql.SQLException- Throws:
- java.sql.SQLException
 
 - 
getSeqpublic long getSeq(java.lang.String seqName) throws java.sql.SQLExceptionGets the next value in a sequence.- Specified by:
- getSeqin interface- DBInterface
- Throws:
- java.sql.SQLException
 
 - 
getSeqpublic long getSeq(java.lang.String seqName, java.sql.Connection connection) throws java.sql.SQLExceptionDescription 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 interface- DBInterface
- Throws:
- java.sql.SQLException
 
 - 
runPrepQuerypublic static java.util.List<java.util.List<java.lang.Object>> runPrepQuery(java.sql.Connection con, java.lang.String stmt, java.lang.Object... args) throws java.sql.SQLException- Throws:
- java.sql.SQLException
 
 - 
runPrepQuerypublic java.util.List<java.util.List<java.lang.Object>> runPrepQuery(java.lang.String stmt, java.lang.Object... args) throws java.sql.SQLExceptionDescription 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 interface- DBInterface
- Throws:
- java.sql.SQLException
 
 - 
runPrepUpdatepublic static int runPrepUpdate(java.sql.Connection con, java.lang.String stmt, java.io.Serializable... args) throws java.sql.SQLException- Throws:
- java.sql.SQLException
 
 - 
runPrepUpdatepublic int runPrepUpdate(java.lang.String stmt, java.io.Serializable... args) throws java.sql.SQLExceptionDescription 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 interface- DBInterface
- Throws:
- java.sql.SQLException
 
 - 
runQuerypublic static java.util.List<java.util.List<java.lang.Object>> runQuery(java.sql.Connection con, java.lang.String query) throws java.sql.SQLException- Throws:
- java.sql.SQLException
 
 - 
runQuerypublic java.util.List<java.util.List<java.lang.Object>> runQuery(java.lang.String query) throws java.sql.SQLExceptionDescription copied from interface:DBInterfaceRuns the given SELECT query, and returns the results in a List of Lists of Objects.- Specified by:
- runQueryin interface- DBInterface
- Throws:
- java.sql.SQLException
 
 - 
runScalarQuerypublic java.lang.Object runScalarQuery(java.lang.String query) throws java.sql.SQLExceptionRuns 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 interface- DBInterface
- Throws:
- java.sql.SQLException
 
 - 
runTransactionpublic java.lang.Object runTransaction(DBInterface.Transaction tx) throws java.sql.SQLException Runs the given transaction with a new connection. Closes the connection if the transaction doesn't do it.- Specified by:
- runTransactionin interface- DBInterface
- Throws:
- java.sql.SQLException
 
 - 
runUpdateQuerypublic static int runUpdateQuery(java.sql.Connection con, java.lang.String query) throws java.sql.SQLException- Throws:
- java.sql.SQLException
 
 - 
runUpdateQuerypublic int runUpdateQuery(java.lang.String query) throws java.sql.SQLExceptionRuns the given update query, and returns the number of rows affected.- Specified by:
- runUpdateQueryin interface- DBInterface
- Throws:
- java.sql.SQLException
 
 
- 
 
-