Class jDbPDOConnection

Description

A connection object based on PDO

Located in /db/jDbPDOConnection.class.php (line 20)

PDO
   |
   --jDbPDOConnection
Direct descendents
Class Description
jDbPDOConnectionDebug A connection object based on PDO, for debugging
Variable Summary
string $dbms
string $driverName
array $profile
Method Summary
jDbPDOConnection __construct (array $profile)
string encloseName (string $fieldName)
boolean hasTablePrefix ()
integer lastIdInTable (string $fieldName, string $tableName)
string lastInsertId ([string $fromSequence = null])
jDbPDOResultSet|boolean limitQuery (string $queryString, [integer $limitOffset = null], [integer $limitCount = null])
string prefixTable ( $table_name, string $table)
void query ()
string quote2 (string $text, [boolean $checknull = true], [boolean $binary = false])
void setAutoCommit ([boolean $state = true])
Variables
string $dbms (line 35)

The database type name (mysql, pgsql ...)

  • access: public
string $driverName = '' (line 41)

driver name

  • access: public
array $profile (line 29)

the profile the connection is using

  • access: public
jDbTools $_tools = null (line 245)
  • access: protected
Methods
Constructor __construct (line 47)

Use a profile to do the connection

jDbPDOConnection __construct (array $profile)
  • array $profile: the profile data readed from the ini file

Redefinition of:
PDO::constructor __construct ( $dsn, [$username = ], [$passwd = ], [$options = ] )
encloseName (line 218)

enclose the field name

  • return: the enclosed field name
  • since: 1.1.2
  • access: public
string encloseName (string $fieldName)
  • string $fieldName: the field name
hasTablePrefix (line 208)

Check if the current connection has a table prefix set

  • author: Julien Issler
  • since: 1.0
  • access: public
boolean hasTablePrefix ()
lastIdInTable (line 178)

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

  • return: the maximum value
  • access: public
integer lastIdInTable (string $fieldName, string $tableName)
  • string $fieldName: the name of the primary key
  • string $tableName: the name of the table
lastInsertId (line 268)

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

so, we use a custom query

  • access: public
string lastInsertId ([string $fromSequence = null])
  • string $fromSequence: the sequence name, if needed

Redefinition of:
PDO::lastInsertId ( [$seqname = ] )
limitQuery (line 147)

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

  • return: SQL Select. False if the query has failed.
  • access: public
jDbPDOResultSet|boolean limitQuery (string $queryString, [integer $limitOffset = null], [integer $limitCount = null])
  • string $queryString: the SQL query
  • integer $limitOffset: the offset of the first row to return
  • integer $limitCount: the maximum of number of rows to return
prefixTable (line 195)

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.

  • return: the prefixed table's name
  • author: Julien Issler
  • since: 1.0
  • access: public
string prefixTable ( $table_name, string $table)
  • string $table: the table's name
  • $table_name
query (line 123)
  • access: public
void query ()

Redefinition of:
PDO::query ( )

Redefined in descendants as:
quote2 (line 235)

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

  • return: escaped string
  • todo: $binary parameter is not really supported, check if PDOConnection::quote supports binary strings
  • since: 1.2
  • access: public
string quote2 (string $text, [boolean $checknull = true], [boolean $binary = false])
  • string $text: string to quote
  • boolean $checknull: if true, check if $text is a null value, and then return NULL
  • boolean $binary: set to true if $text contains a binary string
setAutoCommit (line 168)

sets the autocommit state

  • access: public
void setAutoCommit ([boolean $state = true])
  • boolean $state: the status of autocommit
tools (line 250)
  • access: public
jDbTools tools ()

Inherited Methods

Inherited From PDO (Internal Class)

constructor __construct ( $dsn, [$username = ], [$passwd = ], [$options = ] )
beginTransaction ( )
commit ( )
errorCode ( )
errorInfo ( )
exec ( $query )
getAttribute ( $attribute )
getAvailableDrivers ( )
inTransaction ( )
lastInsertId ( [$seqname = ] )
prepare ( $statement, [$options = ] )
query ( )
quote ( $string, [$paramtype = ] )
rollBack ( )
setAttribute ( $attribute, $value )
__sleep ( )
__wakeup ( )
Class Constants

Inherited Constants

Inherited from PDO (Internal Class)

ATTR_AUTOCOMMIT = 0
ATTR_CASE = 8
ATTR_CLIENT_VERSION = 5
ATTR_CONNECTION_STATUS = 7
ATTR_CURSOR = 10
ATTR_CURSOR_NAME = 9
ATTR_DEFAULT_FETCH_MODE = 19
ATTR_DRIVER_NAME = 16
ATTR_EMULATE_PREPARES = 20
ATTR_ERRMODE = 3
ATTR_FETCH_CATALOG_NAMES = 15
ATTR_FETCH_TABLE_NAMES = 14
ATTR_MAX_COLUMN_LEN = 18
ATTR_ORACLE_NULLS = 11
ATTR_PERSISTENT = 12
ATTR_PREFETCH = 1
ATTR_SERVER_INFO = 6
ATTR_SERVER_VERSION = 4
ATTR_STATEMENT_CLASS = 13
ATTR_STRINGIFY_FETCHES = 17
ATTR_TIMEOUT = 2
CASE_LOWER = 2
CASE_NATURAL = 0
CASE_UPPER = 1
CURSOR_FWDONLY = 0
CURSOR_SCROLL = 1
ERRMODE_EXCEPTION = 2
ERRMODE_SILENT = 0
ERRMODE_WARNING = 1
ERR_NONE = '00000'
FETCH_ASSOC = 2
FETCH_BOTH = 4
FETCH_BOUND = 6
FETCH_CLASS = 8
FETCH_CLASSTYPE = 262144
FETCH_COLUMN = 7
FETCH_FUNC = 10
FETCH_GROUP = 65536
FETCH_INTO = 9
FETCH_KEY_PAIR = 12
FETCH_LAZY = 1
FETCH_NAMED = 11
FETCH_NUM = 3
FETCH_OBJ = 5
FETCH_ORI_ABS = 4
FETCH_ORI_FIRST = 2
FETCH_ORI_LAST = 3
FETCH_ORI_NEXT = 0
FETCH_ORI_PRIOR = 1
FETCH_ORI_REL = 5
FETCH_PROPS_LATE = 1048576
FETCH_SERIALIZE = 524288
FETCH_UNIQUE = 196608
MYSQL_ATTR_COMPRESS = 1003
MYSQL_ATTR_DIRECT_QUERY = 1004
MYSQL_ATTR_FOUND_ROWS = 1005
MYSQL_ATTR_IGNORE_SPACE = 1006
MYSQL_ATTR_INIT_COMMAND = 1002
MYSQL_ATTR_LOCAL_INFILE = 1001
MYSQL_ATTR_SSL_CA = 1009
MYSQL_ATTR_SSL_CAPATH = 1010
MYSQL_ATTR_SSL_CERT = 1008
MYSQL_ATTR_SSL_CIPHER = 1011
MYSQL_ATTR_SSL_KEY = 1007
MYSQL_ATTR_USE_BUFFERED_QUERY = 1000
NULL_EMPTY_STRING = 1
NULL_NATURAL = 0
NULL_TO_STRING = 2
PARAM_BOOL = 5
PARAM_EVT_ALLOC = 0
PARAM_EVT_EXEC_POST = 3
PARAM_EVT_EXEC_PRE = 2
PARAM_EVT_FETCH_POST = 5
PARAM_EVT_FETCH_PRE = 4
PARAM_EVT_FREE = 1
PARAM_EVT_NORMALIZE = 6
PARAM_INPUT_OUTPUT = 2147483648
PARAM_INT = 1
PARAM_LOB = 3
PARAM_NULL = 0
PARAM_STMT = 4
PARAM_STR = 2
PGSQL_ATTR_DISABLE_NATIVE_PREPARED_STATEMENT = 1000
PGSQL_TRANSACTION_ACTIVE = 1
PGSQL_TRANSACTION_IDLE = 0
PGSQL_TRANSACTION_INERROR = 3
PGSQL_TRANSACTION_INTRANS = 2
PGSQL_TRANSACTION_UNKNOWN = 4

Documentation generated on Wed, 04 Jan 2017 22:53:48 +0100 by phpDocumentor 1.4.3