CakePHP
  • Documentation
    • Book
    • API
    • Videos
    • Reporting Security Issues
    • Privacy Policy
    • Logos & Trademarks
  • Business Solutions
  • Swag
  • Road Trip
  • Team
  • Community
    • Community
    • Get Involved
    • Issues (Github)
    • Bakery
    • Featured Resources
    • Training
    • Meetups
    • My CakePHP
    • CakeFest
    • Newsletter
    • Linkedin
    • YouTube
    • Facebook
    • Twitter
    • Mastodon
    • Help & Support
    • Forum
    • Stack Overflow
    • IRC
    • Slack
    • Paid Support
CakePHP

C CakePHP 3.2 Red Velvet API

  • Project:
    • CakePHP
      • CakePHP
      • Authentication
      • Authorization
      • Chronos
      • Elastic Search
      • Queue
  • Version:
    • 3.2
      • 5.2
      • 5.1
      • 5.0
      • 4.6
      • 4.5
      • 4.4
      • 4.3
      • 4.2
      • 4.1
      • 4.0
      • 3.10
      • 3.9
      • 3.8
      • 3.7
      • 3.6
      • 3.5
      • 3.4
      • 3.3
      • 3.2
      • 3.1
      • 3.0
      • 2.10
      • 2.9
      • 2.8
      • 2.7
      • 2.6
      • 2.5
      • 2.4
      • 2.3
      • 2.2
      • 2.1
      • 2.0
      • 1.3
      • 1.2

Namespaces

  • Global
  • Cake
    • Auth
    • Cache
    • Collection
    • Console
    • Controller
    • Core
    • Database
      • Dialect
      • Driver
      • Exception
      • Expression
      • Log
      • Schema
      • Statement
      • Type
    • Datasource
    • Error
    • Event
    • Filesystem
    • Form
    • I18n
    • Log
    • Mailer
    • Network
    • ORM
    • Routing
    • Shell
    • TestSuite
    • Utility
    • Validation
    • View

Trait PDODriverTrait

PDO driver trait

Namespace: Cake\Database\Driver

Property Summary

  • $_connection protected
    PDO

    Instance of PDO.

Method Summary

  • _connect() protected

    Establishes a connection to the database server

  • beginTransaction() public

    Starts a transaction

  • commitTransaction() public

    Commits a transaction

  • connection() public

    Returns correct connection resource or object that is internally used If first argument is passed, it will set internal connection object or result to the value passed

  • disconnect() public

    Disconnects from database server

  • isConnected() public

    Check whether or not the driver is connected.

  • lastInsertId() public

    Returns last id generated for a table or sequence in database

  • prepare() public

    Prepares a sql statement to be executed

  • quote() public

    Returns a value in a safe representation to be used in a query string

  • rollbackTransaction() public

    Rollback a transaction

  • supportsQuoting() public

    Checks if the driver supports quoting, as PDO_ODBC does not support it.

Method Detail

_connect() ¶ protected

_connect(string $dsn, array $config): bool

Establishes a connection to the database server

Parameters
string $dsn

A Driver-specific PDO-DSN

array $config

configuration to be used for creating connection

Returns
bool

beginTransaction() ¶ public

beginTransaction(): bool

Starts a transaction

Returns
bool

commitTransaction() ¶ public

commitTransaction(): bool

Commits a transaction

Returns
bool

connection() ¶ public

connection(null|PDO $connection = null): PDO

Returns correct connection resource or object that is internally used If first argument is passed, it will set internal connection object or result to the value passed

Parameters
null|PDO $connection optional

The PDO connection instance.

Returns
PDO

disconnect() ¶ public

disconnect(): void

Disconnects from database server

Returns
void

isConnected() ¶ public

isConnected(): bool

Check whether or not the driver is connected.

Returns
bool

lastInsertId() ¶ public

lastInsertId(string|null $table = null, string|null $column = null): string|int

Returns last id generated for a table or sequence in database

Parameters
string|null $table optional

table name or sequence to get last insert value from

string|null $column optional

the name of the column representing the primary key

Returns
string|int

prepare() ¶ public

prepare(string|Cake\Database\Query $query): Cake\Database\StatementInterface

Prepares a sql statement to be executed

Parameters
string|Cake\Database\Query $query

The query to turn into a prepared statement.

Returns
Cake\Database\StatementInterface

quote() ¶ public

quote(mixed $value, string $type): string

Returns a value in a safe representation to be used in a query string

Parameters
mixed $value

The value to quote.

string $type

Type to be used for determining kind of quoting to perform

Returns
string

rollbackTransaction() ¶ public

rollbackTransaction(): bool

Rollback a transaction

Returns
bool

supportsQuoting() ¶ public

supportsQuoting(): bool

Checks if the driver supports quoting, as PDO_ODBC does not support it.

Returns
bool

Property Detail

$_connection ¶ protected

Instance of PDO.

Type
PDO
OpenHub
Pingping
Linode
  • Business Solutions
  • Showcase
  • Documentation
  • Book
  • API
  • Videos
  • Reporting Security Issues
  • Privacy Policy
  • Logos & Trademarks
  • Community
  • Get Involved
  • Issues (Github)
  • Bakery
  • Featured Resources
  • Training
  • Meetups
  • My CakePHP
  • CakeFest
  • Newsletter
  • Linkedin
  • YouTube
  • Facebook
  • Twitter
  • Mastodon
  • Help & Support
  • Forum
  • Stack Overflow
  • IRC
  • Slack
  • Paid Support

Generated using CakePHP API Docs