1. Home
  2. Docs
  3. DBManager
  4. Headers

Headers

The DBManager library header has two different classes with their respective class methods, besides the auxiliar enumerator. Together they perform what has been promised.

  • DBData: Auxiliar class which helps to configure the database connection.
  • DBManager: Singleton class which manages a unique connection between the application and the database.
  • DBConnectionType: Enumerator which is used to specify the database driver that the application must use.

DBData

Return Method name
DBData DBData()
void setHostName(const QString &host)
void setDatabaseName(const QString &name)
void setUserName(const QString &name)
void setPassword(const QString &password)
void setConnectionName(const QString &cName)
void setConnectOptions(const QString &options)
void setTablePrefix(const QString &prefix)
void setNumericalPrecisionPolicy(QSql::NumericalPrecisionPolicy precisionPolicy)
void setDatabaseConnectionType(DBConnectionType type)
void setPort(int port)
QString hostName()
QString databaseName()
QString username()
QString password()
QString connectionName()
QString connectOptions()
QString tablePrefix()
QSql::NumericalPrecisionPolicy numericalPrecisionPolicy()
DBConnectionType connectionType()
int port()

DBManager

Static methods

Return Method name
DBManager * getInstance(const DBData &data = DBData())
QVariant pixmapToVariant(const QPixmap &pixmap)
QPixmap variantToPixmap(const QVariant &variant)
QString getUniqueConnectionName(const QString &partname = "")

Class methods

Return Method name
bool removeInstance()
bool createTable(const QString &tableName, const QStringList &columns)
bool insertRow(const QString &tableName, const QStringList &columnName, const QVariantList &data)
bool updateRow(const QString &tableName, const QString &columnNameCond, const QVariant &condition, const QStringList &columnName, const QVariantList &data, const QString &operation = "=")
bool updateRow(const QString &tableName, const QStringList &columnNameCond, const QVariantList &condition, const QStringList &columnName, const QVariantList &data, const QString &operation = "=")
bool removeRow(const QString &tableName, const QString &columnNameCond, const QVariant &condition, const QString &operation = "=")
bool removeRow(const QString &tableName, const QStringList &columnNameCond, const QVariantList &condition, const QString &operation = "=")
bool rowExists(const QString &tableName, const QString &columnNameCond, const QVariant &data, const QString &operation = "=")
bool rowExists(const QString &tableName, const QStringList &columnNameCond, const QVariantList &data, const QString &operation = "=")
QVariantList retrieveRow(const QString &tableName, const QString &columnNameCond, const QVariant &condition, const QString &operation = "=")
QVariantList retrieveRow(const QString &tableName, const QStringList &columnNameCond, const QVariantList &condition, const QString &operation = "=")
QVariantList retrieveRow(const QString &tableName, const QStringList &columnNameCond, const QVariantList &condition, QStringList columnName, const QString &operation = "=")
QList< QVariantList > retrieveAll(const QString &tableName, const QStringList &columns = QStringList(), const QStringList &groupby = QStringList(), const QStringList &orderby = QStringList())
QList< QVariantList > retrieveAllCond(const QString &tableName, const QString &columnCondition, const QVariant &condition, const QString &operation = "=", const QStringList &orderby = QStringList())
QList< QVariantList > retrieveAllCond(const QString &tableName, const QStringList &columnCondition, const QVariantList &condition, const QString &operation = "=", const QStringList &orderby = QStringList())
QList< QVariantList > retrieveAllCond(const QString &tableName, const QStringList &columnName, const QString &columnCondition, const QVariant &condition, const QString &operation = "=", const QStringList &groupby = QStringList(), const QStringList &orderby = QStringList())
QList< QVariantList > retrieveAllCond(const QString &tableName, const QStringList &columnName, const QStringList &columnCondition, const QVariantList &condition, const QString &operation = "=", const QStringList &groupby = QStringList(), const QStringList &orderby = QStringList())
int rowsCount(const QString &tableName)
int rowsCountCond(const QString &tableName, const QString &columnCondition, const QVariant &condition, const QString &operation = "=")
int rowsCountCond(const QString &tableName, const QStringList &columnCondition, const QVariantList &condition, const QString &operation = "=")
bool clearTable(const QString &tableName)
bool dropTable(const QString &tableName)
QSqlQuery createCustomQuery(const QString &query = "")
bool setConnectionType(DBConnectionType cType)
DBConnectionType connectionType()
bool setConnectionName(const QString &cName)
QString currentConnectionName()
bool setDBPrefix(const QString &prefix)
QString dbPrefix()
bool setDatabaseData(const DBManager::DBData &dbData)
DBManager::DBData databaseData()

DBConnectionType


Articles