KanoopDatabaseQt 1.1.1
Qt database abstraction library
Loading...
Searching...
No Matches
DatabaseCredentials Class Reference

DatabaseCredentials. More...

#include <databasecredentials.h>

Public Member Functions

 DatabaseCredentials ()
 Construct default (empty) credentials.
 
 DatabaseCredentials (const QString &host, const QString &schema, const QString &username, const QString &password, const QString &engine)
 Construct credentials with all connection parameters.
 
 DatabaseCredentials (const QString &schema)
 Construct SQLite credentials with only a schema (file path).
 
QString host () const
 Get the database server hostname.
 
void setHost (const QString &value)
 Set the database server hostname.
 
QString schema () const
 Get the database/schema name.
 
void setSchema (const QString &value)
 Set the database/schema name.
 
QString username () const
 Get the database username.
 
void setUsername (const QString &value)
 Set the database username.
 
QString password () const
 Get the database password.
 
void setPassword (const QString &value)
 Set the database password.
 
QString engine () const
 Get the database engine identifier.
 
void setEngine (const QString &value)
 Set the database engine identifier.
 
bool isSqlite () const
 Return true if the engine is SQLite.
 
bool isValid () const
 Return true if the credentials have a non-empty schema.
 

Static Public Attributes

static const QString SQLENG_SQLITE
 Engine identifier string for SQLite.
 
static const QString SQLENG_MYSQL
 Engine identifier string for MySQL.
 
static const QString SQLENG_PGSQL
 Engine identifier string for PostgreSQL.
 

Detailed Description

DatabaseCredentials.

Represents a set of database credentials for use by the DataSource class

Stephen Punak, January 11 2025

Represents a set of database connection credentials for use by the DataSource class.

Definition at line 14 of file databasecredentials.h.

Constructor & Destructor Documentation

◆ DatabaseCredentials() [1/3]

DatabaseCredentials::DatabaseCredentials ( )
inline

Construct default (empty) credentials.

Definition at line 18 of file databasecredentials.h.

◆ DatabaseCredentials() [2/3]

DatabaseCredentials::DatabaseCredentials ( const QString &  host,
const QString &  schema,
const QString &  username,
const QString &  password,
const QString &  engine 
)
inline

Construct credentials with all connection parameters.

Parameters
hostThe database server hostname or IP address.
schemaThe database/schema name.
usernameThe database username.
passwordThe database password.
engineThe database engine identifier (e.g. SQLENG_SQLITE, SQLENG_MYSQL).

Definition at line 27 of file databasecredentials.h.

◆ DatabaseCredentials() [3/3]

DatabaseCredentials::DatabaseCredentials ( const QString &  schema)
inline

Construct SQLite credentials with only a schema (file path).

Parameters
schemaThe SQLite database file path.

Definition at line 33 of file databasecredentials.h.

Member Function Documentation

◆ engine()

QString DatabaseCredentials::engine ( ) const
inline

Get the database engine identifier.

Returns
The engine string (e.g. SQLENG_SQLITE, SQLENG_MYSQL).

Definition at line 75 of file databasecredentials.h.

◆ host()

QString DatabaseCredentials::host ( ) const
inline

Get the database server hostname.

Returns
The hostname or IP address.

Definition at line 39 of file databasecredentials.h.

◆ isSqlite()

bool DatabaseCredentials::isSqlite ( ) const
inline

Return true if the engine is SQLite.

Returns
true if the engine is SQLite.

Definition at line 84 of file databasecredentials.h.

References SQLENG_SQLITE.

Referenced by DataSource::isSqlite().

◆ isValid()

bool DatabaseCredentials::isValid ( ) const
inline

Return true if the credentials have a non-empty schema.

Returns
true if a schema has been set.

Definition at line 88 of file databasecredentials.h.

◆ password()

QString DatabaseCredentials::password ( ) const
inline

Get the database password.

Returns
The password string.

Definition at line 66 of file databasecredentials.h.

◆ schema()

QString DatabaseCredentials::schema ( ) const
inline

Get the database/schema name.

Returns
The schema name or SQLite file path.

Definition at line 48 of file databasecredentials.h.

◆ setEngine()

void DatabaseCredentials::setEngine ( const QString &  value)
inline

Set the database engine identifier.

Parameters
valueThe engine string (e.g. SQLENG_SQLITE).

Definition at line 79 of file databasecredentials.h.

◆ setHost()

void DatabaseCredentials::setHost ( const QString &  value)
inline

Set the database server hostname.

Parameters
valueThe hostname or IP address.

Definition at line 43 of file databasecredentials.h.

◆ setPassword()

void DatabaseCredentials::setPassword ( const QString &  value)
inline

Set the database password.

Parameters
valueThe password.

Definition at line 70 of file databasecredentials.h.

◆ setSchema()

void DatabaseCredentials::setSchema ( const QString &  value)
inline

Set the database/schema name.

Parameters
valueThe schema name or SQLite file path.

Definition at line 52 of file databasecredentials.h.

◆ setUsername()

void DatabaseCredentials::setUsername ( const QString &  value)
inline

Set the database username.

Parameters
valueThe username.

Definition at line 61 of file databasecredentials.h.

◆ username()

QString DatabaseCredentials::username ( ) const
inline

Get the database username.

Returns
The username string.

Definition at line 57 of file databasecredentials.h.

Member Data Documentation

◆ SQLENG_MYSQL

const QString DatabaseCredentials::SQLENG_MYSQL
static

Engine identifier string for MySQL.

Definition at line 93 of file databasecredentials.h.

◆ SQLENG_PGSQL

const QString DatabaseCredentials::SQLENG_PGSQL
static

Engine identifier string for PostgreSQL.

Definition at line 95 of file databasecredentials.h.

◆ SQLENG_SQLITE

const QString DatabaseCredentials::SQLENG_SQLITE
static

Engine identifier string for SQLite.

Definition at line 91 of file databasecredentials.h.

Referenced by isSqlite().


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