You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by GitBox <gi...@apache.org> on 2019/11/14 04:45:26 UTC
[GitHub] [incubator-shardingsphere] beijing-penguin commented on a change in
pull request #3519: Fixes #3370 .and change some code structure for
compatibility
beijing-penguin commented on a change in pull request #3519: Fixes #3370 .and change some code structure for compatibility
URL: https://github.com/apache/incubator-shardingsphere/pull/3519#discussion_r346125291
##########
File path: sharding-core/sharding-core-common/src/main/java/org/apache/shardingsphere/core/metadata/datasource/dialect/H2DataSourceMetaData.java
##########
@@ -31,24 +37,43 @@
*/
@Getter
public final class H2DataSourceMetaData implements MemorizedDataSourceMetaData {
-
+
private static final int DEFAULT_PORT = -1;
-
+
private final String hostName;
-
+
private final int port;
-
+
private final String schemaName;
-
+
+ private final String catalog;
+
private final Pattern pattern = Pattern.compile("jdbc:h2:(mem|~)[:/]([\\w\\-]+);?\\S*", Pattern.CASE_INSENSITIVE);
-
+
public H2DataSourceMetaData(final String url) {
Matcher matcher = pattern.matcher(url);
if (!matcher.find()) {
throw new UnrecognizedDatabaseURLException(url, pattern.pattern());
}
hostName = "";
port = DEFAULT_PORT;
- schemaName = matcher.group(2);
+ catalog = matcher.group(2);
+ schemaName = null;
+ }
+
+ public H2DataSourceMetaData(final DataSource dataSource) {
Review comment:
At present we only need jdbcurl and username ,but at future ,maybe we need more datasouce infomation,so,it is possibility that will use this datasource to get more infomation.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services