<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: xiaobo  
    $Date: 2012-11-26 上午10:41:36  
    $Revision: 1.0  
    $Purpose: 
-->
<bm:model xmlns:bm="http://www.leaf-framework.org/schema/bm" xmlns:f="leaf.database.features" alias="t1" baseTable="PSR_BASE_TABLES_FIELDS" defaultOrderBy="tables_field_id">
    <bm:operations>
        <bm:operation name="insert">
            <bm:update-sql><![CDATA[
            begin
				PSR_REPORT_PKG.insert_table_fields(
						p_table_name => ${@table_name},
						p_field_name => ${@field_name},
						p_field_description => ${@field_description},
    					p_field_type => ${@field_type},
    					p_field_size => ${@field_size},
    					p_field_decimal => ${@field_decimal},
    					p_user_id => ${/session/@user_id}
				);
			end;
			]]></bm:update-sql>
            <bm:parameters>
                <bm:parameter name="table_name"/>
                <bm:parameter name="field_name"/>
                <bm:parameter name="field_description"/>
                <bm:parameter name="field_type"/>
                <bm:parameter name="field_size"/>
                <bm:parameter name="field_decimal"/>
            </bm:parameters>
        </bm:operation>
    </bm:operations>
    <bm:fields>
        <bm:field name="tables_field_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="tables_field_id" prompt="PSR_BASE_TABLES_FIELDS.tables_field_id"/>
        <bm:field name="table_name" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="TABLE_NAME" prompt="PSR_BASE_TABLES_FIELDS.TABLE_NAME"/>
        <bm:field name="field_name" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="FIELD_NAME" prompt="PSR_BASE_TABLES_FIELDS.FIELD_NAME"/>
        <bm:field name="field_description" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="FIELD_DESCRIPTION" prompt="PSR_BASE_TABLES_FIELDS.FIELD_DESCRIPTION" required="true"/>
        <bm:field name="field_type" databaseType="VARCHAR2" datatype="java.lang.String" lookupCode="PSR_FIELD_TYPE_CODE" lookupField="field_type_dis" physicalName="FIELD_TYPE" prompt="PSR_BASE_TABLES_FIELDS.FIELD_TYPE"/>
        <bm:field name="field_type_dis" forInsert="false" forUpdate="false"/>
        <bm:field name="field_size" databaseType="NUMBER" datatype="java.lang.Long" physicalName="FIELD_SIZE" prompt="PSR_BASE_TABLES_FIELDS.FIELD_SIZE"/>
        <bm:field name="field_decimal" databaseType="NUMBER" datatype="java.lang.Long" physicalName="FIELD_DECIMAL" prompt="PSR_BASE_TABLES_FIELDS.FIELD_DECIMAL"/>
        <bm:field name="flag" databaseType="VARCHAR2" datatype="java.lang.String"/>
    </bm:fields>
    <bm:features>
        <f:standard-who/>
    </bm:features>
    <bm:primary-key>
        <bm:pk-field name="tables_field_id"/>
    </bm:primary-key>
    <bm:query-fields>
        <bm:query-field name="table_name" queryExpression="t1.table_name = ${/parameter/@table_name}"/>
        <bm:query-field name="field_name" queryExpression="t1.field_name = ${/parameter/@field_name}"/>
        <bm:query-field name="flag" queryExpression="t1.flag = ${/parameter/@flag}"/>
    </bm:query-fields>
</bm:model>
