#include <stdlib.h>
#include <string>
#include <sstream>
#include "EventDatabase.H"
#include "Event.H"
#include <postgresql/libpq-fe.h>
#include <iostream>
Defines | |
#define | CONNINFO "hostaddr=138.16.41.179 dbname=geoevents user=ychatura password=ychatura" |
define the arguments needed to connect to the geoevents database | |
Functions | |
void | openConnection (char *cinfo) |
void | closeConnection () |
void | processQuery (PGconn *connection, string query_text) |
string | makeValidString (string name) |
string | d2String (double val, int count) |
string | catToString (Event::EventCategory cat) |
string | getCategoriesString (list< Event::EventCategory > cat_list) |
string | time2timeString (string date_time_str) |
string | time2dateString (string date_time_str) |
string | testgetOid (string table_name) |
string | getDuplicateOid (bool &is_dup, string table, Event ev) |
string | getOid (bool &is_dup, string table_name, Event ev) |
void | mergeEvents (string oid, Event ev) |
bool | singlePut (Event ev) |
Variables | |
PGconn * | conn |
a connection to database server |
|
convert from EventCategory type to string
|
|
close connection to database |
|
convert from type double of length count to string
|
|
convert the list of catagories into string
|
|
the event to be put in is a duplicate so need to find it's id by querying for the same event in the database
|
|
find the id for an event |
|
Any string that has apostrophe can't be query into database directly without braking it. So need to add change them by adding another ' so the query works
|
|
merge info of the same event if either the catagories aren't match, the url is missing or the description is missing.
|
|
open connection to database with connection arguments passed in as char*
|
|
execute a query
|
|
put a single tuple into corresponding table
|
|
get id for the tuple to be put into table The id must be unique and starts at 0. The id the number of the tuples already in the database (unless some other events already assigned that number
|
|
get just the date portion(yyyy-mm-dd) of the date/time string of time_t
|
|
get just the time portion(hh:mm:ss) from the date/time string of time_t
|