Commit 27addb78 authored by liaowenwu's avatar liaowenwu

修改bug

parent 49e012e1
...@@ -109,6 +109,7 @@ public class AsyncMysqlDataTransferFunctionNew extends RichAsyncFunction<JSONObj ...@@ -109,6 +109,7 @@ public class AsyncMysqlDataTransferFunctionNew extends RichAsyncFunction<JSONObj
resultList.add(Tuple3.of(excueteSql,groupKey,ts)); resultList.add(Tuple3.of(excueteSql,groupKey,ts));
Boolean logEnable = MapUtil.getBool(dbInfoMap, "log_enable", false); Boolean logEnable = MapUtil.getBool(dbInfoMap, "log_enable", false);
if (logEnable){ if (logEnable){
//logger.error("-----datajson:{}----",value.toJSONString());
String logSql = buildLogData(type, table, pkNameSet, dataObj, ts, value.toJSONString()); String logSql = buildLogData(type, table, pkNameSet, dataObj, ts, value.toJSONString());
resultList.add(Tuple3.of(logSql,"dsc_cdc_log",ts)); resultList.add(Tuple3.of(logSql,"dsc_cdc_log",ts));
} }
...@@ -130,8 +131,8 @@ public class AsyncMysqlDataTransferFunctionNew extends RichAsyncFunction<JSONObj ...@@ -130,8 +131,8 @@ public class AsyncMysqlDataTransferFunctionNew extends RichAsyncFunction<JSONObj
} }
String pkColumns = String.join(",",pkNameSet); String pkColumns = String.join(",",pkNameSet);
String pkValues = String.join("-",pkValueList); String pkValues = String.join("-",pkValueList);
dataJsonStr = dataJsonStr.replace("\\","\\\\");
return String.format(logSqlFormat, table, type, pkColumns, pkValues, dataJsonStr, ts); return String.format(logSqlFormat, table, type, pkColumns, pkValues, dataJsonStr, ts);
} }
...@@ -218,55 +219,4 @@ public class AsyncMysqlDataTransferFunctionNew extends RichAsyncFunction<JSONObj ...@@ -218,55 +219,4 @@ public class AsyncMysqlDataTransferFunctionNew extends RichAsyncFunction<JSONObj
return dataObj.getString(columnKey); return dataObj.getString(columnKey);
} }
public static void main(String[] args) {
JSONObject jsonObject = new JSONObject();
jsonObject.put("id",1);
jsonObject.put("name","Nana");
jsonObject.put("age",26);
jsonObject.put("salary",20000);
jsonObject.put("date1","2023-10-01");
jsonObject.put("date2","2023-10-02 11:11:00");
JSONObject mysqlType = new JSONObject();
mysqlType.put("id","int");
mysqlType.put("name","varchar");
mysqlType.put("age","bigint");
mysqlType.put("salary","double");
mysqlType.put("date1","date");
mysqlType.put("date2","datetime");
mysqlType.put("relation",null);
String table = "test";
String s= "ff8940af-c080-40cc-9d83-8c7dc8b86ed4";
System.out.println(s.length());
String s1 = "hello string sss";
String s2 = "'kaskljsl'";
System.out.println(StrUtil.subBefore(s1,"string",true));
System.out.println(tranferInsertSql(table,jsonObject,mysqlType));
System.out.println(s2.replaceAll("'","\\\\'"));
String[] ss = new String[]{"1","2","3" };
StringBuilder sb = new StringBuilder();
for (String s3 : ss)
{
sb.append("`"+s3+"?").append(",");
}
for (String s3 : ss) {
System.out.println(s3);
}
sb.setLength(sb.length()-1);
System.out.println(sb.toString());
String s5 = "交货地址:安徽霍邱供应站及指定地点\\\",\\\"bjsm\\\":null,\\\"jhType\\\":null,\\";
System.out.println(s5);
System.out.println(s5.replace("\\","\\\\").replace("'", "\\'"));
}
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment