jDbPDOConnection

Extends \PDO

A connection object based on PDO

package

jelix

subpackage

db

Methods

Use a profile to do the connection

__construct(array $profile) 

Arguments

$profile

array

the profile data readed from the ini file

_parseSqlitePath

_parseSqlitePath( $path) 

Arguments

$path

enclose the field name

encloseName(string $fieldName) : string
since 1.1.2

Arguments

$fieldName

string

the field name

Response

string

the enclosed field name

Check if the current connection has a table prefix set

hasTablePrefix() : boolean
author

Julien Issler

since 1.0

Response

boolean

return the maximum value of the given primary key in a table

lastIdInTable(string $fieldName, string $tableName) : integer

Arguments

$fieldName

string

the name of the primary key

$tableName

string

the name of the table

Response

integer

the maximum value

Get the ID of the last inserted row Mssql pdo driver does not support this feature.

lastInsertId(string $fromSequence = null) : string

so, we use a custom query

Arguments

$fromSequence

string

the sequence name, if needed

Response

string

Launch a SQL Query with limit parameter (so only a subset of a result)

limitQuery(string $queryString, integer $limitOffset = null, integer $limitCount = null) : \jDbPDOResultSet|boolean

Arguments

$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

Response

\jDbPDOResultSet|boolean

SQL Select. False if the query has failed.

Create a limitQuery for the SQL server dbms

limitQuerySqlsrv(string $queryString, integer $limitOffset = null, integer $limitCount = null) : string

Arguments

$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

Response

string

SQL Select.

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.

prefixTable( $table_name) : string
author

Julien Issler

since 1.0

Arguments

$table_name

Response

string

the prefixed table's name

Escape and quotes strings. if null, will only return the text "NULL"

quote2(string $text, boolean $checknull = true, boolean $binary = false) : string
since 1.2
todo

$binary parameter is not really supported, check if PDOConnection::quote supports binary strings

Arguments

$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

Response

string

escaped string

sets the autocommit state

setAutoCommit(boolean $state = true) 

Arguments

$state

boolean

the status of autocommit

tools

tools() : \jDbTools
Throws
\jException

Response

\jDbTools

Properties

_mysqlCharsets

_mysqlCharsets : 

Type(s)

_pgsqlCharsets

_pgsqlCharsets : 

Type(s)

the profile the connection is using

profile : array
var

Type(s)

array

The database type name (mysql, pgsql .

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.

var

Type(s)

string

driver name

driverName : string
var

Type(s)

string

_tools

_tools : \jDbTools
var

Type(s)

\jDbTools