Author: buildbot
Date: Tue Apr 1 08:19:08 2014
New Revision: 904496
Log:
Production update by buildbot for camel
Modified:
websites/production/camel/content/cache/main.pageCache
websites/production/camel/content/sql-component.html
Modified: websites/production/camel/content/cache/main.pageCache
==============================================================================
Binary files - no diff available.
Modified: websites/production/camel/content/sql-component.html
==============================================================================
--- websites/production/camel/content/sql-component.html (original)
+++ websites/production/camel/content/sql-component.html Tue Apr 1 08:19:08
2014
@@ -119,7 +119,7 @@ a) If the query has only single column,
b) If the query has more than one column, then it will return a Map of that
result.<br clear="none">
c) If the <code>outputClass</code> is set, then it will convert the query
result into an Java bean object by calling all the setters that match the
column names. It will assume your class has a default constructor to create
instance with.<br clear="none">
d) If the query resulted in more than one rows, it throws an non-unique result
exception.</p></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p> <code>outputClass</code> </p></td><td colspan="1"
rowspan="1" class="confluenceTd"><p> <code>String</code> </p></td><td
colspan="1" rowspan="1" class="confluenceTd"><p> <code>null</code> </p></td><td
colspan="1" rowspan="1" class="confluenceTd"><p> <strong>Camel 2.12.0:</strong>
Specify the full package and class name to use as conversion when
<code>outputType=SelectOne</code>. </p></td></tr><tr><td colspan="1"
rowspan="1" class="confluenceTd"><p> <code>parametersCount</code> </p></td><td
colspan="1" rowspan="1" class="confluenceTd"><p> <code>int</code> </p></td><td
colspan="1" rowspan="1" class="confluenceTd"><p> <code>0</code> </p></td><td
colspan="1" rowspan="1" class="confluenceTd"><p> <strong>Camel
2.11.2/2.12.0</strong> If set greater than zero, then Camel will use this count
value of parameters to replace instead of qu
erying via JDBC metadata API. This is useful if the JDBC vendor could not
return correct parameters count, then user may override instead.
</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p>
<code>noop</code> </p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>
<code>boolean</code> </p></td><td colspan="1" rowspan="1"
class="confluenceTd"><p> false </p></td><td colspan="1" rowspan="1"
class="confluenceTd"><p> <strong>Camel 2.12.0</strong> If set, will ignore the
results of the SQL query and use the existing IN message as the OUT message for
the continuation of processing </p></td></tr></tbody></table>
-</div><h3 id="SQLComponent-Treatmentofthemessagebody">Treatment of the message
body</h3><p>The SQL component tries to convert the message body to an object of
<code>java.util.Iterator</code> type and then uses this iterator to fill the
query parameters (where each query parameter is represented by a <code>#</code>
symbol (or configured placeholder) in the endpoint URI). If the message body is
not an array or collection, the conversion results in an iterator that iterates
over only one object, which is the body itself.</p><p>For example, if the
message body is an instance of <code>java.util.List</code>, the first item in
the list is substituted into the first occurrence of <code>#</code> in the SQL
query, the second item in the list is substituted into the second occurrence of
<code>#</code>, and so on.</p><p>If <code>batch</code> is set to
<code>true</code>, then the interpretation of the inbound message body changes
slightly – instead of an iterator of parameters, the compone
nt expects an iterator that contains the parameter iterators; the size of the
outer iterator determines the batch size.</p><h3
id="SQLComponent-Resultofthequery">Result of the query</h3><p>For
<code>select</code> operations, the result is an instance of
<code>List<Map<String, Object>></code> type, as returned by the <a
shape="rect" class="external-link"
href="http://static.springframework.org/spring/docs/2.5.x/api/org/springframework/jdbc/core/JdbcTemplate.html#queryForList(java.lang.String,%20java.lang.Object%91%93)"
rel="nofollow">JdbcTemplate.queryForList()</a> method. For <code>update</code>
operations, the result is the number of updated rows, returned as an
<code>Integer</code>.</p><h3 id="SQLComponent-Headervalues">Header
values</h3><p>When performing <code>update</code> operations, the SQL Component
stores the update count in the following message headers:</p><div
class="table-wrap"><table class="confluenceTable"><tbody><tr><th colspan="1"
rowspan="1" class="conf
luenceTh"><p>Header</p></th><th colspan="1" rowspan="1"
class="confluenceTh"><p>Description</p></th></tr><tr><td colspan="1"
rowspan="1"
class="confluenceTd"><p><code>CamelSqlUpdateCount</code></p></td><td
colspan="1" rowspan="1" class="confluenceTd"><p>The number of rows updated for
<code>update</code> operations, returned as an <code>Integer</code>
object.</p></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p><code>CamelSqlRowCount</code></p></td><td colspan="1"
rowspan="1" class="confluenceTd"><p>The number of rows returned for
<code>select</code> operations, returned as an <code>Integer</code>
object.</p></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p><code>CamelSqlQuery</code></p></td><td colspan="1"
rowspan="1" class="confluenceTd"><p><strong>Camel 2.8:</strong> Query to
execute. This query takes precedence over the query specified in the endpoint
URI. Note that query parameters in the header <em>are</em> represented by a
<code>?</code> instead
of a <code>#</code> symbol</p></td></tr></tbody></table></div><h3
id="SQLComponent-Configuration">Configuration</h3><p>You can now set a
reference to a <code>DataSource</code> in the URI directly:</p><div class="code
panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
+</div><h3 id="SQLComponent-Treatmentofthemessagebody">Treatment of the message
body</h3><p>The SQL component tries to convert the message body to an object of
<code>java.util.Iterator</code> type and then uses this iterator to fill the
query parameters (where each query parameter is represented by a <code>#</code>
symbol (or configured placeholder) in the endpoint URI). If the message body is
not an array or collection, the conversion results in an iterator that iterates
over only one object, which is the body itself.</p><p>For example, if the
message body is an instance of <code>java.util.List</code>, the first item in
the list is substituted into the first occurrence of <code>#</code> in the SQL
query, the second item in the list is substituted into the second occurrence of
<code>#</code>, and so on.</p><p>If <code>batch</code> is set to
<code>true</code>, then the interpretation of the inbound message body changes
slightly – instead of an iterator of parameters, the compone
nt expects an iterator that contains the parameter iterators; the size of the
outer iterator determines the batch size.</p><h3
id="SQLComponent-Resultofthequery">Result of the query</h3><p>For
<code>select</code> operations, the result is an instance of
<code>List<Map<String, Object>></code> type, as returned by the <a
shape="rect" class="external-link"
href="http://static.springframework.org/spring/docs/2.5.x/api/org/springframework/jdbc/core/JdbcTemplate.html#queryForList(java.lang.String,%20java.lang.Object%91%93)"
rel="nofollow">JdbcTemplate.queryForList()</a> method. For <code>update</code>
operations, the result is the number of updated rows, returned as an
<code>Integer</code>.</p><h3 id="SQLComponent-Headervalues">Header
values</h3><p>When performing <code>update</code> operations, the SQL Component
stores the update count in the following message headers:</p><div
class="table-wrap"><table class="confluenceTable"><tbody><tr><th colspan="1"
rowspan="1" class="conf
luenceTh"><p>Header</p></th><th colspan="1" rowspan="1"
class="confluenceTh"><p>Description</p></th></tr><tr><td colspan="1"
rowspan="1"
class="confluenceTd"><p><code>CamelSqlUpdateCount</code></p></td><td
colspan="1" rowspan="1" class="confluenceTd"><p>The number of rows updated for
<code>update</code> operations, returned as an <code>Integer</code>
object.</p></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p><code>CamelSqlRowCount</code></p></td><td colspan="1"
rowspan="1" class="confluenceTd"><p>The number of rows returned for
<code>select</code> operations, returned as an <code>Integer</code>
object.</p></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p><code>CamelSqlQuery</code></p></td><td colspan="1"
rowspan="1" class="confluenceTd"><p><strong>Camel 2.8:</strong> Query to
execute. This query takes precedence over the query specified in the endpoint
URI. Note that query parameters in the header <em>are</em> represented by a
<code>?</code> instead
of a <code>#</code> symbol</p></td></tr></tbody></table></div><p>When
performing <code>insert</code> operations, the SQL Component stores the
rows with the generated keys and number of these rown in the following message
headers (<strong>Available as of Camel 2.12.4, 2.13.1</strong>):</p><div
class="table-wrap"><table class="confluenceTable"><tbody><tr><th colspan="1"
rowspan="1" class="confluenceTh"><p>Header</p></th><th colspan="1" rowspan="1"
class="confluenceTh"><p>Description</p></th></tr><tr><td colspan="1"
rowspan="1"
class="confluenceTd"><pre>CamelSqlGeneratedKeysRowCount</pre></td><td
colspan="1" rowspan="1" class="confluenceTd">The number of rows in the header
that contains generated keys.</td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><pre>CamelSqlGeneratedKeyRows</pre></td><td colspan="1"
rowspan="1" class="confluenceTd"> Rows that contains the generated keys (a
list of maps of keys).</td></tr></tbody></table></div><h3
id="SQLComponent-Generated
keys">Generated keys</h3><p><strong>Available as of Camel 2.12.4, 2.13.1 and
2.14<br clear="none"></strong></p><p>If you insert data using SQL INSERT, then
the RDBMS may support auto generated keys. You can instruct the SQL producer to
return the generated keys in headers.<br clear="none"> To do that set the
header <code>CamelSqlRetrieveGeneratedKeys=true</code>. Then the generated keys
will be provided as headers with the keys listed in the table above.</p><p>You
can see more details in this <a shape="rect" class="external-link"
href="https://git-wip-us.apache.org/repos/asf?p=camel.git;a=blob_plain;f=components/camel-sql/src/test/java/org/apache/camel/component/sql/SqlGeneratedKeysTest.java;hb=3962b23f94bb4bc23011b931add08c3f6833c82e">unit
test</a>.</p><h3 id="SQLComponent-Configuration">Configuration</h3><p>You can
now set a reference to a <code>DataSource</code> in the URI directly:</p><div
class="code panel pdl" style="border-width: 1px;"><div class="codeContent
panelContent pdl
">
<script class="theme: Default; brush: java; gutter: false"
type="syntaxhighlighter"><![CDATA[sql:select * from table where id=# order by
name?dataSource=myDS
]]></script>
</div></div><h3 id="SQLComponent-Sample">Sample</h3><p>In the sample below we
execute a query and retrieve the result as a <code>List</code> of rows, where
each row is a <code>Map<String, Object</code> and the key is the column
name.</p><p>First, we set up a table to use for our sample. As this is based on
an unit test, we do it in java:</p><div class="code panel pdl"
style="border-width: 1px;"><div class="codeContent panelContent pdl">