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