Class DBUtilities
- java.lang.Object
-
- com.inductiveautomation.ignition.gateway.util.DBUtilities
-
public class DBUtilities extends java.lang.Object
Static utility functions pertaining to the database.
-
-
Constructor Summary
Constructors Constructor Description DBUtilities()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static void
close(java.sql.Connection conn)
static void
close(java.sql.Connection conn, java.sql.Statement stmt)
Silently close the given connection and statement.static void
close(java.sql.ResultSet rs)
static void
close(java.sql.Statement stmt)
static int
getJdbcType(DataType type)
static java.lang.Object
getParameterValue(java.sql.CallableStatement stmt, int index, int dbType)
static java.lang.Object
getParameterValue(java.sql.CallableStatement stmt, java.lang.String paramName, int dbType)
This class is necessary because some db connectors don't correctly support CallableStatement.getObject(string) [MYSQL is one, which always returns byte[2]]static DataType
getTypeForJDBC(int jdbcType)
static boolean
isDataManipulationQuery(java.lang.String query)
Returns false if query is SELECT, otherwise true.static void
rollback(java.sql.Connection conn)
-
-
-
Method Detail
-
getParameterValue
public static java.lang.Object getParameterValue(java.sql.CallableStatement stmt, java.lang.String paramName, int dbType) throws java.sql.SQLException
This class is necessary because some db connectors don't correctly support CallableStatement.getObject(string) [MYSQL is one, which always returns byte[2]]- Throws:
java.sql.SQLException
-
getParameterValue
public static java.lang.Object getParameterValue(java.sql.CallableStatement stmt, int index, int dbType) throws java.sql.SQLException
- Throws:
java.sql.SQLException
-
close
public static void close(java.sql.Connection conn, java.sql.Statement stmt)
Silently close the given connection and statement.
-
rollback
public static void rollback(java.sql.Connection conn)
-
close
public static void close(java.sql.Connection conn)
-
close
public static void close(java.sql.Statement stmt)
-
close
public static void close(java.sql.ResultSet rs)
-
isDataManipulationQuery
public static boolean isDataManipulationQuery(java.lang.String query)
Returns false if query is SELECT, otherwise true.
-
getJdbcType
public static int getJdbcType(DataType type)
-
getTypeForJDBC
public static DataType getTypeForJDBC(int jdbcType)
-
-