database_login_info Class Reference

a container for authentication information for logging into a database. More...

#include <login_info.h>

Inheritance diagram for database_login_info:

Inheritance graph
[legend]
Collaboration diagram for database_login_info:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 database_login_info (const istring &db_section)
 constructs a blank login info object that will live in "db_section".
 ~database_login_info ()
 IMPLEMENT_CLASS_NAME ("database_login_info")
bool identical (const database_login_info &to_compare)
 returns true if all significant data members are identical.
void reset ()
 sets all values to their defaults.
bool read_info (ini_configurator &ini)
 reads all the members of this class from the specified ini file.
bool update_freetds_configuration ()
 stuffs host, port and instance into freetds.conf in "db_section".
bool replace_value (istring &modify, const istring &tag, const istring &replacement)
 replaces the ini value for "tag" inside "modify" with "replacement".

Static Public Member Functions

static istring_objectfreetds_config_file ()
 if the freetds.conf file differs from our default, change it here.
static bool read_login_info (ini_configurator &ini, database_login_info &to_fill)
 reads the login info entries from the "ini" and stores them in "to_fill".

Public Attributes

istring user_name
 database user name that has appropriate rights.
istring password
 password for that user.
istring db_host
int db_port
istring db_instance
istring database
 name of the database that we care about on the host.
istring table_name
 read from grid but does not figure into comparison.
istring db_section
 established at construction, unique in config file.

Detailed Description

a container for authentication information for logging into a database.

this class tracks our required information for logging into a particular sql server and a particular database. we also get the table name when we read, but it is not persistent because changing which table to use does not require a logout/login (unless the rest of the contents of the login info have changed). note that this library currently requires write access to the free_tds.conf file; we change it at runtime to match the parameters for our database.

Definition at line 36 of file login_info.h.


Constructor & Destructor Documentation

database_login_info::database_login_info ( const istring db_section  ) 

constructs a blank login info object that will live in "db_section".

the "db_section" is required to know where we will find (and store) our database server information in the freetds.conf file.

Definition at line 39 of file login_info.cpp.

References reset().

database_login_info::~database_login_info (  ) 

Definition at line 45 of file login_info.cpp.

References reset().


Member Function Documentation

database_login_info::IMPLEMENT_CLASS_NAME ( "database_login_info"   ) 

bool database_login_info::identical ( const database_login_info to_compare  ) 

returns true if all significant data members are identical.

Definition at line 47 of file login_info.cpp.

References database, db_host, db_instance, db_port, password, and user_name.

Referenced by query_handler::prepare_for_query().

void database_login_info::reset (  ) 

sets all values to their defaults.

Definition at line 57 of file login_info.cpp.

References database, db_host, db_instance, db_port, istring::empty_string(), password, table_name, and user_name.

Referenced by database_login_info(), read_info(), and ~database_login_info().

bool database_login_info::read_info ( ini_configurator ini  ) 

reads all the members of this class from the specified ini file.

Definition at line 68 of file login_info.cpp.

References database, db_host, db_instance, db_port, configurator::load(), password, reset(), table_name, and user_name.

Referenced by read_login_info().

static istring_object& database_login_info::freetds_config_file (  )  [static]

if the freetds.conf file differs from our default, change it here.

Referenced by update_freetds_configuration().

bool database_login_info::update_freetds_configuration (  ) 

stuffs host, port and instance into freetds.conf in "db_section".

this must be called to register our database in the config file before we attempt to use it as a known entry.

Definition at line 150 of file login_info.cpp.

References byte_filer::close(), db_host, db_instance, db_port, freetds_config_file(), FUNCDEF, istring::length(), LOG, byte_filer::read(), replace_value(), istring::t(), and byte_filer::write().

Referenced by query_handler::prepare_for_query().

bool database_login_info::replace_value ( istring modify,
const istring tag,
const istring replacement 
)

replaces the ini value for "tag" inside "modify" with "replacement".

Definition at line 109 of file login_info.cpp.

References CHECK_INDY, db_section, istring::find(), FUNCDEF, istring::insert(), istring::length(), log_base::platform_ending(), and istring::zap().

Referenced by update_freetds_configuration().

bool database_login_info::read_login_info ( ini_configurator ini,
database_login_info to_fill 
) [static]

reads the login info entries from the "ini" and stores them in "to_fill".

Definition at line 146 of file login_info.cpp.

References read_info().

Referenced by query_handler::prepare_for_query().


Member Data Documentation

istring database_login_info::user_name

database user name that has appropriate rights.

Definition at line 39 of file login_info.h.

Referenced by identical(), query_handler::login_to_database(), read_info(), and reset().

istring database_login_info::password

password for that user.

Definition at line 40 of file login_info.h.

Referenced by identical(), query_handler::login_to_database(), read_info(), and reset().

istring database_login_info::db_host

Definition at line 43 of file login_info.h.

Referenced by identical(), query_handler::login_to_database(), read_info(), reset(), and update_freetds_configuration().

int database_login_info::db_port

Definition at line 45 of file login_info.h.

Referenced by identical(), read_info(), reset(), and update_freetds_configuration().

istring database_login_info::db_instance

Definition at line 47 of file login_info.h.

Referenced by identical(), query_handler::login_to_database(), read_info(), reset(), and update_freetds_configuration().

istring database_login_info::database

name of the database that we care about on the host.

Definition at line 49 of file login_info.h.

Referenced by identical(), main(), query_handler::prepare_for_query(), read_info(), reset(), and query_handler::use_database().

istring database_login_info::table_name

read from grid but does not figure into comparison.

Definition at line 50 of file login_info.h.

Referenced by grid_processor::process_grid_files(), read_info(), and reset().

istring database_login_info::db_section

established at construction, unique in config file.

Definition at line 52 of file login_info.h.

Referenced by query_handler::login_to_database(), query_handler::prepare_for_query(), and replace_value().


The documentation for this class was generated from the following files:
Generated on Sat Oct 11 04:30:07 2008 for HOOPLE Libraries by  doxygen 1.5.1