<?xml version="1.0" encoding="UTF-8" ?>
<jsp:root
	xmlns:jsp="http://java.sun.com/JSP/Page"
	xmlns:og="hybs-taglib.tld"
	version="2.0">
<jsp:directive.page language="java" contentType="text/html; charset=UTF-8" />

<og:head headType="result" />
<jsp:directive.include file="/jsp/custom/result_info.jsp" />
<og:comment
	system	= "GF:エンジンサンプル"
	pgid	= "GF2040"
	title	= "インデックスカラム"
	date	= "2008/10/27"
	author	= "Hiroki.Nakamura"
	text	= ""
	version	= "001"
/>

<og:columnCheck
	command   = "NEW"
/>

<og:query command="NEW" debug="{@debug}" maxRowCount="{@maxRowCount}">
	<jsp:text>
		DELETE FROM GF07
		WHERE SYSTEM_ID = '{@SYSTEM_ID}'
		AND   TBLSYU    = '{@TBLSYU}'
	</jsp:text>
	<og:where startKey="and">
		<og:and value = "TABLE_NAME like '{@TABLE_NAME}%'" />
	</og:where>
</og:query>

<jsp:directive.include file="sqlGF07.jsp" />

<og:tableUpdate
	command		= "ENTRY"
	queryType	= "JDBCTableUpdate"
	selectedAll = "true"
>
<jsp:text>
	INSERT INTO GF07
		(TABLE_NAME,INDEX_NAME,CLM,SEQNO,SYSTEM_ID,TBLSYU,
		 FGJ,DYSET,DYUPD,USRSET,USRUPD,PGUPD)
	VALUES
		([TABLE_NAME],[INDEX_NAME],[CLM],[SEQNO],[SYSTEM_ID],[TBLSYU],
		 '1','{@USER.YMDH}','{@USER.YMDH}','{@USER.ID}','{@USER.ID}','{@GUI.KEY}')
</jsp:text>
</og:tableUpdate>

<!-- SYSTEM_ID,TBLSYU,TABLE_NAME,INDEX_NAME でユニークになるように、データをマージします。 -->
<og:tableMerge action="GROUP" masterKeys="SYSTEM_ID,TBLSYU,TABLE_NAME,INDEX_NAME" groupAddClms="CLM" />

<og:tableUpdate
	command		= "ENTRY"
	queryType	= "JDBCTableUpdate"
	selectedAll = "true"
>
<jsp:text>
	UPDATE GF06
	SET BIKO = [CLM]
	WHERE SYSTEM_ID  = '{@SYSTEM_ID}'
	AND   TBLSYU     = '{@TBLSYU}'
	AND   TABLE_NAME = [TABLE_NAME]
	AND   INDEX_NAME = [INDEX_NAME]
</jsp:text>
</og:tableUpdate>

<og:forward page="result.jsp" keys="command" vals="RENEW" />
<jsp:directive.include file="/jsp/common/htmlend.jsp" />
</jsp:root>
