类 SqlUtil
- java.lang.Object
-
- org.sagacity.sqltoy.utils.SqlUtil
-
public class SqlUtil extends Object
- 版本:
- v1.3,Date:Apr 14, 2009 11:52:31 PM
- 作者:
- zhongxuchen
-
-
字段概要
字段 修饰符和类型 字段 说明 static StringFROM_REGEX查询from 匹配static PatternmaskPatternsql中的单行注释static PatternORDER_BY_PATTERNstatic StringSELECT_REGEX查询select 匹配static PatternUNION_PATTERNstatic PatternUPCASE_ORDER_PATTERN
-
方法概要
所有方法 静态方法 具体方法 已过时的方法 修饰符和类型 方法 说明 static LongbatchUpdateByJdbc(TypeHandler typeHandler, String updateSql, Collection rowDatas, int batchSize, InsertRowCallbackHandler insertCallhandler, Integer[] updateTypes, Boolean autoCommit, Connection conn, Integer dbType)static ObjectcallableStatementProcess(Object userData, CallableStatement pst, ResultSet rs, CallableStatementResultHandler callableStatementResultHandler)static StringclearDefaultValue(String defaultValue)static StringclearMark(String sql)static StringclearMistyChars(String source, String target)static StringclobToString(Clob clob)static voidclose(Closeable... closeables)static voidcloseQuietly(Closeable... closeables)static StringcombineQueryInStr(Object conditions, Integer colIndex, String property, boolean isChar)已过时。static StringcompletionSql(SqlToyContext sqlToyContext, Class entityClass, String sql)static StringconvertFieldsToColumns(EntityMeta entityMeta, String sql)static ObjectconvertIdValueType(Object idValue, String idType)static voidexecuteBatchSql(Connection conn, String sqlContent, Integer batchSize, Boolean autoCommit)static LongexecuteSql(TypeHandler typeHandler, String executeSql, Object[] params, Integer[] paramsType, Connection conn, Integer dbType, Boolean autoCommit, boolean processWord)static ListfindByJdbcQuery(TypeHandler typeHandler, String queryStr, Object[] params, Class voClass, RowCallbackHandler rowCallbackHandler, DecryptHandler decryptHandler, Connection conn, Integer dbType, boolean ignoreAllEmptySet, HashMap<String,String> colFieldMap, int fetchSize, int maxRows)static ObjectgetSequenceValue(Connection conn, String sequence, Integer dbType)static booleanhasLock(String sql, Integer dbType)static booleanhasOrderBy(String sql, boolean judgeUpcase)static booleanhasUnion(String sql, boolean clearMistyChar)static ObjectloadByJdbcQuery(TypeHandler typeHandler, String queryStr, Object[] params, Class voClass, RowCallbackHandler rowCallbackHandler, Connection conn, Integer dbType, boolean ignoreAllEmptySet, HashMap<String,String> colFieldMap)static ObjectpreparedStatementProcess(Object userData, PreparedStatement pst, ResultSet rs, PreparedStatementResultHandler preparedStatementResultHandler)static ListprocessResultSet(TypeHandler typeHandler, ResultSet rs, Class voClass, RowCallbackHandler rowCallbackHandler, DecryptHandler decryptHandler, int startColIndex, boolean ignoreAllEmptySet, HashMap<String,String> colFieldMap)static voidsetParamsValue(TypeHandler typeHandler, Connection conn, Integer dbType, PreparedStatement pst, Object[] params, Integer[] paramsType, int fromIndex)static voidsetParamValue(TypeHandler typeHandler, Connection conn, Integer dbType, PreparedStatement pst, Object paramValue, int jdbcType, int paramIndex)static booleanwrapTreeTableRoute(TypeHandler typeHandler, TreeTableModel treeTableModel, Connection conn, Integer dbType)static StringwrapWhere(EntityMeta entityMeta)
-
-
-
方法详细资料
-
combineQueryInStr
@Deprecated public static String combineQueryInStr(Object conditions, Integer colIndex, String property, boolean isChar)
已过时。- 参数:
conditions- :数据库in条件的数据集合,可以是POJO List或Object[]colIndex- :二维数组对应列编号property- :POJO propertyisChar- :in 是否要加单引号
-
setParamsValue
public static void setParamsValue(TypeHandler typeHandler, Connection conn, Integer dbType, PreparedStatement pst, Object[] params, Integer[] paramsType, int fromIndex) throws SQLException, IOException
- 参数:
typeHandler-conn-dbType-pst-params-paramsType-fromIndex-- 抛出:
SQLExceptionIOException
-
setParamValue
public static void setParamValue(TypeHandler typeHandler, Connection conn, Integer dbType, PreparedStatement pst, Object paramValue, int jdbcType, int paramIndex) throws SQLException, IOException
- 参数:
typeHandler-conn-dbType-pst-paramValue-jdbcType-paramIndex-- 抛出:
SQLExceptionIOException
-
preparedStatementProcess
public static Object preparedStatementProcess(Object userData, PreparedStatement pst, ResultSet rs, PreparedStatementResultHandler preparedStatementResultHandler) throws Exception
- 参数:
userData-pst-rs-preparedStatementResultHandler-- 返回:
- 抛出:
Exception
-
callableStatementProcess
public static Object callableStatementProcess(Object userData, CallableStatement pst, ResultSet rs, CallableStatementResultHandler callableStatementResultHandler) throws Exception
- 参数:
userData-pst-rs-callableStatementResultHandler-- 返回:
- 抛出:
Exception
-
loadByJdbcQuery
public static Object loadByJdbcQuery(TypeHandler typeHandler, String queryStr, Object[] params, Class voClass, RowCallbackHandler rowCallbackHandler, Connection conn, Integer dbType, boolean ignoreAllEmptySet, HashMap<String,String> colFieldMap) throws Exception
- 参数:
typeHandler-queryStr-params-voClass-rowCallbackHandler-conn-dbType-ignoreAllEmptySet-colFieldMap-- 返回:
- 抛出:
Exception
-
getSequenceValue
public static Object getSequenceValue(Connection conn, String sequence, Integer dbType) throws DataAccessException
- 参数:
conn-sequence-dbType-- 返回:
- 抛出:
DataAccessException
-
findByJdbcQuery
public static List findByJdbcQuery(TypeHandler typeHandler, String queryStr, Object[] params, Class voClass, RowCallbackHandler rowCallbackHandler, DecryptHandler decryptHandler, Connection conn, Integer dbType, boolean ignoreAllEmptySet, HashMap<String,String> colFieldMap, int fetchSize, int maxRows) throws Exception
- 参数:
typeHandler-queryStr-params-voClass-rowCallbackHandler-decryptHandler-conn-dbType-ignoreAllEmptySet-colFieldMap-fetchSize-maxRows-- 返回:
- 抛出:
Exception
-
processResultSet
public static List processResultSet(TypeHandler typeHandler, ResultSet rs, Class voClass, RowCallbackHandler rowCallbackHandler, DecryptHandler decryptHandler, int startColIndex, boolean ignoreAllEmptySet, HashMap<String,String> colFieldMap) throws Exception
- 参数:
typeHandler-rs-voClass-rowCallbackHandler-decryptHandler-startColIndex-ignoreAllEmptySet-colFieldMap-- 返回:
- 抛出:
Exception
-
batchUpdateByJdbc
public static Long batchUpdateByJdbc(TypeHandler typeHandler, String updateSql, Collection rowDatas, int batchSize, InsertRowCallbackHandler insertCallhandler, Integer[] updateTypes, Boolean autoCommit, Connection conn, Integer dbType) throws Exception
- 参数:
typeHandler-updateSql-rowDatas-batchSize-insertCallhandler-updateTypes-autoCommit-conn-dbType-- 返回:
- 抛出:
Exception
-
wrapTreeTableRoute
public static boolean wrapTreeTableRoute(TypeHandler typeHandler, TreeTableModel treeTableModel, Connection conn, Integer dbType) throws Exception
- 参数:
typeHandler-treeTableModel-conn-dbType-- 返回:
- 抛出:
Exception
-
executeBatchSql
public static void executeBatchSql(Connection conn, String sqlContent, Integer batchSize, Boolean autoCommit) throws Exception
- 参数:
conn-sqlContent-batchSize-autoCommit-- 抛出:
Exception
-
hasOrderBy
public static boolean hasOrderBy(String sql, boolean judgeUpcase)
- 参数:
sql-judgeUpcase-- 返回:
-
executeSql
public static Long executeSql(TypeHandler typeHandler, String executeSql, Object[] params, Integer[] paramsType, Connection conn, Integer dbType, Boolean autoCommit, boolean processWord) throws Exception
- 参数:
typeHandler-executeSql-params-paramsType-conn-dbType-autoCommit-processWord-- 返回:
- 抛出:
Exception
-
convertIdValueType
public static Object convertIdValueType(Object idValue, String idType)
- 参数:
idValue-idType-- 返回:
-
close
public static void close(Closeable... closeables) throws IOException
- 参数:
closeables- 可关闭的流对象列表- 抛出:
IOException
-
closeQuietly
public static void closeQuietly(Closeable... closeables)
- 参数:
closeables- 可关闭的流对象列表
-
hasUnion
public static boolean hasUnion(String sql, boolean clearMistyChar)
- 参数:
sql-clearMistyChar-- 返回:
-
convertFieldsToColumns
public static String convertFieldsToColumns(EntityMeta entityMeta, String sql)
- 参数:
entityMeta-sql-- 返回:
-
wrapWhere
public static String wrapWhere(EntityMeta entityMeta)
- 参数:
entityMeta-- 返回:
-
completionSql
public static String completionSql(SqlToyContext sqlToyContext, Class entityClass, String sql)
- 参数:
sqlToyContext-entityClass-sql-- 返回:
-
clearDefaultValue
public static String clearDefaultValue(String defaultValue)
- 参数:
defaultValue-- 返回:
-
-