Class DBUtilities
- java.lang.Object
-
- com.inductiveautomation.ignition.gateway.util.DBUtilities
-
public class DBUtilities extends java.lang.ObjectStatic 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 voidclose(java.sql.Connection conn)static voidclose(java.sql.Connection conn, java.sql.Statement stmt)Silently close the given connection and statement.static voidclose(java.sql.ResultSet rs)static voidclose(java.sql.Statement stmt)static intgetJdbcType(DataType type)static java.lang.ObjectgetParameterValue(java.sql.CallableStatement stmt, int index, int dbType)static java.lang.ObjectgetParameterValue(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 DataTypegetTypeForJDBC(int jdbcType)static booleanisDataManipulationQuery(java.lang.String query)Returns false if query is SELECT, otherwise true.static voidrollback(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.SQLExceptionThis 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)
-
-