<?xml version='1.0' encoding='Shift_JIS'?>
<!--
 ******************************************************************** 
 sticker sample
 
 export : remote database -> local db -> csv file
  
 ******************************************************************** 
-->
<sticker version="0.01" debug="true">
	<debug>Server definition</debug>
	<servers>
		<server name="your-server" driver="driver name"
			url="jdbc url" user="your name"
			pass="password" autocommit="false" />
	</servers>

	<!-- local db(hsqldb) definition -->
	<tables>
		<table name="local_emp_table">
			<column name="emp_no" type="integer" nullable="false" />
			<column name="name" type="varchar(10)" nullable="false" />
			<column name="division_cd" type="integer" nullable="false" />
			<column name="sex" type="varchar(5)" nullable="false" />
		</table>
	</tables>

	<connect name="your-server">
		<debug>export to local db</debug>
		<export destination="local_emp_table"
				fileCharset="UTF8">
			select
				emp_no,
				name,
				division_cd,
				sex
			from
				employee_table
			where
				deleted='false';
		</export>
		<debug>export to local db success</debug>

		<sql target="local">
		   begin transaction;
		</sql>
		<sql target="local">
		   update
		     local_emp_table
		   set
		     division_cd = 0
		   where
		     division_cd > 10
		</sql> 
		<sql target="local">
		   commit;
		</sql>

		<debug>export to csv file</debug>
		<export target="local"
				destination="/enable_employee_datas.csv" 
				fileCharset="UTF8">
			select
				*
			from
				local_employee_table;
		</export>
		<debug>export to csv file success</debug>
	</connect>

	<!-- exception definition -->
	<exception>
		<debug>process failure!</debug>
	</exception>
</sticker>