1 16 17 package org.apache.cocoon.components.language.markup.xsp; 18 19 import java.sql.ResultSet ; 20 import java.sql.SQLException ; 21 import java.sql.Connection ; 22 23 27 final public class OracleEsqlQuery extends AbstractEsqlQuery { 28 29 public OracleEsqlQuery(Connection connection, String query) { 30 super(connection, query); 31 } 32 33 37 private OracleEsqlQuery(ResultSet resultSet) { 38 super(resultSet); 39 } 40 41 45 public AbstractEsqlQuery newInstance(final ResultSet resultSet) { 46 return(new OracleEsqlQuery(resultSet)); 47 } 48 49 public String getQueryString() throws SQLException { 50 if (getSkipRows() > 0) { 51 if (getMaxRows() > -1) { 52 return (new StringBuffer ("select * from (select a.*, rownum rnum from (") 53 .append(super.getQueryString()) 54 .append(") a where rownum <= ") 55 .append(getSkipRows() + getMaxRows() + 1) 56 .append(") where rnum > ") 57 .append(getSkipRows()) 58 .toString()); 59 } 60 else { 61 return (new StringBuffer ("select * from (select a.*, rownum rnum from (") 62 .append(super.getQueryString()) 63 .append(") a ") 64 .append(") where rnum > ") 65 .append(getSkipRows()) 66 .toString()); 67 } 68 } 69 else { 70 if (getMaxRows() > -1) { 71 return (new StringBuffer ("select * from (select a.*, rownum from (") 72 .append(super.getQueryString()) 73 .append(") a where rownum <= ") 74 .append(getMaxRows() + 1) 75 .append(")").toString()); 76 } 77 else { 78 return (super.getQueryString()); 79 } 80 } 81 } 82 83 public void getResultRows() throws SQLException { 84 setPosition(getSkipRows()); 85 } 86 87 } 88 | Popular Tags |