代码优化
This commit is contained in:
@@ -4,7 +4,6 @@ import com.yanghuanglin.seq.enums.DbType;
|
|||||||
|
|
||||||
import javax.sql.DataSource;
|
import javax.sql.DataSource;
|
||||||
import java.sql.Connection;
|
import java.sql.Connection;
|
||||||
import java.sql.DatabaseMetaData;
|
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -134,9 +133,8 @@ public class GeneratorConfig {
|
|||||||
|
|
||||||
public DbType getDbType() {
|
public DbType getDbType() {
|
||||||
if (this.dbType == null) {
|
if (this.dbType == null) {
|
||||||
Connection connection = null;
|
|
||||||
try {
|
try {
|
||||||
connection = dataSource.getConnection();
|
Connection connection = dataSource.getConnection();
|
||||||
String productName = connection.getMetaData().getDatabaseProductName();
|
String productName = connection.getMetaData().getDatabaseProductName();
|
||||||
this.dbType = DbType.of(productName);
|
this.dbType = DbType.of(productName);
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
|
|||||||
Reference in New Issue
Block a user