<?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	= "GF2020"
	title	= "テーブルカラム"
	date	= "2008/10/27"
	author	= "Hiroki.Nakamura"
	text	= ""
	version	= "001"
/>

<og:columnCheck
	command   = "NEW"
	nullCheck = "SYSTEM_ID"
/>

<og:query command="NEW" dbid="{@DBID}" debug="{@debug}" maxRowCount="{@maxRowCount}">
	<jsp:text>
		select TABLE_NAME,COLUMN_NAME AS CLM,COLUMN_ID AS SEQNO,COLUMN_NAME AS NAME_JA,
			DATA_TYPE AS CLS_NAME,
			( CASE WHEN DATA_PRECISION IS NULL 
						THEN to_char(DATA_LENGTH)
						ELSE (	CASE WHEN DATA_SCALE = 0 
									THEN to_char(DATA_PRECISION)
									ELSE DATA_PRECISION || ',' || DATA_SCALE
							  	END )
					 END ) AS USE_LENGTH ,
			DATA_DEFAULT ,
		    (CASE NULLABLE WHEN 'Y' THEN null WHEN 'N' THEN '1' END) AS NOT_NULL,
			'0' AS FGCOM, '' AS BIKO,'' AS RENDERER,'' AS EDITOR,'' AS DBTYPE,
			'{@SYSTEM_ID}' AS SYSTEM_ID,
			'{@TBLSYU}' AS TBLSYU
		from USER_TAB_COLUMNS
		where exists ( select 'X' from USER_TABLES
						where USER_TABLES.TABLE_NAME = USER_TAB_COLUMNS.TABLE_NAME
					)
	</jsp:text>
		<og:where startKey="and">
			<og:and value = "TABLE_NAME like '{@TABLE_NAME}%'" />
			<og:and value = "INSTR(TABLE_NAME,'$') &lt; 1" />
		</og:where>
	<jsp:text>
		order by TABLE_NAME,COLUMN_ID
	</jsp:text>
</og:query>

<form onSubmit="return oneClick();" method="POST" action="forward.jsp" target="RESULT" >
<og:writeCheck>
	<og:submit  value="entry"   lbl="ENTRY" accesskey="E" />
	<og:submit  value="reset"   lbl="RESET" accesskey="R" />
	<og:input type="reset" name="command" lbl="MSG0011" td="false" />
<br />
</og:writeCheck>

<og:view
	viewFormType = "HTMLTable"
	command    = "NEW"
	columnWritable   = "NOT_NULL,FGCOM,CLS_NAME,BIKO"
	checked    = "true"
	startNo    = "{@startNo}"
	pageSize   = "10000" />
<og:hidden name="names"
			value=",," />

<og:hidden name="SQL" >
  <jsp:text>
	INSERT INTO GF05
		(TABLE_NAME,CLM,SEQNO,NAME_JA,CLS_NAME,USE_LENGTH,
		 DATA_DEFAULT,NOT_NULL,
		 RENDERER,EDITOR,DBTYPE,BIKO,SYSTEM_ID,FGCOM,TBLSYU,
		 CDKH,FGJ,DYSET,DYUPD,USRSET,USRUPD,PGUPD)
	VALUES
		([TABLE_NAME],[CLM],[SEQNO],[NAME_JA],[CLS_NAME],[USE_LENGTH],
		  DATA_DEFAULT([DATA_DEFAULT]),[NOT_NULL],
		  [RENDERER],[EDITOR],[DBTYPE],[BIKO],[SYSTEM_ID],[FGCOM],[TBLSYU],
		 'A','1','{@USER.YMDH}','{@USER.YMDH}','{@USER.ID}','{@USER.ID}','{@GUI.KEY}')
  </jsp:text>
</og:hidden>

<og:hidden name="SQL2" >
	<jsp:text>
		DELETE FROM GF05
		WHERE SYSTEM_ID = [SYSTEM_ID] AND TABLE_NAME = [TABLE_NAME] AND TBLSYU = [TBLSYU]
	</jsp:text>
</og:hidden>

<og:hidden name="sqlType" value="{@command}" />

</form>

<jsp:directive.include file="/jsp/common/htmlend.jsp" />
</jsp:root>
