mirror of
https://github.com/alibaba/DataX.git
synced 2025-05-03 03:59:07 +08:00
修复了由于SQL中的保留字作为表名或者字段名而引起的sql错误
This commit is contained in:
parent
4e916b0f4b
commit
738c11e0e3
@ -37,20 +37,17 @@ public class OceanBaseReader extends Reader {
|
|||||||
if (userConfigedFetchSize != null) {
|
if (userConfigedFetchSize != null) {
|
||||||
LOG.warn("The [fetchSize] is not recognized, please use readBatchSize instead.");
|
LOG.warn("The [fetchSize] is not recognized, please use readBatchSize instead.");
|
||||||
}
|
}
|
||||||
|
|
||||||
this.originalConfig.set(Constant.FETCH_SIZE, Integer.MIN_VALUE);
|
this.originalConfig.set(Constant.FETCH_SIZE, Integer.MIN_VALUE);
|
||||||
|
|
||||||
setDatabaseType(originalConfig);
|
setDatabaseType(originalConfig);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
this.readerJob = new ReaderJob();
|
this.readerJob = new ReaderJob();
|
||||||
this.readerJob.init(this.originalConfig,DATABASE_TYPE);
|
this.readerJob.init(this.originalConfig, DATABASE_TYPE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void prepare(){
|
public void prepare() {
|
||||||
//ObReaderUtils.DATABASE_TYPE获取当前数据库的语法模式
|
//ObReaderUtils.DATABASE_TYPE获取当前数据库的语法模式
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void preCheck() {
|
public void preCheck() {
|
||||||
init();
|
init();
|
||||||
@ -80,7 +77,7 @@ public class OceanBaseReader extends Reader {
|
|||||||
Configuration connConf = Configuration.from(conns.get(0).toString());
|
Configuration connConf = Configuration.from(conns.get(0).toString());
|
||||||
List<String> jdbcUrls = connConf.getList(Key.JDBC_URL, String.class);
|
List<String> jdbcUrls = connConf.getList(Key.JDBC_URL, String.class);
|
||||||
String jdbcUrl = jdbcUrls.get(0);
|
String jdbcUrl = jdbcUrls.get(0);
|
||||||
if(jdbcUrl.startsWith(com.alibaba.datax.plugin.rdbms.writer.Constant.OB10_SPLIT_STRING)) {
|
if (jdbcUrl.startsWith(com.alibaba.datax.plugin.rdbms.writer.Constant.OB10_SPLIT_STRING)) {
|
||||||
String[] ss = jdbcUrl.split(com.alibaba.datax.plugin.rdbms.writer.Constant.OB10_SPLIT_STRING_PATTERN);
|
String[] ss = jdbcUrl.split(com.alibaba.datax.plugin.rdbms.writer.Constant.OB10_SPLIT_STRING_PATTERN);
|
||||||
if (ss.length != 3) {
|
if (ss.length != 3) {
|
||||||
LOG.warn("unrecognized jdbc url: " + jdbcUrl);
|
LOG.warn("unrecognized jdbc url: " + jdbcUrl);
|
||||||
@ -97,11 +94,11 @@ public class OceanBaseReader extends Reader {
|
|||||||
if (ObReaderUtils.isOracleMode(compatibleMode)) {
|
if (ObReaderUtils.isOracleMode(compatibleMode)) {
|
||||||
ObReaderUtils.DATABASE_TYPE = DataBaseType.OceanBase;
|
ObReaderUtils.DATABASE_TYPE = DataBaseType.OceanBase;
|
||||||
}
|
}
|
||||||
} catch (Exception e){
|
|
||||||
|
} catch (Exception e) {
|
||||||
LOG.warn("error in get compatible mode, using mysql as default: " + e.getMessage());
|
LOG.warn("error in get compatible mode, using mysql as default: " + e.getMessage());
|
||||||
}
|
} finally {
|
||||||
finally {
|
DATABASE_TYPE = ObReaderUtils.DATABASE_TYPE;
|
||||||
DATABASE_TYPE=ObReaderUtils.DATABASE_TYPE;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue
Block a user