org.culturegraph.mf.sql.sink
Class SqlStreamSink
java.lang.Object
org.culturegraph.mf.framework.DefaultLifeCycle
org.culturegraph.mf.framework.DefaultStreamReceiver
org.culturegraph.mf.sql.sink.SqlStreamSink
- All Implemented Interfaces:
- org.culturegraph.mf.framework.LifeCycle, org.culturegraph.mf.framework.Receiver, org.culturegraph.mf.framework.StreamReceiver
@Description(value="Executes a prepared query for each record received.")
@In(value=org.culturegraph.mf.framework.StreamReceiver.class)
public final class SqlStreamSink
- extends org.culturegraph.mf.framework.DefaultStreamReceiver
Executes a prepared query for each record received. The
prepared query supports named parameters (written as
:PARAMETER). If a literal name matches a parameter name
its value is used for the parameter. Literals in entities
are not prefixed with entity name.
SqlStreamSinkTest does not evaluate the result set
which may be returned by executing the query. This
makes this module suitable for performing operations such
as INSERT, UPDATE or DELETE.
Use SqlStreamPipe if access to the results of the
SQL query is required.
- Author:
- Christoph Böhme
- See Also:
SqlStreamPipe
| Methods inherited from class org.culturegraph.mf.framework.DefaultStreamReceiver |
endEntity, startEntity |
| Methods inherited from class org.culturegraph.mf.framework.DefaultLifeCycle |
resetStream |
| Methods inherited from interface org.culturegraph.mf.framework.LifeCycle |
resetStream |
ID_PARAMETER
public static final String ID_PARAMETER
- See Also:
- Constant Field Values
SqlStreamSink
public SqlStreamSink(String datasource)
SqlStreamSink
public SqlStreamSink(Connection connection)
setQuery
public void setQuery(String sql)
startRecord
public void startRecord(String id)
- Specified by:
startRecord in interface org.culturegraph.mf.framework.StreamReceiver- Overrides:
startRecord in class org.culturegraph.mf.framework.DefaultStreamReceiver
endRecord
public void endRecord()
- Specified by:
endRecord in interface org.culturegraph.mf.framework.StreamReceiver- Overrides:
endRecord in class org.culturegraph.mf.framework.DefaultStreamReceiver
literal
public void literal(String name,
String value)
- Specified by:
literal in interface org.culturegraph.mf.framework.StreamReceiver- Overrides:
literal in class org.culturegraph.mf.framework.DefaultStreamReceiver
closeStream
public void closeStream()
- Specified by:
closeStream in interface org.culturegraph.mf.framework.LifeCycle- Overrides:
closeStream in class org.culturegraph.mf.framework.DefaultLifeCycle
Copyright © 2014. All Rights Reserved.