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.DBInterface
DBInterface.Transaction 
 - 
 
- 
Constructor Summary
Constructors Constructor Description AbstractDBInterface() 
- 
Method Summary
All 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
- 
getConnection
public abstract java.sql.Connection getConnection() throws java.sql.SQLException- Specified by:
 getConnectionin interfaceDBInterface- Throws:
 java.sql.SQLException
 
- 
shouldCloseConnection
protected boolean shouldCloseConnection()
 
- 
resultSetToListNatural
public static java.util.List<java.util.List<java.lang.Object>> resultSetToListNatural(java.sql.ResultSet rs) throws java.sql.SQLException- Throws:
 java.sql.SQLException
 
- 
getSeq
public long getSeq(java.lang.String seqName) throws java.sql.SQLExceptionGets the next value in a sequence.- Specified by:
 getSeqin interfaceDBInterface- Throws:
 java.sql.SQLException
 
- 
getSeq
public 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 interfaceDBInterface- Throws:
 java.sql.SQLException
 
- 
runPrepQuery
public 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
 
- 
runPrepQuery
public 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 interfaceDBInterface- Throws:
 java.sql.SQLException
 
- 
runPrepUpdate
public static int runPrepUpdate(java.sql.Connection con, java.lang.String stmt, java.io.Serializable... args) throws java.sql.SQLException- Throws:
 java.sql.SQLException
 
- 
runPrepUpdate
public 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 interfaceDBInterface- Throws:
 java.sql.SQLException
 
- 
runQuery
public 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
 
- 
runQuery
public 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 interfaceDBInterface- Throws:
 java.sql.SQLException
 
- 
runScalarQuery
public 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 interfaceDBInterface- Throws:
 java.sql.SQLException
 
- 
runTransaction
public 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 interfaceDBInterface- Throws:
 java.sql.SQLException
 
- 
runUpdateQuery
public static int runUpdateQuery(java.sql.Connection con, java.lang.String query) throws java.sql.SQLException- Throws:
 java.sql.SQLException
 
- 
runUpdateQuery
public int runUpdateQuery(java.lang.String query) throws java.sql.SQLExceptionRuns the given update query, and returns the number of rows affected.- Specified by:
 runUpdateQueryin interfaceDBInterface- Throws:
 java.sql.SQLException
 
 - 
 
 -