Class OracleAdapter

java.lang.Object
edu.ucsb.nceas.dbadapter.AbstractDatabase
edu.ucsb.nceas.dbadapter.OracleAdapter

public class OracleAdapter extends AbstractDatabase
The Oracle db adapter implementation.
  • Constructor Details

    • OracleAdapter

      public OracleAdapter()
  • Method Details

    • getUniqueID

      public long getUniqueID(Connection conn, String tableName) throws SQLException
      The Oracle unique ID generator through use of sequences The name of the sequence used to generate the unique id is made from the name of the table that uses the id by appending "_id_seq" to it. When record is inserted in the table and insert trigger gets a nextval from that sequence, select currval of that sequence can return the generated key in the same db connection.
      Specified by:
      getUniqueID in class AbstractDatabase
      Parameters:
      conn - db connection in which the unique id was generated
      tableName - the name of table which unique id was generate
      Returns:
      return the generated unique id as a long type
      Throws:
      SQLException -
      any SQLException that can be thrown during the db operation
    • getDateTimeFunction

      public String getDateTimeFunction()
      The Oracle's function name that gets the current date and time from the database server: "sysdate"
      Specified by:
      getDateTimeFunction in class AbstractDatabase
      Returns:
      return the current date and time function name: "sysdate"
    • getIsNULLFunction

      public String getIsNULLFunction()
      The Oracle's function name that is used to return non-NULL value
      Specified by:
      getIsNULLFunction in class AbstractDatabase
      Returns:
      return the non-NULL function name: "nvl"
    • getStringDelimiter

      public String getStringDelimiter()
      The Oracles's string delimiter character: single quote (')
      Specified by:
      getStringDelimiter in class AbstractDatabase
      Returns:
      return the string delimiter: single quote (')
    • getLeftJoinQuery

      public String getLeftJoinQuery(String selectFields, String tableA, String tableB, String joinCriteria, String nonJoinCriteria)
      The Oracles's syntax for doing a left join Add 'a.' in front of the fields for first table and 'b.' in front of the fields for the second table
      Specified by:
      getLeftJoinQuery in class AbstractDatabase
      Parameters:
      selectFields - fields that you want to be selected
      tableA - first table in the join
      tableB - second table in the join
      joinCriteria - the criteria based on which the join will be made
      nonJoinCriteria - all other criterias
      Returns:
      return the string for teh select query
    • getReplicationDocumentListSQL

      public String getReplicationDocumentListSQL()
      Return a hard code string to get xml_document list in timed replcation
      Specified by:
      getReplicationDocumentListSQL in class AbstractDatabase
      Returns:
    • getPagedQuery

      public String getPagedQuery(String queryWithOrderBy, Integer start, Integer count)
      Description copied from class: AbstractDatabase
      for generating a query for paging
      Specified by:
      getPagedQuery in class AbstractDatabase
      Parameters:
      queryWithOrderBy - - the complete query with SELECT, FROM, WHERE and ORDER BY clauses
      start - the row number to start from
      count - the number of records from start to return
      Returns:
      query specific to the RDBMS in use