sptk2 logo
SPTK Home Page
Public Member Functions | Protected Member Functions | List of all members
sptk::DatabaseConnectionString Class Reference

#include <DatabaseConnectionString.h>

Inheritance diagram for sptk::DatabaseConnectionString:
sptk::DatabaseConnectionPool

Public Member Functions

 DatabaseConnectionString (const String &connectionString="")
 
 DatabaseConnectionString (const DatabaseConnectionString &cs)=default
 
DatabaseConnectionStringoperator= (const DatabaseConnectionString &cs)=default
 
String toString () const
 
const StringdriverName () const
 
const StringhostName () const
 
const StringuserName () const
 
const Stringpassword () const
 
const StringdatabaseName () const
 
const Stringschema () const
 
uint16_t portNumber () const
 
void userName (const String &user)
 
void password (const String &pass)
 
String parameter (const String &name) const
 
bool empty () const
 

Protected Member Functions

void parse ()
 

Detailed Description

Database Connection String

Database connection string includes driver name ('odbc', 'sqlite3', etc) as a protocol name, and username, password, server name in a traditional form. Database name is optionally defined after server name and '/' delimiter.

Example: drivername://[username:password]@servername[:port]/databasename

Some driver-specific parameters may be passed after '?': drivername://username:password@servername/databasename?timeout=10&reconnect=30

This class is thread-safe.

Constructor & Destructor Documentation

◆ DatabaseConnectionString() [1/2]

sptk::DatabaseConnectionString::DatabaseConnectionString ( const String connectionString = "")
inlineexplicit

Constructor

Parameters
connectionStringDatabase connection string

◆ DatabaseConnectionString() [2/2]

sptk::DatabaseConnectionString::DatabaseConnectionString ( const DatabaseConnectionString cs)
default

Copy constructor

Parameters
csDatabase connection string object to copy from

Member Function Documentation

◆ databaseName()

const String & sptk::DatabaseConnectionString::databaseName ( ) const
inline

Returns database name

◆ driverName()

const String & sptk::DatabaseConnectionString::driverName ( ) const
inline

Returns driver name

◆ empty()

bool sptk::DatabaseConnectionString::empty ( ) const

Is connection string empty?

◆ hostName()

const String & sptk::DatabaseConnectionString::hostName ( ) const
inline

Returns host name

◆ operator=()

DatabaseConnectionString & sptk::DatabaseConnectionString::operator= ( const DatabaseConnectionString cs)
default

Assignment

Parameters
csDatabase connection string object to copy from

◆ parameter()

String sptk::DatabaseConnectionString::parameter ( const String name) const

Return optional parameter value

Parameters
nameParameter name
Returns
parameter value

◆ parse()

void sptk::DatabaseConnectionString::parse ( )
protected

Parses connection string

◆ password() [1/2]

const String & sptk::DatabaseConnectionString::password ( ) const
inline

Returns user password

◆ password() [2/2]

void sptk::DatabaseConnectionString::password ( const String pass)
inline

Set new password

Parameters
passNew password

◆ portNumber()

uint16_t sptk::DatabaseConnectionString::portNumber ( ) const
inline

Returns server port number

◆ schema()

const String & sptk::DatabaseConnectionString::schema ( ) const
inline

Returns schema name

◆ toString()

String sptk::DatabaseConnectionString::toString ( ) const

Returns connection string

◆ userName() [1/2]

const String & sptk::DatabaseConnectionString::userName ( ) const
inline

Returns user name

◆ userName() [2/2]

void sptk::DatabaseConnectionString::userName ( const String user)
inline

Set new user name

Parameters
userNew user name

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

Fri Oct 14 2022 09:58:41: SPTK 5.4.1