kr.co.hit.live.dao.supporter
Class SqlServerSupporter

java.lang.Object
  extended by kr.co.hit.live.dao.supporter.DbmsSupporter
      extended by kr.co.hit.live.dao.supporter.SqlServerSupporter

public class SqlServerSupporter
extends DbmsSupporter


Field Summary
 
Fields inherited from class kr.co.hit.live.dao.supporter.DbmsSupporter
ARRAY, BIG_DECIMAL, BINARY_STREAM, BLOB, BOOLEAN, BYTE, CHAR_STREAM, CLOB, DATE, defMap, DOUBLE, globalResultMap, INT, LONG, OBJECT, postAdviceSqls, preAdviceSqls, REAL, SCALAR, SHORT, SIMPLEINT, STRING, TIME, TIMESTAMP
 
Constructor Summary
SqlServerSupporter()
           
 
Method Summary
 String generateTopSql(String fromSql, int topn)
          첫번째 topn 개의 row 만 조회하는 SQL 문장을 생성한다.
 String getDummyTableName()
          더미 테이블 명을 반환한다.
 boolean match(Connection conn)
          Connection을 통해 DbmsSupporter의 하위구현 class가 해당 Connection을 제공한 벤더의 dbms를
지원가능한지 확인한다.
 PreparedStatement preparePageStatement(Connection conn, String sql, List<Object> parameters, int offset, int maxCount, Map<String,Object> args)
          페이지 단위 조회를 위한 SQL 문장을 생성한다.
 
Methods inherited from class kr.co.hit.live.dao.supporter.DbmsSupporter
executePostAdviceSql, executePreAdviceSql, getColumnReader, getDefaultColumnReader, getDefintionValue, getInstance, getVendorName, handleSqlException, prepareStatement, setCallableStatementOutParam, setCallableStatementParam, setDefaultCallableStatementOutParam, setDefaultCallableStatementParam, setDefaultPreparedStatementParam, setPreparedStatementParam
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SqlServerSupporter

public SqlServerSupporter()
Method Detail

match

public boolean match(Connection conn)
              throws SQLException
Description copied from class: DbmsSupporter
Connection을 통해 DbmsSupporter의 하위구현 class가 해당 Connection을 제공한 벤더의 dbms를
지원가능한지 확인한다. Connection을 통해 ResultSetMetaData를 얻어와서 판별하도록 구현한다.

Specified by:
match in class DbmsSupporter
Returns:
Connection에 해당하는 Dbms를 support 가능한지의 여부.
Throws:
SQLException

preparePageStatement

public PreparedStatement preparePageStatement(Connection conn,
                                              String sql,
                                              List<Object> parameters,
                                              int offset,
                                              int maxCount,
                                              Map<String,Object> args)
                                       throws SQLException
페이지 단위 조회를 위한 SQL 문장을 생성한다. Sybase와 MS-SQL 은 Transact-SQL을 기반으로 구현되어있는데 이 경우 Oracle의 rownum과 같은 기능을 제공하지 않으므로 임의 위치부터 조회하는 SQL을 자동 생성할 수 없다. 그러므로 offset 값이 0보다 큰 값이 들어오면 SQLException을 던지고 있으며, 단지 최대 조회 건수를 지정하는 기능만 SELECT TOP N 문장를 사용하여 구현되어 있다. offset 기능은 자동으로 제공되지 않으므로 offset 기능은 각 SQL 문장에서 처리해야한다.

Specified by:
preparePageStatement in class DbmsSupporter
Parameters:
conn -
sql - SQL 원문장
parameters - 원 SQL 문장에 bind될 파라메터 리스트
offset - 건너뛸 건수
maxCount - 최대 조회 건수
args - 벤더별로 다른 parameter들에 대한 정의.
Returns:
Throws:
SQLException - offset 값이 0보다 크면 SQLException 발생

getDummyTableName

public String getDummyTableName()
Description copied from class: DbmsSupporter
더미 테이블 명을 반환한다. (예 : oracle은 "DUAL")

Specified by:
getDummyTableName in class DbmsSupporter
Returns:

generateTopSql

public String generateTopSql(String fromSql,
                             int topn)
Description copied from class: DbmsSupporter
첫번째 topn 개의 row 만 조회하는 SQL 문장을 생성한다.

Specified by:
generateTopSql in class DbmsSupporter
Parameters:
fromSql - 조회대상 테이블 명 또는 SQL문
topn - 조회 건
Returns:


Copyright © 2014. All Rights Reserved.