casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Private Types | Private Member Functions | Private Attributes | Static Private Attributes | List of all members
casa::SearcherSQLite Class Reference

Searches a local sqlite database for molecular lines meeting the specified search criteria. More...

#include <SearcherSQLite.h>

Inheritance diagram for casa::SearcherSQLite:
casa::Searcher

Public Member Functions

 SearcherSQLite (const string &databasePath)
 
string tableInfo (const string &tableName, string &errorMsg) const
 Returns a string containing (columnName, columnType) information for all the columns in the table. More...
 
string getCreatedDate () const
 Returns the date the database file was installed. More...
 
virtual bool isConnected () const
 Returns whether or not a connection has been established to the database provider. More...
 
virtual void stopSearch ()
 Provide a way to interrupt long searches. More...
 
virtual void reset ()
 Set all the search parameters back to their defaults. More...
 
virtual void setChemicalNames (const std::vector< string > &chemNames)
 Search Paramaters. More...
 
virtual void setSpeciesNames (const std::vector< string > &speciesNames)
 
virtual void setFrequencyRange (double minValue, double maxValue)
 Units are assumed to be MHz. More...
 
virtual void setIntensityRange (double minValue, double maxValue)
 
virtual void setSmu2Range (double minValue, double maxValue)
 
virtual void setLogaRange (double minValue, double maxValue)
 
virtual void setElRange (double minValue, double maxValue)
 
virtual void setEuRange (double minValue, double maxValue)
 
virtual void setQNS (const std::vector< string > &qns)
 
virtual void setFilterTop20 (bool filter=true)
 Astronomical Filters. More...
 
virtual void setFilterPlanetaryAtmosphere (bool filter=true)
 
virtual void setFilterHotCores (bool filter=true)
 
virtual void setFilterDarkClouds (bool filter=true)
 
virtual void setFilterDiffuseClouds (bool filter=true)
 
virtual void setFilterComets (bool filter=true)
 
virtual void setFilterAgbPpnPn (bool filter=true)
 
virtual void setFilterExtragalactic (bool filter=true)
 
virtual std::vector< SplatResultdoSearch (string &errorMsg, int offset)
 Performing the Search. More...
 
virtual long doSearchCount (string &errorMsg)
 
virtual void setSearchResultLimit (int limit)
 Sets the maximum number of rows that will be returned as a result of a database search. More...
 
virtual ~SearcherSQLite ()
 
- Public Member Functions inherited from casa::Searcher
 Searcher ()
 
virtual ~Searcher ()
 

Private Types

enum  FILTER_LIST {
  FILTER_TOP_20,
  FILTER_PLANETARY_ATMOSPHERE,
  FILTER_HOT_CORES,
  FILTER_DARK_CLOUDS,
  FILTER_DIFFUSE_CLOUDS,
  FILTER_COMETS,
  FILTER_AGB_PPN_PN,
  FILTER_EXTRAGALACTIC,
  END_FILTERS
}
 
enum  TableColumns {
  SPECIES_ID_COL,
  SPECIES_NAME_COL,
  CHEMICAL_NAME_COL,
  FREQUENCY_COL,
  TEMPERATURE_COL,
  RESOLVED_QNS_COL,
  INTENSITY_COL,
  SMU2_COL,
  LOGA_COL,
  EL_COL,
  EU_COL,
  END_COL
}
 

Private Member Functions

bool executeQuery (sqlite3_stmt *&statement, const string &query, string &errorMsg) const
 
string prepareQuery (bool countOnly, int offset) const
 
std::string getTrue () const
 
string numToString (double number) const
 
string getBetweenClause (const string &columnName, double low, double high) const
 
string getInClause (const string &columnName, const std::vector< string > &values) const
 
string getLikeClause (const string &columnName, const std::vector< string > &values) const
 

Private Attributes

sqlite3 * db
 Set-up. More...
 
double minValueFreq
 Search parameters. More...
 
double maxValueFreq
 
double minValueIntensity
 
double maxValueIntensity
 
double minValueSmu2
 
double maxValueSmu2
 
double minValueLoga
 
double maxValueLoga
 
double minValueEl
 
double maxValueEl
 
double minValueEu
 
double maxValueEu
 
std::vector< string > speciesNames
 bool recommendedOnly; More...
 
std::vector< string > chemicalNames
 
std::vector< string > qns
 
std::vector< bool > filters
 
int rowLimit
 Limiting the number of rows returned by a search. More...
 

Static Private Attributes

static std::vector< string > filterNames
 
static const std::string TABLE_MAIN
 casacore::Table Names More...
 
static const std::string TABLE_SPECIES
 
static const std::string FREQUENCY_COLUMN
 casacore::Table columns More...
 
static const std::string TEMPERATURE_COLUMN
 
static const std::string SPECIES_ID_COLUMN
 
static const std::string SPECIES_COLUMN
 
static const std::string SMU2_COLUMN
 
static const std::string EL_COLUMN
 
static const std::string EU_COLUMN
 
static const std::string LOGA_COLUMN
 
static const std::string INTENSITY_COLUMN
 
static const std::string RESOLVED_QNS_COLUMN
 
static const std::string CHEMICAL_NAME_COLUMN
 
static std::vector< string > resultColumns
 
static const std::string FILTER_KNOWN_AST_COLUMN
 
static const std::string FILTER_PLANET_COLUMN
 
static const std::string FILTER_HOTCORE_COLUMN
 
static const std::string FILTER_DIFFUSECLOUD_COLUMN
 
static const std::string FILTER_DARKCLOUD_COLUMN
 
static const std::string FILTER_COMET_COLUMN
 
static const std::string FILTER_EXTRAGALACTIC_COLUMN
 
static const std::string FILTER_AGB_PPN_PN_COLUMN
 
static const std::string FILTER_TOP20_COLUMN
 
static const std::string FROM
 SQL Constants. More...
 
static const std::string SELECT
 
static const std::string BETWEEN
 
static const std::string AND
 
static const std::string OPEN_PAREN
 
static const std::string CLOSE_PAREN
 
static const std::string SINGLE_QUOTE
 
static const std::string COMMA
 
static const std::string PERIOD
 
static const std::string EQUALS
 
static const std::string IN
 
static const std::string LIKE
 
static const std::string OR
 
static const int DEFAULT_VALUE
 

Detailed Description

Searches a local sqlite database for molecular lines meeting the specified search criteria.

Definition at line 41 of file SearcherSQLite.h.

Member Enumeration Documentation

Enumerator
FILTER_TOP_20 
FILTER_PLANETARY_ATMOSPHERE 
FILTER_HOT_CORES 
FILTER_DARK_CLOUDS 
FILTER_DIFFUSE_CLOUDS 
FILTER_COMETS 
FILTER_AGB_PPN_PN 
FILTER_EXTRAGALACTIC 
END_FILTERS 

Definition at line 145 of file SearcherSQLite.h.

Enumerator
SPECIES_ID_COL 
SPECIES_NAME_COL 
CHEMICAL_NAME_COL 
FREQUENCY_COL 
TEMPERATURE_COL 
RESOLVED_QNS_COL 
INTENSITY_COL 
SMU2_COL 
LOGA_COL 
EL_COL 
EU_COL 
END_COL 

Definition at line 167 of file SearcherSQLite.h.

Constructor & Destructor Documentation

casa::SearcherSQLite::SearcherSQLite ( const string &  databasePath)
virtual casa::SearcherSQLite::~SearcherSQLite ( )
virtual

Member Function Documentation

virtual std::vector<SplatResult> casa::SearcherSQLite::doSearch ( string &  errorMsg,
int  offset 
)
virtual

Performing the Search.

The offset is used when there is a limit on the number of rows that will be returned from the database. In the case that the number of rows that meet the search criteria exceeds the search limit, the offset indicates the starting index of the rows that are returned.

Implements casa::Searcher.

virtual long casa::SearcherSQLite::doSearchCount ( string &  errorMsg)
virtual

Implements casa::Searcher.

bool casa::SearcherSQLite::executeQuery ( sqlite3_stmt *&  statement,
const string &  query,
string &  errorMsg 
) const
private
string casa::SearcherSQLite::getBetweenClause ( const string &  columnName,
double  low,
double  high 
) const
private
string casa::SearcherSQLite::getCreatedDate ( ) const
virtual

Returns the date the database file was installed.

Implements casa::Searcher.

string casa::SearcherSQLite::getInClause ( const string &  columnName,
const std::vector< string > &  values 
) const
private
string casa::SearcherSQLite::getLikeClause ( const string &  columnName,
const std::vector< string > &  values 
) const
private
std::string casa::SearcherSQLite::getTrue ( ) const
private
virtual bool casa::SearcherSQLite::isConnected ( ) const
virtual

Returns whether or not a connection has been established to the database provider.

Implements casa::Searcher.

string casa::SearcherSQLite::numToString ( double  number) const
private
string casa::SearcherSQLite::prepareQuery ( bool  countOnly,
int  offset 
) const
private
virtual void casa::SearcherSQLite::reset ( )
virtual

Set all the search parameters back to their defaults.

Implements casa::Searcher.

virtual void casa::SearcherSQLite::setChemicalNames ( const std::vector< string > &  chemNames)
virtual

Search Paramaters.

Implements casa::Searcher.

virtual void casa::SearcherSQLite::setElRange ( double  minValue,
double  maxValue 
)
virtual

Implements casa::Searcher.

virtual void casa::SearcherSQLite::setEuRange ( double  minValue,
double  maxValue 
)
virtual

Implements casa::Searcher.

virtual void casa::SearcherSQLite::setFilterAgbPpnPn ( bool  filter = true)
virtual

Implements casa::Searcher.

virtual void casa::SearcherSQLite::setFilterComets ( bool  filter = true)
virtual

Implements casa::Searcher.

virtual void casa::SearcherSQLite::setFilterDarkClouds ( bool  filter = true)
virtual

Implements casa::Searcher.

virtual void casa::SearcherSQLite::setFilterDiffuseClouds ( bool  filter = true)
virtual

Implements casa::Searcher.

virtual void casa::SearcherSQLite::setFilterExtragalactic ( bool  filter = true)
virtual

Implements casa::Searcher.

virtual void casa::SearcherSQLite::setFilterHotCores ( bool  filter = true)
virtual

Implements casa::Searcher.

virtual void casa::SearcherSQLite::setFilterPlanetaryAtmosphere ( bool  filter = true)
virtual

Implements casa::Searcher.

virtual void casa::SearcherSQLite::setFilterTop20 ( bool  filter = true)
virtual

Astronomical Filters.

Implements casa::Searcher.

virtual void casa::SearcherSQLite::setFrequencyRange ( double  minValue,
double  maxValue 
)
virtual

Units are assumed to be MHz.

Implements casa::Searcher.

virtual void casa::SearcherSQLite::setIntensityRange ( double  minValue,
double  maxValue 
)
virtual

Implements casa::Searcher.

virtual void casa::SearcherSQLite::setLogaRange ( double  minValue,
double  maxValue 
)
virtual

Implements casa::Searcher.

virtual void casa::SearcherSQLite::setQNS ( const std::vector< string > &  qns)
virtual

Implements casa::Searcher.

virtual void casa::SearcherSQLite::setSearchResultLimit ( int  limit)
virtual

Sets the maximum number of rows that will be returned as a result of a database search.

Setting this value to a negative or zero value means that there will be no limit on the number of search results from the database.

Implements casa::Searcher.

virtual void casa::SearcherSQLite::setSmu2Range ( double  minValue,
double  maxValue 
)
virtual

Implements casa::Searcher.

virtual void casa::SearcherSQLite::setSpeciesNames ( const std::vector< string > &  speciesNames)
virtual

Implements casa::Searcher.

