Akonadi::Server::DbIntrospector
#include <dbintrospector.h>
Classes | |
class | ForeignKey |
Public Types | |
using | Ptr = QSharedPointer<DbIntrospector> |
Public Member Functions | |
virtual QList< ForeignKey > | foreignKeyConstraints (const QString &tableName) |
virtual QString | getAutoIncrementValueQuery (const QString &tableName, const QString &columnName)=0 |
virtual bool | hasColumn (const QString &tableName, const QString &columnName) |
virtual bool | hasIndex (const QString &tableName, const QString &indexName) |
virtual bool | hasTable (const QString &tableName) |
virtual bool | isTableEmpty (const QString &tableName) |
virtual QString | updateAutoIncrementValueQuery (const QString &tableName, const QString &columnName, qint64 value)=0 |
Static Public Member Functions | |
static DbIntrospector::Ptr | createInstance (const QSqlDatabase &database) |
Protected Member Functions | |
DbIntrospector (const QSqlDatabase &database) | |
virtual QString | hasIndexQuery (const QString &tableName, const QString &indexName) |
Protected Attributes | |
QSqlDatabase | m_database |
Detailed Description
Methods for introspecting the current state of a database schema.
I.e. this is about the structure of a database, not its content.
Definition at line 24 of file dbintrospector.h.
Member Typedef Documentation
◆ Ptr
Definition at line 27 of file dbintrospector.h.
Constructor & Destructor Documentation
◆ ~DbIntrospector()
|
virtual |
Definition at line 43 of file dbintrospector.cpp.
◆ DbIntrospector()
|
protected |
Creates a new database introspector, call from subclass.
- Parameters
-
database The database to introspect.
Definition at line 38 of file dbintrospector.cpp.
Member Function Documentation
◆ createInstance()
|
static |
Returns an introspector instance for a given database.
Definition at line 22 of file dbintrospector.cpp.
◆ foreignKeyConstraints()
|
virtual |
Returns the foreign key constraints on table tableName
.
The default implementation returns an empty list, so any backend supporting referential integrity should reimplement this.
Definition at line 97 of file dbintrospector.cpp.
◆ getAutoIncrementValueQuery()
|
pure virtual |
Returns query to retrieve the next autoincrement value for tableName
.
columnName
.
◆ hasColumn()
Check whether table tableName
has a column named columnName
.
The default implementation should work with all backends.
Definition at line 61 of file dbintrospector.cpp.
◆ hasIndex()
Returns true
of the given table has an index with the given name.
The default implementation performs the query returned by hasIndexQuery().
- See also
- hasIndexQuery()
- Exceptions
-
DbException on database errors.
Definition at line 52 of file dbintrospector.cpp.
◆ hasIndexQuery()
|
protectedvirtual |
Returns a query string to determine if tableName
has an index indexName
.
The query is expected to have one boolean result row/column. This is used by the default implementation of hasIndex() only, thus reimplementation is not necessary if you reimplement hasIndex() The default implementation asserts.
Definition at line 103 of file dbintrospector.cpp.
◆ hasTable()
|
virtual |
Returns true
if table tableName
exists.
The default implementation relies on QSqlDatabase::tables(). Usually this does not need to be reimplemented.
Definition at line 47 of file dbintrospector.cpp.
◆ isTableEmpty()
|
virtual |
Check whether table tableName
is empty, ie.
does not contain any rows. The default implementation should work for all backends.
- Exceptions
-
DbException on database errors.
Definition at line 83 of file dbintrospector.cpp.
◆ updateAutoIncrementValueQuery()
|
pure virtual |
Returns query to update the next autoincrement value for tableName
.
columnName
to value value
.
Member Data Documentation
◆ m_database
|
protected |
The database connection we are introspecting.
Definition at line 111 of file dbintrospector.h.
The documentation for this class was generated from the following files:
Documentation copyright © 1996-2024 The KDE developers.
Generated on Sat Dec 21 2024 17:01:43 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.