반응형
DB : Oarcle

SELECT A.TABLE_NAME as 테이블명
     , B.COMMENTS as 테이블한글명
     , A.COLUMN_NAME as 컬럼명
     , C.COMMENTS as 컬럼한글명
     , A.DATA_LENGTH
     , A.DATA_TYPE     
     , A.NULLABLE
     , D.CONSTRAINT_NAME
     , D.CONSTRAINT_TYPE
FROM   ALL_TAB_COLUMNS A
, ALL_TAB_COMMENTS B
     , ALL_COL_COMMENTS C
     , ALL_CONSTRAINTS  D
WHERE  A.TABLE_NAME = B.TABLE_NAME
  AND  A.TABLE_NAME = C.TABLE_NAME
  AND  A.TABLE_NAME = D.TABLE_NAME
  AND  A.COLUMN_NAME = C.COLUMN_NAME
  AND  A.TABLE_NAME = :tableNm

CONSTRAINT_TYPE 을 'P' 로 설정해주면 입력한 테이블의 PK만 조회 가능하다. !

 
  
728x90
반응형
반응형
ColumnDatatypeNULLDescription
OWNER VARCHAR2(30) NOT NULL Owner of the object
TABLE_NAME VARCHAR2(30) NOT NULL Name of the object
COLUMN_NAME VARCHAR2(30) NOT NULL Name of the column
COMMENTS VARCHAR2(4000)   Comment on the column


테이블의 컬럼명과 컬럼 한글명을 검색할때 사용하면 된다. 

출처 : ORACLE DOCUMENTATION LIBRARY 
728x90
반응형
반응형
ColumnDatatypeNULLDescription
OWNER VARCHAR2(30) NOT NULL Owner of the object
TABLE_NAME VARCHAR2(30) NOT NULL Name of the object
TABLE_TYPE VARCHAR2(11)   Type of the object
COMMENTS VARCHAR2(4000)   Comment on the object


테이블 명을 알고 싶을때 사용하면 유용하다.!

출처 : ORACLE DOCUMENTATION LIBRARY 
728x90
반응형
반응형
Column              DatatypeNULLDescription
OWNER VARCHAR2(30) NOT NULL Owner of the constraint definition
CONSTRAINT_NAME VARCHAR2(30) NOT NULL Name of the constraint definition
CONSTRAINT_TYPE VARCHAR2(1)   Type of the constraint definition:
  • C - Check constraint on a table

  • P - Primary key

  • U - Unique key

  • R - Referential integrity

  • V - With check option, on a view

  • O - With read only, on a view

  • H - Hash expression

  • F - Constraint that involves a REF column

  • S - Supplemental logging

TABLE_NAME VARCHAR2(30) NOT NULL Name associated with the table (or view) with the constraint definition
SEARCH_CONDITION LONG   Text of search condition for a check constraint
R_OWNER VARCHAR2(30)   Owner of the table referred to in a referential constraint
R_CONSTRAINT_NAME VARCHAR2(30)   Name of the unique constraint definition for the referenced table
DELETE_RULE VARCHAR2(9)   Delete rule for a referential constraint:
  • CASCADE

  • SET NULL

  • NO ACTION

STATUS VARCHAR2(8)   Enforcement status of the constraint:
  • ENABLED

  • DISABLED

DEFERRABLE VARCHAR2(14)   Indicates whether the constraint is deferrable (DEFERRABLE) or not (NOT DEFERRABLE)
DEFERRED VARCHAR2(9)   Indicates whether the constraint was initially deferred (DEFERRED) or not (IMMEDIATE)
VALIDATED VARCHAR2(13)   Indicates whether all data obeys the constraint (VALIDATED) or not (NOT VALIDATED)
GENERATED VARCHAR2(14)   Indicates whether the name of the constraint is user-generated (USER NAME) or system-generated (GENERATED NAME)
BAD VARCHAR2(3)   Indicates whether this constraint specifies a century in an ambiguous manner (BAD) or not (NULL). To avoid errors resulting from this ambiguity, rewrite the constraint using the TO_DATE function with a four-digit year.

See Also: the TO_DATE function in Oracle Database SQL Language Reference and Oracle Database Advanced Application Developer's Guide

RELY VARCHAR2(4)   Indicates whether an enabled constraint is enforced (RELY) or unenforced (NULL)

See Also: the constraints in Oracle Database SQL Language Reference

LAST_CHANGE DATE   When the constraint was last enabled or disabled
INDEX_OWNER VARCHAR2(30)   Name of the user owning the index
INDEX_NAME VARCHAR2(30)   Name of the index (only shown for unique and primary-key constraints)
INVALID VARCHAR2(7)   Indicates whether the constraint is invalid (INVALID) or not (NULL)
VIEW_RELATED VARCHAR2(14)   Indicates whether the constraint depends on a view (DEPEND ON VIEW) or not (NULL)


테이블의 PK, FK등을 찾을수 있다. 테이블에서 지정되어있는 not null 여부도 이 테이블을 조회해보면 확인할 수 있다.

출처 : ORACLE DOCUMENTATION LIBRARY
728x90
반응형
반응형
ColumnDatatypeNULLDescription
OWNER VARCHAR2(30) NOT NULL Owner of the constraint definition
CONSTRAINT_NAME VARCHAR2(30) NOT NULL Name of the constraint definition
TABLE_NAME VARCHAR2(30) NOT NULL Name of the table with the constraint definition
COLUMN_NAME VARCHAR2(4000)   Name of the column or attribute of the object type column specified in the constraint definition
      Note: If you create a constraint on a user-defined REF column, the system creates the constraint on the attributes that make up the REF column. Therefore, the column names displayed in this view are the attribute names, with the REF column name as a prefix, in the following form:

