com.alibaba.druid.support.opds.udf.MetaSqlExtract Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of druid Show documentation
Show all versions of druid Show documentation
An JDBC datasource implementation.
package com.alibaba.druid.support.opds.udf;
import com.aliyun.odps.udf.UDF;
import org.apache.commons.lang.StringEscapeUtils;
public class MetaSqlExtract extends UDF {
public String evaluate(String xml) {
if (xml == null || xml.length() == 0) {
return null;
}
int p0 = xml.indexOf("");
if (p0 == -1) {
return null;
}
p0 += "".length();
int p1 = xml.indexOf(" ", p0);
if (p1 == -1) {
return null;
}
String sql = xml.substring(p0, p1);
int p2 = xml.indexOf(" "