Author: cbegin Date: Mon Sep 1 22:16:38 2008 New Revision: 691109 URL: http://svn.apache.org/viewvc?rev=691109&view=rev Log: added more statement nodelets
Modified: ibatis/trunk/java/ibatis-3/ibatis-3-monarch/src/main/java/org/apache/ibatis/monarch/builder/MapperParser.java Modified: ibatis/trunk/java/ibatis-3/ibatis-3-monarch/src/main/java/org/apache/ibatis/monarch/builder/MapperParser.java URL: http://svn.apache.org/viewvc/ibatis/trunk/java/ibatis-3/ibatis-3-monarch/src/main/java/org/apache/ibatis/monarch/builder/MapperParser.java?rev=691109&r1=691108&r2=691109&view=diff ============================================================================== --- ibatis/trunk/java/ibatis-3/ibatis-3-monarch/src/main/java/org/apache/ibatis/monarch/builder/MapperParser.java (original) +++ ibatis/trunk/java/ibatis-3/ibatis-3-monarch/src/main/java/org/apache/ibatis/monarch/builder/MapperParser.java Mon Sep 1 22:16:38 2008 @@ -160,10 +160,43 @@ configuration.addResultMap(resultMapBuilder.build()); } - // <select id="selectAllPeople" cacheType="" cacheDomain="" - // flushCache="" parameterType="" resultType="" resultMap=""> + // <select ...> @Nodelet("/mapper/select") public void selectElement(NodeletContext context) throws Exception { + buildStatement(context, StatementType.PREPARED); + } + + // <insert ...> + @Nodelet("/mapper/insert") + public void insertElement(NodeletContext context) throws Exception { + buildStatement(context, StatementType.PREPARED); + } + + // <update ...> + @Nodelet("/mapper/update") + public void updateElement(NodeletContext context) throws Exception { + buildStatement(context, StatementType.PREPARED); + } + + // <delete ...> + @Nodelet("/mapper/delete") + public void deleteElement(NodeletContext context) throws Exception { + buildStatement(context, StatementType.PREPARED); + } + + // <procedure ...> + @Nodelet("/mapper/procedure") + public void procedureElement(NodeletContext context) throws Exception { + buildStatement(context,StatementType.CALLABLE); + } + + // <procedure ...> + @Nodelet("/mapper/statement") + public void statementElement(NodeletContext context) throws Exception { + buildStatement(context,StatementType.STATEMENT); + } + + private void buildStatement(NodeletContext context, StatementType statementType) { String id = context.getStringAttribute("id"); String sql = context.getStringBody(); SqlSource sqlSource = new BasicSqlSource(sql); @@ -171,12 +204,15 @@ MappedStatement.Builder statementBuilder = new MappedStatement.Builder(configuration, id, sqlSource); Integer fetchSize = context.getIntAttribute("fetchSize", null); statementBuilder.fetchSize(fetchSize); - statementBuilder.statementType(StatementType.PREPARED); + statementBuilder.statementType(statementType); setStatementTimeout(context, statementBuilder); setStatementParameterMap(context, statementBuilder); setStatementResultMap(context, statementBuilder); setStatementCache(context, statementBuilder); + + MappedStatement statement = statementBuilder.build(); + configuration.addMappedStatement(statement); } private void setStatementCache(NodeletContext context, MappedStatement.Builder statementBuilder) {