Skip to content

Commit

Permalink
fix forward
Browse files Browse the repository at this point in the history
  • Loading branch information
eldenmoon committed Oct 16, 2024
1 parent cbf75a9 commit 3b0e042
Showing 1 changed file with 11 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1292,15 +1292,17 @@ class Suite implements GroovyInterceptable {

String getServerPrepareJdbcUrl(String jdbcUrl, String database) {
String urlWithoutSchema = jdbcUrl.substring(jdbcUrl.indexOf("://") + 3)
def sql_ip = urlWithoutSchema.substring(0, urlWithoutSchema.indexOf(":"))
def sql_port
if (urlWithoutSchema.indexOf("/") >= 0) {
// e.g: jdbc:mysql://locahost:8080/?a=b
sql_port = urlWithoutSchema.substring(urlWithoutSchema.indexOf(":") + 1, urlWithoutSchema.indexOf("/"))
} else {
// e.g: jdbc:mysql://locahost:8080
sql_port = urlWithoutSchema.substring(urlWithoutSchema.indexOf(":") + 1)
}
def masterFe = cluster.getMasterFe()
// def sql_ip = urlWithoutSchema.substring(0, urlWithoutSchema.indexOf(":"))
def sql_ip = masterFe.host
def sql_port = masterFe.queryPort
// if (urlWithoutSchema.indexOf("/") >= 0) {
// // e.g: jdbc:mysql://locahost:8080/?a=b
// sql_port = urlWithoutSchema.substring(urlWithoutSchema.indexOf(":") + 1, urlWithoutSchema.indexOf("/"))
// } else {
// // e.g: jdbc:mysql://locahost:8080
// sql_port = urlWithoutSchema.substring(urlWithoutSchema.indexOf(":") + 1)
// }
// set server side prepared statement url
return "jdbc:mysql://" + sql_ip + ":" + sql_port + "/" + database + "?&useServerPrepStmts=true"
}
Expand Down

0 comments on commit 3b0e042

Please sign in to comment.