Package uk.ac.starlink.ttools.cone
Class JdbcConeSearcher
- java.lang.Object
-
- uk.ac.starlink.ttools.cone.JdbcConeSearcher
-
- All Implemented Interfaces:
ConeSearcher
public class JdbcConeSearcher extends java.lang.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(java.sql.Connection connection, java.lang.String tableName, java.lang.String raCol, java.lang.String decCol, AngleUnits units, java.lang.String tileCol, SkyTiling tiling, java.lang.String cols, java.lang.String where, boolean bestOnly, boolean prepareSql, boolean closeConnection)
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
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.
-
-
-
Constructor Detail
-
JdbcConeSearcher
public JdbcConeSearcher(java.sql.Connection connection, java.lang.String tableName, java.lang.String raCol, java.lang.String decCol, AngleUnits units, java.lang.String tileCol, SkyTiling tiling, java.lang.String cols, java.lang.String where, boolean bestOnly, boolean prepareSql, boolean closeConnection) throws java.sql.SQLException
Constructor.- Parameters:
connection
- live connection to databasetableName
- name of a table in the database to searchraCol
- name of table column containing right ascensiondecCol
- name of table column containing declinationunits
- angular units used by ra and dec columnstileCol
- column containing a sky tiling index value, or nulltiling
- tiling scheme used by tileCol columncols
- list of column names for the SELECT statementwhere
- additional WHERE clause constraintsbestOnly
- true iff only the closest match is required (hint)prepareSql
- whether to use PreparedStatements or notcloseConnection
- whether to close the connection when this object is closed- Throws:
java.sql.SQLException
-
-
Method Detail
-
performSearch
public uk.ac.starlink.table.StarTable performSearch(double ra, double dec, double sr) throws java.io.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 interfaceConeSearcher
- Parameters:
ra
- right ascension in degrees of search region centredec
- declination in degrees of search region centresr
- search radius in degrees- Returns:
- table containing records in the given cone, or possibly null if no records are found
- Throws:
java.io.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 interfaceConeSearcher
- Parameters:
result
- table returned byperformSearch
- 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 interfaceConeSearcher
- Parameters:
result
- table returned byperformSearch
- 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 interfaceConeSearcher
-
-