virtual void casa::SearcherSQLite::stopSearch ( )
virtual

Provide a way to interrupt long searches.

Implements casa::Searcher.

string casa::SearcherSQLite::tableInfo ( const string &  tableName,
string &  errorMsg 
) const
virtual

Returns a string containing (columnName, columnType) information for all the columns in the table.

Implements casa::Searcher.

Member Data Documentation

const std::string casa::SearcherSQLite::AND
staticprivate

Definition at line 188 of file SearcherSQLite.h.

const std::string casa::SearcherSQLite::BETWEEN
staticprivate

Definition at line 187 of file SearcherSQLite.h.

const std::string casa::SearcherSQLite::CHEMICAL_NAME_COLUMN
staticprivate

Definition at line 166 of file SearcherSQLite.h.

std::vector<string> casa::SearcherSQLite::chemicalNames
private

Definition at line 141 of file SearcherSQLite.h.

const std::string casa::SearcherSQLite::CLOSE_PAREN
staticprivate

Definition at line 190 of file SearcherSQLite.h.

const std::string casa::SearcherSQLite::COMMA
staticprivate

Definition at line 192 of file SearcherSQLite.h.

sqlite3* casa::SearcherSQLite::db
private

Set-up.

Definition at line 124 of file SearcherSQLite.h.

const int casa::SearcherSQLite::DEFAULT_VALUE
staticprivate

Definition at line 199 of file SearcherSQLite.h.

const std::string casa::SearcherSQLite::EL_COLUMN
staticprivate

Definition at line 161 of file SearcherSQLite.h.

const std::string casa::SearcherSQLite::EQUALS
staticprivate

Definition at line 194 of file SearcherSQLite.h.

const std::string casa::SearcherSQLite::EU_COLUMN
staticprivate

Definition at line 162 of file SearcherSQLite.h.

const std::string casa::SearcherSQLite::FILTER_AGB_PPN_PN_COLUMN
staticprivate

Definition at line 180 of file SearcherSQLite.h.

const std::string casa::SearcherSQLite::FILTER_COMET_COLUMN
staticprivate

Definition at line 178 of file SearcherSQLite.h.

const std::string casa::SearcherSQLite::FILTER_DARKCLOUD_COLUMN
staticprivate

Definition at line 177 of file SearcherSQLite.h.

const std::string casa::SearcherSQLite::FILTER_DIFFUSECLOUD_COLUMN
staticprivate

Definition at line 176 of file SearcherSQLite.h.

const std::string casa::SearcherSQLite::FILTER_EXTRAGALACTIC_COLUMN
staticprivate

Definition at line 179 of file SearcherSQLite.h.

const std::string casa::SearcherSQLite::FILTER_HOTCORE_COLUMN
staticprivate

Definition at line 175 of file SearcherSQLite.h.

const std::string casa::SearcherSQLite::FILTER_KNOWN_AST_COLUMN
staticprivate

Definition at line 173 of file SearcherSQLite.h.

const std::string casa::SearcherSQLite::FILTER_PLANET_COLUMN
staticprivate

Definition at line 174 of file SearcherSQLite.h.

const std::string casa::SearcherSQLite::FILTER_TOP20_COLUMN
staticprivate

Definition at line 181 of file SearcherSQLite.h.

std::vector<string> casa::SearcherSQLite::filterNames
staticprivate

Definition at line 149 of file SearcherSQLite.h.

std::vector<bool> casa::SearcherSQLite::filters
private

Definition at line 148 of file SearcherSQLite.h.

const std::string casa::SearcherSQLite::FREQUENCY_COLUMN
staticprivate

casacore::Table columns

Definition at line 156 of file SearcherSQLite.h.

const std::string casa::SearcherSQLite::FROM
staticprivate

SQL Constants.

Definition at line 185 of file SearcherSQLite.h.

const std::string casa::SearcherSQLite::IN
staticprivate

Definition at line 195 of file SearcherSQLite.h.

const std::string casa::SearcherSQLite::INTENSITY_COLUMN
staticprivate

