PHP Class PHPFusion\Database\Driver\PDOMySQL

Inheritance: extends PHPFusion\Database\AbstractDatabaseDriver
显示文件 Open project: php-fusion/PHP-Fusion

Public Methods

Method Description
_query ( string $query, array $parameters = [] ) : PDOStatement Send a database query
close ( ) Close the connection
count ( string $field, string $table, string $conditions = "", array $parameters = [] ) : integer Count the number of rows in a table filtered by conditions
countRows ( PDOStatement $statement ) : integer Count the number of affected rows by the given query
fetchAssoc ( PDOStatement $statement ) : array Fetch one row as an associative array
fetchFirstColumn ( PDOStatement $statement, integer $row ) : mixed Fetch the first column of a specific row
fetchRow ( PDOStatement $statement ) : array Fetch one row as a numeric array
getLastId ( ) : integer Get the last inserted auto increment id
getServerVersion ( ) : string Get the database server version
isConnected ( ) : boolean
quote ( $value ) : string Implementation of \PDO::quote()

Protected Methods

Method Description
connect ( string $host, string $user, string $pass, string $db, array $options = [] ) Connect to the database

Method Details

_query() public method

Send a database query
public _query ( string $query, array $parameters = [] ) : PDOStatement
$query string SQL
$parameters array
return PDOStatement or FALSE on error

close() public method

Close the connection
public close ( )

connect() protected method

Connect to the database
protected connect ( string $host, string $user, string $pass, string $db, array $options = [] )
$host string Server domain or IP followed by an optional port definition
$user string
$pass string Password
$db string The name of the database
$options array Currently only one option exists: charset

count() public method

Count the number of rows in a table filtered by conditions
public count ( string $field, string $table, string $conditions = "", array $parameters = [] ) : integer
$field string Parenthesized field name
$table string Table name
$conditions string conditions after "where"
$parameters array
return integer

countRows() public method

Count the number of affected rows by the given query
public countRows ( PDOStatement $statement ) : integer
$statement PDOStatement
return integer

fetchAssoc() public method

Fetch one row as an associative array
public fetchAssoc ( PDOStatement $statement ) : array
$statement PDOStatement
return array Associative array

fetchFirstColumn() public method

Fetch the first column of a specific row
public fetchFirstColumn ( PDOStatement $statement, integer $row ) : mixed
$statement PDOStatement
$row integer
return mixed

fetchRow() public method

Fetch one row as a numeric array
public fetchRow ( PDOStatement $statement ) : array
$statement PDOStatement
return array Numeric array

getLastId() public method

Get the last inserted auto increment id
public getLastId ( ) : integer
return integer

getServerVersion() public method

Get the database server version
public getServerVersion ( ) : string
return string

isConnected() public method

public isConnected ( ) : boolean
return boolean TRUE if the connection is alive

quote() public method

Implementation of \PDO::quote()
See also: http://php.net/manual/en/pdo.quote.php
public quote ( $value ) : string
$value
return string