本文整理匯總了Java中com.mysql.jdbc.StringUtils.sanitizeProcOrFuncName方法的典型用法代碼示例。如果您正苦於以下問題:Java StringUtils.sanitizeProcOrFuncName方法的具體用法?Java StringUtils.sanitizeProcOrFuncName怎麽用?Java StringUtils.sanitizeProcOrFuncName使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.mysql.jdbc.StringUtils
的用法示例。
在下文中一共展示了StringUtils.sanitizeProcOrFuncName方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: testSplit
import com.mysql.jdbc.StringUtils; //導入方法依賴的package包/類
/**
* Tests sanitation and SplitDBdotName
*
* @throws Exception
* if an error occurs
*/
public void testSplit() throws Exception {
String src = null;
String resString = null;
List<String> results = new ArrayList<String>();
//Test 1.1, weird DB.SP name
src = "`MyDatabase 1.0.1.0`.`Proc 1.v1`";
resString = StringUtils.sanitizeProcOrFuncName(src);
if ((resString != null)) {
results = StringUtils.splitDBdotName(resString, null, "`", true);
assertEquals(results.get(0), "MyDatabase 1.0.1.0");
assertEquals(results.get(1), "Proc 1.v1");
} else {
fail("Test 1.1 returned null resString");
}
//Test 1.2, toggle isNoBslashEscSet
src = "`MyDatabase 1.0.1.0`.`Proc 1.v1`";
resString = StringUtils.sanitizeProcOrFuncName(src);
if ((resString != null)) {
results = StringUtils.splitDBdotName(resString, null, "`", false);
assertEquals(results.get(0), "MyDatabase 1.0.1.0");
assertEquals(results.get(1), "Proc 1.v1");
} else {
fail("Test 1.2 returned null resString");
}
//Test 2.1, weird SP name, no DB parameter
src = "`Proc 1.v1`";
resString = StringUtils.sanitizeProcOrFuncName(src);
if ((resString != null)) {
results = StringUtils.splitDBdotName(resString, null, "`", true);
assertEquals(results.get(0), null);
assertEquals(results.get(1), "Proc 1.v1");
} else {
fail("Test 2.1 returned null resString");
}
//Test 2.2, toggle isNoBslashEscSet
src = "`Proc 1.v1`";
resString = StringUtils.sanitizeProcOrFuncName(src);
if ((resString != null)) {
results = StringUtils.splitDBdotName(resString, null, "`", false);
assertEquals(results.get(0), null);
assertEquals(results.get(1), "Proc 1.v1");
} else {
fail("Test 2.2 returned null resString");
}
}