提交 7f147e05 编写于 作者: Z zyyang

change

上级 3ce01a27
package com.taosdata.taosdemo.dao;
import com.taosdata.taosdemo.utils.SqlSpeller;
import org.apache.log4j.Logger;
import org.springframework.jdbc.core.JdbcTemplate;
import javax.sql.DataSource;
import java.util.Map;
public class DatabaseMapperImpl implements DatabaseMapper {
private static final Logger logger = Logger.getLogger(DatabaseMapperImpl.class);
private final JdbcTemplate jdbcTemplate;
......@@ -17,21 +19,29 @@ public class DatabaseMapperImpl implements DatabaseMapper {
@Override
public void createDatabase(String dbname) {
jdbcTemplate.execute("create database if not exists " + dbname);
String sql = "create database if not exists " + dbname;
jdbcTemplate.execute(sql);
logger.info("SQL >>> " + sql);
}
@Override
public void dropDatabase(String dbname) {
jdbcTemplate.update("drop database if exists " + dbname);
String sql = "drop database if exists " + dbname;
jdbcTemplate.update(sql);
logger.info("SQL >>> " + sql);
}
@Override
public void createDatabaseWithParameters(Map<String, String> map) {
jdbcTemplate.execute(SqlSpeller.createDatabase(map));
String sql = SqlSpeller.createDatabase(map);
jdbcTemplate.execute(sql);
logger.info("SQL >>> " + sql);
}
@Override
public void useDatabase(String dbname) {
jdbcTemplate.execute("use " + dbname);
String sql = "use " + dbname;
jdbcTemplate.execute(sql);
logger.info("SQL >>> " + sql);
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册