# LogDoctor: DatabaseWrapper Class Reference

Loading...
Searching...
No Matches
DatabaseWrapper Class Referencefinal

DatabaseWrapper. More...

`#include <database.h>`

## Public Member Functions

QSqlDatabase * | operator-> () noexcept
| Returns a pointer to the underlying QSqlDatabase instance.
QSqlDatabase & | operator* () noexcept
| Returns a reference to the underlying QSqlDatabase instance.
const QString & | name () const noexcept
| Returns the name of the database.
void | open (const std::string &path, const bool explain_err)
| Opens the database file at the given path.
void | openNew (const std::string &path)
| Opens the database file at the given path.
void | startTransaction (const bool explain_msg, const bool explain_err)
| Starts an ACID transaction on the database.
void | commitTransaction (const bool explain_msg, const bool explain_err)
| Commits an ongoing transaction.
void | rollbackTransaction (const bool explain_msg, const bool explain_err)
| Rolls back an ongoing transaction.
QueryWrapper | getQuery () noexcept
| Returns an instance of a QueryWrapper associated with the database.

## Detailed Description

DatabaseWrapper.

A wrapper around a QSqlDatabase

## Member Function Documentation

## commitTransaction()

void DatabaseWrapper::commitTransaction | ( | const bool | explain_msg,
|  | const bool | explain_err )

Commits an ongoing transaction.

Throws in case of failure

Exceptions

  VoidException |

## open()

void DatabaseWrapper::open | ( | const std::string & | path,
|  | const bool | explain_err )

Opens the database file at the given path.

Throws if the file cannot be opened or if opening fails

Exceptions

  VoidException |

## openNew()

void DatabaseWrapper::openNew | ( | const std::string & | path | ) |

Opens the database file at the given path.

Used when creating a new database file. Throws if opening fails.

Exceptions

  VoidException |

## rollbackTransaction()

void DatabaseWrapper::rollbackTransaction | ( | const bool | explain_msg,
|  | const bool | explain_err )

Rolls back an ongoing transaction.

Throws in case of failure

Exceptions

  VoidException |

## startTransaction()

void DatabaseWrapper::startTransaction | ( | const bool | explain_msg,
|  | const bool | explain_err )

Starts an ACID transaction on the database.

Throws in case of failure

Exceptions

  VoidException |

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

- logdoctor/modules/database/database.h
- logdoctor/modules/database/database.cpp