'테이블 생성 sqlclient ibatis'에 해당되는 글 1건

  1. 2009.04.21 Dynamically creating table in ibatis
Ibatis sqlclient provides "statement" tag to create table in dynamic. "Statement" tag are used in various way.

<ibatis xml file>
<?xml version="1.0" encoding="EUC-KR" standalone="no"?>
<!DOCTYPE sqlMap PUBLIC "-//iBATIS.com//DTD SQL Map 2.0//EN"
"http://www.ibatis.com/dtd/sql-map-2.dtd">

<sqlMap namespace="com.google.collector.test">
<statement id="createJavabasic" parameterClass="map" >
     CREATE TABLE exam_$tableid$ (
 logid int(11) NOT NULL auto_increment primary key,
 projectname varchar(30),
 disttype varchar(7),
 contents longtext,
 isSuccess char(1)
);
</statement>

<statement id="dropJavabasic" parameterClass="map" >
DROP TABLE IF EXISTS exam_$tableid$;
</statement>
</sqlMap>


<java code>
Map<String, String> map = new HashMap<String, String>();
map.put("tableid", "test");
sqlMap.queryForObject("com.google.com.test.createJavabasic", map);
Posted by 김용환 '김용환'