com.poscoict.glueframework.dao.vo
Class GlueColumnDef

java.lang.Object
  extended by com.poscoict.glueframework.dao.vo.GlueColumnDef
All Implemented Interfaces:
Serializable

public class GlueColumnDef
extends Object
implements Serializable

데이타베이스 조회결과인 GlueRowSet Object의 각 Column항목의 정보를 제공하는 Class이다. Column정보에는 Name, Type, Length, Precision, Scale이 있다. Column정보를 사용하기 위해서는 applicaitonContext.xml의 dao bean속성에 다음이 추가되어야 한다.

 1. applicationContext.xml 예 
 <bean id="testdao" class="com.poscoict.glueframework.dao.jdbc.GlueJdbcDao">
     <property name="dataSource" ref="dataSource"/>
     <property name="queryManager" ref="queryManager"/>
     <property name="columnDefCache" value="true" />
 </bean>
 
 2. Sample Code 
 GlueGenericDao dao = getDao("testdao"); 
 GlueRowSet rowSet = dao.findByQueryStatement("select * from EMP");
 GlueColumnDef[] def = rowSet.getColumnDefs();
 while(rowSet.hasNext())
 { 
     GlueRow row = rowSet.next();
     for(int i=0, iz=def.length; i < iz; i++)
     {
         System.out.println("ColumnDef - Name : "+def[i].getName());
         System.out.println("ColumnDef - Type : "+def[i].getType());
         System.out.println("ColumnDef - Length : "+def[i].getLength());
         System.out.println("ColumnDef - Precision : "+def[i].getPrecision());
         System.out.println("ColumnDef - Scale : "+def[i].getScale());
         System.out.println("Data : "+row.getAttribute(def[i].getName()));
     }
 }
 

See Also:
Serialized Form

Constructor Summary
GlueColumnDef(String name, int type, int length)
          생성자(constructor).
GlueColumnDef(String name, int type, int length, int precision, int scale)
          생성자(constructor).
 
Method Summary
 int getLength()
          Indicates the designated column's normal maximum width in characters.
 String getName()
          Get the designated column's name.
 int getPrecision()
          Get the designated column's number of decimal digits.
 int getScale()
          Gets the designated column's number of digits to right of the decimal point.
 int getType()
          Retrieves the designated column's SQL type.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

GlueColumnDef

public GlueColumnDef(String name,
                     int type,
                     int length)
생성자(constructor).

Parameters:
name -
type -
length -

GlueColumnDef

public GlueColumnDef(String name,
                     int type,
                     int length,
                     int precision,
                     int scale)
생성자(constructor).

Parameters:
name -
type -
length -
precision -
scale -
Method Detail

getName

public String getName()
Get the designated column's name.
 ex) 다음과 같은 sql문이라면 EMPNO, NAME을 얻을수 있다. 
 select empno, ename as name from emp
 

Returns:
column name

getType

public int getType()
Retrieves the designated column's SQL type.

Returns:
SQL type from java.sql.Types

getLength

public int getLength()
Indicates the designated column's normal maximum width in characters.

Returns:
the normal maximum number of characters allowed as the width of the designated column , or if type is BLOB or CLOB, then it returns -1

getPrecision

public int getPrecision()
Get the designated column's number of decimal digits.

Returns:
precision or -1(if BLOB or CLOB)

getScale

public int getScale()
Gets the designated column's number of digits to right of the decimal point.

Returns:
scale or -1(if BLOB or CLOB)

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2013–2016 POSCO ICT. All rights reserved.