PHP Класс PrivateBin\Data\Database

Model for database access, implemented as a singleton.
Наследование: extends AbstractData
Показать файл Открыть проект

Открытые методы

Метод Описание
create ( string $pasteid, array $paste ) : boolean Create a paste.
createComment ( string $pasteid, string $parentid, string $commentid, array $comment ) : boolean Create a comment in a paste.
delete ( string $pasteid ) : void Delete a paste and its discussion.
exists ( string $pasteid ) : boolean Test if a paste exists.
existsComment ( string $pasteid, string $parentid, string $commentid ) : boolean Test if a comment exists.
getInstance ( array $options = null ) : Database get instance of singleton
read ( string $pasteid ) : stdClas\stdClass | false Read a paste.
readComments ( string $pasteid ) : array Read all comments of paste.

Защищенные методы

Метод Описание
_getExpiredPastes ( integer $batchsize ) : array Returns up to batch size number of paste ids that have expired

Приватные методы

Метод Описание
_createCommentTable ( ) : void create the paste table
_createConfigTable ( ) : void create the paste table
_createPasteTable ( ) : void create the paste table
_exec ( string $sql, array $params ) : boolean execute a statement
_getConfig ( string $key ) : string get a value by key from the config table
_getPrimaryKeyClauses ( string $key = 'dataid' ) : array get the primary key clauses, depending on the database driver
_getTableQuery ( string $type ) : string get table list query, depending on the database type
_sanitizeIdentifier ( string $identifier ) : string sanitizes identifiers
_select ( string $sql, array $params, boolean $firstOnly = false ) : array run a select statement
_upgradeDatabase ( string $oldversion ) : void upgrade the database schema from an old version

Описание методов

_getExpiredPastes() защищенный Метод

Returns up to batch size number of paste ids that have expired
protected _getExpiredPastes ( integer $batchsize ) : array
$batchsize integer
Результат array

create() публичный Метод

Create a paste.
public create ( string $pasteid, array $paste ) : boolean
$pasteid string
$paste array
Результат boolean

createComment() публичный Метод

Create a comment in a paste.
public createComment ( string $pasteid, string $parentid, string $commentid, array $comment ) : boolean
$pasteid string
$parentid string
$commentid string
$comment array
Результат boolean

delete() публичный Метод

Delete a paste and its discussion.
public delete ( string $pasteid ) : void
$pasteid string
Результат void

exists() публичный Метод

Test if a paste exists.
public exists ( string $pasteid ) : boolean
$pasteid string
Результат boolean

existsComment() публичный Метод

Test if a comment exists.
public existsComment ( string $pasteid, string $parentid, string $commentid ) : boolean
$pasteid string
$parentid string
$commentid string
Результат boolean

getInstance() публичный статический Метод

get instance of singleton
public static getInstance ( array $options = null ) : Database
$options array
Результат Database

read() публичный Метод

Read a paste.
public read ( string $pasteid ) : stdClas\stdClass | false
$pasteid string
Результат stdClas\stdClass | false

readComments() публичный Метод

Read all comments of paste.
public readComments ( string $pasteid ) : array
$pasteid string
Результат array