Difference between revisions of "DBOSelect"

From GreenVulcano Wiki
Jump to: navigation, search
({{GVESB}} configuration)
({{GVESB}} configuration)
Line 14: Line 14:
 
Can be defined, for every statement and field, the FieldFormatter that allows you to force the formatting of the values ​​extracted from the database.
 
Can be defined, for every statement and field, the FieldFormatter that allows you to force the formatting of the values ​​extracted from the database.
  
Its attributes are:
+
The following table shows the DBOSelect attributes:
* ''type'': dbo
+
{|class="gvtable"
* ''class'': it.greenvulcano.gvesb.datahandling.dbo.DBOSelect
+
! Attribute !! Type !! Description
* ''name''
+
|-
* ''transformation''
+
| type || fixed || This attribute must assume the value '''dbo'''
* ''force-mode'' (caller|xml2db): Force mode of the DBO, can be used in [[DBOBuilder]] whit more heterogeneous DBO. <br/> Mode:<br/> caller - inherit the mode of the caller<br/> db2xml - data extraction mode
+
|-
* ''jdbc-connection-name'':  DataSource JNDI name. <br/>  Override connection defined in [[DBOBuilder]].
+
| class || fixed || This attribute must assume the value '''it.greenvulcano.gvesb.datahandling.dbo.DBOSelect'''
* ''ignore-input'' (true|false):  Tell the engine do not use the input data.
+
|-
* ''output-data'':  The default is the value of @name-Output.
+
| name || required || DOSelect name
 +
|-
 +
| transformation || required ||
 +
|-
 +
| force-mode || required || (caller|xml2db): Force mode of the DBO, can be used in [[DBOBuilder]] whit more heterogeneous DBO. <br/> Mode:<br/> caller - inherit the mode of the caller<br/> db2xml - data extraction mode
 +
|-
 +
| jdbc-connection-name || required || DataSource JNDI name. <br/>  Override connection defined in [[DBOBuilder]].
 +
|-
 +
| ignore-input || optional || (true|false):  Tell the engine do not use the input data.
 +
|-
 +
| output-data || optional || The default is the value of @name-Output.
 +
|}
  
 
For example:
 
For example:
 
<syntaxhighlight lang="XML"><?xml version="1.0" encoding="UTF-8"?>
 
<syntaxhighlight lang="XML"><?xml version="1.0" encoding="UTF-8"?>
<DBOBuilder class="it.greenvulcano.gvesb.datahandling.dbobuilder.DBOBuilder"  jdbc-connection-name="ds.gv_test"  
+
<DBOBuilder class="it.greenvulcano.gvesb.datahandling.dbobuilder.DBOBuilder"   
                        name="SearchPerson"  type="dbobuilder">
+
            jdbc-connection-name="ds.gv_test"  
 +
            name="SearchPerson"  type="dbobuilder">
 
       <DHVariables>
 
       <DHVariables>
 
             <DHVariable name="decimal-separator" value="."/>
 
             <DHVariable name="decimal-separator" value="."/>

Revision as of 12:46, 30 March 2012

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.

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 required
force-mode required xml2db): 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 false): Tell 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: