- åããµãŒããŒäžã®ç°ãªãããŒã¿ããŒã¹ã«ç°ãªãã¿ã€ã ãŸãŒã³ãäœæããæ¹æ³ã
- ãŠãŒã¶ãŒã«ããããŒã¿å€æŽã®ãã°ãããŒã¿ããŒã¹ã«ä¿åããå¥ã®ããŒã¿ããŒã¹ã«ä¿åããŠãã¡ã€ã³ããŒã¿ããŒã¹ããŽãã§è©°ãŸããªãããã«ããæé·ããªãããã«ããæ¹æ³ã
- ããŒã¿ããŒã¹ã®blobãã£ãŒã«ãã«åºã¥ããŠãã¡ã€ã«ã·ã¹ãã ãäœæããæ¹æ³ã ãªã䟿å©ãªã®ã§ããã ãã¡ã€ã«ã¹ãã¬ãŒãžã®å¹çã®åé¡ïŒæ倧ã®ããã©ãŒãã³ã¹ãåŸããšåæã«æå°ã®ã¹ããŒã¹ã確ä¿ããæ¹æ³ã
æåã®èšäºã®ã³ã¡ã³ãã®æ°ã«é©ããã®ã§ãããã«ãããå®è£ ããå¯äžã®æ£ããæ¹æ³ã®ãµããããŠããªãããšã«æ³šæããããšæããŸãã åµé çãªäººã ã¯ããã®ã¿ã¹ã¯ãå®çŸããããã®ããã«å€ãã®æ¹æ³ãèŠã€ãããšç¢ºä¿¡ããŠããŸãã ãããããã®ããšã«æ°ä»ãããšããç§ã¯ãã®ãããªæ©èœã説æããåäžã®èšäºãèŠã€ããããããã®ã¿ã¹ã¯ããŒãããå®è¡ããªããã°ãªããŸããã§ããããããã¯ç§ã®æèŠã§ã¯é¢é£ããŠããŸãã 説æããå®è£ ã¯å®å šã«æ©èœããå®éã«äœ¿çšãããŠããŸãã
建èšçãªæ¹å€ãæè¿ããŸãã 人ã ãé¢çœãããšãæžããããäºæããªãè§åºŠããåé¡ã調ã¹ãããäœããã®åœ¢ã§ã¡ã«ããºã ãæ¹åãããããããšããããŸãã
ããã§ã¯å§ããŸãããã
Firebird 3ããŒã¿ããŒã¹ã
åé¡ã®ã¹ããŒãã¡ã³ãã¯æ¬¡ã®ãšããã§ãã ããŒã¿ããŒã¹å ã®ãŠãŒã¶ãŒã«ããããŒã¿å€æŽã®è©³çŽ°ãªãã°ïŒæ¿å ¥ãæŽæ°ãåé€ïŒãæžã蟌ãå¿ èŠããããŸãããåæã«å¥ã®ãµãŒããŒäžã®å¥ã®ããŒã¿ããŒã¹ã«æžã蟌ã¿ãŸãã ããã¯ãã¡ã€ã³ããŒã¿ããŒã¹ã®ãµã€ãºãæ¥æ¿ã«å¢å ããªãããã«ããããã«å¿ èŠã§ããããã¯ã¢ããã埩å ããŠãããã«åäœãããŽããèç©ãããäžèŠã§ãŸããªæ å ±ãå«ãŸããªãããã«ããã®ã䟿å©ã§ãã
ãã®ã¡ã«ããºã ã¯ãšã³ã¿ãŒãã©ã€ãºãªãŒãã¡ãŒã·ã§ã³çšã®ã¯ã©ãŠããã©ãããã©ãŒã ïŒ https://erp-platforma.com ïŒåãã«éçºãããŸããããéä¿¡äŒç€Ÿã®è«æ±éšéã§åããŠãããšãã«åããŠãã®åé¡ã«ééããŸããã ãã¹ãŠã®ã·ã¹ãã ãæ©èœãã課éããŒã¿ããŒã¹ïŒã¡ã€ã³ããŒã¿ããŒã¹ãšåŒã³ãŸãããïŒãšã顧客ã®å人ã¢ã«ãŠã³ãçšã®ããŒã¿ããŒã¹ïŒLCããŒã¿ããŒã¹ãšåŒã³ãŸãããïŒããããã¡ã€ã³ããŒã¿ããŒã¹ã®ã»ãšãã©ã®ããŒã¿ãå«ãŸããŠããå¿ èŠããããŸãã ããã¯ããå€éšãã«ããLKãäŒç€Ÿã®ã¡ã€ã³ããŒã¿ããŒã¹ãèŠãããšã誰ã«ãšã£ãŠãæãã ã£ãããã§ãã
ã¡ã€ã³ããŒã¿ããŒã¹ããã®ããŒã¿ãLCããŒã¿ããŒã¹ïŒããã³å Žåã«ãã£ãŠã¯LCããŒã¿ããŒã¹ããã¡ã€ã³ããŒã¿ããŒã¹ïŒã«åé¡ãããããã«ãè«æ±éçºè ã¯è€è£œã¡ã«ããºã ãå®è£ ããç¹å®ã®ãäžéãããŒãã«ã«ãã¹ãŠã®å€æŽãæžã蟌ãæ¿å ¥ãæŽæ°ãåé€ããªã¬ãŒãããªã¬ãŒããŸãããç¹å®ã®åšææ§ãæã€å€éšã¹ã¯ãªããã¯ããã®ããŒãã«ããæ°ããã¬ã³ãŒããæç§æžã«ã¢ã³ããŒããããããã®æç§æžã¯LCããŒã¿ããŒã¹ãããµãŒããŒã«ã¢ããããŒããããããã§ãã®ããŒã¿ããŒã¹ã§å®è¡ãããŸããã ãã¹ãŠãé 調ã«é²ãã§ããããã«èŠããŸãããããŒã¹ã¯é£èºçã«æé·ãããã¹ãŠã®ãã°ãããŒãžããããã®ããŒãã«ã«ãããæ°ãæã§GIANTãµã€ãºã«éããŸããã åé€ãããããŒã¿ã¯ãã®äžã«æ®ããŸããããããã«ã¯åé€ãããŸããã§ãããåé€ã¯é·ãããã»ã¹ã§ãããã¬ããŒãžã®èç©ã«å¯äžããåçŽã«ããŒã¿ããŒã¹ã¯æéãšãšãã«é ããªãããã§ãã ãã®ãããéçºè ã決å®ããŸããã ãã®çµæããµãŒããŒã¹ããŒã¹ãäžè¶³ããããã3ãæããšã«ãã®ããŒã¿ãåé€ããããã¯ã¢ããããŒã¿ããŒã¹ã®åŸ©å ãè¡ãå¿ èŠããããŸããã ãã®ãããªããªã¥ãŒã ãšãã®ãããªãµãŒããŒã§ã®ããã¯ã¢ãã埩å -ãã¹ãŠã®äœæ¥ã«ã»ãŒ1æ¥ã ããã¯ã3ãæããšã«äŒç€Ÿå šäœã®1æ¥ãåæ¢ããããšã§ãã ãããŠããããããªããã°ãªããŸããã§ããã ãã«ããã¹ã¯ã¯ãã®æç¹ã§ã¡ã¢ãçŽã«æžããŸãã...
çµéšãèæ ®ããŠãã¯ã©ãŠããã©ãããã©ãŒã ãéçºãããã®åé¡ãæ¢ã«èªèããŠããããããããã®æ¬ ç¹ã®ãªã詳现ãªãã°ãèšé²ããã·ã¹ãã ãäœæããããšã«ããŸããã ç¹ã«ã1ã€ã®ãµãŒããŒã«1ã€ã®ããŒã¿ããŒã¹ã§ã¯ãªã1000ã®ããªã¥ãŒã ãååšããå¯èœæ§ãããããšãèæ ®ãããã®1000ã®ããã¯ã¢ãã埩å ãè¡ãã®ã¯éçŸå®çã§ãã
ãŸããäžè¬çãªæŠå¿µã説æããŸãã
èšé²ç®¡çãæ§é åããããã«ããããã¯ãããæ¹åŒã§ç¶æãããŸãã
ããã±ãŒãžã«é¢ããæ å ±ãå«ãããŒãã«ãšããã®ããã±ãŒãžã®ããŒã¿ãå«ãããŒãã«ã®2ã€ã®ããŒãã«ããããŸãã ããããLOG_PACKETããã³LOGãšåŒã³ãŸããã
LOG_PACKET
- äžæã®èå¥å
- èšé²æ¥
- ã¬ã³ãŒãäœæè ïŒãŠãŒã¶ãŒIDïŒ
- åŠçå±æ§ïŒ0ãŸãã¯1ïŒ
- ã¬ã³ãŒãã¿ã€ãïŒinsãupãdelïŒ
- ããŒãã«çªå·ïŒãã°ãæžã蟌ãããŒãã«ã®ååïŒ
- ããŒã¿ããŒãã«çªå·
- ããã±ãŒãžã¬ã³ãŒãèå¥å
- åŠçã®è©Šè¡åæ°
- æçµåŠçæ¥
LOG
- äžæã®èå¥å
- OLDããŒã¿ã®Blobãã£ãŒã«ã
- BLOBããŒã¿ãã£ãŒã«ãNEW
- ããã±ãŒãžã¬ã³ãŒãèå¥å
- ããŒãã«ãã£ãŒã«ãçªå·ïŒããŒãã«ãã£ãŒã«ãåïŒ
ããŒã¿ãå€æŽãããšãã®ããªã¬ãŒã§ã¯ãLOG_PACKETã®ãšã³ããªã«ããã®ã¬ã³ãŒããšLOGããŒãã«ã®ããŒã¿ïŒå€æŽååŸïŒã«é¢ããæ å ±ãå ¥åããå¿ èŠããããŸãã
次ã«ãç¹å®ã®é »åºŠã§å®è¡ãããå€éšã¹ã¯ãªããã¯ãLOG_PACKETã§æªåŠçã®ãšã³ããªãèŠã€ãããããã®ã³ããŒãå¥ã®ãµãŒããŒã®ãã°ããŒã¿ããŒã¹ã«äœæããLOGããŒãã«ã®ãã¹ãŠã®ãšã³ããªã§èå¥ããã³ããŒãäœæããŸãã
次ã«ãã¡ã€ã³ããŒã¿ããŒã¹ã®ãŽããåãé€ãå¿ èŠããããŸãã LOGããããŒã¿ãåé€-ããŒã¿ããŒã¹ã®é床ãäœäžããããŽããç¯çŽããŸãã ããé«éã§åªããDROP TABLEããã·ãŒãžã£ããããŸãã
PSïŒ DROPãDELETEãããæãŸããçç±ã«ã€ããŠã¯è©³ãã説æããŸããã ãã®èšäºã§ã¯ãã¹ãŠãéåžžã«ãã説æãããŠããŸã ã
ãããã£ãŠã次ã®è§£æ±ºçãé©çšãããŸãã
LOGããŒãã«ã¯3ã€ã®éšåã§æ§æãããŸãã LOG_1-æåã®æ¥ã«ããŒã¿ãããã«æžã蟌ãŸããŸããLOG_2-ç¿æ¥ã«ããŒã¿ãããã«æžã蟌ãŸããŸãã LOG_1ã§1æ¥ç®ãLOG_2ã§2æ¥ç®ã亀äºã«è¡ãããŸãã ããŒã¿ãLOG_2ã«æžã蟌ãŸããLOG_1ãåç §ãããã¹ãŠã®ãã±ãããåŠçããããšãDROP LOG_1ããã³CREATE TABLE LOG_1ãçºçããŸãã ãããã£ãŠãçŸæç¹ã§ã¯ãã¹ãŠã®ã¬ã³ãŒããåé€ãããããŒãã«ã¯ã¯ãªãŒã³ã«ãªããŸãã ç¿æ¥ãLOG_2ãšåæ§ã
ããããããã»ã©åçŽã§ã¯ãããŸããã ãªããªã LOG_1ãšLOG_2ãžã®åç §ã¯ããã°ã«èšé²ããããã¹ãŠã®ããŒãã«ã®ããªã¬ãŒã«ç»é²ãããŸã-åé€ã§ããŸããã ãããè¡ãã«ã¯ãããªãã¯ãé©çšããŸãã ãããã衚瀺ããŸãã ãããŠããã®VIEWãä»ããŠããªã¬ãŒã«ããŒã¿ã®è¿œå ãç»é²ããŸãã
CREATE OR ALTER VIEW V_LOG_1( ID, BLOB_OLD, BLOB_NEW, PACKET, NUM_POLE) AS select p.id, p.blob_old, p.blob_new, p.packet, p.num_pole from LOG_1 p;
ããã§ããããªã¬ãŒå ã®VIEWã¯ãããåç §ãããããããªã¬ãŒãæã€ããŒãã«ãåé€ããŠãæ©èœããŸããã
ãããè¡ãã«ã¯ãããŒãã«LOG_3ãäœæããŸããããã¯ãæ§é LOG_1ããã³LOG_2ã®ã³ããŒã«ãªããŸãã VIOG LOG_1ãLOG_3ããã³vaulã«çœ®ãæããŸããããŒãã«LOG_1ãåé€ããŠåäœæã§ããŸãã ãã®åŸãVIEWã§LOG_3ãLOG_1ã«æ»ããŸãããã¹ãŠãããã«æ©èœããŸãã
ãã®æäœã¯åé¡ãªãå®è¡ã§ããŸããçŸæç¹ã§ã¯ãLOG_1ããŒãã«ã«ã¬ã³ãŒãã¯çºçããŸããã ãã®æ¥ãèšé²ã¯LOG_2ã«ãããŸãã ãã®ãããªã¯ãªãŒãã³ã°æäœã¯ããã®æ¥ã«ãšã³ããªããªãããŒãã«ã§åžžã«çºçããŸãã ç¿æ¥ãåãæäœãLOG_2ããŒãã«ã§çºçããŸãã
ãŸãããã®æäœã¯ããã®ããŒãã«ã®LOG_PACKETã®ãã¹ãŠã®ããŒã¿ãåŠçãããå Žåã«ã®ã¿çºçããŸãã ããããåŠçãããŠããªãå ŽåãããŒã¿æ倱ã«ãªããããããŒãã«ã«è§Šããããšã¯ã§ããŸããã ãŸããããŒã¿ãåŠçãããªãçç±ãç解ããå¿ èŠããããŸããããšãã°ãã¹ã¯ãªããããã³ã°ããŠããã°ã䜿çšããŠããŒã¿ããŒã¹ã«ç§»åããå ŽåããããŸãã ãã®æ¥ã«ã¯ãªãŒãã³ã°æäœããã£ã³ã»ã«ãããå Žåã次ã®è©Šè¡ã1æ¥ããã«è¡ãããŸãã
ã³ã³ã»ãããåæããŸããã次ã«ãæé©ãªäœæ¥ã¹ããŒã ãåæããŸãã
ãŸããä»æ¥äœæããŠããããŒãã«ã«é¢ããæ å ±ãå«ãããŒãã«ãå ¥åããå¿ èŠããããŸãã åäžã®ã¬ã³ãŒããæã€ããŒãã«ïŒãã®å Žåãæäœã¯ããŒã¿ããã°ããååŸã§ããŸãïŒã§ããã€ã³ããã¯ã¹ã§ããããŸããã æ¥ä»ãæŽæ°æ¥ãããã³ãã°èšé²ãèš±å¯ãããã©ãããå«ããå¿ èŠããããŸãïŒç®¡çè ã¯ããã°ããŸã£ããå¿ èŠãšããªãå Žåã¯ããã°èšé²ãçŠæ¢ããŠã¹ããŒã¹ãç¯çŽã§ããå¿ èŠããããŸãïŒ
äŸãã°
CREATE TABLE LOG_INFO ( ZAPIS SMALLINT, DATA TIMESTAMP, ID_TABLE SMALLINT );
ãã°ã«èšé²ãããããŒãã«ã®ãã¹ãŠã®ããªã¬ãŒã§ã¯ãæåã«èšé²ãèš±å¯ãããŠãããã©ããããã§ãã¯ãããŸã
select p.zapis from LOG_INFO p into: zapis;
èš±å¯ãããŠããå Žåãã©ã®ããŒãã«ã§ããŒã¿ãæžã蟌ããããã§ãã¯ãããŸã
select first 1 case when p.data=current_date then p.id_table else case when p.id_table=1 then 2 when p.id_table=2 then 1 end end, case when p.data=current_date then 1 else -1 end from LOG_INFO p into: log_info, log_info_check;
PSïŒæçè«è ã®å Žåãè€æ°ã®ã¬ã³ãŒããLOG_INFOããŒãã«ã«çªç¶çŸããå Žåã«ããªã¬ãŒãã¯ã©ãã·ã¥ããå¯èœæ§ãæé€ããããã«ãæåã®1ãå¿ èŠã§ãã ãã®å Žåããã°ã«èšé²ããããã¹ãŠã®ããŒãã«ã«ããŒã¿ãæžã蟌ããšãã«ãšã©ãŒãçºçããŸãïŒéåžžãè€æ°è¡ã®ãšã©ãŒïŒã ãããŠãæåã®1ã€ã¯ããã®ãªãã·ã§ã³ãé€å€ããããšãä¿èšŒãããŠããŸãã
ãã®ãªã¯ãšã¹ãã«ããïŒ
1ïŒæ¥ä»ãçŸåšã®æ¥ä»ãšäžèŽãããã©ããã確èªããäžèŽããå Žåã¯ãçŸåšã®ããŒãã«ã«æžã蟌ã¿ãããã§ãªãå Žåã¯ãããŒãã«ãå¥ã®ããŒãã«ã«å€æŽããŸãïŒæ¥ãã次ãžã®ç§»è¡ããããŸããïŒã
2ïŒãã®ããŒãã«ã1æ¥ã®ç§»è¡äžã«å¥ã®ããŒãã«ã«æŽæ°ããå¿ èŠããããšããå åãèšå®ããŸãã
次ã®ã¹ãããã¯ããã®æ¥ã®ç§»åæã«æŽæ°ãå¿ èŠãªå ŽåãæŽæ°ã§ã
if (log_info_check=-1) then UPDATE LOG_INFO SET ID_TABLE = :log_info, DATA = current_date;
ã€ãŸã ç¿æ¥ã®æåã®ã¬ã³ãŒãã¯ã次ã®ããŒãã«ã«æžã蟌ãå¿ èŠãããããŒã¿ãæŽæ°ããŸãã ãããŠããªãœãŒã¹ã¯ããã«ç¡é§ã«ãªããŸããã
次ã«ãããŒã¿ã¯LOG_PACKETã«æžã蟌ãŸãããã®èå¥åãååŸããŸã
if (inserting) then TYPE_=1; if (updating) then TYPE_=2; if (deleting) then TYPE_=3; if (TYPE_ in (1,2)) then INSERT INTO LOG_PACKET (TYPE_, TABLE_, NUM_TABLE, AVTOR, ID_ZAPISI) VALUES (:TYPE_, 15, :log_info, new.avtor, new.id) RETURNING ID into: id_packet; else INSERT INTO LOG_PACKET (TYPE_, TABLE_, NUM_TABLE, AVTOR, ID_ZAPISI) VALUES (:TYPE_, 15, :log_info, old.avtor, old.id) RETURNING ID into: id_packet;
ããã«ãåä¿¡ããããŒãã«çªå·ã«å¿ããŠãããŒã¿ã¯V_LOG_1ãŸãã¯V_LOG_2ã«æžã蟌ãŸããå¿ èŠããããŸãã
ããšãã°ãã¬ã³ãŒãã¯æ¬¡ã®ããã«ãªããŸãã
if (log_info=1) then begin if (TYPE_=1) then begin INSERT INTO V_LOG_1 (BLOB_OLD, BLOB_NEW, PACKET, NUM_POLE) VALUES (NULL, new.n_687, :id_packet, 687); INSERT INTO V_LOG_1 (BLOB_OLD, BLOB_NEW, PACKET, NUM_POLE) VALUES (NULL, new.n_688, :id_packet, 688); INSERT INTO V_LOG_1 (BLOB_OLD, BLOB_NEW, PACKET, NUM_POLE) VALUES (NULL, new.n_689, :id_packet, 689); INSERT INTO V_LOG_1 (BLOB_OLD, BLOB_NEW, PACKET, NUM_POLE) VALUES (NULL, new.n_690, :id_packet, 690); INSERT INTO V_LOG_1 (BLOB_OLD, BLOB_NEW, PACKET, NUM_POLE) VALUES (NULL, new.n_691, :id_packet, 691); end if (TYPE_=2) then begin if (new.n_687<>old.n_687) then INSERT INTO V_LOG_1 (BLOB_OLD, BLOB_NEW, PACKET, NUM_POLE) VALUES (old.n_687, new.n_687, :id_packet, 687); if (new.n_688<>old.n_688) then INSERT INTO V_LOG_1 (BLOB_OLD, BLOB_NEW, PACKET, NUM_POLE) VALUES (old.n_688, new.n_688, :id_packet, 688); if (new.n_689<>old.n_689) then INSERT INTO V_LOG_1 (BLOB_OLD, BLOB_NEW, PACKET, NUM_POLE) VALUES (old.n_689, new.n_689, :id_packet, 689); if (new.n_690<>old.n_690) then INSERT INTO V_LOG_1 (BLOB_OLD, BLOB_NEW, PACKET, NUM_POLE) VALUES (old.n_690, new.n_690, :id_packet, 690); if (new.n_691<>old.n_691) then INSERT INTO V_LOG_1 (BLOB_OLD, BLOB_NEW, PACKET, NUM_POLE) VALUES (old.n_691, new.n_691, :id_packet, 691); end if (TYPE_=3) then begin INSERT INTO V_LOG_1 (BLOB_OLD, BLOB_NEW, PACKET, NUM_POLE) VALUES (old.n_687, NULL, :id_packet, 687); INSERT INTO V_LOG_1 (BLOB_OLD, BLOB_NEW, PACKET, NUM_POLE) VALUES (old.n_688, NULL, :id_packet, 688); INSERT INTO V_LOG_1 (BLOB_OLD, BLOB_NEW, PACKET, NUM_POLE) VALUES (old.n_689, NULL, :id_packet, 689); INSERT INTO V_LOG_1 (BLOB_OLD, BLOB_NEW, PACKET, NUM_POLE) VALUES (old.n_690, NULL, :id_packet, 690); INSERT INTO V_LOG_1 (BLOB_OLD, BLOB_NEW, PACKET, NUM_POLE) VALUES (old.n_691, NULL, :id_packet, 691); end end
PSïŒã·ã¹ãã ã«ç¬èªã®çµã¿èŸŒã¿ããã°ã©ãã³ã°èšèªãããããã¹ãŠã®ããŒãã«ãšãã£ãŒã«ãã«ã¯ããã¹ãã§ã¯ãªãæ°åãä»ããŠãããšããäºå®ã«ãã£ãŠã人çãå°ãç°¡ç¥åããŸããã ãŸãããã®ãããã§ããã®ãããªããªã¬ãŒã¯ãæ°ããããŒãã«ã衚瀺ããããšãã«å®å šã«èªåçã«äœæããããããã£ãŒã«ããå€æŽããããšãã«åäœæãããŸãã ã€ãŸã ãŠãŒã¶ãŒãã€ã³ã¿ãŒãã§ãŒã¹ã®ããã°ãæå¹ã«ãããããŒãã«ãšãã£ã¿ãŒã®ã€ã³ã¿ãŒãã§ãŒã¹ã®ãã¿ã³ãã²ã£ãããã ãã§ååã§ãããã以éã¯ãã¹ãŠèªåçã«è¡ãããŸãã èªè ã¯ããè€éã«ãªããŸãããã®ããŒã¿ããŒã¹ãåçŽãªå Žåããããã®ããªã¬ãŒã¯æåã§äœæããå¿ èŠããããNUM_POLEããã³NUM_TABLEã®ããŒã¿åã¯ããã¹ã圢åŒã§ããå¿ èŠããããŸãã ããã§ãããŒãã«ãšãã£ãŒã«ãã®ååãæžãå¿ èŠããããŸãã ãŸãã¯ãããŒãã«ãšãã£ãŒã«ãã«çªå·ãå²ãåœãŠãããããããããŒã¿ãååŸããç¹å®ã®ããŒãã«ãå ¥åããŸãã
次ã«ãã¬ã³ãŒããçºçãããã©ããã«ãããããããã©ã°ä»ãã®ããŒãã«ãäœæããå¿ èŠããããŸãã 1ã€ã®ãã£ãŒã«ããæã€ããŒãã«ã§ã¯ãšãªãå®è¡ããæ¹ããæ°ããã¬ã³ãŒãã®ãã©ã°ãæ€çŽ¢ããŠLOG_PACKETããœãŒããããããã¯ããã«é«éã§ãããããã·ã¹ãã ãªãœãŒã¹ãç¯çŽããŸãã
ããšãã°ã次ã®ããã«ïŒ
CREATE TABLE LOG_PACKET_FLAG (ID SMALLINT);
æ°ããããã±ãŒãžã¬ã³ãŒããè¿œå ãããšãã«ããªã¬ãŒã®LOG_PACETããŒãã«ã«é 眮ããŸã
UPDATE LOG_PACKET_FLAG SET ID = 1;
ã¹ã¯ãªãããå®è¡ããŠããŒã¿ããã°ããŒã¿ããŒã¹ã«è»¢éããå Žåãæ°ãããšã³ããªããããã©ããã確èªããå¿ èŠããããŸãïŒãªãå Žåã¯ããã以äžäœãããŸããïŒã
select first 1 p.id from LOG_PACKET_FLAG p
ããã¯ãããšãã°æ¬¡ã®å Žåãããã¯ããã«é«éã«æ©èœããŸãã
select count(*) from LOG_PACKET p where p.check_=0
ã¬ã³ãŒãã®è»¢éã®æåŸã«ã転éãããã¬ã³ãŒãã転éããŠããéã«æ°ããã¬ã³ãŒããåºçŸãããã©ããã確èªããå¿ èŠããããŸãã
UPDATE LOG_PACKET_FLAG SET ID = 0;
äžè¬ã«ãã·ã¹ãã ã®ãªãœãŒã¹ãç¯çŽããŸãã
次ã«ãã¬ã³ãŒãã転éããããã»ã¹ãæ€èšããŸãã
ãŸããã¡ã€ã³ããŒã¿ããŒã¹ãããã¹ãŠã®æ°ããLOG_PACKETãšã³ããªãéžæããã«ãŒãã§ãã®ããŒã¿ããã°ããŒã¿ããŒã¹ã«æ¿å ¥ããŸãã
ãã°ããŒã¿ããŒã¹ã«ããã±ãŒãžã¬ã³ãŒããäœæããåŸããã®ããã±ãŒãžã®ããŒã¿ãããŒãã«LOG_1ïŒ2ïŒãã転éããå¿ èŠããããŸãã
ããããã£ãŒã«ãããããŒã¿ãæœåºããŠå¥ã®å Žæã«è¿œå ããããšã¯ãç¹å®ã®hemoãšã¿ã³ããªã³ãšã®ãã³ã¹ã§ãã å€ãã®å®éšã®åŸãæãç°¡åã§å¹æçãªæ¹æ³ã¯ãããŒã¿ããŒã¹ãžã®ã¯ãšãªãããã¹ã¯ãªããããã¯ãšãªãéå§ããããšã§ãããšããçµè«ã«éããŸããïŒäžè¬çã«ããã°ããŒã¿ããŒã¹ããã¡ã€ã³ããŒã¿ããŒã¹ãžã®çŽæ¥ã¯ãšãªã§blobãã£ãŒã«ãããã©ãã°ã¢ã³ãããããããŸãïŒã
ããã±ãŒãžããŒã¿ãå§çž®ããæé ãããã±ãŒãžãè¿œå ããåŸã«ã¹ã¯ãªããããã«ããå¿ èŠããããŸãã
reate or alter procedure BLOB_INS ( SELECT_ varchar(250), BASE_ varchar(100), USER_ varchar(50), PASS_ varchar(50), PACKET integer) AS declare variable BLOB_OLD BLOB SUB_TYPE 0 SEGMENT SIZE 80; declare variable BLOB_NEW BLOB SUB_TYPE 0 SEGMENT SIZE 80; declare variable PACKET BIGINT; declare variable NUM_POLE INTEGER; begin FOR EXECUTE STATEMENT (:select_) ON EXTERNAL :base_ AS USER :user_ PASSWORD :pass_ INTO :BLOB_OLD,:BLOB_NEW,:NUM_POLE DO INSERT INTO LOG (BLOB_OLD, BLOB_NEW, PACKET, NUM_POLE) VALUES (:BLOB_OLD,:BLOB_NEW, :pacet, :NUM_POLE); End
ïŒselectã«ã¯ãã¹ã¯ãªãããã次ã®ãããªãµãŒãã¹ãæäŸãããŸãã
select p.blob_old, p.blob_new, p.num_pole from log_'.< >.' p where p.packet='.< >
ããã±ãŒãžãæ£åžžã«åŠçãããåŸãã¡ã€ã³ããŒã¿ããŒã¹ã§ãã®ããã±ãŒãžãåŠçãããããšã瀺ããã©ã°ãèšå®ããå¿ èŠããããŸãã
ããã±ãŒãžããŒã¿ã®è¿œå ã§ãšã©ãŒãçºçããå Žåãè©Šè¡åæ°ã§ããŒã¿ãæŽæ°ããŸãã5åè©Šè¡ãããšããã©ã°ãèšå®ãããããŒã¿ããšã©ãŒã§åŠçãããããã°ã©ã ã¯ãããã®åŠçãåæ¢ããŸãã ãã®ã¡ã«ããºã ãäœæããªããšãäœããã®ãšã©ãŒãçºçããå Žåã«ç¡éã®ãµã€ã¯ã«ã«å ¥ãå¯èœæ§ããããããã°ã©ã ã¯ãã®æ©èœã®å®è¡ãåæ¢ããŸãã 誀ã£ãããã±ãŒãžã¯åŸã§åŠçã§ããããã°ã©ã ã¯ããã«åäœããã¯ãã§ãã
ã»ãã®å°ããªå¥ãã®èšèïŒãã°ããŒã¿ããŒã¹çšã«å¥ã®ä»®æ³ãã·ã³ãäœæããŸãã ãã®ãã·ã³ã«ããå°ãªãã³ã¢ãšã¡ã¢ãªãå²ãåœãŠãããšãã§ããŸãã ããæªããã£ã¹ã¯ã·ã¹ãã ãå²ãåœãŠãããšãã§ããŸã;ããšãã°ãã¡ã€ã³ã®äœæ¥ãè¡ãã¡ã€ã³ããŒã¿ããŒã¹ãšããŠãSSDã«ãã°ãä¿åããå¿ èŠã¯ãããŸããã
ããã©ãŒãã³ã¹èŠä»¶ã®å¢å ã¯ãããŸããã ããã¯é 延æäœã§ãã ãã°ã1åãŸãã¯1.5ååŸã«èšé²ãããããšã¯éèŠã§ã¯ãããŸãããäž»ãªããšã¯ããã°ãèšé²ãããããšã§ãã ãŠãŒã¶ãŒããã®ããŒã¿ã«ã¢ã¯ã»ã¹ããããšã¯éåžžã«ãŸãã§ãããäœããã®åé¡ãçºçããå Žåã®ã¿ã§ãããã°ããŒãžã®èªã¿èŸŒã¿æéã200ããªç§ä»¥äžã§ããã°åé¡ãããŸããã
äžè¬ã«ããããè¡ãããšã§ãªãœãŒã¹ãç¯çŽã§ããŸãããããã®ãªãœãŒã¹ãããŒãããããã·ã³ã«å²ãåœãŠãããšããå§ãããŸãã