1. SQL XML ÆÄÀϱ¸Á¶.
- DTD ÆÄÀÏÂüÁ¶. http://chalranjdbccomp.sourceforge.net/caf-dbmanager-2.0.dtd
- ¼¹ö Deploy ½Ã´Â ¹Ýµå½Ã »èÁ¦Çϰųª, ÇØ´ç ¼¹öÀÇ dtd url ·Î º¯°æÇÒ °Í.
2. type ¼³¸í.
- sql : sql¿¡ ÇØ´çÇÏ´Â Äõ¸®¸¦ ½ÇÇàÇÔ.
- Ãß°¡ÀûÀÎ Attribute ( select Àΰæ¿ì )
firstResult - ¹ÌÁöÁ¤½Ã 0¹ø° ResultSet ºÎÅÍ µ¥ÀÌŸ¸¦ °¡Á®¿È.
maxResults - maxResults ·Î Á¤ÀÇÇÑ °¹¼ö¸¸Å µ¥ÀÌŸ¸¦ °¡Á®¿È.
randomResults - randomResults ¿¡ ÇØ´çÇÏ´Â °¹¼ö¸¸Å ·£´ý µ¥ÀÌŸ¸¦ °¡Á®¿È.
- uid : ÇØ´çÇÏ´Â Äõ¸®½ÇÇàÈÄ ÇØ´çÄ÷³¿¡ º¯¼ö¸íÀ¸·Î »ç¿ë°¡´É.
SEQ ä¹øÀÇ °æ¿ì, ÀÚÁÖ »ç¿ëÇÔ.
dbmanager°¡ ½ÇÇàÇÏ°í ÀÖ´Â µ¿¾ÈÀº ±Û·Î¹ú º¯¼ö·Î ÀÌÈÄ Äõ¸® ½ÇÇà½Ã »ç¿ë°¡´ÉÇÔ.
Q_com_sample.xml ÆÄÀÏ
ÂüÁ¶.
- proc : ÇÁ·Î½ÃÀú ½ÇÇà.
OUT º¯¼ö°¡ CURSOR, ¼ýÀÚ, ¹®ÀÚ·Î ¸®ÅϹÞÀ» ¼ö ÀÖÀ½.
¼ýÀÚ, ¹®ÀÚÀÇ °æ¿ì´Â uid ŸÀÔ°ú ¸¶Âù°¡Áö·Î ±Û·Î¹ú º¯¼ö ÇüÅ·ΠÀÌÈÄ Äõ¸® ½ÇÇà½Ã »ç¿ë°¡´ÉÇÔ.
Q_com_sample.xml ÆÄÀÏÂüÁ¶.
- xlob : CLOB, BLOB °»½Å½Ã »ç¿ëÇÏ´Â type.
- call_sqlid : ÇØ´çÄõ¸®½Ã ½ÇÇàÈÄ, sqlid Ä÷³ÀÇ ¹®ÀÚ¿°ª¿¡ ÇØ´çÇÏ´Â sql id ¸¦ ´Ù½Ã È£ÃâÇÔ.
ex) SELECT DECODE( COUNT(*), 0, 'insert', 'update' ) sqlid FROM DUAL
¼³¸í : COUNT°¡ 0À̸é
<sql id="insert">
¾Æ´Ï¸é
<sql id="update">
¸¦ ´Ù½Ã È£ÃâÇÔ.
Q_com_sample.xml ÆÄÀÏ¿¹½Ã
-
select nvl(max(seq)+1,1) seq from com_sample
-
INSERT INTO COM_SAMPLE ( seq,user_id,user_nm,pwd,rrn,birth_day,max_number,min_number,self_desc,f_id,regr_id,reg_tm,updr_id,upd_tm,html_desc )
VALUES ( @@seq , @@user_id , @@user_nm , @@pwd , @@rrn , @@birth_day , @@max_number , @@min_number , @@self_desc , @@f_id , @@regr_id ,to_date( @@reg_tm ,'yyyy-mm-dd hh24:mi:ss'), @@updr_id ,to_date( @@upd_tm ,'yyyy-mm-dd hh24:mi:ss'), empty_clob() )
-
SELECT html_desc
FROM COM_SAMPLE
WHERE SEQ = @@seq
FOR UPDATE
-
UPDATE COM_SAMPLE
SET
USER_ID = @@user_id,
USER_NM = @@user_nm,
PWD = @@pwd,
RRN = @@rrn,
BIRTH_DAY = @@birth_day,
MAX_NUMBER = @@max_number,
MIN_NUMBER = @@min_number,
SELF_DESC = @@self_desc,
HTML_DESC = empty_clob() ,
F_ID = @@f_id,
REGR_ID = @@regr_id,
REG_TM = to_date(@@reg_tm,'yyyy-mm-dd hh24:mi:ss'),
UPDR_ID = @@updr_id,
UPD_TM = to_date(@@upd_tm,'yyyy-mm-dd hh24:mi:ss')
WHERE SEQ = @@seq
-
SELECT html_desc
FROM COM_SAMPLE
WHERE SEQ = @@seq
FOR UPDATE
DELETE FROM COM_SAMPLE
WHERE SEQ = @@seq
3. Ư¼ö¹®ÀÚ¼³¸í. ( ÀÚüSQL-Parser »ç¿ë)
[ ] - ¼±ÅÃÀûÀ¸·Î Á¶°ÇÀýÀ» Ãß°¡ÇÏ°íÀÚÇÏ´Â °æ¿ì »ç¿ëÇÔ.
[ ] ¹®ÀÚ »çÀÌ¿¡ Çش纯¼ö¸íÀÌ °ªÀÌ µé¾î¿Â °æ¿ì¸¸ ½ÇÇàSQL¿¡ append µÊ.
{ } - [ ] ¹®ÀåÀÌ ¿©·¯°³ ÀÖ´Â °æ¿ì, ¿¹¸¦ µé¾î a, b, c ÀÇ º¯¼ö°¡ µé¾î¿À´Â °æ¿ì.
¼±ÅÃÀûÀ¸·Î µé¾î¿À¹Ç·Î, { } ¹®ÀÚ»çÀÌ¿¡ µé¾îÀÖ´Â ÃÖÁ¾ ¹®ÀÚ¿¡ ´ëÇÏ¿©,
AND -> WHERE ·Î º¯È¯ÇÏ´Â ¿ªÇÒÀ» ÇÔ.
@@º¯¼ö¸í - PrepareStatement ¹æ½ÄÀ¸·Î º¯¼ö¸íÀ» setString ÇÔ.
@!º¯¼ö¸í - Á÷Á¢ ½ÇÇàÇÏ°íÀÚÇÏ´Â SQLÀ» ¸¸µé¾î ½ÇÇàÇÔ.
4. dbmanager »ç¿ë¹æ¹ýÀº JAVADOCÀ» ÂüÁ¶.