nyla.solutions.dao.XmlQuery Maven / Gradle / Ivy
package nyla.solutions.dao;
import nyla.solutions.global.data.Textable;
import nyla.solutions.global.exception.NoDataFoundException;
import nyla.solutions.global.util.Debugger;
import nyla.solutions.global.xml.XML;
/**
*
* XmlQuery is a textable version of of SLQ query result set
*
* Sample Spring Definition
* <bean id="dbJobLongRunningWeek" class="nyla.solutions.dao.XmlQuery"
singleton="false">
<property name="sql">
<value>
select JOB_NAME, TO_CHAR(LOG_DATE,'MM/dd/YYYY hh:mi:ss AM') as
log_date,
TO_CHAR(RUN_DURATION),
NVL(ADDITIONAL_INFO,' ')
from
dba_scheduler_job_run_details
where run_duration > INTERVAL
'0 1:00:0'
DAY TO SECOND(0)
and TO_CHAR(LOG_DATE,'IW') =
TO_CHAR(SYSDATE,'IW')
and status = 'SUCCEEDED'
order by JOB_NAME, LOG_DATE
</value>
</property>
<property name="connectionURL" value="jdbc.connection.url=jdbc:oracle:thin:@sid"/>
<property name="jdbc.driver" value="oracle.jdbc.driver.OracleDriver"/>
<property name="dbUserName" value="user"/>
<property name="dbPassword" value="{cryption}-25 -20 98 -25.."/>
</bean>
Sample XML results
<dataRows>
<nyla.solutions.dao.DataRow>
<useNullString>false</useNullString>
<entries>
<string>BIODATA</string>
<big-decimal>0</big-decimal>
<big-decimal>15678056</big-decimal>
</entries>
</nyla.solutions.dao.DataRow>
<dataRows>
* @author Gregory Green
*
*/
public class XmlQuery extends Query implements Textable
{
/**
*
* Execute the sqlQuery and return XML results in the format DataResultSet
*
*/
public String getText()
{
try
{
String xml = XML.getInterpreter().toXML(this.getResults());
Debugger.println(this, "xml query results="+xml);
return xml;
}
catch(NoDataFoundException e)
{
return "";
}
}//--------------------------------------------
public int compareTo(Object arg0)
{
return 0;
}//--------------------------------------------
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy