org.apache.ibatis.scripting.defaults.RawSqlSource Java Examples

The following examples show how to use org.apache.ibatis.scripting.defaults.RawSqlSource. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: XMLLanguageDriver.java    From mybaties with Apache License 2.0 6 votes vote down vote up
@Override
public SqlSource createSqlSource(Configuration configuration, String script, Class<?> parameterType) {
  // issue #3
  if (script.startsWith("<script>")) {
    XPathParser parser = new XPathParser(script, false, configuration.getVariables(), new XMLMapperEntityResolver());
    return createSqlSource(configuration, parser.evalNode("/script"), parameterType);
  } else {
    // issue #127
    script = PropertyParser.parse(script, configuration.getVariables());
    TextSqlNode textSqlNode = new TextSqlNode(script);
    //一种是动态,一种是原始
    if (textSqlNode.isDynamic()) {
      return new DynamicSqlSource(configuration, textSqlNode);
    } else {
      return new RawSqlSource(configuration, script, parameterType);
    }
  }
}
 
Example #2
Source File: XMLLanguageDriver.java    From mybatis with Apache License 2.0 6 votes vote down vote up
@Override
public SqlSource createSqlSource(Configuration configuration, String script, Class<?> parameterType) {
  // issue #3
  if (script.startsWith("<script>")) {
    XPathParser parser = new XPathParser(script, false, configuration.getVariables(), new XMLMapperEntityResolver());
    return createSqlSource(configuration, parser.evalNode("/script"), parameterType);
  } else {
    // issue #127
    script = PropertyParser.parse(script, configuration.getVariables());
    TextSqlNode textSqlNode = new TextSqlNode(script);
    //一种是动态,一种是原始
    if (textSqlNode.isDynamic()) {
      return new DynamicSqlSource(configuration, textSqlNode);
    } else {
      return new RawSqlSource(configuration, script, parameterType);
    }
  }
}
 
Example #3
Source File: RawSqlSourceTest.java    From mybaties with Apache License 2.0 4 votes vote down vote up
@Test
public void shouldUseRawSqlSourceForAnStaticStatement() {
  test("getUser1", RawSqlSource.class);
}
 
Example #4
Source File: RawSqlSourceTest.java    From mybatis with Apache License 2.0 4 votes vote down vote up
@Test
public void shouldUseRawSqlSourceForAnStaticStatement() {
  test("getUser1", RawSqlSource.class);
}