Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | |||
5 | 6 | 7 | 8 | 9 | 10 | 11 |
12 | 13 | 14 | 15 | 16 | 17 | 18 |
19 | 20 | 21 | 22 | 23 | 24 | 25 |
26 | 27 | 28 | 29 | 30 | 31 |
Tags
- react
- VSCode
- Git
- nodejs
- springboot
- MySQL
- tibero
- JPA
- BPMN
- log4j2
- useEffect
- jetbrains
- dbeaver
- Java
- docker
- database
- kubectl
- JavaScript
- Windows
- intellijIDEA
- gson
- Spring
- nginx
- NCP
- LOG4J
- gradle
- Kubernetes
- IntelliJ
- mybatis
- wildfly
Archives
- Today
- Total
두 손끝의 창조자
세미콜론으로 구분된 sql 들 분리하기 본문
private List<String> splitSql(String sqlChunk) {
StringBuilder sb = new StringBuilder();
List<String> sqlList = new ArrayList<>();
boolean openQuote = false;
for (int i = 0; i < sqlChunk.length(); i++) {
char c = sqlChunk.charAt(i);
if (c == '\'') {
openQuote = !openQuote;
}
if (c == ';' && !openQuote) {
sqlList.add(sb.toString().trim());
sb = new StringBuilder();
} else {
sb.append(c);
}
}
return sqlList;
}
반응형
Comments