|
|
@@ -90,8 +90,10 @@ public abstract class AbstractFileWork { |
|
|
|
int deleteSize = 0; |
|
|
|
int createSize = 0; |
|
|
|
int alterSize = 0; |
|
|
|
int dropSize = 0; |
|
|
|
for (CanalVO canal : list) { |
|
|
|
if (canal.createIs()) { |
|
|
|
doDropSql(canal); |
|
|
|
doCreateSql(canal); |
|
|
|
createSize++; |
|
|
|
continue; |
|
|
@@ -101,6 +103,11 @@ public abstract class AbstractFileWork { |
|
|
|
alterSize++; |
|
|
|
continue; |
|
|
|
} |
|
|
|
if (canal.dropIs()) { |
|
|
|
doDropSql(canal); |
|
|
|
dropSize++; |
|
|
|
continue; |
|
|
|
} |
|
|
|
if (canal.insertIs()) { |
|
|
|
doInsertSql(canal); |
|
|
|
insertSize++; |
|
|
@@ -116,7 +123,7 @@ public abstract class AbstractFileWork { |
|
|
|
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(); |
|
|
@@ -125,6 +132,19 @@ public abstract class AbstractFileWork { |
|
|
|
|
|
|
|
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) { |
|
|
|
return ""; |
|
|
|
} |
|
|
|