Java Code Examples for org.apache.ibatis.session.Configuration#getVariables()

The following examples show how to use org.apache.ibatis.session.Configuration#getVariables() . 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: XMLMapperBuilder.java    From Shop-for-JavaWeb with MIT License 5 votes vote down vote up
@Deprecated
public XMLMapperBuilder(Reader reader, Configuration configuration,
		String resource, Map<String, XNode> sqlFragments) {
	this(new XPathParser(reader, true, configuration.getVariables(),
			new XMLMapperEntityResolver()), configuration, resource,
			sqlFragments);
}
 
Example 4
Source File: XMLMapperBuilder.java    From Shop-for-JavaWeb with MIT License 5 votes vote down vote up
public XMLMapperBuilder(InputStream inputStream,
		Configuration configuration, String resource,
		Map<String, XNode> sqlFragments) {
	this(new XPathParser(inputStream, true, configuration.getVariables(),
			new XMLMapperEntityResolver()), configuration, resource,
			sqlFragments);
}
 
Example 5
Source File: XMLMapperBuilder.java    From mybaties with Apache License 2.0 4 votes vote down vote up
@Deprecated
public XMLMapperBuilder(Reader reader, Configuration configuration, String resource, Map<String, XNode> sqlFragments) {
  this(new XPathParser(reader, true, configuration.getVariables(), new XMLMapperEntityResolver()),
      configuration, resource, sqlFragments);
}
 
Example 6
Source File: XMLMapperBuilder.java    From mybaties with Apache License 2.0 4 votes vote down vote up
public XMLMapperBuilder(InputStream inputStream, Configuration configuration, String resource, Map<String, XNode> sqlFragments) {
  this(new XPathParser(inputStream, true, configuration.getVariables(), new XMLMapperEntityResolver()),
      configuration, resource, sqlFragments);
}
 
Example 7
Source File: XMLMapperBuilder.java    From mybatis with Apache License 2.0 4 votes vote down vote up
@Deprecated
public XMLMapperBuilder(Reader reader, Configuration configuration, String resource, Map<String, XNode> sqlFragments) {
  this(new XPathParser(reader, true, configuration.getVariables(), new XMLMapperEntityResolver()),
      configuration, resource, sqlFragments);
}
 
Example 8
Source File: XMLMapperBuilder.java    From mybatis with Apache License 2.0 4 votes vote down vote up
public XMLMapperBuilder(InputStream inputStream, Configuration configuration, String resource, Map<String, XNode> sqlFragments) {
  this(new XPathParser(inputStream, true, configuration.getVariables(), new XMLMapperEntityResolver()),
      configuration, resource, sqlFragments);
}