Data_deduplication_service
Service that will use hashes to deduplicate files
models::myPxxxModelBase Class Referenceabstract

Basic class for database pqxx::result representation. More...

#include <myPqxxModel.h>

+ Inheritance diagram for models::myPxxxModelBase:

Public Member Functions

bool performConnection (myConnString &cstring)
 
bool checkConnection ()
 
virtual void getData ()=0
 
bool isEmpty () const
 
template<typename ResType1 , typename... Args>
void executeInTransaction (ResType1(*call)(db_services::trasnactionType &, Args...), Args &&... args)
 
template<typename ResType1 , typename... Args>
void executeInTransaction (const std::function< ResType1(trasnactionType &, Args...)> &call, Args &&... args)
 

Protected Member Functions

QVariant convertFromPqxx (const QModelIndex &index, int role) const
 Returns properly casted data Uses postgres column OID to perform cast to suitable type that will be wrapped in QVariant. More...
 
template<typename ResType1 , typename ... Args>
void executeInTransaction (ResType1(*call)(db_services::trasnactionType &, Args ...), Args &&... args)
 
template<typename ResType1 , typename ... Args>
void executeInTransaction (const std::function< ResType1(db_services::trasnactionType &, Args ...)> &call, Args &&... args)
 
void setColumnsTypes ()
 
void reset ()
 

Protected Attributes

resType res
 
conPtr connection
 
QList< oidcolumnTypes
 
QList< QString > columnNames
 
bool good
 
bool isEmpty_
 

Detailed Description

Basic class for database pqxx::result representation.

Member Function Documentation

◆ checkConnection()

bool models::myPxxxModelBase::checkConnection ( )

Checks connection status

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ convertFromPqxx()

QVariant models::myPxxxModelBase::convertFromPqxx ( const QModelIndex &  index,
int  role 
) const
protected

Returns properly casted data Uses postgres column OID to perform cast to suitable type that will be wrapped in QVariant.

This function is used in order for elements in inheriting models

to be able to get native data type for better sorting etc.

Parameters
index
role
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ executeInTransaction() [1/4]

template<typename ResType1 , typename ... Args>
void models::myPxxxModelBase::executeInTransaction ( const std::function< ResType1(db_services::trasnactionType &, Args ...)> &  call,
Args &&...  args 
)
protected

db_services::executeInTransaction(conPtr &conn_, ResultType (*call)(trasnactionType &, Args ...), Args &&... args) "executeInTransaction()"

Template Parameters
ResType1
Args
Parameters
call
args

◆ executeInTransaction() [2/4]

template<typename ResType1 , typename... Args>
void models::myPxxxModelBase::executeInTransaction ( const std::function< ResType1(trasnactionType &, Args...)> &  call,
Args &&...  args 
)
+ Here is the call graph for this function:

◆ executeInTransaction() [3/4]

template<typename ResType1 , typename ... Args>
void models::myPxxxModelBase::executeInTransaction ( ResType1(*)(db_services::trasnactionType &, Args ...)  call,
Args &&...  args 
)
protected

executeInTransaction()

Template Parameters
ResType1
Args
Parameters
call
args

◆ executeInTransaction() [4/4]

template<typename ResType1 , typename... Args>
void models::myPxxxModelBase::executeInTransaction ( ResType1(*)(db_services::trasnactionType &, Args...)  call,
Args &&...  args 
)
+ Here is the call graph for this function:

◆ getData()

virtual void models::myPxxxModelBase::getData ( )
pure virtual

◆ isEmpty()

bool models::myPxxxModelBase::isEmpty ( ) const
inline

Checks models emptiness

Returns

◆ performConnection()

bool models::myPxxxModelBase::performConnection ( myConnString cstring)

Connects to database using given connection string

Parameters
cstring
+ Here is the call graph for this function:

◆ reset()

void models::myPxxxModelBase::reset ( )
inlineprotected

Resets result

+ Here is the caller graph for this function:

◆ setColumnsTypes()

void models::myPxxxModelBase::setColumnsTypes ( )
protected

Member Data Documentation

◆ columnNames

QList<QString> models::myPxxxModelBase::columnNames
protected

◆ columnTypes

QList<oid> models::myPxxxModelBase::columnTypes
protected

◆ connection

conPtr models::myPxxxModelBase::connection
protected

◆ good

bool models::myPxxxModelBase::good
protected

◆ isEmpty_

bool models::myPxxxModelBase::isEmpty_
protected

◆ res

resType models::myPxxxModelBase::res
protected

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