Class PostgresConnection

java.lang.Object
org.dbos.apiary.postgres.PostgresConnection
All Implemented Interfaces:
org.dbos.apiary.connection.ApiaryConnection

public class PostgresConnection extends Object implements org.dbos.apiary.connection.ApiaryConnection
A connection to a Postgres database.
  • Constructor Details

    • PostgresConnection

      public PostgresConnection(String hostname, Integer port, String databaseName, String databaseUsername, String databasePassword) throws SQLException
      Create a connection to a Postgres database.
      Parameters:
      hostname - the Postgres database hostname.
      port - the Postgres database port.
      databaseName - the Postgres database name.
      databaseUsername - the Postgres database username.
      databasePassword - the Postgres database password.
      Throws:
      SQLException
  • Method Details

    • registerFunction

      public void registerFunction(String name, Callable<PostgresFunction> function)
      Register a PostgresFunction.
      Parameters:
      name - The name of the function.
      function - The constructor of the function.
    • dropTable

      public void dropTable(String tableName) throws SQLException
      Drop a table and its corresponding events table if they exist.
      Parameters:
      tableName - the table to drop.
      Throws:
      SQLException
    • createTable

      public void createTable(String tableName, String specStr) throws SQLException
      Create a table and a corresponding events table.
      Parameters:
      tableName - the table to create.
      specStr - the schema of the table, in Postgres DDL.
      Throws:
      SQLException
    • callFunction

      public FunctionOutput callFunction(ProvenanceBuffer provBuff, String service, long execID, long functionID, String name, Object... inputs) throws Exception
      Description copied from interface: org.dbos.apiary.connection.ApiaryConnection
      For internal use only.
      Specified by:
      callFunction in interface org.dbos.apiary.connection.ApiaryConnection
      Returns:
      Throws:
      Exception
    • updatePartitionInfo

      public void updatePartitionInfo()
      Description copied from interface: org.dbos.apiary.connection.ApiaryConnection
      For internal use only.
      Specified by:
      updatePartitionInfo in interface org.dbos.apiary.connection.ApiaryConnection
    • getNumPartitions

      public int getNumPartitions()
      Description copied from interface: org.dbos.apiary.connection.ApiaryConnection
      For internal use only.
      Specified by:
      getNumPartitions in interface org.dbos.apiary.connection.ApiaryConnection
      Returns:
    • getHostname

      public String getHostname(Object... input)
      Description copied from interface: org.dbos.apiary.connection.ApiaryConnection
      For internal use only.
      Specified by:
      getHostname in interface org.dbos.apiary.connection.ApiaryConnection
      Returns:
    • getPartitionHostMap

      public Map<Integer,String> getPartitionHostMap()
      Description copied from interface: org.dbos.apiary.connection.ApiaryConnection
      For internal use only.
      Specified by:
      getPartitionHostMap in interface org.dbos.apiary.connection.ApiaryConnection
      Returns: