GOFIGURE2  0.9.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Classes | Public Types | Public Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
GoDBRecordSet< TObject > Class Template Reference

#include <Code/IO/GoDBRecordSet.h>

Classes

struct  IsLess
 

Public Types

typedef std::pair< bool,
OriginalObjectType
InternalObjectType
 
typedef TObject OriginalObjectType
 
typedef std::vector
< InternalObjectType
RowContainerType
 

Public Member Functions

void AddObject (const OriginalObjectType &object)
 Add a new Object of OriginalObjectType (exp: GoDBprojectRow) in the m_RowContainer and set the bool to false. More...
 
std::vector< std::string > GetColumnNamesContainer ()
 
RowContainerTypeGetRowContainer ()
 
 GoDBRecordSet ()
 
void InsertObject (const int &pos, const OriginalObjectType &object)
 
void PopulateFromDB ()
 help read content from DB: select all the fields for a given table (TableName)in the database and fills the m_RowContainer with the results: each row from the database will fill an InternalObjectType with true and an OriginalObjectType (exp; GoProjectRow). if there is a need to add a condition on the selection ( add a WHERE), have to use the function SetWhereString( std::string whereString ) from the same class. More...
 
bool SaveInDB (bool Update=false)
 
void SetConnector (vtkMySQLDatabase *iDatabaseConnector)
 
void SetDataBaseName (const std::string &iDataBaseName)
 
void SetPassword (const std::string &iPassword)
 
void SetServerName (const std::string &iServerName)
 
void SetTableName (const std::string &iTableName)
 
void SetUser (const std::string &iUser)
 
void SetWhereString (const std::string &whereString)
 is there to be used in case there is a "WHERE" condition to add for the selection in PopulateFromDB() More...
 
 ~GoDBRecordSet ()
 

Private Types

typedef std::vector
< InternalObjectType >
::iterator 
myIteratorType
 

Private Member Functions

void PopulateColumnNamesContainer ()
 fills the vector m_ColumnNamesContainer with the column names gotten from the database and in the same order as the query results will be given:(only way to retrieve which query->datavalue corresponds to which field). More...
 
bool SaveEachRow (vtkSQLQuery *query, bool Update=false)
 
bool SaveRows (vtkSQLQuery *query, const std::string &what, const myIteratorType &start, const myIteratorType &end)
 uses the INSERT or REPLACE query to save all the objects GoDB..Row currently in the m_RowContainer located between start and end More...
 
bool UpdateRows (vtkSQLQuery *query, const myIteratorType &start, const myIteratorType &end)
 uses the INSERT or REPLACE query to save all the objects GoDB..Row currently in the m_RowContainer located between start and end More...
 

Private Attributes

std::string DataBaseName
 
bool IsOpen
 
bool IsWhereStringSet
 
std::vector< std::string > m_ColumnNamesContainer
 
vtkMySQLDatabase * m_DatabaseConnector
 
std::vector< InternalObjectTypem_RowContainer
 
std::string m_WhereString
 
std::string PassWord
 
std::string ServerName
 
std::string TableName
 
std::string User
 

Detailed Description

template<class TObject>
class GoDBRecordSet< TObject >

Definition at line 50 of file GoDBRecordSet.h.

Member Typedef Documentation

template<class TObject >
typedef std::pair< bool, OriginalObjectType > GoDBRecordSet< TObject >::InternalObjectType

Definition at line 58 of file GoDBRecordSet.h.

template<class TObject >
typedef std::vector< InternalObjectType >::iterator GoDBRecordSet< TObject >::myIteratorType
private

Definition at line 232 of file GoDBRecordSet.h.

template<class TObject >
typedef TObject GoDBRecordSet< TObject >::OriginalObjectType

Definition at line 54 of file GoDBRecordSet.h.

template<class TObject >
typedef std::vector< InternalObjectType > GoDBRecordSet< TObject >::RowContainerType

Definition at line 59 of file GoDBRecordSet.h.

Constructor & Destructor Documentation

template<class TObject >
GoDBRecordSet< TObject >::GoDBRecordSet ( )
inline

Definition at line 61 of file GoDBRecordSet.h.

template<class TObject >
GoDBRecordSet< TObject >::~GoDBRecordSet ( )
inline

Definition at line 62 of file GoDBRecordSet.h.

Member Function Documentation

template<class TObject >
void GoDBRecordSet< TObject >::AddObject ( const OriginalObjectType object)
inline

Add a new Object of OriginalObjectType (exp: GoDBprojectRow) in the m_RowContainer and set the bool to false.

Definition at line 76 of file GoDBRecordSet.h.

template<class TObject >
std::vector< std::string > GoDBRecordSet< TObject >::GetColumnNamesContainer ( )
inline

Definition at line 64 of file GoDBRecordSet.h.

template<class TObject >
RowContainerType* GoDBRecordSet< TObject >::GetRowContainer ( )
inline

Definition at line 69 of file GoDBRecordSet.h.

template<class TObject >
void GoDBRecordSet< TObject >::InsertObject ( const int &  pos,
const OriginalObjectType object 
)
inline

