kr.co.hit.live.dao.helper
Class OracleTypeHelper

java.lang.Object
  extended by kr.co.hit.live.dao.helper.OracleTypeHelper

public class OracleTypeHelper
extends Object

OracleDB 사용시 BLOB, CLOB, ARRAY, XMLType 등의 타입변환을 지원하기위한 클래스.
제공되는 메소드들은 static이므로 Class scope로 사용된다.

 Connection con = dao.getCurrentConnection();
 String str = " <root> Person </root>";
 OracleTypeHelper.getCLOB(con,str);
 

Since:
Live 0.1
Version:
$Revision: 1.1 $ $Date: 2006/09/26 08:20:17 $
Author:
홍선주

Constructor Summary
OracleTypeHelper()
           
 
Method Summary
static oracle.sql.ARRAY getARRAY(Connection con, String typeName, Object obj)
          Oracle 용 ARRAY 타입 객체를 생성하는 메소드
static oracle.sql.BLOB getBLOB(Connection con, byte[] bytes)
           바이트 배열 데이터로 부터 BLOB(Binary Large OBject) 객체를 생성하여 리턴한다.
static byte[] getBytes(oracle.sql.BLOB blob)
           BLOB 객체의 내용을 바이트 배열로 변환하여 리턴하는 메소드.
static oracle.sql.CLOB getCLOB(Connection con, char[] str)
           문자열 데이터로 부터 CLOB(Character Large OBject) 객체를 생성하여 리턴한다.
static oracle.sql.CLOB getCLOB(Connection con, String str)
           문자열 데이터로 부터 CLOB(Character Large OBject) 객체를 생성하여 리턴한다.
static String getString(oracle.xdb.XMLType xml)
           XMLType 객체의 내용을 문자열 데이터로 변환하여 리턴하는 메소드.
static String getStringForCLOB(oracle.sql.CLOB clob)
           CLOB 객체의 내용을 문자열 데이터로 변환하여 리턴하는 메소드.
static oracle.xdb.XMLType getXMLType(Connection con, String str)
           문자열 데이터로 부터 XMLType 객체를 생성하여 리턴한다.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

OracleTypeHelper

public OracleTypeHelper()
Method Detail

getCLOB

public static oracle.sql.CLOB getCLOB(Connection con,
                                      char[] str)
                               throws SQLException

문자열 데이터로 부터 CLOB(Character Large OBject) 객체를 생성하여 리턴한다.
파라미터로 받은 Connection 으로 부터 물리적인 Connection 정보를 얻어 이를 기반으로 CLOB 객체를 생성하여 리턴한다. 다음은 사용예이다.

 import oracle.sql.CLOB;
 import java.sql.Connection;
 import kr.co.hit.live.dao.SQLMapsDAO;

 class MyDao extends SQLMapsDAO{
   Connection con = this.getCurrentConnection();
   char[] str = new char[]{'t','e','s','t'}";
   CLOB clob = OracleTypeHelper.getCLOB(con,str);
   ..
 }
 

Parameters:
con - 실제 물리적 Connection 얻어오기 위한 해당 애플리케이션의 Connection 정보
str - CLOB 객체로 변환될 문자열 데이터
Returns:
변환된 CLOB 객체
Throws:
LiveException - CLOB 객체의 생성이 실패하거나, CLOB 객체 생성시 활용했던 리소스의 해제가 정상적으로 이루어지지 않은 경우
SQLException

getCLOB

public static oracle.sql.CLOB getCLOB(Connection con,
                                      String str)
                               throws SQLException

문자열 데이터로 부터 CLOB(Character Large OBject) 객체를 생성하여 리턴한다.
파라미터로 받은 Connection 으로 부터 물리적인 Connection 정보를 얻어 이를 기반으로 CLOB 객체를 생성하여 리턴한다. 다음은 사용예이다.

 import oracle.sql.CLOB;
 import java.sql.Connection;
 import kr.co.hit.live.dao.SQLMapsDAO;

 class MyDao extends SQLMapsDAO{
   Connection con = this.getCurrentConnection();
   String str = "test";
   CLOB clob = OracleTypeHelper.getCLOB(con,str);
   ..
 }
 

