Main Page | Namespace List | Class List | Directories | File List | Class Members | File Members

DBInterface Class Reference

#include <DBInterface.H>

List of all members.


Detailed Description

This class is the gateway to all the data held in the database, be it ranking info or map info.


Public Member Functions

 DBInterface ()
 ~DBInterface ()
vector< seg_t * > * getSegment (std::string routeid)
 Converts routeid into an int and then queries database for tuples with said routeid. Returns vector although we will always have only one segment. This is for continuity with the other methods and the helper methods.
vector< seg_t * > * getStreetsAt (isect_t *i)
 Queries the database for all streets that either start or end with intersection i. Returns an STL vector of all queried matches, each match will be a filled streetSeg struct. Using STL vector because of ease of interface, the fact that this doesnt have to be sorted, and because insertion and removal at the end (the only type used in this case) is constant time, it becomes the most efficient thing to use.
vector< seg_t * > * getPath (isect_t *from, isect_t *to)
 See DBInterface.H for more extensive comments.
vector< segComps_t * > * getPathArcs (isect_t *from, isect_t *to)
 See DBInterface.H for more extensive comments.
vector< seg_t * > * getMatches (std::vector< string > streetName, string town, string state, string zip, double address)
 Given user entered streetName, etc return all streetSegs that match the general description of the road given by the parameters. What elements are required of the parameters is dictated by the UI's form checking. If the number of matches exceeds what is easily displayable by UI this interface will return an error, and the user will be forced to reenter search terms.
int addQuantRanking (seg_t *where, double shoulder_val, int numShoulder_val, double traffic_val, int numTraffic_val, double condition_val, int numCondition_val, double steepness_val, int numSteepness_val)
 given a streetSeg, and updated rankings information we will do a SQL insert or update to make the database reflect the new information on the road. Returns an int for error codes. Not per user of course as there are no users in BQ v1. Since there are many rankings per segment, the mechanism to addRanking is as follows: a call to getRanking is done to receive existing data on the road (the number of votes for shoulder, and the average of it, etc). With the current information, the rankings code will average the new information, add a vote to the total, and call addRanking() with the newly calculated information.
int addQualRanking (seg_t *where, string comment, int commenttype, string author)
 Interface to add qualitative comments to bikequest database. Based on the enumeration in BQStructs, the caller will give what type of comment it is. This method, in addition to adding this to the database, will concatenate the current date to the comment.
seg_tgetRanking (isect_t *from, isect_t *to)
 Given a street segment that starts with from, and ends with to, query the database for a row which meets the from, to criteria. Also fills out a streetSeg struct with the information returned. The data that is needed out of the street segment is its ranking information. The qualitative information from tables is parsed here, and put into a multimap for ease of information retrieval.
vector< segComps_t * > * getArcs ()
 Given a full path description we will traverse the linked list of street segments and return a string of comma separated values that are the exact point to point geometry of the streets in the path. Used by mapvis. Mapvis will parse the numbers sent back and convert the stateplane coordinates to their own xy coordinate plane.

Private Member Functions

pqxx::result executeTransaction (pqxx::connection *c, std::string sql)
pqxx::result executeNonTransaction (pqxx::connection *c, std::string sql)
pqxx::connection * getConnection ()
pqxx::connection * makeConnection ()
void tryDisconnect (pqxx::connection *c)
vector< seg_t * > * processRDQUANTTuple (pqxx::result &R)
void addQUALResults (std::vector< seg_t * > *segvector, pqxx::connection *c)


Constructor & Destructor Documentation

DBInterface::DBInterface  ) 
 

DBInterface::~DBInterface  ) 
 


Member Function Documentation

int DBInterface::addQualRanking seg_t where,
string  comment,
int  commenttype,
string  author
 

Interface to add qualitative comments to bikequest database. Based on the enumeration in BQStructs, the caller will give what type of comment it is. This method, in addition to adding this to the database, will concatenate the current date to the comment.

SQL Structure:

Deviations:

Here is the call graph for this function:

