haul 02/05/17 07:30:54 Modified: src/java/org/apache/cocoon/components/language/markup/xsp EsqlQuery.java Log: improve multiple result case Revision Changes Path 1.16 +34 -12 xml-cocoon2/src/java/org/apache/cocoon/components/language/markup/xsp/EsqlQuery.java Index: EsqlQuery.java =================================================================== RCS file: /home/cvs/xml-cocoon2/src/java/org/apache/cocoon/components/language/markup/xsp/EsqlQuery.java,v retrieving revision 1.15 retrieving revision 1.16 diff -u -r1.15 -r1.16 --- EsqlQuery.java 16 May 2002 16:01:17 -0000 1.15 +++ EsqlQuery.java 17 May 2002 14:30:53 -0000 1.16 @@ -66,15 +66,19 @@ * * based on the orginal esql.xsl * @author <a href="mailto:[EMAIL PROTECTED]">Torsten Curdt</a> - * @version CVS $Id: EsqlQuery.java,v 1.15 2002/05/16 16:01:17 haul Exp $ + * @version CVS $Id: EsqlQuery.java,v 1.16 2002/05/17 14:30:53 haul Exp $ */ public class EsqlQuery { + private static final int UPDATE_COUNT_UNSET = -2; + private Connection connection = null; private Statement statement = null; private PreparedStatement preparedStatement = null; private ResultSet resultSet = null; private ResultSetMetaData resultSetMetaData = null; + private int updateCount = EsqlQuery.UPDATE_COUNT_UNSET; + private int resultCount = 1; private boolean hasResultSet = false; private boolean resultSetValid = false; private int position = -1; @@ -82,8 +86,8 @@ private int skipRows = 0; private boolean keepgoing = true; - private ArrayList groups = null; - private int groupLevel = -1; + private ArrayList groups = null; + private int groupLevel = -1; private String query; private int limitMethod; @@ -104,15 +108,15 @@ } - class EsqlGroup { - public String var = null; - public Object value = null; + class EsqlGroup { + public String var = null; + public Object value = null; - EsqlGroup ( String var, Object value ) { - this.var = var; - this.value = value; - } - } + EsqlGroup ( String var, Object value ) { + this.var = var; + this.value = value; + } + } public int getSkipRows() { return(skipRows); @@ -274,8 +278,26 @@ return(statement); } + public int getUpdateCount() throws SQLException { + if (this.updateCount == EsqlQuery.UPDATE_COUNT_UNSET) { + this.updateCount = this.statement.getUpdateCount(); + } + return this.updateCount; + } + + public int getResultCount() { + return this.resultCount; + } + public boolean getMoreResults() throws SQLException { - return (statement!=null? statement.getMoreResults() : false); + this.updateCount=EsqlQuery.UPDATE_COUNT_UNSET; + if (this.statement==null) + return false; + this.hasResultSet = this.statement.getMoreResults(); + this.updateCount=this.getUpdateCount(); + this.resultCount++; + this.resultSetValid=false; + return (this.hasResultSet || (this.updateCount>-1)); } public boolean execute() throws SQLException {
---------------------------------------------------------------------- In case of troubles, e-mail: [EMAIL PROTECTED] To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]