This class is used to declare public functions

package OWR
subpackage Interfaces

 Methods

Constructor It will try to connect to the database and set utf8 character set @ and set the default cache life time

__construct() 
access public
author Pierre-Alain Mignot

Starts transaction mode

beginTransaction() 
access public
author Pierre-Alain Mignot

Executes a query (cached)

cExecute(string $sql, \OWR\DB\Request $datas, boolean $prepare) : \OWR\Interfaces\OWR\DB\Result
access public
author Pierre-Alain Mignot

Parameters

$sql

string

the query

$datas

\OWR\Interfaces\OWR\Request

the request

$prepare

boolean

prepare or not the query

Returns

\OWR\Interfaces\OWR\DB\Resultthe result

Executes a prepared query (cached)

cExecuteP(string $sql, \OWR\DB\Request $datas) : \OWR\Interfaces\OWR\DB\Result
access public
author Pierre-Alain Mignot

Parameters

$sql

string

the query

$datas

\OWR\Interfaces\OWR\Request

the request

Returns

\OWR\Interfaces\OWR\DB\Resultthe result

Executes a query (cached) and returns all the rows

cGetAll(string $sql, string $action) : \OWR\Interfaces\OWR\DB\Result
access public
author Pierre-Alain Mignot

Parameters

$sql

string

the query

$action

string

the action

Returns

\OWR\Interfaces\OWR\DB\Resultthe result

Executes a prepared query (cached) and returns all the rows

cGetAllP(string $sql, \OWR\DB\Request $datas, string $action, boolean $prepare) : \OWR\Interfaces\OWR\DB\Result
access public
author Pierre-Alain Mignot

Parameters

$sql

string

the query

$datas

\OWR\Interfaces\OWR\Request

the request

$action

string

the action

$prepare

boolean

prepare or not the query

Returns

\OWR\Interfaces\OWR\DB\Resultthe result

Executes a query (cached) and returns the first field from the first row

cGetOne(string $sql) : \OWR\Interfaces\OWR\DB\Result
access public
author Pierre-Alain Mignot

Parameters

$sql

string

the query

Returns

\OWR\Interfaces\OWR\DB\Resultthe result

Executes a prepared query (cached) and returns the first field from the first row

cGetOneP(string $sql, \OWR\DB\Request $datas, string $prepared) : \OWR\Interfaces\OWR\DB\Result
access public
author Pierre-Alain Mignot

Parameters

$sql

string

the query

$datas

\OWR\Interfaces\OWR\Request

the request

$prepared

string

prepare or not the query

Returns

\OWR\Interfaces\OWR\DB\Resultthe result

Executes a query (cached) and returns the first row

cGetRow(string $sql) : \OWR\Interfaces\OWR\DB\Result
access public
author Pierre-Alain Mignot

Parameters

$sql

string

the query

Returns

\OWR\Interfaces\OWR\DB\Resultthe result

Executes a prepared query (cached) and returns the first row

cGetRowP(string $sql, \OWR\DB\Request $datas, string $prepared) : \OWR\Interfaces\OWR\DB\Result
access public
author Pierre-Alain Mignot

Parameters

$sql

string

the query

$datas

\OWR\Interfaces\OWR\Request

the request

$prepared

string

prepare or not the query

Returns

\OWR\Interfaces\OWR\DB\Resultthe result

Commits to the database

commit(mixed $stmt) 
access public
author Pierre-Alain Mignot

Parameters

$stmt

mixed

the PDOStatement to unset, optionnal

Executes a query

execute(string $sql, \OWR\DB\Request $datas, boolean $prepare) : \OWR\Interfaces\OWR\DB\Result
access public
author Pierre-Alain Mignot

Parameters

$sql

string

the query

$datas

\OWR\Interfaces\OWR\Request

the request

$prepare

boolean

prepare or not the query

Returns

\OWR\Interfaces\OWR\DB\Resultthe result

Executes a prepared query

executeP(string $sql, \OWR\DB\Request $datas) : mixed
access public
author Pierre-Alain Mignot

Parameters

$sql

string

the query

$datas

\OWR\Interfaces\OWR\Request

the request

Returns

mixedan Result

Executes a query and returns the result

get(string $sql, \OWR\DB\Request $datas, string $action, boolean $returnId) : mixed
access public
author Pierre-Alain Mignot

Parameters

$sql

string

the query

$datas

\OWR\Interfaces\OWR\Request

