Class OracleDialect

java.lang.Object
org.javalite.activejdbc.dialects.DefaultDialect
org.javalite.activejdbc.dialects.OracleDialect
All Implemented Interfaces:
Serializable, Dialect

public class OracleDialect extends DefaultDialect
Author:
Igor Polevoy, Eric Nielsen
See Also:
Serialized Form
  • Constructor Details

    • OracleDialect

      public OracleDialect()
  • Method Details

    • formSelect

      public String formSelect(String tableName, String[] columns, String subQuery, List<String> orderBys, long limit, long offset)
      Example of a query we are building here:
       SELECT * FROM (
         SELECT t2.*, ROWNUM AS oracle_row_number FROM (
           SELECT t.* FROM pages t WHERE <conditions> ORDER BY id
         ) t2
       ) WHERE oracle_row_number >= 20 AND rownum <= 10;
       

      Look here for reference: Oracle: ROW_NUMBER vs ROWNUM

      Specified by:
      formSelect in interface Dialect
      Overrides:
      formSelect in class DefaultDialect
      Parameters:
      tableName - name of table. If table name is null, then the subQuery parameter is considered to be a full query, and all that needs to be done is to add limit, offset and order bys
      columns - not used in this implementation.
      subQuery - sub query, something like: "name = ? AND ssn = ?". It can be blank: "" or null;
      orderBys - collection of order by: "dob desc" - one example
      limit - limit value, -1 if not needed.
      offset - offset value, -1 if not needed.
      Returns:
      Oracle - specific select query. Here is one example:
      SELECT * FROM (SELECT t2.*, ROWNUM AS oracle_row_number FROM (SELECT t.* FROM pages t WHERE <conditions> ORDER BY id) t2) WHERE oracle_row_number >= 20 AND rownum <= 10;
      Can't think of an uglier thing. Shame on you, Oracle.
    • overrideDriverTypeConversion

      public Object overrideDriverTypeConversion(MetaModel mm, String attributeName, Object value)
      Specified by:
      overrideDriverTypeConversion in interface Dialect
      Overrides:
      overrideDriverTypeConversion in class DefaultDialect
    • appendEmptyRow

      protected void appendEmptyRow(MetaModel metaModel, StringBuilder query)
      Overrides:
      appendEmptyRow in class DefaultDialect
    • appendTime

      protected void appendTime(StringBuilder query, Time value)
      Overrides:
      appendTime in class DefaultDialect