A ConnectionManager implementation determine how to get or release connection
from DataSource or ThreadLocal or from Spring or JTA or some container...
DbProConfig class is used to store constructor parameters for build DbPro
instance, this is a transient object, never try to re-use it, re-use it will
break thread safe of jDbPro
For logger output, to avoid logger jar version conflict, default use JDK log,
if found commons log, use it, if found Log4j use it..., by this way this
project has no dependency to any logger jar.
Create a bean instance from configClass class, note: result object type may
different to configClass itself, that's why here called "configClass", an
example can see testGuessAnnotationHasParam() unit test in HandlersTest.java
ImprovedQueryRunner made below improvements compare DbUtils's QueryRunner:
1) Override close() and prepareConnection() method of QueryRunner, use a
ConnectionManager to manage connection, ConnectionManager can get connection
from DataSource or ThreadLocal or some other 3rd party tools like Spring.
IocTool have a method getBean(Class> configClass) to create a bean instance
from configClass class, note: result object type may different to configClass
itself, that's why here called "configClass", an example can see
testGuessAnnotationHasParam() unit test in HandlersTest.java
IocTool here is not used for transaction control, but usually can share use
the same transaction control IOC tool.
Prepare a PreparedSQL for iXxxx (Single SQL) style, unknown objects (include
null) will automatically looked as SQL pieces, more detail see doPrepare
method
Interface of Normal JDBC methods, this interface is used for other projects
to eliminate jar dependency, other projects need copy this interface into
there source code folder but always use name
"com.github.drinkjava2.jdbpro.NormalJdbcTool"
Clear all ThreadLocal parameters first, then cache parameters in ThreadLocal
and return an empty String, a non parameter param0() call equal to
clearAllInlineThreadlocalParams()
Prepare a PreparedSQL for pXxxx (Single SQL) style, pXxxx style only allow
single String (The first appeared) as SQL, unknown objects (include null)
will automatically looked as SQL parameters, more detail see doPrepare method
PreparedSQL is a temporary object used for store SQL, parameter,
ResultSetHandlers, SqlHandlers, Connection and templateEngine..., it's not
thread-safe
Query for an Object, only return the first row and first column's value if
more than one column or more than 1 rows returned, a null object may return
if no result found, SQLException may be threw if some SQL operation Exception
happen.
Query for an Object, only return the first row and first column's value if
more than one column or more than 1 rows returned, a null object may return
if no result found, SQLException may be threw if some SQL operation Exception
happen.
A ConnectionManager implementation determine how to close connection or
return connection to ThreadLocal or return to Spring or JTA or some
container...
For logger output, to avoid logger jar version conflict, default use JDK log,
if found commons log, use it, if found Log4j use it..., by this way this
project has no dependency to any logger jar.