casa  $Rev:20696$
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
Public Member Functions | Private Types | Private Member Functions | Private Attributes | Static Private Attributes
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

List of all members.

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.
string getCreatedDate () const
 Returns the date the database file was installed.
virtual bool isConnected () const
 Returns whether or not a connection has been established to the database provider.
virtual void stopSearch ()
 Provide a way to interrupt long searches.
virtual void reset ()
 Set all the search parameters back to their defaults.
virtual void setChemicalNames (const vector< string > &chemNames)
 Search Paramaters.
virtual void setSpeciesNames (const vector< string > &speciesNames)
virtual void setFrequencyRange (double minValue, double maxValue)
 Units are assumed to be MHz.
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 vector< string > &qns)
virtual void setFilterTop20 (bool filter=true)
 Astronomical Filters.
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 vector< SplatResultdoSearch (string &errorMsg, int offset)
 Performing the Search.
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.
virtual ~SearcherSQLite ()

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,
  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 vector< string > &values) const

Private Attributes

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

Static Private Attributes

static vector< string > filterNames
static const std::string TABLE_MAIN
 Table Names.
static const std::string TABLE_SPECIES
static const std::string FREQUENCY_COLUMN
 Table columns.
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.
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 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 144 of file SearcherSQLite.h.

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

Definition at line 165 of file SearcherSQLite.h.


Constructor & Destructor Documentation

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

Member Function Documentation

virtual 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 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 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 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 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 [static, private]

Definition at line 186 of file SearcherSQLite.h.

const std::string casa::SearcherSQLite::BETWEEN [static, private]

Definition at line 185 of file SearcherSQLite.h.

const std::string casa::SearcherSQLite::CHEMICAL_NAME_COLUMN [static, private]

Definition at line 164 of file SearcherSQLite.h.

vector<string> casa::SearcherSQLite::chemicalNames [private]

Definition at line 140 of file SearcherSQLite.h.

const std::string casa::SearcherSQLite::CLOSE_PAREN [static, private]

Definition at line 188 of file SearcherSQLite.h.

const std::string casa::SearcherSQLite::COMMA [static, private]

Definition at line 190 of file SearcherSQLite.h.

sqlite3* casa::SearcherSQLite::db [private]

Set-up.

Definition at line 123 of file SearcherSQLite.h.

const int casa::SearcherSQLite::DEFAULT_VALUE [static, private]

Definition at line 195 of file SearcherSQLite.h.

const std::string casa::SearcherSQLite::EL_COLUMN [static, private]

Definition at line 159 of file SearcherSQLite.h.

const std::string casa::SearcherSQLite::EQUALS [static, private]

Definition at line 192 of file SearcherSQLite.h.

const std::string casa::SearcherSQLite::EU_COLUMN [static, private]

Definition at line 160 of file SearcherSQLite.h.

const std::string casa::SearcherSQLite::FILTER_AGB_PPN_PN_COLUMN [static, private]

Definition at line 178 of file SearcherSQLite.h.

const std::string casa::SearcherSQLite::FILTER_COMET_COLUMN [static, private]

Definition at line 176 of file SearcherSQLite.h.

const std::string casa::SearcherSQLite::FILTER_DARKCLOUD_COLUMN [static, private]

Definition at line 175 of file SearcherSQLite.h.

const std::string casa::SearcherSQLite::FILTER_DIFFUSECLOUD_COLUMN [static, private]

Definition at line 174 of file SearcherSQLite.h.

const std::string casa::SearcherSQLite::FILTER_EXTRAGALACTIC_COLUMN [static, private]

Definition at line 177 of file SearcherSQLite.h.

const std::string casa::SearcherSQLite::FILTER_HOTCORE_COLUMN [static, private]

Definition at line 173 of file SearcherSQLite.h.

const std::string casa::SearcherSQLite::FILTER_KNOWN_AST_COLUMN [static, private]

Definition at line 171 of file SearcherSQLite.h.

const std::string casa::SearcherSQLite::FILTER_PLANET_COLUMN [static, private]

Definition at line 172 of file SearcherSQLite.h.

const std::string casa::SearcherSQLite::FILTER_TOP20_COLUMN [static, private]

Definition at line 179 of file SearcherSQLite.h.

vector<string> casa::SearcherSQLite::filterNames [static, private]

Definition at line 148 of file SearcherSQLite.h.

vector<bool> casa::SearcherSQLite::filters [private]

Definition at line 147 of file SearcherSQLite.h.

const std::string casa::SearcherSQLite::FREQUENCY_COLUMN [static, private]

Table columns.

Definition at line 155 of file SearcherSQLite.h.

const std::string casa::SearcherSQLite::FROM [static, private]

SQL Constants.

Definition at line 183 of file SearcherSQLite.h.

const std::string casa::SearcherSQLite::IN [static, private]

Definition at line 193 of file SearcherSQLite.h.

const std::string casa::SearcherSQLite::INTENSITY_COLUMN [static, private]

Definition at line 162 of file SearcherSQLite.h.

const std::string casa::SearcherSQLite::LOGA_COLUMN [static, private]

Definition at line 161 of file SearcherSQLite.h.

Definition at line 135 of file SearcherSQLite.h.

Definition at line 137 of file SearcherSQLite.h.

Definition at line 127 of file SearcherSQLite.h.

Definition at line 129 of file SearcherSQLite.h.

Definition at line 133 of file SearcherSQLite.h.

Definition at line 131 of file SearcherSQLite.h.

Definition at line 134 of file SearcherSQLite.h.

Definition at line 136 of file SearcherSQLite.h.

Search parameters.

Definition at line 126 of file SearcherSQLite.h.

Definition at line 128 of file SearcherSQLite.h.

Definition at line 132 of file SearcherSQLite.h.

Definition at line 130 of file SearcherSQLite.h.

const std::string casa::SearcherSQLite::OPEN_PAREN [static, private]

Definition at line 187 of file SearcherSQLite.h.

const std::string casa::SearcherSQLite::PERIOD [static, private]

Definition at line 191 of file SearcherSQLite.h.

vector<string> casa::SearcherSQLite::qns [private]

Definition at line 141 of file SearcherSQLite.h.

Definition at line 138 of file SearcherSQLite.h.

const std::string casa::SearcherSQLite::RESOLVED_QNS_COLUMN [static, private]

Definition at line 163 of file SearcherSQLite.h.

std::vector<string> casa::SearcherSQLite::resultColumns [static, private]

Definition at line 168 of file SearcherSQLite.h.

Limiting the number of rows returned by a search.

Definition at line 198 of file SearcherSQLite.h.

const std::string casa::SearcherSQLite::SELECT [static, private]

Definition at line 184 of file SearcherSQLite.h.

const std::string casa::SearcherSQLite::SINGLE_QUOTE [static, private]

Definition at line 189 of file SearcherSQLite.h.

const std::string casa::SearcherSQLite::SMU2_COLUMN [static, private]

Definition at line 158 of file SearcherSQLite.h.

const std::string casa::SearcherSQLite::SPECIES_COLUMN [static, private]

Definition at line 157 of file SearcherSQLite.h.

const std::string casa::SearcherSQLite::SPECIES_ID_COLUMN [static, private]

Definition at line 156 of file SearcherSQLite.h.

vector<string> casa::SearcherSQLite::speciesNames [private]

Definition at line 139 of file SearcherSQLite.h.

const std::string casa::SearcherSQLite::TABLE_MAIN [static, private]

Table Names.

Definition at line 151 of file SearcherSQLite.h.

const std::string casa::SearcherSQLite::TABLE_SPECIES [static, private]

Definition at line 152 of file SearcherSQLite.h.


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