sql

Description

Runs a SQL query. If the SQL provides results then they are available as nested properties of rows, and possibly row, properties of this job.

Properties

NameDescriptionRequired
name A name, can be any text. No.
sql The sql query or dml statement to run. Yes.
connection The connection to use. Yes.
rows The results of the query. This property allows indexed access to the rows in the result. Read only.
updateCount The update count of any insert/update/delete statement. Read only.
row The result of a query when only one result is expected. If the results of the query are not a single row this property is null. Read only.
getRowCount The number of rows returned by the query. Read only.

Example

 <sequential>
  <jobs>
   <variables id="vars">
    <connection>
     <connection driver="org.hsqldb.jdbcDriver"
                    url="jdbc:hsqldb:hsql://localhost:11001/mydb"
                    username="sa"/>
    </connection>
   </variables>
   <sql id="query">
     <connection>
      <connection>
       <value value="${vars.connection}">
      </connection>
     select text from greetings where style='nice'
   </sql>
   <echo name="Single Row Result" text="${query.row.greeting}"/>
   <echo name="Result By Row Index" text="${query.rows[0].greeting}"/>
  </jobs>
 <sequential>


(c) Rob Gordon 2005 - 2009