Definition at line 164 of file SearcherSQLite.h.

const std::string casa::SearcherSQLite::LIKE
staticprivate

Definition at line 196 of file SearcherSQLite.h.

const std::string casa::SearcherSQLite::LOGA_COLUMN
staticprivate

Definition at line 163 of file SearcherSQLite.h.

double casa::SearcherSQLite::maxValueEl
private

Definition at line 136 of file SearcherSQLite.h.

double casa::SearcherSQLite::maxValueEu
private

Definition at line 138 of file SearcherSQLite.h.

double casa::SearcherSQLite::maxValueFreq
private

Definition at line 128 of file SearcherSQLite.h.

double casa::SearcherSQLite::maxValueIntensity
private

Definition at line 130 of file SearcherSQLite.h.

double casa::SearcherSQLite::maxValueLoga
private

Definition at line 134 of file SearcherSQLite.h.

double casa::SearcherSQLite::maxValueSmu2
private

Definition at line 132 of file SearcherSQLite.h.

double casa::SearcherSQLite::minValueEl
private

Definition at line 135 of file SearcherSQLite.h.

double casa::SearcherSQLite::minValueEu
private

Definition at line 137 of file SearcherSQLite.h.

double casa::SearcherSQLite::minValueFreq
private

Search parameters.

Definition at line 127 of file SearcherSQLite.h.

double casa::SearcherSQLite::minValueIntensity
private

Definition at line 129 of file SearcherSQLite.h.

double casa::SearcherSQLite::minValueLoga
private

Definition at line 133 of file SearcherSQLite.h.

double casa::SearcherSQLite::minValueSmu2
private

Definition at line 131 of file SearcherSQLite.h.

const std::string casa::SearcherSQLite::OPEN_PAREN
staticprivate

Definition at line 189 of file SearcherSQLite.h.

const std::string casa::SearcherSQLite::OR
staticprivate

Definition at line 197 of file SearcherSQLite.h.

const std::string casa::SearcherSQLite::PERIOD
staticprivate

Definition at line 193 of file SearcherSQLite.h.

std::vector<string> casa::SearcherSQLite::qns
private

Definition at line 142 of file SearcherSQLite.h.

const std::string casa::SearcherSQLite::RESOLVED_QNS_COLUMN
staticprivate

Definition at line 165 of file SearcherSQLite.h.

std::vector<string> casa::SearcherSQLite::resultColumns
staticprivate

Definition at line 170 of file SearcherSQLite.h.

int casa::SearcherSQLite::rowLimit
private

Limiting the number of rows returned by a search.

Definition at line 202 of file SearcherSQLite.h.

const std::string casa::SearcherSQLite::SELECT
staticprivate

Definition at line 186 of file SearcherSQLite.h.

const std::string casa::SearcherSQLite::SINGLE_QUOTE
staticprivate

Definition at line 191 of file SearcherSQLite.h.

const std::string casa::SearcherSQLite::SMU2_COLUMN
staticprivate

Definition at line 160 of file SearcherSQLite.h.

const std::string casa::SearcherSQLite::SPECIES_COLUMN
staticprivate

Definition at line 159 of file SearcherSQLite.h.

const std::string casa::SearcherSQLite::SPECIES_ID_COLUMN
staticprivate

Definition at line 158 of file SearcherSQLite.h.

std::vector<string> casa::SearcherSQLite::speciesNames
private

bool recommendedOnly;

Definition at line 140 of file SearcherSQLite.h.

const std::string casa::SearcherSQLite::TABLE_MAIN
staticprivate

casacore::Table Names

Definition at line 152 of file SearcherSQLite.h.

const std::string casa::SearcherSQLite::TABLE_SPECIES
staticprivate

Definition at line 153 of file SearcherSQLite.h.

const std::string casa::SearcherSQLite::TEMPERATURE_COLUMN
staticprivate

Definition at line 157 of file SearcherSQLite.h.


The documentation for this class was generated from the following file: