jDbPDOConnectionDebug
extends jDbPDOConnection
in package
A connection object based on PDO, for debugging.
Tags
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
Tags
$driverName
driver name.
public
string
$driverName
= ''
Tags
$profile
the profile the connection is using.
public
array<string|int, mixed>
$profile
Tags
$_schema
protected
jDbSchema
$_schema
Tags
$_pgsqlCharsets
private
mixed
$_pgsqlCharsets
= array('UTF-8' => 'UNICODE', 'ISO-8859-1' => 'LATIN1')
Tags
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
Tags
Return values
mixed —encloseName()
enclose the field name.
public
encloseName(string $fieldName) : string
Parameters
- $fieldName : string
-
the field name
Tags
Return values
string —the enclosed field name
exec()
public
exec(mixed $query) : mixed
Parameters
- $query : mixed
Tags
Return values
mixed —getProfileName()
public
getProfileName() : mixed
Tags
Return values
mixed —hasTablePrefix()
Check if the current connection has a table prefix set.
public
hasTablePrefix() : bool
Tags
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
Tags
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
Tags
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
Tags
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
Return values
string —the prefixed table's name
prepare()
public
prepare(mixed $query[, mixed $driverOptions = array() ]) : mixed
Parameters
- $query : mixed
- $driverOptions : mixed = array()
Tags
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
Tags
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
Return values
string —escaped string
schema()
public
schema() : jDbSchema
Tags
Return values
jDbSchema —setAutoCommit()
sets the autocommit state.
public
setAutoCommit([bool $state = true ]) : mixed
Parameters
- $state : bool = true
-
the status of autocommit
Tags
Return values
mixed —tools()
public
tools() : jDbTools
Tags
Return values
jDbTools —_parseSqlitePath()
protected
_parseSqlitePath(mixed $path) : mixed
Parameters
- $path : mixed
Tags
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
Tags
Return values
string —SQL Select