public class DBHelper extends Object implements AutoCloseable
| Modifier and Type | Field and Description |
|---|---|
String |
dbUrl |
Map<String,SPParameterInfo> |
inputParameterList |
Boolean |
IsMicrosoftSQLServer |
SPInfo |
SPMetaInfo |
Statement |
statement |
| Constructor and Description |
|---|
DBHelper(Connection conn) |
DBHelper(String connectionString) |
| Modifier and Type | Method and Description |
|---|---|
void |
addOutParameter(String name) |
void |
addParameter(String name,
Object value) |
void |
close() |
ArrayList<ArrayList<?>> |
executeSP(String commandText,
Class<?>... outputType) |
<T> ArrayList<T> |
executeSP(String commandText,
Class<T> outputType) |
int |
executeSQL(String sql) |
ArrayList<ArrayList<?>> |
executeSQL(String sql,
Class<?>... outputType) |
<T> ArrayList<T> |
executeSQL(String sql,
Class<T> outputType) |
String |
executeToXml(String commandText,
CommandTypeInfo commandType) |
static HashMap<String,FieldInfo> |
findClassFieldInfo(Class<?> type) |
static TableInfo |
findResultsColumnInfo(ResultSetMetaData rsMeta) |
SPInfo |
findSPInfo(String spName) |
static SPInfo |
findSPMetaInfo(String connectionString,
String spName,
CommandTypeInfo commandType) |
SPInfo |
findTSQLInfo(String commandText) |
static ArrayList<String> |
findTSQLParameters(String content)
Search TSQL script find parameter with following format $param, it will find $name and $size
SELECT * from world.city where name=$name limit 0,$size"
|
static Connection |
getConnection(String connectionString) |
Map<String,Object> |
getOutputParameterList() |
static Map<String,Object> |
ReadOutputParameterList(SPInfo spMetaInfo,
CallableStatement callableStatement) |
public Map<String,SPParameterInfo> inputParameterList
public String dbUrl
public SPInfo SPMetaInfo
public Boolean IsMicrosoftSQLServer
public Statement statement
public DBHelper(Connection conn) throws SQLException, ClassNotFoundException
SQLExceptionClassNotFoundExceptionpublic DBHelper(String connectionString) throws IOException, SQLException, ClassNotFoundException, NamingException
public static Connection getConnection(String connectionString) throws SQLException, NamingException, ClassNotFoundException
public void addOutParameter(String name)
public ArrayList<ArrayList<?>> executeSP(String commandText, Class<?>... outputType) throws Exception
Exceptionpublic <T> ArrayList<T> executeSP(String commandText, Class<T> outputType) throws Exception
Exceptionpublic String executeToXml(String commandText, CommandTypeInfo commandType) throws SQLException, ParserConfigurationException, IOException, ParseException, NoSuchMethodException, IllegalAccessException, InvocationTargetException
public ArrayList<ArrayList<?>> executeSQL(String sql, Class<?>... outputType) throws Exception
Exceptionpublic <T> ArrayList<T> executeSQL(String sql, Class<T> outputType) throws Exception
Exceptionpublic int executeSQL(String sql) throws SQLException, IllegalAccessException, InstantiationException, NoSuchMethodException, InvocationTargetException, ParseException
public void close()
close in interface AutoCloseablepublic SPInfo findSPInfo(String spName) throws SQLException
SQLExceptionpublic SPInfo findTSQLInfo(String commandText) throws SQLException, NoSuchMethodException, IllegalAccessException, InvocationTargetException
public static SPInfo findSPMetaInfo(String connectionString, String spName, CommandTypeInfo commandType) throws SQLException, ClassNotFoundException, IOException, NamingException, NoSuchMethodException, IllegalAccessException, InvocationTargetException
public static ArrayList<String> findTSQLParameters(String content) throws NoSuchMethodException, IllegalAccessException, InvocationTargetException
content - NoSuchMethodExceptionIllegalAccessExceptionInvocationTargetExceptionpublic static TableInfo findResultsColumnInfo(ResultSetMetaData rsMeta) throws SQLException
SQLExceptionpublic static HashMap<String,FieldInfo> findClassFieldInfo(Class<?> type) throws Exception
Exceptionpublic static Map<String,Object> ReadOutputParameterList(SPInfo spMetaInfo, CallableStatement callableStatement) throws SQLException
SQLExceptionpublic Map<String,Object> getOutputParameterList() throws SQLException
SQLExceptionCopyright © 2015. All rights reserved.