public interface SQLDataType extends DataType, AutoCloseable
Modifier and Type | Method and Description |
---|---|
boolean |
checkTable(String tablename)
Checks if a table exists within the set database
|
default void |
close() |
default void |
commit()
Pushes any queued transactions to the database
|
Connection |
getConnection()
Returns the
Connection object for ease of use in exposing more
internal API |
default boolean |
isAutoCommit()
Returns whether or not this connection automatically commits changes
to the database.
|
default PreparedStatement |
prepare(String stmt)
Returns a
PreparedStatement in which you can easily protect
against SQL injection attacks. |
default ResultSet |
query(String query)
Executes a query, but does not update any information
|
default void |
rollback()
Cancel any queued transactions
|
default void |
setAutoCommit(boolean set)
Sets whether or not to automatically commit changes to the database.
|
default int |
update(String query)
Executes a query that can change values
|
boolean checkTable(String tablename) throws SQLException
tablename
- Name of the table to check forSQLException
- The query on the database failsdefault ResultSet query(String query) throws SQLException
query
- The string query to executeSQLException
- The connection cannot be establisheddefault int update(String query) throws SQLException
query
- The string query to executeSQLException
- The connection cannot be establisheddefault PreparedStatement prepare(String stmt) throws SQLException
PreparedStatement
in which you can easily protect
against SQL injection attacks.stmt
- The string to preparePreparedStatement
from the passed stringSQLException
- The connection cannot be establisheddefault boolean isAutoCommit() throws SQLException
SQLException
- database access error or closed connectiondefault void setAutoCommit(boolean set) throws SQLException
commit()
or
rollback()
.set
- true
to enable, false
to disableSQLException
- The connection cannot be established,
or an access error occurreddefault void commit() throws SQLException
SQLException
- The connection cannot be established, an access
error occurred, or auto-commit is enableddefault void rollback() throws SQLException
SQLException
- The connection cannot be established, an access
error occurred, or auto-commit is enabledConnection getConnection()
Connection
object for ease of use in exposing more
internal APIConnection
object in use by this SQLDataType
default void close()
close
in interface AutoCloseable
Copyright © 2015. All rights reserved.