Пример #1
0
 public void testIdentifierSubsequentCharactersRule() {
   String sql = "create table #testa(f8 float)";
   SqlTranslator translator =
       new SqlTranslator(sql, EDbVendor.dbvmssql, EDbVendor.dbvoracle, false);
   assertTrue(translator.getIdentifierCheckResults().length == 1);
   IdentifierCheckResult checkResult = translator.getIdentifierCheckResults()[0];
   assertTrue(checkResult.getCheckRuleResults().length == 2);
   IdentifierRuleResult result = checkResult.getCheckRuleResults()[1];
   assertTrue(result.getRule() == IdentifierRule.SubsequentCharacters);
   assertTrue(!result.canTranslate());
 }
Пример #2
0
 public void testIdentifierSizeRule() {
   String sql = "select a_very_very_long_and_not_valid_name from abc";
   SqlTranslator translator =
       new SqlTranslator(sql, EDbVendor.dbvmssql, EDbVendor.dbvoracle, false);
   assertTrue(translator.getIdentifierCheckResults().length == 1);
   IdentifierCheckResult checkResult = translator.getIdentifierCheckResults()[0];
   assertTrue(checkResult.getCheckRuleResults().length == 1);
   IdentifierRuleResult result = checkResult.getCheckRuleResults()[0];
   assertTrue(result.getRule() == IdentifierRule.Size);
   assertTrue(!result.canTranslate());
 }
Пример #3
0
 public void testQuotedIdentifierRule() {
   String sql = "create table [WHENEVER](f8 float)";
   SqlTranslator translator =
       new SqlTranslator(sql, EDbVendor.dbvmssql, EDbVendor.dbvoracle, false);
   assertTrue(translator.getIdentifierCheckResults().length == 1);
   IdentifierCheckResult checkResult = translator.getIdentifierCheckResults()[0];
   assertTrue(checkResult.getCheckRuleResults().length == 1);
   IdentifierRuleResult result = checkResult.getCheckRuleResults()[0];
   assertTrue(result.getRule() == IdentifierRule.QuotedIdentifier);
   assertTrue(result.canTranslate());
   checkResult.translate();
   assertTrue(result.getToken().toString().equalsIgnoreCase("\"WHENEVER\""));
 }