<?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" />

<!-- add -->
<og:equals val1="{@execType}" val2="0">

	<og:equals val1="{@init}" val2="true" notEquals="true">
		<og:value command="SQL" dbid="{@SYS.DEV_DBID}">
			select coalesce(max(SEQ),0) + 10 SEQ
			from GF91
			where SYSTEM_ID = '{@systemId}'
			and PGID = '{@pgId}'
		</og:value>

		<og:value command="SQL" dbid="{@SYS.DEV_DBID}" >
			select 'A'{@DBF.CON}({@SEQ}/10) AS_TABLE
			from GF90
			where SYSTEM_ID = '{@systemId}'
			and PGID = '{@pgId}'
		</og:value>

		<og:value command="SET" key="seq" value="{@SEQ}" />
		<og:value command="SET" key="asTable" value="{@AS_TABLE}" />
	</og:equals>

	<og:text>
	<div tableId="{@tableId}" asTable="{@asTable}" tableName="{@tableName}" seq="{@seq}" class="divTable tabItem" >
	<p title="{@tableName}"><span class="close" title="{@LBL.CLOSE}">{@LBL.CLOSEBUTTON}</span><span class="astable">({@asTable})</span>{@tableName}</p>
	<og:select name="D" td="false">
<!--
		<og:queryOption dbid="{@SYS.DEV_DBID}">
			select CLM,CLM_NAME
			from GF80
			where SYSTEM_ID= '{@systemId}'
			and TBLSYU = 'D'
			and TABLE_NAME = '{@tableId}'
			order by SEQNO
		</og:queryOption>
-->
		<og:queryOption dbid="{@SYS.DEV_DBID}">
			select CLM,NAME_JA
			from GF05
			where SYSTEM_ID = '{@systemId}'
			and TBLSYU = 'D'
			and TABLE_NAME = '{@tableId}'
			order by SEQNO
		</og:queryOption>
	</og:select>
	</div>
	</og:text>

	<og:equals val1="{@init}" val2="true" notEquals="true">
		<og:query displayMsg="" notfoundMsg="" dbid="{@SYS.DEV_DBID}">
			insert into GF91(
				SYSTEM_ID, PGID, TABLE_NAME, AS_TABLE, SEQ
			) values (
				'{@systemId}', '{@pgId}', '{@tableId}', '{@asTable}', '{@SEQ}'
			)
		</og:query>
	</og:equals>
</og:equals>

<!-- remove -->
<og:equals val1="{@execType}" val2="9">
	<og:query displayMsg="" notfoundMsg="" dbid="{@SYS.DEV_DBID}">
		delete from GF91
		where SYSTEM_ID = '{@systemId}'
		and PGID = '{@pgId}'
		and TABLE_NAME = '{@tableId}'
		and AS_TABLE = '{@asTable}'
	</og:query>

	<og:query displayMsg="" notfoundMsg="" dbid="{@SYS.DEV_DBID}">
		delete from GF92
		where SYSTEM_ID = '{@systemId}'
		and PGID = '{@pgId}'
		and TABLE_NAME = '{@tableId}'
		and AS_TABLE = '{@asTable}'
	</og:query>

	<og:query displayMsg="" notfoundMsg="" dbid="{@SYS.DEV_DBID}">
		delete from GF92
		where SYSTEM_ID = '{@systemId}'
		and PGID = '{@pgId}'
		and NMSYORI = 'JOIN'
		and ZOKUSEI like '%{@tableId}__{@asTable}'
	</og:query>
</og:equals>

</jsp:root>
