Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
D
dinky
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
wangpeng
dinky
Commits
ed1e6951
Unverified
Commit
ed1e6951
authored
Jan 25, 2024
by
Licho
Committed by
GitHub
Jan 25, 2024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: double slop (#3063)
Signed-off-by:
Lichao
<
lecho.sun@gmail.com
>
Co-authored-by:
leechor
<
leechor@users.noreply.github.com
>
parent
65b71948
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
14 additions
and
5 deletions
+14
-5
vcs.xml
.idea/vcs.xml
+5
-3
SqlUtilTest.java
dinky-admin/src/test/java/org/dinky/utils/SqlUtilTest.java
+8
-1
SqlUtil.java
dinky-common/src/main/java/org/dinky/utils/SqlUtil.java
+1
-1
No files found.
.idea/vcs.xml
View file @
ed1e6951
<?xml version="1.0" encoding="UTF-8"?>
<?xml version="1.0" encoding="UTF-8"?>
<project
version=
"4"
>
<project
version=
"4"
>
<component
name=
"VcsDirectoryMappings"
>
<mapping
directory=
""
vcs=
"Git"
/>
</component>
<component
name=
"IssueNavigationConfiguration"
>
<component
name=
"IssueNavigationConfiguration"
>
<option
name=
"links"
>
<option
name=
"links"
>
<list>
<list>
...
@@ -13,4 +10,8 @@
...
@@ -13,4 +10,8 @@
</list>
</list>
</option>
</option>
</component>
</component>
<component
name=
"VcsDirectoryMappings"
>
<mapping
directory=
""
vcs=
"Git"
/>
<mapping
directory=
"$PROJECT_DIR$"
vcs=
"Git"
/>
</component>
</project>
</project>
\ No newline at end of file
dinky-admin/src/test/java/org/dinky/utils/SqlUtilTest.java
View file @
ed1e6951
...
@@ -47,7 +47,14 @@ public class SqlUtilTest {
...
@@ -47,7 +47,14 @@ public class SqlUtilTest {
String
removedNoteSql
=
SqlUtil
.
removeNote
(
testSql
);
String
removedNoteSql
=
SqlUtil
.
removeNote
(
testSql
);
Assertions
.
assertThat
(
removedNoteSql
).
isNotNull
();
Assertions
.
assertThat
(
removedNoteSql
).
isNotNull
();
Assertions
.
assertThat
(
removedNoteSql
).
isNotEqualTo
(
testSql
);
Assertions
.
assertThat
(
removedNoteSql
)
.
isEqualTo
(
"//test2\n"
+
"\n"
+
"\n"
+
"select 1 \n"
+
" from test # test9\n"
+
" where '1' <> '-- ::.' //test6\n"
+
" and 1=1 \n"
+
" and 'zz' <> null;"
);
}
}
@Test
@Test
...
...
dinky-common/src/main/java/org/dinky/utils/SqlUtil.java
View file @
ed1e6951
...
@@ -60,7 +60,7 @@ public class SqlUtil {
...
@@ -60,7 +60,7 @@ public class SqlUtil {
// Remove the special-space characters
// Remove the special-space characters
sql
=
sql
.
replaceAll
(
"\u00A0"
,
" "
).
replaceAll
(
"[\r\n]+"
,
"\n"
);
sql
=
sql
.
replaceAll
(
"\u00A0"
,
" "
).
replaceAll
(
"[\r\n]+"
,
"\n"
);
// Remove annotations Support '--aa' , '/**aaa*/' , '//aa' , '#aaa'
// Remove annotations Support '--aa' , '/**aaa*/' , '//aa' , '#aaa'
Pattern
p
=
Pattern
.
compile
(
"(?ms)('(?:''|[^'])*')|--.*?$|/
/.*?$|/\\*[^+].*?\\*/|#.*?$
|"
);
Pattern
p
=
Pattern
.
compile
(
"(?ms)('(?:''|[^'])*')|--.*?$|/
\\*[^+].*?\\*/
|"
);
String
presult
=
p
.
matcher
(
sql
).
replaceAll
(
"$1"
);
String
presult
=
p
.
matcher
(
sql
).
replaceAll
(
"$1"
);
return
presult
.
trim
();
return
presult
.
trim
();
}
}
...
...
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