void DBInterface::addQUALResults std::vector< seg_t * > *  segvector,
pqxx::connection *  c
[private]
 

Here is the call graph for this function:

int DBInterface::addQuantRanking seg_t where,
double  shoulder_val,
int  numShoulder_val,
double  traffic_val,
int  numTraffic_val,
double  condition_val,
int  numCondition_val,
double  steepness_val,
int  numSteepness_val
 

given a streetSeg, and updated rankings information we will do a SQL insert or update to make the database reflect the new information on the road. Returns an int for error codes. Not per user of course as there are no users in BQ v1. Since there are many rankings per segment, the mechanism to addRanking is as follows: a call to getRanking is done to receive existing data on the road (the number of votes for shoulder, and the average of it, etc). With the current information, the rankings code will average the new information, add a vote to the total, and call addRanking() with the newly calculated information.

SQL Structure:

Deviations:

Here is the call graph for this function:

pqxx::result DBInterface::executeNonTransaction pqxx::connection *  c,
std::string  sql
[private]
 

pqxx::result DBInterface::executeTransaction pqxx::connection *  c,
std::string  sql
[private]
 

vector< segComps_t * > * DBInterface::getArcs  ) 
 

Given a full path description we will traverse the linked list of street segments and return a string of comma separated values that are the exact point to point geometry of the streets in the path. Used by mapvis. Mapvis will parse the numbers sent back and convert the stateplane coordinates to their own xy coordinate plane.

SQL Structure:

Deviations:

Here is the call graph for this function:

pqxx::connection* DBInterface::getConnection  )  [private]
 

vector< seg_t * > * DBInterface::getMatches std::vector< string >  streetName,
std::string  town,
std::string  state,
std::string  zip,
double  address
 

Given user entered streetName, etc return all streetSegs that match the general description of the road given by the parameters. What elements are required of the parameters is dictated by the UI's form checking. If the number of matches exceeds what is easily displayable by UI this interface will return an error, and the user will be forced to reenter search terms.

SQL Structure:

Deviations:

Here is the call graph for this function:

vector< seg_t * > * DBInterface::getPath isect_t from,
isect_t to
 

See DBInterface.H for more extensive comments.

SQL Structure:

Deviations:

Here is the call graph for this function:

vector< segComps_t * > * DBInterface::getPathArcs isect_t from,
isect_t to
 

See DBInterface.H for more extensive comments.

SQL Structure:

Deviations:

Here is the call graph for this function:

seg_t * DBInterface::getRanking isect_t from,
isect_t to
 

Given a street segment that starts with from, and ends with to, query the database for a row which meets the from, to criteria. Also fills out a streetSeg struct with the information returned. The data that is needed out of the street segment is its ranking information. The qualitative information from tables is parsed here, and put into a multimap for ease of information retrieval.

SQL Structure:

Deviations:

Here is the call graph for this function:

vector< seg_t * > * DBInterface::getSegment std::string  routeid  ) 
 

Converts routeid into an int and then queries database for tuples with said routeid. Returns vector although we will always have only one segment. This is for continuity with the other methods and the helper methods.

SQL Structure:

Deviations:

Here is the call graph for this function:

vector< seg_t * > * DBInterface::getStreetsAt isect_t i  ) 
 

Queries the database for all streets that either start or end with intersection i. Returns an STL vector of all queried matches, each match will be a filled streetSeg struct. Using STL vector because of ease of interface, the fact that this doesnt have to be sorted, and because insertion and removal at the end (the only type used in this case) is constant time, it becomes the most efficient thing to use.

SQL Structure:

Deviations:

Here is the call graph for this function:

pqxx::connection * DBInterface::makeConnection  )  [private]
 

vector< seg_t * > * DBInterface::processRDQUANTTuple pqxx::result &  R  )  [private]
 

void DBInterface::tryDisconnect pqxx::connection *  c  )  [private]
 


The documentation for this class was generated from the following files:
Generated on Mon May 16 11:08:50 2005 for BikeQuest by  doxygen 1.4.0