Project

General

Profile

« Previous | Next » 

Revision 7437

use RDBMS-specific features to limit the resultset for paging -- postgres and oracle have implementations. we don''t really support mssql so I skipped that one.

View differences:

PostgresqlAdapter.java
26 26

  
27 27
package edu.ucsb.nceas.dbadapter;
28 28

  
29
import java.sql.*;
30
import edu.ucsb.nceas.metacat.*;
29
import java.sql.Connection;
30
import java.sql.ResultSet;
31
import java.sql.SQLException;
32
import java.sql.Statement;
31 33

  
32 34
/**
33 35
 * The PostgreSQL db adapter implementation.
......
127 129
      String sql ="select a.docid, a.rev, a.doctype from ( xml_documents as a left outer join  xml_revisions as b on (a.docid=b.docid and  a.rev<=b.rev)) where b.docid is null ";
128 130
      return sql;
129 131
  }
132
  
133
  public String getPagedQuery(String queryWithOrderBy, Integer start, Integer count) {
134
	  String query = queryWithOrderBy;
135
	  if (count != null) {
136
		  query = query + " LIMIT " + count;
137
	  }
138
	  if (start != null) {
139
		  query = query + " OFFSET " + start;
140
	  }
141
	  return query;
142
  }
130 143
}
131 144
    

Also available in: Unified diff