"REF_name"."attribute"

POSITION NUMBER   Original position of the column or attribute in the definition of the object

ALL_CONS_COLUMNS을 조회하면 위에 정보를 알수 있다. 
그리고 테이블별로 CONSTRAINT_NAME 을 알수 있기 때문에 테이블의 PK 도 조회 가능하다.  

출처 : ORACLE DOCUMENT LIBRARY 
728x90
반응형
반응형

cross-cutting-concerns(횡단관심사) : 한 어플리케이션이 여러부분에 걸쳐있는 기능
aspect-oriented programming(AOP) : 횡단 관심사의 분리를 위한것 


 용어  정의
advice aspect가 해야할 작업. aspect가 '무엇'을 '언제'할지를 정의한다. 
joinpoint advice를 적용할수 있는곳, 어플리케이션 실행에 aspect를 끼워넣을수 있는 지점. 
pointcut aspect가 advice할 joinpoint 영역을 좁힌다. '어디서' 하는것을 정의한다. 
aspect advice와 pointcut을 합친것. '무엇','언제','어디서'가  앞의 2가지에 의해서 정의된다. 
target advice가 적용될 객체.  
proxy  advice를 taget 객체에 적용하면 생성되는 객체. taget객체와 proxy 객체는 차이가 없어야 한다.   
weaving target객체에 aspect를 적용해서 새로운 proxy 객체를 생성하는 절차. 
728x90
반응형
반응형

Factory Method 패턴에서는 객체를 생성하기 위한 인터페이스를 정의한다.

어떤 클래스를 만들지는 서브클래스에서 결정한다.

즉, 클래스의 인스턴스를 만드는 일을 서브클래스에 맡기게 된다.



Factory Method 구조?

abstract Product factoryMethod(String type)

abstract : 추상메소드로 선언하여 서브클래스에서 객채 생성을 책임진다.

Product : 특정 객체를 리턴한다. 

type : 매개변수를 써서 만들어낼 객체 종류를 선택할수 있다.


DIP : Dependency Inversion Principle

구상 클래스에 의존하지 않고 추상화된 것에 의존하도록 만들어라!


Product를 구현하는 ConcreteProduct 의 종류가 다양해져도 Creator는 Product를 바라보고 있기 때문에

소스에 변화가 없다. 

728x90
반응형

'Development > Design Pattern' 카테고리의 다른 글

Strategy Pattern  (0) 2013.07.02
[데코레이터 패턴]  (0) 2013.06.26
Decorator Pattern  (0) 2011.08.30
Template Method Pattern  (0) 2011.08.30
반응형


객체에 추가적인 요건을 동적으로 첨가할수 있다.

데코레이터는 서브클래스를 만드는것을 통해서 기능을 유연하게 확장할 수 있는 방법은 제공한다.



Decorator가 Component를 상속받음으로써 ConcreteDecorator들의 형식을 동일하게 맞출 수 있다.

그래서 Component에 여러개의 ConcreteDecorator들을 충첩시킬수도 있다.

728x90
반응형

'Development > Design Pattern' 카테고리의 다른 글

Strategy Pattern  (0) 2013.07.02
[데코레이터 패턴]  (0) 2013.06.26
Factory Method Pattern  (0) 2011.08.30
Template Method Pattern  (0) 2011.08.30
반응형

Template이란??
일상생활에서도 많이 쓴다. 특히 PPT만들때 많이들 사용하는것처럼 
무엇인가 정형화된 틀이라고 생각하면 될것 같다. 

상위클래스에서 abstract 메소드를 정의해서 상속받는 하위 클래스들에게 그것을 구현할
책임을 부여해주는것... 이게 Template Method 패턴의 핵심인듯 하다.
뭐 책을 보니 이것을 Subclass Responsibility라고 한다고 하네???

Abstract Class A{
abstract method1;
template method;
}

ConcreateClass extends A{
method{....}
}

뭐 이런 구조다...그냥 살펴보면 참 간단한 패턴.. 하지만 실제 적용하려면... 참 머리 뽀개지겠구나..
그리고 예전에 내가 생각없이 Copy&Paste했던 코드들이 머리속에 떠오른다.. 
정말 무식하게 똑깥이 쓸때없이 복사했던 코드들...

상위 클래스에 좀더 많은것을 두느냐, 아니면 하위클래스에서 좀더 많은 기능을 두느냐는 
어떤 프로그램이냐에 따라 달라지겠지만 적정선에서 분배하지 않으면 다시 같은 기능들이
한쪽에 몰려서 수정할때 걷잡을수 없는 노가다를 초래하게 만들것 같다.

하지만 template이라는 이름 답게 상위클래스에는 틀만 갖춰두고
최대한 하위 클래스에서 기능에 맞게 구현을 하는것이 맞지 않을까 생각이 든다.
728x90
반응형

'Development > Design Pattern' 카테고리의 다른 글

Strategy Pattern  (0) 2013.07.02
[데코레이터 패턴]  (0) 2013.06.26
Factory Method Pattern  (0) 2011.08.30
Decorator Pattern  (0) 2011.08.30

+ Recent posts