Jelix 1.7.18

jDbPDOConnectionDebug extends jDbPDOConnection
in package

A connection object based on PDO, for debugging.

Tags
subpackage

db

Table of Contents

$dbms  : string
The database type name (mysql, pgsql ...) 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<string|int, mixed>
the profile the connection is using.
$_schema  : jDbSchema
$_pgsqlCharsets  : mixed
__construct()  : mixed
Use a profile to do the connection.
encloseName()  : string
enclose the field name.
exec()  : mixed
getProfileName()  : mixed
hasTablePrefix()  : bool
Check if the current connection has a table prefix set.
lastIdInTable()  : int
return the maximum value of the given primary key in a table.
lastInsertId()  : string
Get the ID of the last inserted row Mssql pdo driver does not support this feature.
limitQuery()  : bool|jDbPDOResultSet
Launch a SQL Query with limit parameter (so only a subset of a result).
prefixTable()  : 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.
prepare()  : mixed
query()  : mixed
quote2()  : string
Escape and quotes strings. if null, will only return the text "NULL".
schema()  : jDbSchema
setAutoCommit()  : mixed
sets the autocommit state.
tools()  : jDbTools
_parseSqlitePath()  : mixed
limitQuerySqlsrv()  : string
Create a limitQuery for the SQL server dbms.

Properties

$dbms

The database type name (mysql, pgsql ...) 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

$_pgsqlCharsets

private mixed $_pgsqlCharsets = array('UTF-8' => 'UNICODE', 'ISO-8859-1' => 'LATIN1')

Methods

__construct()

Use a profile to do the connection.

public __construct(array<string|int, mixed> $profile) : mixed
Parameters
$profile : array<string|int, mixed>

the profile data. Its content must be normalized by jDbParameters

Return values
mixed

encloseName()

enclose the field name.

public encloseName(string $fieldName) : string
Parameters
$fieldName : string

the field name

Tags
since
1.1.2
Return values
string

the enclosed field name

hasTablePrefix()

Check if the current connection has a table prefix set.

public hasTablePrefix() : bool
Tags
author

Julien Issler

since
1.0
Return values
bool

lastIdInTable()

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

public lastIdInTable(string $fieldName, string $tableName) : int
Parameters
$fieldName : string

the name of the primary key

$tableName : string

the name of the table

Return values
int

the maximum value

lastInsertId()

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

public lastInsertId([string $fromSequence = null ]) : string

so, we use a custom query.

Parameters
$fromSequence : string = null

the sequence name, if needed

Return values
string

limitQuery()

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

public limitQuery(string $queryString[, int $limitOffset = null ][, int $limitCount = null ]) : bool|jDbPDOResultSet
Parameters
$queryString : string

the SQL query

$limitOffset : int = null

the offset of the first row to return

$limitCount : int = null

the maximum of number of rows to return

Return values
bool|jDbPDOResultSet

SQL Select. False if the query has failed.

prefixTable()

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.

public prefixTable(mixed $table_name) : string
Parameters
$table_name : mixed
Tags
author

Julien Issler

since
1.0
Return values
string

the prefixed table's name

prepare()

public prepare(mixed $query[, mixed $driverOptions = array() ]) : mixed
Parameters
$query : mixed
$driverOptions : mixed = array()
Return values
mixed

query()

public query(mixed $queryString[, mixed $fetchmode = PDO::FETCH_OBJ ], mixed ...$fetchModeArgs) : mixed
Parameters
$queryString : mixed
$fetchmode : mixed = PDO::FETCH_OBJ
$fetchModeArgs : mixed
Return values
mixed

quote2()

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

public quote2(string $text[, bool $checknull = true ][, bool $binary = false ]) : string
Parameters
$text : string

string to quote

$checknull : bool = true

if true, check if $text is a null value, and then return NULL

$binary : bool = false

set to true if $text contains a binary string

Tags
since
1.2
todo

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

Return values
string

escaped string

setAutoCommit()

sets the autocommit state.

public setAutoCommit([bool $state = true ]) : mixed
Parameters
$state : bool = true

the status of autocommit

Return values
mixed

_parseSqlitePath()

protected _parseSqlitePath(mixed $path) : mixed
Parameters
$path : mixed
Return values
mixed

limitQuerySqlsrv()

Create a limitQuery for the SQL server dbms.

protected limitQuerySqlsrv(string $queryString[, int $limitOffset = null ][, int $limitCount = null ]) : string
Parameters
$queryString : string

the SQL query

$limitOffset : int = null

the offset of the first row to return

$limitCount : int = null

the maximum of number of rows to return

Return values
string

SQL Select

Search results