Class JdbcConeSearcher

java.lang.Object
uk.ac.starlink.ttools.cone.JdbcConeSearcher
All Implemented Interfaces:
ConeSearcher

public class JdbcConeSearcher extends Object implements ConeSearcher
ConeSearcher implementation using JDBC access to an SQL database.
Since:
5 Nov 2007
Author:
Mark Taylor
  • Constructor Summary

    Constructors
    Constructor
    Description
    JdbcConeSearcher(Connection connection, String tableName, String raCol, String decCol, AngleUnits units, String tileCol, SkyTiling tiling, String cols, String where, boolean bestOnly, boolean prepareSql, boolean closeConnection)
    Constructor.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Closes the connection if requested to.
    int
    getDecIndex(uk.ac.starlink.table.StarTable result)
    Returns the index of a column giving the declination in the returned table.
    int
    getRaIndex(uk.ac.starlink.table.StarTable result)
    Returns the index of a column giving the right ascension in the returned table.
    uk.ac.starlink.table.StarTable
    performSearch(double ra, double dec, double sr)
    Returns a table consisting of all the objects within a given search radius of a specified point on the sky.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • JdbcConeSearcher

      public JdbcConeSearcher(Connection connection, String tableName, String raCol, String decCol, AngleUnits units, String tileCol, SkyTiling tiling, String cols, String where, boolean bestOnly, boolean prepareSql, boolean closeConnection) throws SQLException
      Constructor.
      Parameters:
      connection - live connection to database
      tableName - name of a table in the database to search
      raCol - name of table column containing right ascension
      decCol - name of table column containing declination
      units - angular units used by ra and dec columns
      tileCol - column containing a sky tiling index value, or null
      tiling - tiling scheme used by tileCol column
      cols - list of column names for the SELECT statement
      where - additional WHERE clause constraints
      bestOnly - true iff only the closest match is required (hint)
      prepareSql - whether to use PreparedStatements or not
      closeConnection - whether to close the connection when this object is closed
      Throws:
      SQLException
  • Method Details

    • performSearch

      public uk.ac.starlink.table.StarTable performSearch(double ra, double dec, double sr) throws IOException
      Description copied from interface: ConeSearcher
      Returns a table consisting of all the objects within a given search radius of a specified point on the sky. If no matching objects are found, then it is preferable to return an empty table with the correct columns. However, if this cannot be done, it is permissible to return null. For every table returned, the columns should be the same.
      Specified by:
      performSearch in interface ConeSearcher
      Parameters:
      ra - right ascension in degrees of search region centre
      dec - declination in degrees of search region centre
      sr - search radius in degrees
      Returns:
      table containing records in the given cone, or possibly null if no records are found
      Throws:
      IOException
    • getRaIndex

      public int getRaIndex(uk.ac.starlink.table.StarTable result)
      Description copied from interface: ConeSearcher
      Returns the index of a column giving the right ascension in the returned table. This should be the same quantity which is used for the match assessment.
      Specified by:
      getRaIndex in interface ConeSearcher
      Parameters:
      result - table returned by performSearch
      Returns:
      index of RA column, or -1 if it can't be found
    • getDecIndex

      public int getDecIndex(uk.ac.starlink.table.StarTable result)
      Description copied from interface: ConeSearcher
      Returns the index of a column giving the declination in the returned table. This should be the same quantity which is used for the match assessment.
      Specified by:
      getDecIndex in interface ConeSearcher
      Parameters:
      result - table returned by performSearch
      Returns:
      index of dec column, or -1 if it can't be found
    • close

      public void close()
      Closes the connection if requested to.
      Specified by:
      close in interface ConeSearcher