DBOSelect

From GreenVulcano Wiki
Revision as of 12:20, 12 November 2012 by Anonymous (talk) ({{GVESB}} configuration)
Jump to: navigation, search

Description

The DBOSelect element represents the DBO optimized for select operations.

GreenVulcano® ESB configuration

DBOSelect with VulCon

DBOSelect allows you to perform a select on database.

The result of the select(s) is an XML document in internal format that can then be transformed into a useful document for the client.

Can be executed more select statements, each one associated to an id, with the possibility of aggregating, using keys, the extracted data.

Can be defined, for every statement and field, the FieldFormatter that allows you to force the formatting of the values ​​extracted from the database.

It is used by DBOBuilder.

The following table shows the DBOSelect attributes:

Attribute Type Description
type fixed This attribute must assume the value dbo
class fixed This attribute must assume the value it.greenvulcano.gvesb.datahandling.dbo.DBOSelect
name required DOSelect name
transformation optional Transformation to be used for converting internal rowset representation in user desired XML document.
force-mode required (caller or db2xml): Force mode of the DBO, can be used in DBOBuilder whit more heterogeneous DBO.
Mode:
caller - inherit the mode of the caller
db2xml - data extraction mode
jdbc-connection-name required DataSource JNDI name.
Override connection defined in DBOBuilder.
ignore-input optional (true or false): Tells the engine do not use the input data.
output-data optional The default is the value of @name-Output.

For example:

<?xml version="1.0" encoding="UTF-8"?>
<DBOBuilder class="it.greenvulcano.gvesb.datahandling.dbobuilder.DBOBuilder"   
            jdbc-connection-name="ds.gv_test" 
            name="SearchPerson"   type="dbobuilder">
      <DHVariables>
             <DHVariable name="decimal-separator" value="."/>
             <DHVariable name="grouping-separator" value=","/>
             <DHVariable name="format" value="#0.00"/>
             <DHVariable name="NAME" value="NULL"/>
             <DHVariable name="CITY" value="NULL"/>
      </DHVariables>
      <DBOSelect class="it.greenvulcano.gvesb.datahandling.dbo.DBOSelect"  
                 name="SearchPerson" 
                 transformation="SearchPerson"   type="dbo">
             <statement id="1" keys="1,2,3" type="select">
                  select p.NAME, p.BIRTHDATE, c.NAME, cc.CNUMBER, cc.CREDIT, cc.ENABLED
                  from PERSON p, CITY c, CREDIT_CARD cc
                  where p.ID_CITY = c.ID
                  and p.ID = cc.ID_OWNER
                  decode{{@{{NAME}}::NULL::::and p.NAME like ‘%@{{NAME}}%’}}
                  decode{{@{{CITY}}::NULL::::and c.NAME like ‘%@{{CITY}}%’}}
                  order by c.NAME, p.NAME
             </statement>
       </DBOSelect>
</DBOBuilder>


According to the data present into the DB we obtain as output the following XML:

<?xml version="1.0" encoding="UTF-8"?>
<RowSet>
    <data id="1" key_1="ANTONIO ROSSI" key_2="19800205 00:00:00" key_3="MILANO">
        <row id="1">
            <col type="string">1111222233338888</col>
            <col type="string">48.32000</col>
            <col type="string">Y</col>
        </row>
        <row id="1">
            <col type="string">1234123414444789</col>
            <col type="string">600.00000</col>
            <col type="string">Y</col>
        </row>
    </data>
    <data id="1" key_1="MARIO BIANCHI" key_2="19700815 00:00:00" key_3="MILANO">
        <row id="1">
            <col type="string">1234123412341234</col>
            <col type="string">100.00000</col>
            <col type="string">Y</col>
        </row>
        <row id="1">
            <col type="string">1234123415555666</col>
            <col type="string">300.00000</col>
            <col type="string">Y</col>
        </row>
    </data>
</RowSet>

DBOSelect might contain the following sub-elements: