PHP Класс PDO4You\PDO4You

С версии: 2010-09-07
Автор: Giovanni Ramos ([email protected])
Наследование: implements pdo4you\Config
Показать файл Открыть проект Примеры использования класса

Открытые свойства

Свойство Тип Описание
$exception array Stores messages Exception thrown

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

Метод Описание
beginTransaction ( )
clearStyle ( string $value ) : string Removes the style markup in html tags, derived from a text editor
commit ( )
css ( ) : void PDO4You Style
delete ( string $jarr, string $use = null ) : array Method to delete a record in the database
exec ( $query )
execute ( string $json, string $use = null ) : array Method to execute a statement in the database
fireAlert ( string $text, object $error ) : void Triggers a warning via email to the system administrator
getConnection ( ) : string Method to retrieve the name of the current instance of connection
getDatahost ( ) : string Method to retrieve the server name
getDataport ( ) : string Method to retrieve the port number of the server
getDriver ( ) : string Method to retrieve the name of the current driver
getInstance ( string $alias = 'standard', string $type = null, string $user = null, string $pass = null, array $option = null ) : object Method to get a single instance of the database per connection
insert ( string $jarr, string $use = null ) : array Method to insert a new record in the database
lastId ( string $sequence = null ) : array Method that returns the ID of the last inserted row or sequence value Database such as MS SQL Server, PostgreSQL, among others, they make use variable sequence
lastInsertId ( $name )
query ( $query )
rollBack ( )
rowCount ( ) : string Method that returns the number of rows affected by the last CRUD (INSERT, SELECT, UPDATE, or DELETE)
select ( string $sql, string $use = null ) : array Method referring to the fetchAll(PDO::FETCH_ASSOC)
selectAll ( string $sql, string $use = null ) : array Method referring to the fetchAll(PDO::FETCH_BOTH)
selectNum ( string $sql, string $use = null ) : array Method referring to the fetchAll(PDO::FETCH_NUM)
selectObj ( string $sql, string $use = null ) : object Method referring to the fetchAll(PDO::FETCH_OBJ)
setInstance ( string $alias ) Method for setting a connection instance
setPersistent ( boolean $persistent = false ) Method for defining the type of communication with the database The default connection is not persistent
setSettings ( string $settings ) Method to set the file path which contains the settings for each adapter connection with a database
showAvailableDrivers ( ) : void Method to display the PDO drivers installed and supported by the server
showServerInfo ( ) : void Method to display details about the target server's database connected
update ( string $jarr, string $use = null ) : array Method to update a record in the database

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

Метод Описание
__clone ( ) As the builder, we make __clone private to prevent cloning instance of the class
__construct ( ) The constructor is set to private, preventing direct instance of the class
countWhere ( mixed $value = 1, string $operator = '==', string $conditional = 1 ) : integer Returns the sum of occurrences, in an array of a given condition satisfied
executeQuery ( string $jarr, string $type, string $use ) : array Method for manipulation of records in the database
getErrorInfo ( PDOException $e, boolean $debug = false ) : array Method to capture the error information of an Exception
getHandle ( string $alias ) : object Method to return an object PDO connection
getSettings ( ) : string Method to retrieve the path of the file that contains the configuration of adapters
highlightSource ( string $fileName, string $lineNumber, string $showLines = 5 ) : string Method to highlight the syntax of a code
parseJSON ( string $json ) : array Method that converts a string in JSON format for Array
parse_ini_file_advanced ( string $filename ) : array Interprets an INI file with heritage section
selectRecords ( string $query, string $type, string $use, boolean $count = true ) : mixed Method to query records in the database
setConnection ( string $alias ) Method to define which the current instance of connection
setDatahost ( string $host ) Method to set the server name
setDataport ( string $port ) Method to set the port number of the server
setHandle ( string $alias, PDO $instance ) Method for assigning a new object instance PDO connection
singleton ( string $alias, string $driver, string $user, string $pass, array $option ) : void Method Singleton connection
stackTrace ( PDOException $e, boolean $show = true ) : void Method to display the stack trace of an error Exception

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

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

public static beginTransaction ( )

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

Removes the style markup in html tags, derived from a text editor
public static clearStyle ( string $value ) : string
$value string The input string
Результат string

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

public static commit ( )

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

PDO4You Style
public static css ( ) : void
Результат void

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

