Class JdbcUtils


  • public class JdbcUtils
    extends java.lang.Object
    Author:
    Loc Ha
    • Constructor Detail

      • JdbcUtils

        public JdbcUtils()
    • Method Detail

      • rollback

        public static void rollback​(java.sql.Connection conn)
                             throws java.sql.SQLException
        Throws:
        java.sql.SQLException
      • setAutoCommit

        public static void setAutoCommit​(java.sql.Connection conn)
                                  throws java.sql.SQLException
        Throws:
        java.sql.SQLException
      • closeQuietly

        public static void closeQuietly​(java.lang.AutoCloseable closeable)
      • executeSingle

        public static <T> T executeSingle​(StatementImpl stat,
                                          ResultSetMapper<T> mapper)
                                   throws java.sql.SQLException
        Throws:
        java.sql.SQLException
      • executeSingle

        public static <T> T executeSingle​(ResultSetImpl rs,
                                          ResultSetMapper<T> mapper)
                                   throws java.sql.SQLException
        Throws:
        java.sql.SQLException
      • executeList

        public static <T> java.util.List<T> executeList​(StatementImpl stat,
                                                        ResultSetMapper<T> mapper,
                                                        java.util.List<T> list)
                                                 throws java.sql.SQLException
        Throws:
        java.sql.SQLException
      • executeList

        public static <T> java.util.List<T> executeList​(ResultSetImpl rs,
                                                        ResultSetMapper<T> mapper,
                                                        java.util.List<T> list)
                                                 throws java.sql.SQLException
        Throws:
        java.sql.SQLException
      • executeMap

        public static <K,​V> java.util.Map<K,​V> executeMap​(StatementImpl stat,
                                                                      java.lang.String keyColumn,
                                                                      java.lang.String valueColumn,
                                                                      java.util.Map<K,​V> map)
                                                               throws java.sql.SQLException
        Throws:
        java.sql.SQLException
      • executeMap

        public static <K,​V> java.util.Map<K,​V> executeMap​(java.sql.ResultSet rs,
                                                                      java.lang.String keyColumn,
                                                                      java.lang.String valueColumn,
                                                                      java.util.Map<K,​V> map)
                                                               throws java.sql.SQLException
        Throws:
        java.sql.SQLException
      • executeMap

        public static <K,​V> java.util.Map<K,​V> executeMap​(StatementImpl stat,
                                                                      ResultSetMapper<K> keyMapper,
                                                                      ResultSetMapper<V> valueMapper,
                                                                      java.util.Map<K,​V> map)
                                                               throws java.sql.SQLException
        Throws:
        java.sql.SQLException
      • executeMap

        public static <K,​V> java.util.Map<K,​V> executeMap​(ResultSetImpl rs,
                                                                      ResultSetMapper<K> keyMapper,
                                                                      ResultSetMapper<V> valueMapper,
                                                                      java.util.Map<K,​V> map)
                                                               throws java.sql.SQLException
        Throws:
        java.sql.SQLException
      • getColumnLabels

        public static java.lang.String[] getColumnLabels​(java.sql.ResultSet rs)
                                                  throws java.sql.SQLException
        Throws:
        java.sql.SQLException