Repository: camel Updated Branches: refs/heads/master 3c4e19e48 -> 1fb67d6b8
Added camel-josql language to Gitbook Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/1fb67d6b Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/1fb67d6b Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/1fb67d6b Branch: refs/heads/master Commit: 1fb67d6b86e0bab98c1ea42f0700064402f53146 Parents: 3c4e19e Author: Andrea Cosentino <anco...@gmail.com> Authored: Thu Apr 28 13:52:37 2016 +0200 Committer: Andrea Cosentino <anco...@gmail.com> Committed: Thu Apr 28 13:53:01 2016 +0200 ---------------------------------------------------------------------- components/camel-josql/src/main/docs/josql.adoc | 82 ++++++++++++++++++++ docs/user-manual/en/SUMMARY.md | 3 +- 2 files changed, 83 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/camel/blob/1fb67d6b/components/camel-josql/src/main/docs/josql.adoc ---------------------------------------------------------------------- diff --git a/components/camel-josql/src/main/docs/josql.adoc b/components/camel-josql/src/main/docs/josql.adoc new file mode 100644 index 0000000..d0d1043 --- /dev/null +++ b/components/camel-josql/src/main/docs/josql.adoc @@ -0,0 +1,82 @@ +[[SQL-SQLLanguage]] +SQL Language +~~~~~~~~~~~~ + +The SQL support is added by http://josql.sourceforge.net/[JoSQL] and is +primarily used for performing SQL queries on in-memory objects. If you +prefer to perform actual database queries then check out the +link:jpa.html[JPA] component. + +*Looking for the SQL component* + +Camel has both a link:sql.html[SQL] language and a +link:sql-component.html[SQL Component]. This page is about the SQL +language. Click on link:sql-component.html[SQL Component] if you are +looking for the component instead. + +To use SQL in your camel routes you need to add the a dependency on +*camel-josql* which implements the SQL language. + +If you use maven you could just add the following to your pom.xml, +substituting the version number for the latest & greatest release (see +link:download.html[the download page for the latest versions]). + +[source,xml] +---------------------------------------------------------- +<dependency> + <groupId>org.apache.camel</groupId> + <artifactId>camel-josql</artifactId> + <version>x.x.x</version> + <!-- use the same version as your Camel core version --> +</dependency> +---------------------------------------------------------- + +Camel supports http://en.wikipedia.org/wiki/SQL[SQL] to allow an +link:expression.html[Expression] or link:predicate.html[Predicate] to be +used in the link:dsl.html[DSL] or link:xml-configuration.html[Xml +Configuration]. For example you could use SQL to create an +link:predicate.html[Predicate] in a link:message-filter.html[Message +Filter] or as an link:expression.html[Expression] for a +link:recipient-list.html[Recipient List]. + +[source,java] +----------------------------------------------------------------------- +from("queue:foo").setBody().sql("select * from MyType").to("queue:bar") +----------------------------------------------------------------------- + +And the spring DSL: + +[source,xml] +-------------------------------------- + <from uri="queue:foo"/> + <setBody> + <sql>select * from MyType</sql> + </setBody> + <to uri="queue:bar"/> +-------------------------------------- + +[[SQL-Options]] +Options +^^^^^^^ + +// component options: START +// component options: END + +// endpoint options: START +// endpoint options: END + +[[SQL-Loadingscriptfromexternalresource]] +Loading script from external resource +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +*Available as of Camel 2.11* + +You can externalize the script and have Camel load it from a resource +such as `"classpath:"`, `"file:"`, or `"http:"`. + + This is done using the following syntax: `"resource:scheme:location"`, +eg to refer to a file on the classpath you can do: + +[source,java] +---------------------------------------------------------- +.setHeader("myHeader").sql("resource:classpath:mysql.sql") +---------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/camel/blob/1fb67d6b/docs/user-manual/en/SUMMARY.md ---------------------------------------------------------------------- diff --git a/docs/user-manual/en/SUMMARY.md b/docs/user-manual/en/SUMMARY.md index 7e463e1..8eadaa2 100644 --- a/docs/user-manual/en/SUMMARY.md +++ b/docs/user-manual/en/SUMMARY.md @@ -189,11 +189,10 @@ * [Yammer](yammer.adoc) * [ZooKeeper](zookeeper.adoc) -<!-- * [Expession Languages](languages.adoc) * [Bean Language](bean-language.adoc) * [Constant](constant.adoc) ---> + * [SQL](josql.adoc) * Data Formats * [Flatpack](flatpack-dataformat.adoc)