Properties

$host

$host : string

Type

string — - The server IP or host name

$user

$user : string

Type

string — - The server user to login as

$password

$password : string

Type

string — - The user password

$dbName

$dbName : string

Type

string — - The name of the database

$dsn

$dsn : string

Type

string — - Alternative DSN string

$connection

$connection : \PDO

Type

\PDO — - The DB connection session

Methods

__construct()

__construct(string $hostOrDSN, string $dbName)

Initializes the Database object

Parameters

string $hostOrDSN
  • The domain/IP of the DB or the PDO DSN string
string $dbName
  • The name of the database

getTable()

getTable(mixed $tableName) : \ptejada\uFlex\DB_Table

Get table object

Parameters

mixed $tableName

Returns

\ptejada\uFlex\DB_Table

setUser()

setUser(string $user)

Set the database username

Parameters

string $user

setPassword()

setPassword(string $password)

Set the database user password

Parameters

string $password

setDbName()

setDbName(string $dbName)

Set the name of the Database to connect to

Parameters

string $dbName

getLastInsertedID()

getLastInsertedID() : int

Get the record of the last inserted record

Returns

int

getConnection()

getConnection() : \PDO

Gets the connecting to the database Check if the database connection exists if not connects to the database

Returns

\PDO —

| bool

generateDSN()

generateDSN() : string

Generate the DSN string for the connection

Returns

string