Package uk.ac.starlink.ttools.cone
Class ConeSelector
java.lang.Object
uk.ac.starlink.ttools.cone.ConeSelector
Abstract class for an object which can make a JDBC SELECT query
corresponding to cone searches.
- Since:
- 9 Jan 2007
- Author:
- Mark Taylor
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
ConeSelector
(Connection connection, String tableName, String raCol, String decCol, AngleUnits units, String cols, String where) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionstatic ConeSelector
createSelector
(Connection connection, String tableName, String raCol, String decCol, AngleUnits units, String cols, String where, boolean usePrepared) Returns a new selector object which just queries on RA and Dec values.static ConeSelector
createTiledSelector
(Connection connection, String tableName, String raCol, String decCol, AngleUnits units, String cols, String where, String tileCol, SkyTiling tiling, boolean usePrepared) Returns a new selector object which queries using RA, Dec and a spatial tiling value.abstract ResultSet
executeQuery
(double ra, double dec, double sr) Returns an SQL ResultSet containing the records corresponding to a cone search with the given parameters.
-
Constructor Details
-
ConeSelector
protected ConeSelector(Connection connection, String tableName, String raCol, String decCol, AngleUnits units, String cols, String where) throws 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 columnscols
- list of column names for the SELECT statementwhere
- additional WHERE clause constraints- Throws:
SQLException
-
-
Method Details
-
executeQuery
Returns an SQL ResultSet containing the records corresponding to a cone search with the given parameters. This may return a superset of the records in the given cone - it is essential to use SQL which is simple (that is portable and hopefully optimisable).- Parameters:
ra
- right ascension of cone centre in degreesdec
- declination of cone centre in degreessr
- search radius of cone in degrees- Returns:
- ResultSet containing records in cone (and possible some more)
- Throws:
SQLException
-
createSelector
public static ConeSelector createSelector(Connection connection, String tableName, String raCol, String decCol, AngleUnits units, String cols, String where, boolean usePrepared) throws SQLException Returns a new selector object which just queries on RA and Dec values. You can choose an implementation which usesPreparedStatement
s or not - there may be (big) performance implications.- 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 columnscols
- list of column names for the SELECT statementwhere
- additional WHERE clause constraintsusePrepared
- true to use JDBCPreparedStatement
s, false for normalStatement
s- Throws:
SQLException
-
createTiledSelector
public static ConeSelector createTiledSelector(Connection connection, String tableName, String raCol, String decCol, AngleUnits units, String cols, String where, String tileCol, SkyTiling tiling, boolean usePrepared) throws SQLException Returns a new selector object which queries using RA, Dec and a spatial tiling value. You can choose an implementation which usesPreparedStatement
s or not - there may be (big) performance implications.- 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 columnscols
- list of column names for the SELECT statementwhere
- additional WHERE clause constraintstileCol
- column containing a sky tiling index valuetiling
- tiling scheme used by tileCol columnusePrepared
- true to use JDBCPreparedStatement
s, false for normalStatement
s- Throws:
SQLException
-