Documentation

PdoCrud
in package
Uses PdoCrudStatement

Class provides simple CRUD operations

Table of Contents

$pdo  : PDO|null
PDO object
$pdoStatement  : PDOStatement
PDO statement
__destruct()  : mixed
Method destroys connection
bindParameter()  : void
Method binds parameters to query
commit()  : void
Commiting transaction
compileSetQuery()  : string
Method compiles set-query
connect()  : void
Method connects to the database
execSelect()  : array<string|int, mixed>
Method executes select query and fetches results
execute()  : void
Method executes SQL query
executeSelect()  : array<string|int, mixed>
Method executes select query and fetches results
lastInsertId()  : int
Method returns id of the last inserted record
lock()  : void
Method locks tables
prepare()  : void
Method sets safe query
rollback()  : void
Rollback transaction
rowCount()  : int
Method returns count of affected rows
startTransaction()  : void
Method starts transaction
unlock()  : void
Method unlocks locked tables
getPdo()  : PDO
Method returns PDO object
lockQuery()  : string
Method compiles lock queries

Properties

$pdo

PDO object

private PDO|null $pdo = null

Methods

__destruct()

Method destroys connection

public __destruct() : mixed
Return values
mixed

bindParameter()

Method binds parameters to query

public bindParameter(string $parameter, mixed $variable[, int $type = PDO::PARAM_STR ]) : void
Parameters
$parameter : string

name of the parameter

$variable : mixed

value

$type : int = PDO::PARAM_STR

parameter type

Tags
codeCoverageIgnore
Return values
void

commit()

Commiting transaction

public commit() : void
Return values
void

compileSetQuery()

Method compiles set-query

public compileSetQuery(array<string|int, mixed> $record) : string
Parameters
$record : array<string|int, mixed>

Inserting record

Return values
string

Compiled query string

connect()

Method connects to the database

public connect(array<string, string> $connnectionData) : void
Parameters
$connnectionData : array<string, string>

Connection settings

Tags
codeCoverageIgnore
Return values
void

execSelect()

Method executes select query and fetches results

public execSelect([array<string|int, mixed>|null $data = null ]) : array<string|int, mixed>
Parameters
$data : array<string|int, mixed>|null = null

query data

Tags
codeCoverageIgnore
deprecated

Deprecated since 2020-11-21, use executeSelect

Return values
array<string|int, mixed>

query result as an array of objects

execute()

Method executes SQL query

public execute([array<string|int, mixed>|null $data = null ]) : void
Parameters
$data : array<string|int, mixed>|null = null

query data

Tags
codeCoverageIgnore
Return values
void

executeSelect()

Method executes select query and fetches results

public executeSelect([array<string|int, mixed>|null $data = null ]) : array<string|int, mixed>
Parameters
$data : array<string|int, mixed>|null = null

query data

Tags
codeCoverageIgnore
Return values
array<string|int, mixed>

query result as an array of objects

lastInsertId()

Method returns id of the last inserted record

public lastInsertId() : int
Return values
int

id of the last inserted record

lock()

Method locks tables

public lock(array<string|int, string> $tables, array<string|int, string> $modes) : void
Parameters
$tables : array<string|int, string>

list of tables

$modes : array<string|int, string>

list of lock modes

Return values
void

prepare()

Method sets safe query

public prepare(string $query) : void
Parameters
$query : string

safe query

Tags
codeCoverageIgnore
Return values
void

rollback()

Rollback transaction

public rollback() : void
Return values
void

rowCount()

Method returns count of affected rows

public rowCount() : int
Tags
codeCoverageIgnore
Return values
int

count of affected rows

startTransaction()

Method starts transaction

public startTransaction() : void
Return values
void

unlock()

Method unlocks locked tables

public unlock() : void
Return values
void

getPdo()

Method returns PDO object

private getPdo() : PDO
Tags
codeCoverageIgnore
Return values
PDO

lockQuery()

Method compiles lock queries

private lockQuery(array<string|int, string> $tables, array<string|int, string> $modes) : string
Parameters
$tables : array<string|int, string>

List of tables

$modes : array<string|int, string>

List of lock modes

Return values
string

Query

Search results

    Яндекс.Метрика