PHP Class jDbPDOConnection

Author: Laurent Jouanneau
Inheritance: extends PDO
Show file Open project: jelix/jelix Class Usage Examples

Public Properties

Property Type Description
$dbms string ..) It is not the driver name. Several drivers could connect to the same database type. This type name is often used to know whish SQL language we should use.
$driverName string driver name
$profile array the profile the connection is using

Protected Properties

Property Type Description
$_schema jDbSchema
$_tools jDbTools

Public Methods

Method Description
__construct ( array $profile ) Use a profile to do the connection
encloseName ( string $fieldName ) : string enclose the field name
hasTablePrefix ( ) : boolean Check if the current connection has a table prefix set
lastIdInTable ( string $fieldName, string $tableName ) : integer return the maximum value of the given primary key in a table
lastInsertId ( string $fromSequence = null ) : string Get the ID of the last inserted row Mssql pdo driver does not support this feature.
limitQuery ( string $queryString, integer $limitOffset = null, integer $limitCount = null ) : jDbPDOResultSet | boolean Launch a SQL Query with limit parameter (so only a subset of a result)
prefixTable ( $table_name ) : string Prefix the given table with the prefix specified in the connection's profile If there's no prefix for the connection's profile, return the table's name unchanged.
query ( )
quote2 ( string $text, boolean $checknull = true, boolean $binary = false ) : string Escape and quotes strings. if null, will only return the text "NULL"
schema ( ) : jDbSchema
setAutoCommit ( boolean $state = true ) sets the autocommit state
tools ( ) : jDbTools

Protected Methods

Method Description
_parseSqlitePath ( $path )

Method Details

__construct() public method

Use a profile to do the connection
public __construct ( array $profile )
$profile array the profile data. Its content must be normalized by jDbParameters

_parseSqlitePath() protected method

protected _parseSqlitePath ( $path )

encloseName() public method

enclose the field name
Since: 1.1.2
public encloseName ( string $fieldName ) : string
$fieldName string the field name
return string the enclosed field name

hasTablePrefix() public method

Check if the current connection has a table prefix set
Since: 1.0
Author: Julien Issler
public hasTablePrefix ( ) : boolean
return boolean

lastIdInTable() public method

return the maximum value of the given primary key in a table
public lastIdInTable ( string $fieldName, string $tableName ) : integer
$fieldName string the name of the primary key
$tableName string the name of the table
return integer the maximum value

lastInsertId() public method

so, we use a custom query
public lastInsertId ( string $fromSequence = null ) : string
$fromSequence string the sequence name, if needed
return string

limitQuery() public method

Launch a SQL Query with limit parameter (so only a subset of a result)
public limitQuery ( string $queryString, integer $limitOffset = null, integer $limitCount = null ) : jDbPDOResultSet | boolean
$queryString string the SQL query
$limitOffset integer the offset of the first row to return
$limitCount integer the maximum of number of rows to return
return jDbPDOResultSet | boolean SQL Select. False if the query has failed.

prefixTable() public method

Prefix the given table with the prefix specified in the connection's profile If there's no prefix for the connection's profile, return the table's name unchanged.
Since: 1.0
Author: Julien Issler
public prefixTable ( $table_name ) : string
return string the prefixed table's name

query() public method

public query ( )

quote2() public method

Escape and quotes strings. if null, will only return the text "NULL"
Since: 1.2
public quote2 ( string $text, boolean $checknull = true, boolean $binary = false ) : string
$text string string to quote
$checknull boolean if true, check if $text is a null value, and then return NULL
$binary boolean set to true if $text contains a binary string
return string escaped string

schema() public method

public schema ( ) : jDbSchema
return jDbSchema

setAutoCommit() public method

sets the autocommit state
public setAutoCommit ( boolean $state = true )
$state boolean the status of autocommit

tools() public method

public tools ( ) : jDbTools
return jDbTools

Property Details

$_schema protected property

protected jDbSchema $_schema
return jDbSchema

$_tools protected property

protected jDbTools $_tools
return jDbTools

$dbms public property

..) It is not the driver name. Several drivers could connect to the same database type. This type name is often used to know whish SQL language we should use.
public string $dbms
return string

$driverName public property

driver name
public string $driverName
return string

$profile public property

the profile the connection is using
public array $profile
return array