OpenTREP Logo  0.6.0
C++ Open Travel Request Parsing Library
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
OPENTREP::DBManager Class Reference

Class building the Business Object Model (BOM) from data retrieved from the database. More...

#include <opentrep/command/DBManager.hpp>

Static Public Member Functions

static NbOfDBEntries_T buildSQLDB (const PORFilePath_T &, const SQLiteDBFilePath_T &)
 
static void updatePlaceInDB (soci::session &, const Place &)
 
static bool retrievePlace (soci::session &, const LocationKey &, Place &)
 
static bool retrieveClosestPlaces (soci::session &, const double &iLatitude, const double &iLongitude, PlaceOrderedList_T &)
 
static void prepareSelectAllStatement (soci::session &, soci::statement &, Place &)
 
static void prepareSelectFromCodeStatement (soci::session &, soci::statement &, Place &)
 
static void prepareSelectFromCoordStatement (soci::session &, soci::statement &, const double &iLatitude, const double &iLongitude)
 
static bool iterateOnStatement (soci::statement &, Place &)
 

Detailed Description

Class building the Business Object Model (BOM) from data retrieved from the database.

Definition at line 28 of file DBManager.hpp.

Member Function Documentation

NbOfDBEntries_T OPENTREP::DBManager::buildSQLDB ( const PORFilePath_T iPORFilepath,
const SQLiteDBFilePath_T iSQLiteDBFilePath 
)
static

Build the SQL database from the file with the ORI-maintained list of POR (points of reference).

Parameters
constPORFilePath_T& File-path of the file of POR (points of reference).
constSQLiteDBFilePath_T& File-path of the SQLite3 database.
Returns
NbOfDBEntries_T Number of documents inserted in the SQLite3 DB.

Definition at line 516 of file DBManager.cpp.

References OPENTREP::FacPlace::create(), OPENTREP::Place::getKey(), OPENTREP::FacPlace::instance(), iterateOnStatement(), OPENTREP_LOG_DEBUG, OPENTREP_LOG_ERROR, and prepareSelectAllStatement().

Referenced by OPENTREP::OPENTREP_Service::buildSQLDB().

void OPENTREP::DBManager::updatePlaceInDB ( soci::session &  ioSociSession,
const Place iPlace 
)
static

Update the Xapian document ID field of the database row corresponding to the given Place object.

Parameters
soci::session&SOCI session handler.
constPlace& The place to be updated.

Definition at line 410 of file DBManager.cpp.

References OPENTREP::Place::getDocID(), OPENTREP::Place::getIataCode(), OPENTREP_LOG_ERROR, and OPENTREP::Place::toString().

bool OPENTREP::DBManager::retrievePlace ( soci::session &  ioSociSession,
const LocationKey iPlaceKey,
Place ioPlace 
)
static

Retrieve, from the (SQLite3) database, the row corresponding to the given place code (e.g., 'sfo' for San Francisco Intl airport), and fill the given Place object with that retrieved data.

Parameters
soci::session&SOCI session handler.
constLocationKey& The primary key of the place to be retrieved.
Place&The object corresponding to the place to be retrieved. It has to be given empty, and is filled by the method.

Definition at line 449 of file DBManager.cpp.

References OPENTREP::LocationKey::getGeonamesID(), OPENTREP::LocationKey::getIataCode(), OPENTREP::LocationKey::getIataType(), OPENTREP::IATAType::getTypeAsString(), iterateOnStatement(), OPENTREP_LOG_DEBUG, and OPENTREP_LOG_ERROR.

bool OPENTREP::DBManager::retrieveClosestPlaces ( soci::session &  ioSociSession,
const double &  iLatitude,
const double &  iLongitude,
PlaceOrderedList_T ioPlaceList 
)
static

Retrieve, from the (SQLite3) database, the row corresponding to the given place code (e.g., 'sfo' for San Francisco Intl airport), and fill the given Place object with that retrieved data.

Parameters
soci::session&SOCI session handler.
conststd::double& The latitude of the place to be retrieved.
conststd::double& The longitude of the place to be retrieved.
PlaceOrderedList_T&The list corresponding to the places to be retrieved. It has to be given empty, and is filled by the method.

Definition at line 494 of file DBManager.cpp.

References OPENTREP_LOG_ERROR.

void OPENTREP::DBManager::prepareSelectAllStatement ( soci::session &  ioSociSession,
soci::statement &  ioSelectStatement,
Place ioPlace 
)
static

Prepare (parse and put in cache) the SQL statement.

Parameters
soci::session&SOCI session handler.
soci::statement&SOCI SQL statement handler.
Place&The object corresponding to the place to be retrieved. It has to be given empty, and is filled by the method.

Definition at line 22 of file DBManager.cpp.

References OPENTREP_LOG_ERROR.

Referenced by buildSQLDB().

void OPENTREP::DBManager::prepareSelectFromCodeStatement ( soci::session &  ioSociSession,
soci::statement &  ioSelectStatement,
Place ioPlace 
)
static

Prepare (parse and put in cache) the SQL statement.

Parameters
soci::session&SOCI session handler.
soci::statement&SOCI SQL statement handler.
Place&The object corresponding to the place to be retrieved. It has to be given empty, and is filled by the method.

Definition at line 109 of file DBManager.cpp.

References OPENTREP_LOG_ERROR.

void OPENTREP::DBManager::prepareSelectFromCoordStatement ( soci::session &  ioSociSession,
soci::statement &  ioSelectStatement,
const double &  iLatitude,
const double &  iLongitude 
)
static

Prepare (parse and put in cache) the SQL statement.

Parameters
soci::session&SOCI session handler.
soci::statement&SOCI SQL statement handler.
Place&The object corresponding to the place to be retrieved. It has to be given empty, and is filled by the method.

Definition at line 172 of file DBManager.cpp.

References OPENTREP::FacPlace::create(), OPENTREP::FacPlace::instance(), and OPENTREP_LOG_ERROR.

bool OPENTREP::DBManager::iterateOnStatement ( soci::statement &  ioStatement,
Place ioPlace 
)
static

Iterate on the SQL statement.

The SQL has to be already prepared.

Parameters
soci::statement&SOCI SQL statement handler.
Place&The object corresponding to the place to be retrieved. It has to be given empty, and is filled by the method.

Definition at line 388 of file DBManager.cpp.

References OPENTREP::Place::describeKey(), and OPENTREP_LOG_ERROR.

Referenced by buildSQLDB(), and retrievePlace().


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