提交 686312f2 编写于 作者: S serge-rider

#525 Create procedure/function DDL fix.

上级 556f83c7
......@@ -36,6 +36,8 @@ import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.Collection;
import java.util.Locale;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/**
* GenericProcedure
......@@ -121,6 +123,7 @@ public class MySQLProcedure extends AbstractProcedure<MySQLDataSource, MySQLCata
try (JDBCResultSet dbResult = dbStat.executeQuery()) {
if (dbResult.next()) {
clientBody = JDBCUtils.safeGetString(dbResult, (getProcedureType() == DBSProcedureType.PROCEDURE ? "Create Procedure" : "Create Function"));
clientBody = normalizeCreateStatement(clientBody);
} else {
clientBody = "";
}
......@@ -168,6 +171,17 @@ public class MySQLProcedure extends AbstractProcedure<MySQLDataSource, MySQLCata
return clientBody;
}
private String normalizeCreateStatement(String createDDL) {
String procType = getProcedureType().name();
int divPos = createDDL.indexOf(procType + " `");
if (divPos != -1) {
return createDDL.substring(0, divPos) + procType +
" `" + getContainer().getName() + "`." +
createDDL.substring(divPos + procType.length() + 1);
}
return createDDL;
}
@Property(editable = true, updatable = true, order = 3)
public boolean isDeterministic()
{
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册