Method to delete a record in the database
public static delete ( string $jarr, string $use = null ) : array
$jarr string SQL exclusion in JSON/ARRAY format
$use string OPTIONAL Name of the database defined as a new connection instance
Результат array Returns an array with the number of rows affected by delete operation

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

public static exec ( $query )

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

Method to execute a statement in the database
public static execute ( string $json, string $use = null ) : array
$json string SQL statement in JSON format
$use string OPTIONAL Name of the database defined as a new connection instance
Результат array Returns an array with the number of rows affected by type of operation

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

Triggers a warning via email to the system administrator
public static fireAlert ( string $text, object $error ) : void
$text string Error Message
$error object Object of diagnostic of the errors
Результат void

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

Method to retrieve the name of the current instance of connection
public static getConnection ( ) : string
Результат string

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

Method to retrieve the server name
public static getDatahost ( ) : string
Результат string

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

Method to retrieve the port number of the server
public static getDataport ( ) : string
Результат string

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

Method to retrieve the name of the current driver
public static getDriver ( ) : string
Результат string

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

Method to get a single instance of the database per connection
public static getInstance ( string $alias = 'standard', string $type = null, string $user = null, string $pass = null, array $option = null ) : object
$alias string Pseudonym that will be used as a pointer to an instance of established connection
$type string Connection type if using "Initial Setup" or "Full DSN"
$user string Username of the database
$pass string Password of the database
$option array Configuration the connection driver
Результат object

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

Method to insert a new record in the database
public static insert ( string $jarr, string $use = null ) : array
$jarr string SQL insertion in JSON/ARRAY format
$use string OPTIONAL Name of the database defined as a new connection instance
Результат array Returns an array with the number of rows affected by insert operation

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

Method that returns the ID of the last inserted row or sequence value Database such as MS SQL Server, PostgreSQL, among others, they make use variable sequence
public static lastId ( string $sequence = null ) : array
$sequence string Name of the variable sequence requested for some database
Результат array

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

public static lastInsertId ( $name )

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

public static query ( $query )

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

public static rollBack ( )

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

Method that returns the number of rows affected by the last CRUD (INSERT, SELECT, UPDATE, or DELETE)
public static rowCount ( ) : string
Результат string

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

Method referring to the fetchAll(PDO::FETCH_ASSOC)
public static select ( string $sql, string $use = null ) : array
$sql string Instruction SQL of query of records
$use string OPTIONAL Name of the database defined as a new connection instance
Результат array Returns an array indexed by column name

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

Method referring to the fetchAll(PDO::FETCH_BOTH)
public static selectAll ( string $sql, string $use = null ) : array
$sql string Instruction SQL of query of records
$use string OPTIONAL Name of the database defined as a new connection instance
Результат array Returns an array indexed both by the name as the column number

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

Method referring to the fetchAll(PDO::FETCH_NUM)
public static selectNum ( string $sql, string $use = null ) : array
$sql string Instruction SQL of query of records
$use string OPTIONAL Name of the database defined as a new connection instance
Результат array Returns an array indexed by column number

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

Method referring to the fetchAll(PDO::FETCH_OBJ)
public static selectObj ( string $sql, string $use = null ) : object
$sql string Instruction SQL of query of records
$use string OPTIONAL Name of the database defined as a new connection instance
Результат object Returns an object with column names as properties

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

Method for setting a connection instance
public static setInstance ( string $alias )
$alias string Pseudonym of a connection instance

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

Method for defining the type of communication with the database The default connection is not persistent
public static setPersistent ( boolean $persistent = false )
$persistent boolean Sets a persistent connection

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

Method to set the file path which contains the settings for each adapter connection with a database
public static setSettings ( string $settings )
$settings string Path of the file that contains the configuration of adapters

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

Method to display the PDO drivers installed and supported by the server
public static showAvailableDrivers ( ) : void
Результат void

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

Method to display details about the target server's database connected
public static showServerInfo ( ) : void
Результат void

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

Method to update a record in the database
public static update ( string $jarr, string $use = null ) : array
$jarr string SQL update in JSON/ARRAY format
$use string OPTIONAL Name of the database defined as a new connection instance
Результат array Returns an array with the number of rows affected by update operation

Описание свойств

$exception публичное статическое свойство

Stores messages Exception thrown
public static array $exception
Результат array