Package nxt.db
Class DbUtils
- java.lang.Object
-
- nxt.db.DbUtils
-
public final class DbUtils extends java.lang.Object
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidclose(java.lang.AutoCloseable... closeables)static <T> T[]getArray(java.sql.ResultSet rs, java.lang.String columnName, java.lang.Class<? extends T[]> cls)static <T> T[]getArray(java.sql.ResultSet rs, java.lang.String columnName, java.lang.Class<? extends T[]> cls, T[] ifNull)static java.lang.StringlimitsClause(int from, int to)static voidrollback(java.sql.Connection con)static <T> voidsetArray(java.sql.PreparedStatement pstmt, int index, T[] array)static <T> voidsetArrayEmptyToNull(java.sql.PreparedStatement pstmt, int index, T[] array)static voidsetBytes(java.sql.PreparedStatement pstmt, int index, byte[] bytes)static voidsetIntZeroToNull(java.sql.PreparedStatement pstmt, int index, int n)static intsetLimits(int index, java.sql.PreparedStatement pstmt, int from, int to)static voidsetLong(java.sql.PreparedStatement pstmt, int index, java.lang.Long l)static voidsetLongZeroToNull(java.sql.PreparedStatement pstmt, int index, long l)static voidsetShortZeroToNull(java.sql.PreparedStatement pstmt, int index, short s)static voidsetString(java.sql.PreparedStatement pstmt, int index, java.lang.String s)
-
-
-
Method Detail
-
close
public static void close(java.lang.AutoCloseable... closeables)
-
rollback
public static void rollback(java.sql.Connection con)
-
setBytes
public static void setBytes(java.sql.PreparedStatement pstmt, int index, byte[] bytes) throws java.sql.SQLException- Throws:
java.sql.SQLException
-
setString
public static void setString(java.sql.PreparedStatement pstmt, int index, java.lang.String s) throws java.sql.SQLException- Throws:
java.sql.SQLException
-
setLong
public static void setLong(java.sql.PreparedStatement pstmt, int index, java.lang.Long l) throws java.sql.SQLException- Throws:
java.sql.SQLException
-
setShortZeroToNull
public static void setShortZeroToNull(java.sql.PreparedStatement pstmt, int index, short s) throws java.sql.SQLException- Throws:
java.sql.SQLException
-
setIntZeroToNull
public static void setIntZeroToNull(java.sql.PreparedStatement pstmt, int index, int n) throws java.sql.SQLException- Throws:
java.sql.SQLException
-
setLongZeroToNull
public static void setLongZeroToNull(java.sql.PreparedStatement pstmt, int index, long l) throws java.sql.SQLException- Throws:
java.sql.SQLException
-
getArray
public static <T> T[] getArray(java.sql.ResultSet rs, java.lang.String columnName, java.lang.Class<? extends T[]> cls) throws java.sql.SQLException- Throws:
java.sql.SQLException
-
getArray
public static <T> T[] getArray(java.sql.ResultSet rs, java.lang.String columnName, java.lang.Class<? extends T[]> cls, T[] ifNull) throws java.sql.SQLException- Throws:
java.sql.SQLException
-
setArray
public static <T> void setArray(java.sql.PreparedStatement pstmt, int index, T[] array) throws java.sql.SQLException- Throws:
java.sql.SQLException
-
setArrayEmptyToNull
public static <T> void setArrayEmptyToNull(java.sql.PreparedStatement pstmt, int index, T[] array) throws java.sql.SQLException- Throws:
java.sql.SQLException
-
limitsClause
public static java.lang.String limitsClause(int from, int to)
-
setLimits
public static int setLimits(int index, java.sql.PreparedStatement pstmt, int from, int to) throws java.sql.SQLException- Throws:
java.sql.SQLException
-
-