Definition at line 85 of file GoDBRecordSet.h.

template<class TObject >
void GoDBRecordSet< TObject >::PopulateColumnNamesContainer ( )
private

fills the vector m_ColumnNamesContainer with the column names gotten from the database and in the same order as the query results will be given:(only way to retrieve which query->datavalue corresponds to which field).

Definition at line 409 of file GoDBRecordSet.h.

template<class TObject >
void GoDBRecordSet< TObject >::PopulateFromDB ( )
inline

help read content from DB: select all the fields for a given table (TableName)in the database and fills the m_RowContainer with the results: each row from the database will fill an InternalObjectType with true and an OriginalObjectType (exp; GoProjectRow). if there is a need to add a condition on the selection ( add a WHERE), have to use the function SetWhereString( std::string whereString ) from the same class.

Definition at line 125 of file GoDBRecordSet.h.

template<class TObject >
bool GoDBRecordSet< TObject >::SaveEachRow ( vtkSQLQuery *  query,
bool  Update = false 
)
private

Definition at line 265 of file GoDBRecordSet.h.

template<class TObject >
bool GoDBRecordSet< TObject >::SaveInDB ( bool  Update = false)
inline

Definition at line 170 of file GoDBRecordSet.h.

template<class TObject >
bool GoDBRecordSet< TObject >::SaveRows ( vtkSQLQuery *  query,
const std::string &  what,
const myIteratorType start,
const myIteratorType end 
)
private

uses the INSERT or REPLACE query to save all the objects GoDB..Row currently in the m_RowContainer located between start and end

Definition at line 312 of file GoDBRecordSet.h.

template<class TObject >
void GoDBRecordSet< TObject >::SetConnector ( vtkMySQLDatabase *  iDatabaseConnector)
inline

Definition at line 115 of file GoDBRecordSet.h.

template<class TObject >
void GoDBRecordSet< TObject >::SetDataBaseName ( const std::string &  iDataBaseName)
inline

Definition at line 103 of file GoDBRecordSet.h.

template<class TObject >
void GoDBRecordSet< TObject >::SetPassword ( const std::string &  iPassword)
inline

Definition at line 112 of file GoDBRecordSet.h.

template<class TObject >
void GoDBRecordSet< TObject >::SetServerName ( const std::string &  iServerName)
inline

Definition at line 100 of file GoDBRecordSet.h.

template<class TObject >
void GoDBRecordSet< TObject >::SetTableName ( const std::string &  iTableName)
inline

Definition at line 106 of file GoDBRecordSet.h.

template<class TObject >
void GoDBRecordSet< TObject >::SetUser ( const std::string &  iUser)
inline

Definition at line 109 of file GoDBRecordSet.h.

template<class TObject >
void GoDBRecordSet< TObject >::SetWhereString ( const std::string &  whereString)
inline

is there to be used in case there is a "WHERE" condition to add for the selection in PopulateFromDB()

Definition at line 97 of file GoDBRecordSet.h.

template<class TObject >
bool GoDBRecordSet< TObject >::UpdateRows ( vtkSQLQuery *  query,
const myIteratorType start,
const myIteratorType end 
)
private

uses the INSERT or REPLACE query to save all the objects GoDB..Row currently in the m_RowContainer located between start and end

Definition at line 367 of file GoDBRecordSet.h.

Member Data Documentation

template<class TObject >
std::string GoDBRecordSet< TObject >::DataBaseName
private

Definition at line 254 of file GoDBRecordSet.h.

template<class TObject >
bool GoDBRecordSet< TObject >::IsOpen
private

Definition at line 260 of file GoDBRecordSet.h.

template<class TObject >
bool GoDBRecordSet< TObject >::IsWhereStringSet
private

Definition at line 259 of file GoDBRecordSet.h.

template<class TObject >
std::vector< std::string > GoDBRecordSet< TObject >::m_ColumnNamesContainer
private

Definition at line 249 of file GoDBRecordSet.h.

template<class TObject >
vtkMySQLDatabase* GoDBRecordSet< TObject >::m_DatabaseConnector
private

Definition at line 252 of file GoDBRecordSet.h.

template<class TObject >
std::vector< InternalObjectType > GoDBRecordSet< TObject >::m_RowContainer
private

Definition at line 233 of file GoDBRecordSet.h.

template<class TObject >
std::string GoDBRecordSet< TObject >::m_WhereString
private

Definition at line 258 of file GoDBRecordSet.h.

template<class TObject >
std::string GoDBRecordSet< TObject >::PassWord
private

Definition at line 257 of file GoDBRecordSet.h.

template<class TObject >
std::string GoDBRecordSet< TObject >::ServerName
private

Definition at line 253 of file GoDBRecordSet.h.

template<class TObject >
std::string GoDBRecordSet< TObject >::TableName
private

Definition at line 255 of file GoDBRecordSet.h.

template<class TObject >
std::string GoDBRecordSet< TObject >::User
private

Definition at line 256 of file GoDBRecordSet.h.


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