Documentation

DriverBase
in package

AbstractYes

This is an abstract class that serves as the base for all database driver's classes.

It provides common functionality and properties that are shared among different database drivers.

Table of Contents

Properties

$driver  : string
$dsnParams  : array<string, string>
$password  : string
$pdo  : PDO|null
$username  : string

Methods

connect()  : Mysql|Firebird|Oci|Pgsql
Establishes a connection to the database using the provided DSN, username, and password.
disconnect()  : void
Disconnects from the database.
driverSupportsLastInsertId()  : bool
Determines if the driver supports the last insert ID feature.
getDeleteSql()  : string
getDriver()  : string
Returns the driver name for the connection.
getDriverColumnName()  : string
Returns the name of the driver column.
getGetColumnsSql()  : string
Returns the SQL query to retrieve the columns of a table.
getGetTablesSql()  : string
Returns the SQL query to retrieve the list of tables in the database.
getLimitSql()  : string
Retrieves the SQL query for applying a limit to the result set based on the specific driver.
getPdo()  : PDO
Returns the PDO object representing the database connection.

Properties

$dsnParams

protected array<string, string> $dsnParams = []

The array to store the connection details.

Methods

connect()

Establishes a connection to the database using the provided DSN, username, and password.

public abstract connect(array<string, string> $dsn, string $username, string $password) : Mysql|Firebird|Oci|Pgsql
Parameters
$dsn : array<string, string>

The data source name.

$username : string

The username for the database connection.

$password : string

The password for the database connection.

Return values
Mysql|Firebird|Oci|Pgsql

The object representing the database driver.

disconnect()

Disconnects from the database.

public disconnect() : void

driverSupportsLastInsertId()

Determines if the driver supports the last insert ID feature.

public abstract driverSupportsLastInsertId() : bool
Return values
bool

True if the driver supports last insert ID, false otherwise.

getDeleteSql()

public abstract getDeleteSql(string $table, string $where) : string
Parameters
$table : string
$where : string
Return values
string

getDriver()

Returns the driver name for the connection.

public getDriver() : string
Return values
string

The driver name.

getDriverColumnName()

Returns the name of the driver column.

public abstract getDriverColumnName() : string
Return values
string

The name of the driver column.

getGetColumnsSql()

Returns the SQL query to retrieve the columns of a table.

public abstract getGetColumnsSql(string $table) : string
Parameters
$table : string

The name of the table.

Return values
string

The SQL query to retrieve the columns of the table.

getGetTablesSql()

Returns the SQL query to retrieve the list of tables in the database.

public abstract getGetTablesSql() : string
Return values
string

The SQL query.

getLimitSql()

Retrieves the SQL query for applying a limit to the result set based on the specific driver.

public abstract getLimitSql(string $limit) : string
Parameters
$limit : string

The limit to be applied to the result set.

Return values
string

The SQL query for applying the limit.

getPdo()

Returns the PDO object representing the database connection.

public getPdo() : PDO
Return values
PDO

The PDO object representing the database connection.


        
On this page

Search results