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

using DBList = QList< MSqlDatabase * >
 

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_inuseCount
 
int m_nextConnID {0}
 
int m_connCount {0}
 
MSqlDatabasem_schedCon {nullptr}
 
MSqlDatabasem_channelCon {nullptr}
 
QHash< QThread *, DBListm_staticPool
 

Friends

class MSqlQuery
 

Detailed Description

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

Definition at line 54 of file mythdbcon.h.

Member Typedef Documentation

◆ DBList

using MDBManager::DBList = QList<MSqlDatabase*>
private

Definition at line 76 of file mythdbcon.h.

Constructor & Destructor Documentation

◆ MDBManager()

MDBManager::MDBManager ( void  )
default

◆ ~MDBManager()

MDBManager::~MDBManager ( void  )

Definition at line 293 of file mythdbcon.cpp.

Member Function Documentation

◆ CloseDatabases()

void MDBManager::CloseDatabases ( void  )

Definition at line 484 of file mythdbcon.cpp.

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

◆ PurgeIdleConnections()

void MDBManager::PurgeIdleConnections ( bool  leaveOne = false)

Definition at line 389 of file mythdbcon.cpp.

Referenced by popConnection(), and pushConnection().

◆ popConnection()

MSqlDatabase * MDBManager::popConnection ( bool  reuse)
protected

Definition at line 309 of file mythdbcon.cpp.

◆ pushConnection()

void MDBManager::pushConnection ( MSqlDatabase db)
protected

Definition at line 361 of file mythdbcon.cpp.

Referenced by MSqlQuery::~MSqlQuery().

◆ getSchedCon()

MSqlDatabase * MDBManager::getSchedCon ( void  )
protected

Definition at line 474 of file mythdbcon.cpp.

◆ getChannelCon()

MSqlDatabase * MDBManager::getChannelCon ( void  )
protected

Definition at line 479 of file mythdbcon.cpp.

◆ getStaticCon()

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

Definition at line 455 of file mythdbcon.cpp.

Referenced by getChannelCon(), and getSchedCon().

Friends And Related Function Documentation

◆ MSqlQuery

friend class MSqlQuery
friend

Definition at line 56 of file mythdbcon.h.

Member Data Documentation

◆ m_lock

QMutex MDBManager::m_lock
private

Definition at line 75 of file mythdbcon.h.

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

◆ m_pool

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

Definition at line 77 of file mythdbcon.h.

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

◆ m_inuse

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

Definition at line 79 of file mythdbcon.h.

Referenced by popConnection(), and pushConnection().

◆ m_inuseCount

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

Definition at line 80 of file mythdbcon.h.

Referenced by popConnection(), and pushConnection().

◆ m_nextConnID

int MDBManager::m_nextConnID {0}
private

Definition at line 83 of file mythdbcon.h.

Referenced by popConnection(), and PurgeIdleConnections().

◆ m_connCount

int MDBManager::m_connCount {0}
private

Definition at line 84 of file mythdbcon.h.

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

◆ m_schedCon

MSqlDatabase* MDBManager::m_schedCon {nullptr}
private

Definition at line 86 of file mythdbcon.h.

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

◆ m_channelCon

MSqlDatabase* MDBManager::m_channelCon {nullptr}
private

Definition at line 87 of file mythdbcon.h.

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

◆ m_staticPool

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

Definition at line 88 of file mythdbcon.h.

Referenced by CloseDatabases(), and getStaticCon().


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