public class SQLBuilder extends Object
| Modifier and Type | Field and Description |
|---|---|
private static Map<String,String> |
_selectCountCache
select count语句缓存.
|
private static IEntityMetaManager |
entityMetaManager |
static org.slf4j.Logger |
LOG |
| Constructor and Description |
|---|
SQLBuilder() |
| Modifier and Type | Method and Description |
|---|---|
private static Object |
_getRsValue(ResultSet rs,
Field f,
int i) |
static SQL |
buildDeleteByPks(Class<?> clazz,
int tableIndex,
List<EntityPK> pks)
拼装sql.
|
static SQL |
buildSelectByPks(EntityPK[] pks,
List<DefaultQueryImpl.OrderBy> orders,
Class<?> clazz,
int tableIndex)
拼装select sql.
|
static <T> SQL |
buildSelectByQuery(Class<T> clazz,
int tableIndex,
IQuery<T> query)
拼装sql.
|
static PreparedStatement |
buildSelectBySql(Connection conn,
SQL sql,
int tableIndex)
拼装sql.
|
static PreparedStatement |
buildSelectBySqlGlobal(Connection conn,
SQL sql) |
static <T> SQL |
buildSelectCountByQuery(Class<T> clazz,
int tableIndex,
IQuery<T> query) |
static String |
buildSelectCountGlobalSql(Class<?> clazz) |
static String |
buildSelectCountSql(Class<?> clazz,
int tableIndex)
拼装sql.
|
static <T> SQL |
buildSelectPkByQuery(Class<T> clazz,
int tableIndex,
IQuery<T> query)
拼装sql.
|
static <T> List<T> |
createResultObject(Class<T> clazz,
ResultSet rs)
给定数据库查询结果集创建数据对性.
|
static List<Map<String,Object>> |
createResultObject(ResultSet rs)
给定数据库查询结果集创建数据对性.
|
static <T> Map<EntityPK,T> |
createResultObjectAsMap(Class<T> clazz,
ResultSet rs)
将数据转换为数据对象
|
static void |
debugSQL(String sql) |
static void |
debugSQLParam(List<Object> params)
打印SQL日志.
|
static Object |
formatValue(Object value)
格式化数据库值.
|
static SQL |
getInsert(Object entity,
int tableIndex)
根据指定对象创建一个SQL语句.
|
static SQL |
getUpdate(Object entity,
int tableIndex)
获取update PreparedStatement.
|
public static final org.slf4j.Logger LOG
private static IEntityMetaManager entityMetaManager
public static <T> SQL buildSelectPkByQuery(Class<T> clazz, int tableIndex, IQuery<T> query)
public static <T> SQL buildSelectByQuery(Class<T> clazz, int tableIndex, IQuery<T> query)
public static <T> SQL buildSelectCountByQuery(Class<T> clazz, int tableIndex, IQuery<T> query)
public static PreparedStatement buildSelectBySqlGlobal(Connection conn, SQL sql) throws SQLException
SQLExceptionpublic static PreparedStatement buildSelectBySql(Connection conn, SQL sql, int tableIndex) throws SQLException
conn - 数据库连接sql - 查询对象tableIndex - 分表下标SQLExceptionpublic static String buildSelectCountSql(Class<?> clazz, int tableIndex)
clazz - 数据对象classtableIndex - 分表下标public static SQL buildSelectByPks(EntityPK[] pks, List<DefaultQueryImpl.OrderBy> orders, Class<?> clazz, int tableIndex) throws SQLException
clazz - 数据对象tableIndex - 表下标pks - 主键SQLExceptionpublic static SQL buildDeleteByPks(Class<?> clazz, int tableIndex, List<EntityPK> pks) throws SQLException
SQLExceptionpublic static SQL getUpdate(Object entity, int tableIndex) throws SQLException
conn - 数据库连接entities - 数据对象tableIndex - 分表下标SQLExceptionpublic static SQL getInsert(Object entity, int tableIndex) throws SQLException
conn - 数据库连接引用entity - 数据对象tableIndex - 分表下标SQLException - 操作失败public static List<Map<String,Object>> createResultObject(ResultSet rs) throws SQLException
rs - 数据库查询结果集SQLExceptionpublic static <T> List<T> createResultObject(Class<T> clazz, ResultSet rs) throws SQLException
clazz - 数据对象classrs - 数据库查询结果集SQLExceptionpublic static <T> Map<EntityPK,T> createResultObjectAsMap(Class<T> clazz, ResultSet rs) throws SQLException
clazz - 数据对象rs - 结果集SQLExceptionprivate static Object _getRsValue(ResultSet rs, Field f, int i) throws SQLException
SQLExceptionpublic static void debugSQL(String sql)
Copyright © 2015. All rights reserved.