A PDO Adapter implementation.

This adapter will run whatever query you throw at it, so all of the data validation/sanitation should be done before your run it through the adapter.

package Cactus
author Dave Widmer

 Methods

Creates a new PDO Adapter with the connection information passed in.

__construct(PDO $connection) 

Parameters

$connection

\PDO

The PDO connection information.

Runs a query that will remove data.

delete(string $query, array $params) : int

Parameters

$query

string

The query to run

$params

array

A list of parameters to bind to the query

Returns

intThe number of deleted rows

Gets a list of all of the queries that have been run.

getQueries() : array

Returns

array

Runs a query that will add data to the dataset

insert(string $query, array $params) : array

Parameters

$query

string

The query to run.

$params

array

A list of parameters to bind to the query

Returns

arrayarray($insert_id, $affected_rows);

Runs a raw query.

query(string $query) : boolean

Parameters

$query

string

The query

Returns

booleanSuccess

Runs a query to find data in the dataset.

select(string $query, array $params) : array

Parameters

$query

string

The query to run.

$params

array

A list of parameters to bind to the query

Returns

arrayThe result set from the query

Runs a query that will update data

update(string $query, array $params) : int

Parameters

$query

string

The query to run

$params

array

A list of parameters to bind to the query

Returns

intThe number of affected rows

Runs a SQL query and handles any errors.

run(string $query, array $params) : array

Parameters

$query

string

The SQL query to run

$params

Exceptions

\Cactus\Exception

Returns

array[\PDOStatement, (boolean) success]

 Properties

 

The PDO connection object

$connection : \PDO

 

An internal list of queries run

$queries : array