the request

$action

string

the action

$returnId

boolean

shall we return ID of the inserted row

Returns

mixeda PDOStatement or the inserted ID

Executes a query and returns all the rows

getAll(string $sql, string $action) : \OWR\Interfaces\OWR\DB\Result
access public
author Pierre-Alain Mignot

Parameters

$sql

string

the query

$action

string

the action

Returns

\OWR\Interfaces\OWR\DB\Resultthe result

Executes a prepared query and returns all the rows

getAllP(string $sql, \OWR\DB\Request $datas, string $action, string $prepare) : \OWR\Interfaces\OWR\DB\Result
access public
author Pierre-Alain Mignot

Parameters

$sql

string

the query

$datas

\OWR\Interfaces\OWR\Request

the request

$action

string

the action

$prepare

string

prepare or not the query

Returns

\OWR\Interfaces\OWR\DB\Resultthe result

Executes a query and returns the first field of the first row of the result

getOne(string $sql) : \OWR\Interfaces\OWR\DB\Result
access public
author Pierre-Alain Mignot

Parameters

$sql

string

the query

Returns

\OWR\Interfaces\OWR\DB\Resultthe result

Executes a prepared query and returns the first field of the first row of the result

getOneP(string $sql, \OWR\DB\Request $datas, boolean $prepared) : \OWR\Interfaces\OWR\DB\Result
access public
author Pierre-Alain Mignot

Parameters

$sql

string

the query

$datas

\OWR\Interfaces\OWR\Request

the request

$prepared

boolean

prepare the query or not

Returns

\OWR\Interfaces\OWR\DB\Resultthe result

Executes a prepared query and returns the result

getP(string $sql, \OWR\DB\Request $datas, string $action, string $prepare, boolean $returnId) : mixed
access public
author Pierre-Alain Mignot

Parameters

$sql

string

the query

$datas

\OWR\Interfaces\OWR\Request

the request

$action

string

the action

$prepare

string

prepare or not the query

$returnId

boolean

shall we return ID of the inserted row

Returns

mixeda PDOStatement or the inserted ID

Executes a query and returns the first row of the result

getRow(string $sql) : \OWR\Interfaces\OWR\DB\Result
access public
author Pierre-Alain Mignot

Parameters

$sql

string

the query

Returns

\OWR\Interfaces\OWR\DB\Resultthe result

Executes a prepared query and returns the first row of the result

getRowP(string $sql, \OWR\DB\Request $datas, boolean $prepared) : \OWR\Interfaces\OWR\DB\Result
access public
author Pierre-Alain Mignot

Parameters

$sql

string

the query

$datas

\OWR\Interfaces\OWR\Request

the request

$prepared

boolean

prepare the query or not

Returns

\OWR\Interfaces\OWR\DB\Resultthe result

Returns the added microtime of all SQL queries

getTime() : float
Static
access public
author Pierre-Alain Mignot

Returns

float$_queryTime

Singleton pattern getter

iGet() : mixed
Static
access public
static
author Pierre-Alain Mignot

Returns

mixedinstance of this object

Rollback function for transaction mode

rollback() 
access public
author Pierre-Alain Mignot

Function to quote values (sanitize)

sanitize(mixed $datas) 
access public
author Pierre-Alain Mignot

Parameters

$datas

mixed

string or array to sanitize

Executes a query and returns the result

set(string $sql, \OWR\DB\Request $datas, string $action, boolean $returnId) : mixed
access public
author Pierre-Alain Mignot

Parameters

$sql

string

the query

$datas

\OWR\Interfaces\OWR\Request

the request

$action

string

the action

$returnId

boolean

returns the id of the inserted row

Returns

mixedthe result/statement/id

Sets the cache lifetime

setCacheTime(int $cacheTime) 
access public
author Pierre-Alain Mignot

Parameters

$cacheTime

int

the cache time, in seconds

Changes database

setDB(string $db) 
access public
author Pierre-Alain Mignot

Parameters

$db

string

the database name to connect

Executes a prepared query and returns the result

setP(string $sql, \OWR\DB\Request $datas, string $action, string $prepare, boolean $returnId) : mixed
access public
author Pierre-Alain Mignot

Parameters

$sql

string

the query

$datas

\OWR\Interfaces\OWR\Request

the request

$action

string

the action

$prepare

string

prepare the query or not

$returnId

boolean

returns the id of the inserted row

Returns

mixedthe result/statement/id