Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: 达梦数据库支持 #58

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,12 @@
- [x] SqlServer
- [x] PostgreSQL
- [x] Cache DB(2016)
- [x] 达梦
- [ ] H2 (开发中)
- [ ] DB2 (开发中)
- [ ] HSQL (开发中)
- [ ] SQLite(开发中)
- [ ] 瀚高(开发中)
- [ ] 达梦 (开发中)
- [ ] 虚谷 (开发中)
- [ ] 人大金仓(开发中)

Expand Down
Binary file removed lib/Dm7JdbcDriver-16.jar
Binary file not shown.
7 changes: 7 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@
<postgresql.version>42.2.14</postgresql.version>
<ojdbc.version>19.3.0.0</ojdbc.version>
<orai18n.version>12.1.0.2.0</orai18n.version>
<dm.version>8.1.1.193</dm.version>
<postgresql.version>42.2.11</postgresql.version>
<h2.version>1.4.200</h2.version>
<db2-jdbc.version>11.5.5.0</db2-jdbc.version>
Expand Down Expand Up @@ -218,6 +219,12 @@
<artifactId>orai18n</artifactId>
<version>${orai18n.version}</version>
</dependency>
<!-- dm -->
<dependency>
<groupId>com.dameng</groupId>
<artifactId>DmJdbcDriver18</artifactId>
<version>${dm.version}</version>
</dependency>
<!-- postgresql -->
<dependency>
<groupId>org.postgresql</groupId>
Expand Down
6 changes: 6 additions & 0 deletions screw-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,12 @@
<artifactId>orai18n</artifactId>
<scope>provided</scope>
</dependency>
<!-- dm -->
<dependency>
<groupId>com.dameng</groupId>
<artifactId>DmJdbcDriver18</artifactId>
<scope>provided</scope>
</dependency>
<!-- postgresql -->
<dependency>
<groupId>org.postgresql</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,6 @@
*/
package cn.smallbun.screw.core.query.dm;

import static cn.smallbun.screw.core.constant.DefaultConstants.PERCENT_SIGN;

import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
import java.util.stream.Collectors;

import javax.sql.DataSource;

import cn.smallbun.screw.core.exception.QueryException;
import cn.smallbun.screw.core.mapping.Mapping;
import cn.smallbun.screw.core.metadata.Column;
Expand All @@ -45,6 +32,18 @@
import cn.smallbun.screw.core.util.ExceptionUtils;
import cn.smallbun.screw.core.util.JdbcUtils;

import javax.sql.DataSource;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
import java.util.stream.Collectors;

import static cn.smallbun.screw.core.constant.DefaultConstants.PERCENT_SIGN;

/**
* 达梦数据库查询
*
Expand All @@ -57,7 +56,7 @@ public class DmDataBaseQuery extends AbstractDatabaseQuery {
private static final String DM_QUERY_TABLE_SQL = ""
+ "select "
+ " ut.table_name TABLE_NAME, "
+ " utc.comments COMMENTS "
+ " utc.comments REMARKS "
+ "from "
+ " user_tables ut "
+ "left join USER_TAB_COMMENTS utc "
Expand Down Expand Up @@ -128,35 +127,6 @@ public Database getDataBase() throws QueryException {
return model;
}

/**
* 获取达梦数据库的schema
*
* @return {@link String} 达梦数据库的schema信息
*/
@Override
public String getSchema() throws QueryException {
return null;
}

/**
* 获取达梦数据库的schema
*
* @return {@link String} 达梦数据库的schema信息
*/
public String getSchemaBak() throws QueryException {
try {
String schema = null;
ResultSet rs = getMetaData().getSchemas();
while (rs.next()) {
schema = rs.getString(1);
break;
}
return schema;
} catch (Exception e) {
throw ExceptionUtils.mpe(e);
}
}

/**
* 获取表信息
*
Expand Down