src-wad/src/org/openbravo/wad/TableLink_data.xsql
author Juan Pablo Aroztegi <juanpablo.aroztegi@openbravo.com>
Wed, 03 Sep 2008 17:55:37 +0000
changeset 1605 8a0fe0193bef
parent 434 a443f8e946e7
child 6138 0b9610429a92
permissions -rw-r--r--
Merge r2.5x intro trunk
<?xml version="1.0" encoding="UTF-8" ?>
<!--
 *************************************************************************
 * The contents of this file are subject to the Openbravo  Public  License
 * Version  1.0  (the  "License"),  being   the  Mozilla   Public  License
 * Version 1.1  with a permitted attribution clause; you may not  use this
 * file except in compliance with the License. You  may  obtain  a copy of
 * the License at http://www.openbravo.com/legal/license.html 
 * Software distributed under the License  is  distributed  on  an "AS IS"
 * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
 * License for the specific  language  governing  rights  and  limitations
 * under the License. 
 * The Original Code is Openbravo ERP. 
 * The Initial Developer of the Original Code is Openbravo SL 
 * All portions are Copyright (C) 2001-2006 Openbravo SL 
 * All Rights Reserved. 
 * Contributor(s):  ______________________________________.
 ************************************************************************
-->



<SqlClass name="TableLinkData" package="org.openbravo.wad">
  <SqlMethod name="select" type="preparedStatement" return="multiple">
    <SqlMethodComment>Names of the columns and name of the fields of a tab</SqlMethodComment>
    <Sql>
      SELECT W.AD_WINDOW_ID, '' AS PO_WINDOW_ID, W.NAME AS WINDOWNAME, T.NAME AS TABNAME 
      FROM AD_WINDOW W, AD_TAB T 
      WHERE W.AD_WINDOW_ID = T.AD_WINDOW_ID 
      AND W.ISACTIVE = 'Y' 
      AND T.ISACTIVE = 'Y' 
      AND W.AD_WINDOW_ID = ? 
      AND T.AD_TABLE_ID = ? 
    </Sql>
    <Parameter name="adWindowId"/>
    <Parameter name="adTableId"/>
  </SqlMethod>
  <SqlMethod name="selectParent" type="preparedStatement" return="multiple">
    <SqlMethodComment>Names of the columns and name of the fields of a tab</SqlMethodComment>
    <Sql>
      SELECT W.AD_WINDOW_ID, '' AS PO_WINDOW_ID, W.NAME AS WINDOWNAME, T.NAME AS TABNAME 
      FROM AD_WINDOW W, AD_TAB T 
      WHERE W.AD_WINDOW_ID = T.AD_WINDOW_ID 
      AND W.ISACTIVE = 'Y' 
      AND T.ISACTIVE = 'Y' 
      AND T.tablevel = 0 
      AND W.AD_WINDOW_ID = ?
      ORDER BY T.SEQNO 
    </Sql>
    <Parameter name="adWindowId"/>
  </SqlMethod>
  <SqlMethod name="selectWindow" type="preparedStatement" return="multiple">
    <SqlMethodComment>Names of the columns and name of the fields of a tab</SqlMethodComment>
    <Sql>
      SELECT AD_WINDOW_ID, PO_WINDOW_ID 
      FROM AD_TABLE 
      WHERE AD_TABLE_ID=?
    </Sql>
    <Parameter name="adTableId"/>
  </SqlMethod>
  <SqlMethod name="tableId" type="preparedStatement" return="String" default="">
    <SqlMethodComment>Names of the columns and name of the fields of a tab</SqlMethodComment>
    <Sql>
      SELECT AD_TABLE_ID 
      FROM AD_REF_TABLE 
      WHERE AD_REFERENCE_ID = ?
    </Sql>
    <Parameter name="adReferenceId"/>
  </SqlMethod>
  <SqlMethod name="tableNameId" type="preparedStatement" return="String" default="">
    <SqlMethodComment>Names of the columns and name of the fields of a tab</SqlMethodComment>
    <Sql>
      SELECT AD_TABLE_ID 
      FROM AD_TABLE 
      WHERE UPPER(TABLENAME) = UPPER(?)
      AND ISACTIVE = 'Y'
    </Sql>
    <Parameter name="tablename"/>
  </SqlMethod>
  <SqlMethod name="columnName" type="preparedStatement" return="String" default="">
    <SqlMethodComment>Names of the columns and name of the fields of a tab</SqlMethodComment>
    <Sql>
      SELECT C.COLUMNNAME 
      FROM AD_REF_TABLE R, AD_COLUMN C 
      WHERE R.AD_KEY = C.AD_COLUMN_ID 
      AND R.AD_REFERENCE_ID = ? 
    </Sql>
    <Parameter name="adReferenceId"/>
  </SqlMethod>
  <SqlMethod name="keyColumnName" type="preparedStatement" return="String" default="">
    <SqlMethodComment>Names of the columns and name of the fields of a tab</SqlMethodComment>
    <Sql>
      SELECT C.COLUMNNAME 
      FROM AD_TABLE T, AD_COLUMN C 
      WHERE T.AD_TABLE_ID = C.AD_TABLE_ID 
      AND (C.ISKEY = 'Y'
      OR C.ISSECONDARYKEY='Y')
      AND UPPER(T.TABLENAME) = UPPER(?) 
      ORDER BY SEQNO
    </Sql>
    <Parameter name="tablename"/>
  </SqlMethod>
  <SqlMethod name="hasTree" type="preparedStatement" return="String" default="">
    <SqlMethodComment>Names of the columns and name of the fields of a tab</SqlMethodComment>
    <Sql>
      SELECT HASTREE FROM AD_TAB WHERE AD_TAB_ID=?
    </Sql>
    <Parameter name="adTabId"/>
  </SqlMethod>
</SqlClass>