\Pastie_Driver_Sql

Pastie storage implementation for PHP's PEAR database abstraction layer.

Required values for $params:

'phptype' - The database type (e.g. 'pgsql', 'mysql', etc.).
'table' - The name of the foo table in 'database'.
'charset' - The database's internal charset.

Required by some database implementations:

'database' - The name of the database.
'hostspec' - The hostname of the database server.
'protocol' - The communication protocol ('tcp', 'unix', etc.).
'username' - The username with which to connect to the database.
'password' - The password associated with 'username'.
'options' - Additional options to pass to the database.
'tty' - The TTY on which to connect to the database.
'port' - The port on which to connect to the database.

The table structure can be created by the scripts/sql/pastie.sql script.

Copyright 2007-2017 Horde LLC (http://www.horde.org/)

See the enclosed file LICENSE for license information (BSD). If you did not receive this file, see http://www.horde.org/licenses/bsd.

Summary

Methods
Properties
Constants
__construct()
savePaste()
getPaste()
getPastes()
No public properties found
No constants found
_connect()
_disconnect()
$_params
$_db
$_write_db
$_connected
N/A
No private methods found
No private properties found
N/A

Properties

$_params

$_params : array

Hash containing connection parameters.

Type

array

$_db

$_db : \DB

Handle for the current database connection.

Type

\DB

$_write_db

$_write_db : \DB

Handle for the current database connection, used for writing. Defaults to the same handle as $_db if a separate write database is not required.

Type

\DB

$_connected

$_connected : boolean

Boolean indicating whether or not we're connected to the SQL server.

Type

boolean

Methods

__construct()

__construct(array  $params = array()) 

Constructs a new SQL storage object.

Parameters

array $params

A hash containing connection parameters.

savePaste()

savePaste(  $bin,   $paste,   $syntax = 'none',   $title = '') 

Parameters

$bin
$paste
$syntax
$title

getPaste()

getPaste(array  $params) : array

Retrieves the paste from the database.

Parameters

array $params

Array of selectors to find the paste.

Returns

array —

Array of paste information

getPastes()

getPastes(  $bin,   $limit = null,   $start = null) 

Parameters

$bin
$limit
$start

_connect()

_connect() 

Attempts to open a persistent connection to the SQL server.

Throws

\Horde_Exception

_disconnect()

_disconnect() 

Disconnects from the SQL server and cleans up the connection.