Difference between revisions of "DBOSelect"

From GreenVulcano Wiki
Jump to: navigation, search
({{GVESB}} configuration)
Line 5: Line 5:
 
=={{GVESB}} configuration==
 
=={{GVESB}} configuration==
 
[[File:DBOSelect.jpg|thumb|DBOSelect with VulCon]]
 
[[File:DBOSelect.jpg|thumb|DBOSelect with VulCon]]
DBOSelect might contain the following sub-elements:
+
 
* [[Description]]
+
DBOSelect allows you to perform a select on database.
* [[DHVariables]]
+
 
* [[FieldFormatters]]
+
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.
* [[statement]]
+
 
 +
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.
  
 
Its attributes are:
 
Its attributes are:
Line 23: Line 26:
 
For example:
 
For example:
 
<syntaxhighlight lang="XML"><?xml version="1.0" encoding="UTF-8"?>
 
<syntaxhighlight lang="XML"><?xml version="1.0" encoding="UTF-8"?>
<DBOSelect class="it.greenvulcano.gvesb.datahandling.dbo.DBOSelect"
+
<DBOBuilder class="it.greenvulcano.gvesb.datahandling.dbobuilder.DBOBuilder"  jdbc-connection-name="ds.gv_test"
          name="SearchPerson" transformation="SearchPerson" type="dbo">
+
                        name="SearchPerson"  type="dbobuilder">
    <statement id="1" keys="1,2,3" type="select">select p.NAME, p.BIRTHDATE, c.NAME, cc.CNUMBER, cc.CREDIT, cc.ENABLED
+
      <DHVariables>
                                    from PERSON p, CITY c, CREDIT_CARD cc
+
            <DHVariable name="decimal-separator" value="."/>
                                    where p.ID_CITY = c.ID and p.ID = cc.ID_OWNER</statement>
+
            <DHVariable name="grouping-separator" value=","/>
</DBOSelect>
+
            <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>
 
</syntaxhighlight>
 
</syntaxhighlight>
 +
 +
 +
According to the data present into the DB we obtain as output the following XML:
 +
<syntaxhighlight lang="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>
 +
</syntaxhighlight>
 +
 +
DBOSelect might contain the following sub-elements:
 +
* [[Description]]
 +
* [[DHVariables]]
 +
* [[FieldFormatters]]
 +
* [[statement]]

Revision as of 12:41, 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.

Its attributes are:

  • type: dbo
  • class: it.greenvulcano.gvesb.datahandling.dbo.DBOSelect
  • name
  • transformation
  • force-mode (caller|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: DataSource JNDI name.
    Override connection defined in DBOBuilder.
  • ignore-input (true|false): Tell the engine do not use the input data.
  • output-data: 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: