org.jumpmind.symmetric.db.sqlite.xml Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of symmetric-ds Show documentation
Show all versions of symmetric-ds Show documentation
SymmetricDS is an open source database synchronization solution. It is platform-independent,
web-enabled, and database-agnostic. SymmetricDS was first built to replicate changes between 'retail store'
databases and ad centralized 'corporate' database.
The newest version!
<?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:tx="http://www.springframework.org/schema/tx" xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd" default-lazy-init="true"> <bean id="sqliteStringTemplate" class="java.lang.String"> <constructor-arg> <value> <![CDATA[ case when $(tableAlias).$(columnName) is null then '' else '"' || replace(replace($(tableAlias).$(columnName),'\','\\'),'"','\"') || '"' end ||','||]]> </value> </constructor-arg> </bean> <bean id="sqliteDialect" class="org.jumpmind.symmetric.db.sqlite.SqLiteDbDialect" scope="prototype"> <property name="tablePrefix" value="$[sym.sync.table.prefix]" /> <property name="parameterService" ref="parameterService" /> <property name="defaultSchema" value="$[sym.db.default.schema]" /> <property name="streamingResultsFetchSize" value="$[sym.db.jdbc.streaming.results.fetch.size]" /> <property name="sqlTemplate"> <bean class="org.jumpmind.symmetric.db.SqlTemplate"> <property name="stringColumnTemplate" ref="sqliteStringTemplate" /> <property name="clobColumnTemplate"> <value> <![CDATA[ case when $(origTableAlias).$(columnName) is null then '' else '"' || replace(replace(cast($(origTableAlias).$(columnName) as varchar(max)),'\','\\'),'"','\"') || '"' end ||','||]]> </value> </property> <property name="emptyColumnTemplate"> <value> <![CDATA[ ''||','||]]> </value> </property> <property name="blobColumnTemplate"> <value> <![CDATA[ case when $(origTableAlias).$(columnName) is null then '' else '"' || replace(replace(dbo.$[sym.sync.table.prefix]_base64_encode($(origTableAlias).$(columnName)),'\','\\'),'"','\"') || '"' end ||','||]]> </value> </property> <property name="numberColumnTemplate"> <value> <![CDATA[case when $(tableAlias).$(columnName) is null then '' else ('"' || cast($(tableAlias).$(columnName) as varchar) || '"') end||','||]]> </value> </property> <!-- TODO --> <property name="datetimeColumnTemplate"> <value> <![CDATA[case when $(tableAlias).$(columnName) is null then '' else ('"' || convert(varchar,$(tableAlias).$(columnName),121) || '"') end ||','||]]> </value> </property> <property name="booleanColumnTemplate"> <value> <![CDATA[case when $(tableAlias).$(columnName) is null then '' when $(tableAlias).$(columnName) = 1 then '"1"' else '"0"' end ||','||]]> </value> </property> <property name="triggerConcatCharacter" value="||" /> <property name="newTriggerValue" value="new"/> <property name="oldTriggerValue" value="old"/> <property name="sqlTemplates"> <map> <entry key="insertTriggerTemplate"> <value> <![CDATA[ create trigger $(triggerName) after insert on $(schemaName)$(tableName) for each row when $(syncOnInsertCondition) begin insert into $(defaultCatalog)$(prefixName)_data (table_name, event_type, trigger_hist_id, row_data, channel_id, transaction_id, source_node_id, external_data, create_time) values( '$(targetTableName)', 'I', $(triggerHistoryId), $(columns), '$(channelName)', null,null, $(externalSelect), CURRENT_TIMESTAMP ); end ]]> </value> </entry> <entry key="updateTriggerTemplate"> <value> <![CDATA[ create trigger $(triggerName) after update on $(schemaName)$(tableName) for each row when $(syncOnUpdateCondition) begin insert into $(defaultCatalog)$(prefixName)_data (table_name, event_type, trigger_hist_id, pk_data, row_data, old_data, channel_id, transaction_id, source_node_id, external_data, create_time) values( '$(targetTableName)', 'U', $(triggerHistoryId), $(oldKeys), $(columns), $(oldColumns), '$(channelName)', null,null, $(externalSelect), CURRENT_TIMESTAMP ); end ]]> </value> </entry> <entry key="deleteTriggerTemplate"> <value> <![CDATA[ create trigger $(triggerName) after delete on $(schemaName)$(tableName) for each row when $(syncOnDeleteCondition) begin insert into $(defaultCatalog)$(prefixName)_data (table_name, event_type, trigger_hist_id, pk_data, old_data, channel_id, transaction_id, source_node_id, external_data, create_time) values( '$(targetTableName)', 'D', $(triggerHistoryId), $(oldKeys), $(oldColumns), '$(channelName)', null,null, $(externalSelect), CURRENT_TIMESTAMP ); end ]]> </value> </entry> <entry key="initialLoadSqlTemplate"> <value> <![CDATA[select $(columns) from $(schemaName)$(tableName) t where $(whereClause)]]> </value> </entry> </map> </property> </bean> </property> </bean> </beans>