|
QEloquent 1.1.0
Qt most flexible ORM.
|
Manages database connections and transactions. More...
Public Member Functions | |
| Connection () | |
| Constructs a null connection. | |
| Connection (const Connection &) | |
| Copy constructor. | |
| Connection (Connection &&) | |
| Move constructor. | |
| Connection & | operator= (const Connection &) |
| Copy assignment operator. | |
| Connection & | operator= (Connection &&) |
| Move assignment operator. | |
| ~Connection () | |
| Destructor. | |
| QString | name () const |
| Returns the name of the connection. | |
| bool | isOpen () const |
| Returns true if the connection is currently open. | |
| bool | open () |
| Opens the connection using pre-configured parameters. | |
| bool | open (const QString &user, const QString &password) |
| Opens the connection with specific credentials. | |
| void | close () |
| Closes the connection. | |
| bool | beginTransaction () |
| Begins a SQL transaction. | |
| bool | commitTransaction () |
| Commits the current SQL transaction. | |
| bool | rollbackTransaction () |
| Rolls back the current SQL transaction. | |
| Result< QSqlQuery, QSqlError > | exec (const QString &query, bool cache=false) const |
| Executes a raw SQL query on this connection. | |
| QSqlError | lastError () const |
| Returns the last error encountered by this connection. | |
| const QSqlDatabase | database () const |
| Returns the underlaying QSqlDatabase (const). | |
| QSqlDatabase | database () |
| Returns the underlaying QSqlDatabase. | |
| bool | isValid () const |
| Returns true if this is a valid, initialized connection. | |
| operator const QSqlDatabase () const | |
| Implicit conversion to QSqlDatabase. | |
| operator QSqlDatabase () | |
| Implicit conversion to QSqlDatabase. | |
Static Public Member Functions | |
| static Connection | connection (const QString &name) |
| Retrieves an existing connection by name. | |
| static Connection | addConnection (const QString &name, const QUrl &url) |
| Adds a new connection using a URL. | |
| static Connection | addConnection (const QString &name, const QString &type, const QString &dbName, int port=-1) |
| Adds a new connection with basic parameters. | |
| static Connection | addConnection (const QString &name, const QString &type, const QString &dbName, int port, const QString &userName, const QString &password) |
| Adds a new connection with full credentials. | |
| static Connection | addConnection (const QString &name, const QSqlDatabase &db, bool ownDb=false) |
| Adds a connection from an existing QSqlDatabase instance. | |
| static void | removeConnection (const QString &name) |
| Removes a connection by name. | |
| static Connection | defaultConnection () |
| Returns the default connection instance. | |
| static void | setDefault (const Connection &connection) |
| Sets the default connection. | |
Manages database connections and transactions.
Connection is a thin wrapper around QSqlDatabase that provides easy management of multiple named connections and support for default connections.