Class MOXMAN_Util_Pdo

InheritanceMOXMAN_Util_Pdo » PDO

This class extends the PHP PDO class and adds table prefix support to all queries. It also provides some helper functions.

Public Methods

Hide inherited methods

MethodDescriptionDefined By
__construct() Constructs a new PDO intance. MOXMAN_Util_Pdo
exec() Executes the specified query and returns a statement. MOXMAN_Util_Pdo
getDriverName() Returns the name of the current driver. For example: mysql. MOXMAN_Util_Pdo
getSqliteFilePath() Returns the Sqlite filepath. MOXMAN_Util_Pdo
i() Executes the specified query and returns the first column as an integer. MOXMAN_Util_Pdo
prepare() Creates a new prepared statment instance. MOXMAN_Util_Pdo
q() Executes the specified query. MOXMAN_Util_Pdo
qrs() Executes the specified query and returns and array with assoc arrays. MOXMAN_Util_Pdo
query() Executes the specified query. MOXMAN_Util_Pdo

Method Details

__construct() public method

Constructs a new PDO intance.

public void __construct ( $dsn, $user null, $password null, $driverOptions = [], $prefix null )
$dsn string

Connection string.

$user string

User to login to database with.

$password string

Password to login to database with.

$driverOptions Array

Various driver option.

$prefix string

Table prefix to use instead of the default one.

exec() public method

Executes the specified query and returns a statement.

public PDOStatement exec ( $statement )
$statement string

This is a description

return PDOStatement

Query statement.

getDriverName() public method

Returns the name of the current driver. For example: mysql.

public String getDriverName ( )
return String

Currently used driver name.

getSqliteFilePath() public method

Returns the Sqlite filepath.

public String getSqliteFilePath ( )
return String

Sqlfile path.

i() public method

Executes the specified query and returns the first column as an integer.

public int i ( $statement )
$statement string

Statement to execute.

return int

First column as an integer.

prepare() public method

Creates a new prepared statment instance.

public void prepare ( $statement, $driverOptions = [] )
$statement string

Statement to prepare.

$driverOptions Array

Array with driver options.

q() public method

Executes the specified query.

public PDOStatement q ( $statement )
$statement string

This is a description

return PDOStatement

Query statement.

qrs() public method

Executes the specified query and returns and array with assoc arrays.

public Array qrs ( $statement )
$statement string

This is a description

return Array

Array of result items.

query() public method

Executes the specified query.

public PDOStatement query ( $statement )
$statement string

This is a description

return PDOStatement

Query statement.