|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectkr.co.hit.live.dao.supporter.DbmsSupporter
public abstract class DbmsSupporter
특정 Dbms를 지원하는 DbmsSupporter의 abstract class.
Connection instance로 자신이 알맞은 supporter인지 판단하고, 판단이 되면 데이터 fetch시 ResultSet
을 통해 각 Column별로 알맞은 Column Reading방식을 제공한다. LOB이나 database에 의존적인 type의 Column속성이 있다면, 해당 벤더의
JDBC Type Mapping문서를 참조하여 createColumnReader를 구현해야 한다.
| Field Summary | |
|---|---|
protected ColumnReader |
ARRAY
|
protected ColumnReader |
BIG_DECIMAL
|
protected ColumnReader |
BINARY_STREAM
|
protected ColumnReader |
BLOB
|
protected ColumnReader |
BOOLEAN
|
protected ColumnReader |
BYTE
|
protected ColumnReader |
CHAR_STREAM
|
protected ColumnReader |
CLOB
|
protected ColumnReader |
DATE
|
protected DefinitionMap |
defMap
Definition 목록을 가지고 있는 DefinitionMap 객체 |
protected ColumnReader |
DOUBLE
|
protected ResultMap |
globalResultMap
대상 DB용 Global ResultMap을 저장함. |
protected ColumnReader |
INT
|
protected ColumnReader |
LONG
|
protected ColumnReader |
OBJECT
|
protected Map<String,String> |
postAdviceSqls
PostSql 목록을 가지고 있는 Map 객체 |
protected Map<String,String> |
preAdviceSqls
PreSql 목록을 가지고 있는 Map 객체 |
protected ColumnReader |
REAL
|
protected ColumnReader |
SCALAR
|
protected ColumnReader |
SHORT
|
protected ColumnReader |
SIMPLEINT
|
protected ColumnReader |
STRING
|
protected ColumnReader |
TIME
|
protected ColumnReader |
TIMESTAMP
|
| Constructor Summary | |
|---|---|
protected |
DbmsSupporter(String vendor)
생성자이다. |
| Method Summary | |
|---|---|
void |
executePostAdviceSql(Connection con,
String key)
key 로 지정된 PostSQL 문장을 찾아서 수행한다. |
void |
executePreAdviceSql(Connection con,
String key)
key 로 지정된 PreSQL 문장을 찾아서 수행한다. |
abstract String |
generateTopSql(String fromSql,
int topn)
첫번째 topn 개의 row 만 조회하는 SQL 문장을 생성한다. |
ColumnReader |
getColumnReader(int type,
String typeName)
|
ColumnReader |
getDefaultColumnReader(int type,
String typeName)
|
String |
getDefintionValue(String name,
DefinitionMap localDef)
vendor 명칭을 사용하여 해당 definition 값을 찾는다. |
abstract String |
getDummyTableName()
더미 테이블 명을 반환한다. |
static DbmsSupporter |
getInstance(Connection conn)
|
String |
getVendorName()
|
LiveException |
handleSqlException(SQLException sqlex)
DBMS 별로 차이 있는 SQLException을 처리하여 LiveException으로 반환한다. |
abstract boolean |
match(Connection conn)
Connection을 통해 DbmsSupporter의 하위구현 class가 해당 Connection을 제공한 벤더의 dbms를지원가능한지 확인한다. |
abstract PreparedStatement |
preparePageStatement(Connection conn,
String sql,
List<Object> parameters,
int offset,
int maxCount,
Map<String,Object> args)
Dbms마다 paging용 sql과 PreparedStatement에 설정해야 하는 값도 다르다. parameters에 설정된 key:value들은 Dbms 마다 다른 parameter들의 규약이기 때문에 해당 벤더의 supporter를 구현하는 경우에는 parameters에 설정될 값들에 대해서 정의해 주어야 한다. |
PreparedStatement |
prepareStatement(Connection conn,
String sql,
List<?> parameters)
|
void |
setCallableStatementOutParam(CallableStatement cstmt,
int idx,
SqlParameter sqlParam)
|
void |
setCallableStatementParam(CallableStatement cstmt,
int idx,
Object param)
|
protected void |
setDefaultCallableStatementOutParam(CallableStatement cstmt,
int idx,
SqlParameter sqlParam)
|
protected void |
setDefaultCallableStatementParam(CallableStatement cstmt,
int idx,
Object param)
|
protected void |
setDefaultPreparedStatementParam(PreparedStatement pstmt,
int idx,
Object param)
|
void |
setPreparedStatementParam(PreparedStatement pstmt,
List<?> parameters)
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected ResultMap globalResultMap
protected Map<String,String> preAdviceSqls
protected Map<String,String> postAdviceSqls
protected DefinitionMap defMap
protected final ColumnReader BINARY_STREAM
protected final ColumnReader CHAR_STREAM
protected final ColumnReader DATE
protected final ColumnReader INT
protected final ColumnReader STRING
protected final ColumnReader BOOLEAN
protected final ColumnReader BIG_DECIMAL
protected final ColumnReader BYTE
protected final ColumnReader SHORT
protected final ColumnReader LONG
protected final ColumnReader REAL
protected final ColumnReader DOUBLE
protected final ColumnReader TIME
protected final ColumnReader TIMESTAMP
protected final ColumnReader OBJECT
protected final ColumnReader CLOB
protected final ColumnReader BLOB
protected final ColumnReader SCALAR
protected final ColumnReader SIMPLEINT
protected final ColumnReader ARRAY
| Constructor Detail |
|---|
protected DbmsSupporter(String vendor)
vendor - | Method Detail |
|---|
public String getVendorName()
public String getDefintionValue(String name,
DefinitionMap localDef)
name - localDef -
public abstract boolean match(Connection conn)
throws SQLException
Connection을 통해 DbmsSupporter의 하위구현 class가 해당 Connection을 제공한 벤더의 dbms를Connection을 통해 ResultSetMetaData를 얻어와서 판별하도록 구현한다.
conn -
Connection에 해당하는 Dbms를 support 가능한지의 여부.
SQLExceptionpublic abstract String getDummyTableName()
public abstract String generateTopSql(String fromSql,
int topn)
fromSql - 조회대상 테이블 명 또는 SQL문topn - 조회 건
public abstract PreparedStatement preparePageStatement(Connection conn,
String sql,
List<Object> parameters,
int offset,
int maxCount,
Map<String,Object> args)
throws SQLException
conn - sql - parameters - offset - maxCount - args - 벤더별로 다른 parameter들에 대한 정의.
SQLException
public PreparedStatement prepareStatement(Connection conn,
String sql,
List<?> parameters)
throws SQLException
SQLException
public void setPreparedStatementParam(PreparedStatement pstmt,
List<?> parameters)
throws SQLException
SQLException
protected void setDefaultPreparedStatementParam(PreparedStatement pstmt,
int idx,
Object param)
throws SQLException
SQLException
public void setCallableStatementParam(CallableStatement cstmt,
int idx,
Object param)
throws SQLException
SQLException
protected void setDefaultCallableStatementParam(CallableStatement cstmt,
int idx,
Object param)
throws SQLException
SQLException
public void setCallableStatementOutParam(CallableStatement cstmt,
int idx,
SqlParameter sqlParam)
throws SQLException
SQLException
protected void setDefaultCallableStatementOutParam(CallableStatement cstmt,
int idx,
SqlParameter sqlParam)
throws SQLException
SQLException
public ColumnReader getColumnReader(int type,
String typeName)
public ColumnReader getDefaultColumnReader(int type,
String typeName)
public static DbmsSupporter getInstance(Connection conn)
throws SQLException
SQLException
public void executePreAdviceSql(Connection con,
String key)
throws SQLException
key -
SQLException
public void executePostAdviceSql(Connection con,
String key)
key - public LiveException handleSqlException(SQLException sqlex)
sqlex -
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||