Parameters:
con - 실제 물리적 Connection 얻어오기 위한 해당 애플리케이션의 Connection 정보
str - CLOB 객체로 변환될 문자열 데이터
Returns:
변환된 CLOB 객체
Throws:
LiveException - CLOB 객체의 생성이 실패하거나, CLOB 객체 생성시 활용했던 리소스의 해제가 정상적으로 이루어지지 않은 경우
SQLException

getBLOB

public static oracle.sql.BLOB getBLOB(Connection con,
                                      byte[] bytes)
                               throws SQLException

바이트 배열 데이터로 부터 BLOB(Binary Large OBject) 객체를 생성하여 리턴한다.
파라미터로 받은 Connection 으로 부터 물리적인 Connection 정보를 얻어 이를 기반으로 BLOB 객체를 생성하여 리턴한다.

Parameters:
con - 실제 물리적 Connection 얻어오기 위한 해당 애플리케이션의 Connection 정보
bytes - BLOB 객체로 변환될 바이트 배열 데이터
Returns:
변환된 BLOB 객체
Throws:
LiveException - BLOB 객체의 생성이 실패하거나, BLOB 객체 생성시 활용했던 리소스의 해제가 정상적으로 이루어지지 않은 경우
SQLException

getXMLType

public static oracle.xdb.XMLType getXMLType(Connection con,
                                            String str)
                                     throws SQLException

문자열 데이터로 부터 XMLType 객체를 생성하여 리턴한다.
파라미터로 받은 Connection 으로 부터 물리적인 Connection 정보를 얻어 이를 기반으로 XMLType 객체를 생성하여 리턴한다.

Parameters:
con - 실제 물리적 Connection 얻어오기 위한 해당 애플리케이션의 Connection 정보
str - XMLType 객체로 변환될 문자열 데이터
Returns:
변환된 XMLType 객체
Throws:
LiveException - XMLType 객체의 생성이 실패하거나, XMLType 객체 생성시 활용했던 리소스의 해제가 정상적으로 이루어지지 않은 경우
SQLException

getStringForCLOB

public static String getStringForCLOB(oracle.sql.CLOB clob)
                               throws SQLException

CLOB 객체의 내용을 문자열 데이터로 변환하여 리턴하는 메소드.

Parameters:
clob - 문자열로 변환될 CLOB 객체
Returns:
변환된 문자열
Throws:
LiveException - CLOB 객체에서 문자열 정보를 추출할 때 에러가 발생하는 경우
SQLException

getString

public static String getString(oracle.xdb.XMLType xml)
                        throws SQLException

XMLType 객체의 내용을 문자열 데이터로 변환하여 리턴하는 메소드.

Parameters:
xml - 문자열로 변환될 XMLType 객체
Returns:
변환된 문자열
Throws:
LiveException - XMLType 객체에서 문자열 정보를 추출할 때 에러가 발생하는 경우
SQLException

getBytes

public static byte[] getBytes(oracle.sql.BLOB blob)
                       throws SQLException

BLOB 객체의 내용을 바이트 배열로 변환하여 리턴하는 메소드.

Parameters:
blob - 바이트 배열로 변환될 BLOB 객체
Returns:
변환된 바이트 배열
Throws:
SQLException

getARRAY

public static oracle.sql.ARRAY getARRAY(Connection con,
                                        String typeName,
                                        Object obj)
                                 throws SQLException
Oracle 용 ARRAY 타입 객체를 생성하는 메소드

Parameters:
con -
typeName -
obj -
Returns:
Throws:
SQLException


Copyright © 2014. All Rights Reserved.