|
@@ -90,8 +90,10 @@ public abstract class AbstractFileWork { |
|
|
int deleteSize = 0; |
|
|
int deleteSize = 0; |
|
|
int createSize = 0; |
|
|
int createSize = 0; |
|
|
int alterSize = 0; |
|
|
int alterSize = 0; |
|
|
|
|
|
int dropSize = 0; |
|
|
for (CanalVO canal : list) { |
|
|
for (CanalVO canal : list) { |
|
|
if (canal.createIs()) { |
|
|
if (canal.createIs()) { |
|
|
|
|
|
doDropSql(canal); |
|
|
doCreateSql(canal); |
|
|
doCreateSql(canal); |
|
|
createSize++; |
|
|
createSize++; |
|
|
continue; |
|
|
continue; |
|
@@ -101,6 +103,11 @@ public abstract class AbstractFileWork { |
|
|
alterSize++; |
|
|
alterSize++; |
|
|
continue; |
|
|
continue; |
|
|
} |
|
|
} |
|
|
|
|
|
if (canal.dropIs()) { |
|
|
|
|
|
doDropSql(canal); |
|
|
|
|
|
dropSize++; |
|
|
|
|
|
continue; |
|
|
|
|
|
} |
|
|
if (canal.insertIs()) { |
|
|
if (canal.insertIs()) { |
|
|
doInsertSql(canal); |
|
|
doInsertSql(canal); |
|
|
insertSize++; |
|
|
insertSize++; |
|
@@ -116,7 +123,7 @@ public abstract class AbstractFileWork { |
|
|
deleteSize++; |
|
|
deleteSize++; |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
log.debug("[解析canal文件]:::file:" + file.getName() + " insert size:[" + insertSize + "] update size:[" + updateSize + "] delete size:[" + deleteSize + "] create size:[" + createSize + "] alter size:[" + alterSize + "]"); |
|
|
|
|
|
|
|
|
log.debug("[解析canal文件]:::file:" + file.getName() + " insert size:[" + insertSize + "] update size:[" + updateSize + "] delete size:[" + deleteSize + "] create size:[" + createSize + "] alter size:[" + alterSize + "]" + "drop size:[" + dropSize + "]"); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
protected abstract String getDbType(); |
|
|
protected abstract String getDbType(); |
|
@@ -125,6 +132,19 @@ public abstract class AbstractFileWork { |
|
|
|
|
|
|
|
|
protected abstract void doAlterSql(CanalVO canalVO); |
|
|
protected abstract void doAlterSql(CanalVO canalVO); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
protected void doDropSql(CanalVO canalVO) { |
|
|
|
|
|
String sql = ""; |
|
|
|
|
|
if (!StringUtil.isEmpty(getSchemaName(canalVO))) { |
|
|
|
|
|
sql = "drop table if exists " + getSchemaName(canalVO) + "." + canalVO.getTableName(); |
|
|
|
|
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
sql = "drop table if exists " + canalVO.getTableName(); |
|
|
|
|
|
} |
|
|
|
|
|
log.debug("sql:::" + sql); |
|
|
|
|
|
getDbEngine().update(sql); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
protected String getSchemaName(CanalVO canalVO) { |
|
|
protected String getSchemaName(CanalVO canalVO) { |
|
|
return ""; |
|
|
return ""; |
|
|
} |
|
|
} |
|
|