code: private boolean query()
  		throws SQLException
  	{
  		String query = "SELECT PrimaryKey, Revision, RevisionCounter,"
  				+ " RevisionID, ArticleID, Timestamp, FullRevisionID, ContributorName, ContributorId, Comment, Minor, ContributorIsRegistered "
  				+ "FROM revisions";
  
  		if (primaryKey > 0) {
  			query += " WHERE PrimaryKey > " + primaryKey;
  		}
  
  		if (MAX_NUMBER_RESULTS > 0) {
  			query += " LIMIT ";
  
  			if (primaryKey + MAX_NUMBER_RESULTS > endPK) {
  				query += (endPK - primaryKey + 1); // TODO: +1 ?
  			}
  			else {
  				query += MAX_NUMBER_RESULTS;
  			}
  
  		}
  		else if (endPK != Integer.MAX_VALUE) {
  			query += " LIMIT " + (endPK - primaryKey + 1);
  		}
  
  		try{
  			statement=this.connection.prepareStatement(query);
  			result = statement.executeQuery();
  		}catch(Exception e){
  			logger.error(e.getLocalizedMessage(), e);
  			try {
  				boolean connectionReady = !connection.isClosed() && connection.isValid(5);
  				logger.debug("Connection ready: {}", connectionReady);
  				if(!connectionReady) {
  					connection = getConnection(config);
  				}
  				statement = this.connection.prepareStatement(query);
  				result = statement.executeQuery(query);
  			} catch (WikiApiException wae) {
  				logger.error(wae.getLocalizedMessage(), wae);
  			}
  		}
  
  
  		if (result.next()) {
  			binaryData = result.getMetaData().getColumnType(2) == Types.LONGVARBINARY;
  			return true;
  		}
  
  		return false;
  	}
docs: Sends the query to the database and stores the result. The {@link java.sql.Statement} and
  {@link ResultSet} connection will not be closed.
  
  @return {@code true}, if the result set has another element {@code false}, otherwise
  
  @throws SQLException
  if an error occurs while accessing the database.