MythTV  master
Public Member Functions | Protected Member Functions | Private Types | Private Member Functions | Private Attributes | Friends | List of all members
MDBManager Class Reference

DB connection pool, used by MSqlQuery. Do not use directly. More...

#include <mythdbcon.h>

Collaboration diagram for MDBManager:
Collaboration graph
[legend]

Public Member Functions

 MDBManager (void)=default
 
 ~MDBManager (void)
 
void CloseDatabases (void)
 
void PurgeIdleConnections (bool leaveOne=false)
 

Protected Member Functions

MSqlDatabasepopConnection (bool reuse)
 
void pushConnection (MSqlDatabase *db)
 
MSqlDatabasegetSchedCon (void)
 
MSqlDatabasegetChannelCon (void)
 

Private Types

typedef QList< MSqlDatabase * > DBList
 

Private Member Functions

MSqlDatabasegetStaticCon (MSqlDatabase **dbcon, const QString &name)
 

Private Attributes

QMutex m_lock
 
QHash< QThread *, DBListm_pool
 
QHash< QThread *, MSqlDatabase * > m_inuse
 
QHash< QThread *, int > m_inuse_count
 
int m_nextConnID {0}
 
int m_connCount {0}
 
MSqlDatabasem_schedCon {nullptr}
 
MSqlDatabasem_channelCon {nullptr}
 
QHash< QThread *, DBListm_static_pool
 

Friends

class MSqlQuery
 

Detailed Description

DB connection pool, used by MSqlQuery. Do not use directly.

Definition at line 53 of file mythdbcon.h.

Member Typedef Documentation

◆ DBList

typedef QList<MSqlDatabase*> MDBManager::DBList
private

Definition at line 74 of file mythdbcon.h.

Constructor & Destructor Documentation

◆ MDBManager()

MDBManager::MDBManager ( void  )
default

◆ ~MDBManager()

MDBManager::~MDBManager ( void  )

Definition at line 280 of file mythdbcon.cpp.

Member Function Documentation

◆ CloseDatabases()

void MDBManager::CloseDatabases ( void  )

Definition at line 468 of file mythdbcon.cpp.

Referenced by MythContextPrivate::ResetDatabase(), and ~MDBManager().

◆ PurgeIdleConnections()

void MDBManager::PurgeIdleConnections ( bool  leaveOne = false)

Definition at line 374 of file mythdbcon.cpp.

Referenced by popConnection(), and pushConnection().

◆ popConnection()

MSqlDatabase * MDBManager::popConnection ( bool  reuse)
protected

Definition at line 296 of file mythdbcon.cpp.

Referenced by MSqlQuery::InitCon(), and MSqlQuery::testDBConnection().

◆ pushConnection()

void MDBManager::pushConnection ( MSqlDatabase db)
protected

◆ getSchedCon()

MSqlDatabase * MDBManager::getSchedCon ( void  )
protected

Definition at line 458 of file mythdbcon.cpp.

Referenced by MSqlQuery::SchedCon().

◆ getChannelCon()

MSqlDatabase * MDBManager::getChannelCon ( void  )
protected

Definition at line 463 of file mythdbcon.cpp.

Referenced by MSqlQuery::ChannelCon().

◆ getStaticCon()

MSqlDatabase * MDBManager::getStaticCon ( MSqlDatabase **  dbcon,
const QString &  name 
)
private

Definition at line 439 of file mythdbcon.cpp.

Referenced by getChannelCon(), and getSchedCon().

Friends And Related Function Documentation

◆ MSqlQuery

friend class MSqlQuery
friend

Definition at line 55 of file mythdbcon.h.

Member Data Documentation

◆ m_lock

QMutex MDBManager::m_lock
private

Definition at line 73 of file mythdbcon.h.

Referenced by CloseDatabases(), popConnection(), PurgeIdleConnections(), and pushConnection().

◆ m_pool

QHash<QThread*, DBList> MDBManager::m_pool
private

Definition at line 75 of file mythdbcon.h.

Referenced by CloseDatabases(), popConnection(), PurgeIdleConnections(), and pushConnection().

◆ m_inuse

QHash<QThread*, MSqlDatabase*> MDBManager::m_inuse
private

Definition at line 77 of file mythdbcon.h.

Referenced by popConnection(), and pushConnection().

◆ m_inuse_count

QHash<QThread*, int> MDBManager::m_inuse_count
private

Definition at line 78 of file mythdbcon.h.

Referenced by popConnection(), and pushConnection().

◆ m_nextConnID

int MDBManager::m_nextConnID {0}
private

Definition at line 81 of file mythdbcon.h.

Referenced by popConnection(), and PurgeIdleConnections().

◆ m_connCount

int MDBManager::m_connCount {0}
private

Definition at line 82 of file mythdbcon.h.

Referenced by CloseDatabases(), popConnection(), PurgeIdleConnections(), and ~MDBManager().

◆ m_schedCon

MSqlDatabase* MDBManager::m_schedCon {nullptr}
private

Definition at line 84 of file mythdbcon.h.

Referenced by CloseDatabases(), getSchedCon(), and ~MDBManager().

◆ m_channelCon

MSqlDatabase* MDBManager::m_channelCon {nullptr}
private

Definition at line 85 of file mythdbcon.h.

Referenced by CloseDatabases(), getChannelCon(), and ~MDBManager().

◆ m_static_pool

QHash<QThread*, DBList> MDBManager::m_static_pool
private

Definition at line 86 of file mythdbcon.h.

Referenced by CloseDatabases(), and getStaticCon().


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