apache-comnons系列之commons-dbutils1.7 学习笔记
2017-07-26 00:17
483 查看
apache-comnons系列之commons-dbutils1.7 学习笔记
概述
参考http://blog.csdn.net/imust_can/article/details/7005972
DbUtils
A collection of JDBC helper methods. This class is thread safe.
QueryRunner
Executes SQL queries with pluggable strategies for handling
ResultSets. This class is thread safe
QueryLoader
QueryLoaderis a registry for sets of queries so that multiple copies of the same queries aren’t loaded into memory.
This implementation loads properties files filled with query name to SQL mappings. This class is thread safe.
ResultSetHandler
Implementations of this interface convert ResultSets into other objects.
org.apache.commons.dbutils.handlers.ArrayHandler
return rs.next() ? this.convert.toArray(rs) : EMPTY_ARRAY;
org.apache.commons.dbutils.handlers.BeanListHandler
ResultSetHandler implementation that converts a
ResultSetinto a
Listof beans. This class is thread safe.
org.apache.commons.dbutils.handlers.MapHandler
ResultSetHandlerimplementation that converts the first
ResultSetrow into a
Map. This class is thread
RowProcessor
RowProcessor implementations convert
ResultSetrows into various other objects. Implementations can extend
BasicRowProcessorto protect themselves from changes to this interface
BasicRowProcessor
toArray
toBean
toMap
ColumnHandler
Interface to define how implementations can interact with column handling when constructing a bean from a{@link java.sql.ResultSet}. ColumnHandlers do the work of retrieving data correctly from the
ResultSet.
match
apply
StringTrimmedResultSet
Wraps a
ResultSetto trim strings returned by the
getString()and
getObject()methods.
type.cast(Proxy.newProxyInstance(handler.getClass().getClassLoader(), new Class
测试
org.apache.commons.dbutils.DbUtilsTestcloseQuietly
Close a
Connection,
Statementand
ResultSet. Avoid closing if null and hide any SQLExceptions that occur.
commitAndCloseQuietly
Commits a
Connectionthen closes it, avoid closing if null and hide any SQLExceptions that occur
rollbackAndCloseQuietly
Performs a rollback on the
Connectionthen closes it,avoid closing if null and hide any SQLExceptions that occur
loadDriver
Loads and registers a database driver class.If this succeeds, it returns true, else it returns false
org.apache.commons.dbutils.QueryRunnerTest
query
Calls query after checking the parameters to ensure nothing is null.
update
Execute an SQL INSERT, UPDATE, or DELETE query with a single replacement parameter
insert
Executes the given INSERT SQL statement.
org.apache.commons.dbutils.QueryLoaderTest
load
Loads a Map of query names to SQL values. The Maps are cached so a
subsequent request to load queries from the same path will return
the cached Map. The properties file to load can be in either
line-oriented or XML format. XML formatted properties files must use a
.xmlfile extension
相关文章推荐
- apache-comnons系列之commons-fileupload1.3.3 学习笔记
- apache-comnons系列之commons-configuration2 学习笔记
- apache-comnons系列之commons-vfs2 学习笔记
- apache-comnons系列之commons-digester 3.3.2 学习笔记
- apache-comnons系列之commons-math3.6 学习笔记
- apache-comnons系列之commons-codec1.11 学习笔记
- apache-comnons系列之commons-cli1.4 学习笔记
- apache-comnons系列之commons-compress1.14 学习笔记
- apache-comnons系列之commons-imaging1.0 学习笔记
- apache-comnons系列之commons-email1.4 学习笔记
- apache-comnons系列之commons-pool2.4 学习笔记
- apache-comnons系列之commons-exec1.3 学习笔记
- apache-comnons系列之commons-logging1.2 学习笔记
- apache-comnons系列之commons-lang3 学习笔记1
- apache-comnons系列之commons-chain1.2 学习笔记
- apache-comnons系列之commons-net3.6 学习笔记
- nutch-1.7-学习笔记(2)-org.apache.nutch.crawl.Generator.java-关于Hadoop的partition
- nutch-1.7-学习笔记(1)-org.apache.nutch.crawl.Injector.java-Filesystem.get()
- org.apache.commons.dbutils 的API学习(1)
- Apache Commons Digester(Digester2.0)学习笔记