-
Notifications
You must be signed in to change notification settings - Fork 236
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
upgrade version to 3.7.2 and fix bug #221
- Loading branch information
1 parent
fbc172f
commit d8a6718
Showing
32 changed files
with
186 additions
and
150 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
mvn versions:set -DnewVersion=3.7.1 -DprocessDependencies=true -DgenerateBackupPoms=false | ||
mvn versions:set -DnewVersion=3.7.2 -DprocessDependencies=true -DgenerateBackupPoms=false | ||
|
||
mvn compile deploy -pl datax-config,maven-tpi-plugin,tis-plugin -am -Dmaven.test.skip=true -DaltDeploymentRepository=base::default::http://localhost:8080/release | ||
#mvn compile deploy -pl datax-config,maven-tpi-plugin,tis-plugin -am -Dmaven.test.skip=true -DaltDeploymentRepository=base::default::http://localhost:8080/release |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
113 changes: 113 additions & 0 deletions
113
tis-plugin/src/main/java/com/qlangtech/tis/plugin/datax/AbstractCreateTableSqlBuilder.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,113 @@ | ||
/** | ||
* Licensed to the Apache Software Foundation (ASF) under one | ||
* or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information | ||
* regarding copyright ownership. The ASF licenses this file | ||
* to you under the Apache License, Version 2.0 (the | ||
* "License"); you may not use this file except in compliance | ||
* with the License. You may obtain a copy of the License at | ||
* <p> | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* <p> | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package com.qlangtech.tis.plugin.datax; | ||
|
||
import com.qlangtech.tis.datax.IDataxProcessor; | ||
import com.qlangtech.tis.plugin.ds.CMeta; | ||
import com.qlangtech.tis.plugin.ds.DataSourceMeta; | ||
import org.apache.commons.lang.StringUtils; | ||
|
||
import java.util.List; | ||
import java.util.Optional; | ||
import java.util.stream.Collectors; | ||
|
||
/** | ||
* @author: 百岁(baisui@qlangtech.com) | ||
* @create: 2023-05-07 12:35 | ||
**/ | ||
public abstract class AbstractCreateTableSqlBuilder { | ||
|
||
protected final IDataxProcessor.TableMap tableMapper; | ||
|
||
protected final List<CreateTableSqlBuilder.ColWrapper> pks; | ||
public int maxColNameLength; | ||
protected final String escapeChar; | ||
|
||
public AbstractCreateTableSqlBuilder(IDataxProcessor.TableMap tableMapper, DataSourceMeta dsMeta) { | ||
this.tableMapper = tableMapper; | ||
|
||
this.pks = this.getCols().stream() | ||
.filter((c) -> c.isPk()) | ||
.map((c) -> createColWrapper(c)) | ||
.collect(Collectors.toList()); | ||
|
||
maxColNameLength = 0; | ||
for (CMeta col : this.getCols()) { | ||
int m = StringUtils.length(col.getName()); | ||
if (m > maxColNameLength) { | ||
maxColNameLength = m; | ||
} | ||
} | ||
maxColNameLength += 4; | ||
if (supportColEscapeChar()) { | ||
Optional<String> escape = dsMeta.getEscapeChar(); | ||
if (!escape.isPresent()) { | ||
throw new IllegalArgumentException("must contain escapeChar for DB entity"); | ||
} | ||
this.escapeChar = escape.get(); | ||
} else { | ||
this.escapeChar = StringUtils.EMPTY; | ||
} | ||
} | ||
|
||
public abstract CreateTableSqlBuilder.CreateDDL build(); | ||
|
||
|
||
protected CreateTableSqlBuilder.CreateTableName getCreateTableName() { | ||
return new CreateTableSqlBuilder.CreateTableName(tableMapper.getTo(), this); | ||
} | ||
|
||
protected String wrapWithEscape(String val) { | ||
return this.escapeChar + val + this.escapeChar; | ||
} | ||
|
||
protected boolean supportColEscapeChar() { | ||
return true; | ||
} | ||
|
||
protected List<CMeta> getCols() { | ||
return this.tableMapper.getSourceCols(); | ||
} | ||
|
||
protected abstract CreateTableSqlBuilder.ColWrapper createColWrapper(CMeta c);//{ | ||
|
||
|
||
public static class CreateDDL { | ||
private final StringBuffer script; | ||
private final AbstractCreateTableSqlBuilder builder; | ||
|
||
public CreateDDL(StringBuffer script, AbstractCreateTableSqlBuilder builder) { | ||
this.script = script; | ||
this.builder = builder; | ||
} | ||
|
||
public StringBuffer getDDLScript() { | ||
return this.script; | ||
} | ||
|
||
public String getSelectAllScript() { | ||
return "SELECT " + builder.getCols().stream() | ||
.map((c) -> builder.wrapWithEscape(c.getName())) | ||
.collect(Collectors.joining(",")) | ||
+ " FROM " + (builder.getCreateTableName().getEntityName()); | ||
} | ||
} | ||
|
||
|
||
} |
Oops, something went wrong.