Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
D
dsk-dsc-flink
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
shezaixing
dsk-dsc-flink
Commits
27addb78
Commit
27addb78
authored
Dec 05, 2024
by
liaowenwu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改bug
parent
49e012e1
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
52 deletions
+2
-52
AsyncMysqlDataTransferFunctionNew.java
...sc/common/function/AsyncMysqlDataTransferFunctionNew.java
+2
-52
No files found.
src/main/java/com/dsk/flink/dsc/common/function/AsyncMysqlDataTransferFunctionNew.java
View file @
27addb78
...
@@ -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
(
"'"
,
"\\'"
));
}
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment