@Test public void testFormSelectWithoutTableName() { final String fullQuery = "SELECT name FROM people"; a(dialect.formSelect(null, new String[]{"name"}, fullQuery, new ArrayList<String>(), -1, -1)).shouldBeEqual(fullQuery); }
@Override public String formSelect(String tableName, String[] columns, String subQuery, List<String> orderBys, long limit, long offset) { boolean needLimit = limit != -1L; boolean needOffset = offset != -1L; StringBuilder fullQuery = new StringBuilder(); if (needOffset) { fullQuery.append("SELECT * FROM (SELECT t2.*, ROWNUM AS oracle_row_number FROM ("); } else if (needLimit) { fullQuery.append("SELECT * FROM (SELECT t2.* FROM ("); } appendSelect(fullQuery, tableName, columns, null, subQuery, orderBys); if (needOffset) { fullQuery.append(") t2) WHERE oracle_row_number >= ").append(offset + 1); if (needLimit) { fullQuery.append(" AND ROWNUM <= ").append(limit); } } else if (needLimit) { fullQuery.append(") t2) WHERE ROWNUM <= ").append(limit); } return fullQuery.toString(); }
OracleDialect extends DefaultDialect { @Override public String formSelect(String tableName, String[] columns, String subQuery, List<String> orderBys, long limit, long offset) { boolean needLimit = limit != -1L; boolean needOffset = offset != -1L; StringBuilder fullQuery = new StringBuilder(); if (needOffset) { fullQuery.append("SELECT * FROM (SELECT t2.*, ROWNUM AS oracle_row_number FROM ("); } else if (needLimit) { fullQuery.append("SELECT * FROM (SELECT t2.* FROM ("); } appendSelect(fullQuery, tableName, columns, null, subQuery, orderBys); if (needOffset) { fullQuery.append(") t2) WHERE oracle_row_number >= ").append(offset + 1); if (needLimit) { fullQuery.append(" AND ROWNUM <= ").append(limit); } } else if (needLimit) { fullQuery.append(") t2) WHERE ROWNUM <= ").append(limit); } return fullQuery.toString(); } }
OracleDialect extends DefaultDialect { @Override public String formSelect(String tableName, String[] columns, String subQuery, List<String> orderBys, long limit, long offset) { boolean needLimit = limit != -1L; boolean needOffset = offset != -1L; StringBuilder fullQuery = new StringBuilder(); if (needOffset) { fullQuery.append("SELECT * FROM (SELECT t2.*, ROWNUM AS oracle_row_number FROM ("); } else if (needLimit) { fullQuery.append("SELECT * FROM (SELECT t2.* FROM ("); } appendSelect(fullQuery, tableName, columns, null, subQuery, orderBys); if (needOffset) { fullQuery.append(") t2) WHERE oracle_row_number >= ").append(offset + 1); if (needLimit) { fullQuery.append(" AND ROWNUM <= ").append(limit); } } else if (needLimit) { fullQuery.append(") t2) WHERE ROWNUM <= ").append(limit); } return fullQuery.toString(); }  }
OracleDialect extends DefaultDialect { @Override public String formSelect(String tableName, String[] columns, String subQuery, List<String> orderBys, long limit, long offset) { boolean needLimit = limit != -1L; boolean needOffset = offset != -1L; StringBuilder fullQuery = new StringBuilder(); if (needOffset) { fullQuery.append("SELECT * FROM (SELECT t2.*, ROWNUM AS oracle_row_number FROM ("); } else if (needLimit) { fullQuery.append("SELECT * FROM (SELECT t2.* FROM ("); } appendSelect(fullQuery, tableName, columns, null, subQuery, orderBys); if (needOffset) { fullQuery.append(") t2) WHERE oracle_row_number >= ").append(offset + 1); if (needLimit) { fullQuery.append(" AND ROWNUM <= ").append(limit); } } else if (needLimit) { fullQuery.append(") t2) WHERE ROWNUM <= ").append(limit); } return fullQuery.toString(); }  @Override String formSelect(String tableName, String[] columns, String subQuery, List<String> orderBys, long limit, long offset); @Override Object overrideDriverTypeConversion(MetaModel mm, String attributeName, Object value); }
OracleDialect extends DefaultDialect { @Override public String formSelect(String tableName, String[] columns, String subQuery, List<String> orderBys, long limit, long offset) { boolean needLimit = limit != -1L; boolean needOffset = offset != -1L; StringBuilder fullQuery = new StringBuilder(); if (needOffset) { fullQuery.append("SELECT * FROM (SELECT t2.*, ROWNUM AS oracle_row_number FROM ("); } else if (needLimit) { fullQuery.append("SELECT * FROM (SELECT t2.* FROM ("); } appendSelect(fullQuery, tableName, columns, null, subQuery, orderBys); if (needOffset) { fullQuery.append(") t2) WHERE oracle_row_number >= ").append(offset + 1); if (needLimit) { fullQuery.append(" AND ROWNUM <= ").append(limit); } } else if (needLimit) { fullQuery.append(") t2) WHERE ROWNUM <= ").append(limit); } return fullQuery.toString(); }  @Override String formSelect(String tableName, String[] columns, String subQuery, List<String> orderBys, long limit, long offset); @Override Object overrideDriverTypeConversion(MetaModel mm, String attributeName, Object value);  }