PHP Class PDO4You\PDO4You

Since: 2010-09-07
Author: Giovanni Ramos ([email protected])
Inheritance: implements pdo4you\Config
Datei anzeigen Open project: giovanniramos/pdo4you Class Usage Examples

Public Properties

Property Type Description
$exception array Stores messages Exception thrown

Public Methods

Method Description
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

Private Methods

Method Description
__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

Method Details

beginTransaction() public static method

public static beginTransaction ( )

clearStyle() public static method

Removes the style markup in html tags, derived from a text editor
public static clearStyle ( string $value ) : string
$value string The input string
return string

commit() public static method

public static commit ( )

css() public static method

PDO4You Style
public static css ( ) : void
return void

delete() public static method

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
return array Returns an array with the number of rows affected by delete operation

exec() public static method

public static exec ( $query )

execute() public static method

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
return array Returns an array with the number of rows affected by type of operation

fireAlert() public static method

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
return void

getConnection() public static method

Method to retrieve the name of the current instance of connection
public static getConnection ( ) : string
return string

getDatahost() public static method

Method to retrieve the server name
public static getDatahost ( ) : string
return string

getDataport() public static method

Method to retrieve the port number of the server
public static getDataport ( ) : string
return string

getDriver() public static method

Method to retrieve the name of the current driver
public static getDriver ( ) : string
return string

getInstance() public static method

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
return object

insert() public static method

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
return array Returns an array with the number of rows affected by insert operation

lastId() public static method

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
return array

lastInsertId() public static method

public static lastInsertId ( $name )

query() public static method

public static query ( $query )

rollBack() public static method

public static rollBack ( )

rowCount() public static method

Method that returns the number of rows affected by the last CRUD (INSERT, SELECT, UPDATE, or DELETE)
public static rowCount ( ) : string
return string

select() public static method

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
return array Returns an array indexed by column name

selectAll() public static method

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
return array Returns an array indexed both by the name as the column number

selectNum() public static method

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
return array Returns an array indexed by column number

selectObj() public static method

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
return object Returns an object with column names as properties

setInstance() public static method

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

setPersistent() public static method

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() public static method

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() public static method

Method to display the PDO drivers installed and supported by the server
public static showAvailableDrivers ( ) : void
return void

showServerInfo() public static method

Method to display details about the target server's database connected
public static showServerInfo ( ) : void
return void

update() public static method

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
return array Returns an array with the number of rows affected by update operation

Property Details

$exception public_oe static_oe property

Stores messages Exception thrown
public static array $exception
return array