- Phalcon\DataMapper\Pdo\Connection
- Phalcon\DataMapper\Pdo\Connection\AbstractConnection
- Phalcon\DataMapper\Pdo\Connection\ConnectionInterface
- Phalcon\DataMapper\Pdo\Connection\Decorated
- Phalcon\DataMapper\Pdo\Connection\PdoInterface
- Phalcon\DataMapper\Pdo\ConnectionLocator
- Phalcon\DataMapper\Pdo\ConnectionLocatorInterface
- Phalcon\DataMapper\Pdo\Exception\CannotDisconnect
- Phalcon\DataMapper\Pdo\Exception\ConnectionNotFound
- Phalcon\DataMapper\Pdo\Exception\Exception
- Phalcon\DataMapper\Pdo\Profiler\MemoryLogger
- Phalcon\DataMapper\Pdo\Profiler\Profiler
- Phalcon\DataMapper\Pdo\Profiler\ProfilerInterface
- Phalcon\DataMapper\Query\AbstractConditions
- Phalcon\DataMapper\Query\AbstractQuery
- Phalcon\DataMapper\Query\Bind
- Phalcon\DataMapper\Query\Delete
- Phalcon\DataMapper\Query\Insert
- Phalcon\DataMapper\Query\QueryFactory
- Phalcon\DataMapper\Query\Select
- Phalcon\DataMapper\Query\Update
Class Phalcon\DataMapper\Pdo\Connection
| Namespace | Phalcon\DataMapper\Pdo | | Uses | InvalidArgumentException, Phalcon\DataMapper\Pdo\Connection\AbstractConnection, Phalcon\DataMapper\Pdo\Profiler\Profiler, Phalcon\DataMapper\Pdo\Profiler\ProfilerInterface | | Extends | AbstractConnection |
Provides array quoting, profiling, a new perform()
method, new fetch*()
methods
@property array $arguments @property PDO $pdo @property ProfilerInterface $profiler
Properties¶
Methods¶
public function __construct( string $dsn, string $username = null, string $password = null, array $options = [], array $queries = [], ProfilerInterface $profiler = null );
This overrides the parent so that it can take connection attributes as a constructor parameter, and set them after connection.
The purpose of this method is to hide sensitive data from stack traces. Connects to the database. Disconnects from the database.Abstract Class Phalcon\DataMapper\Pdo\Connection\AbstractConnection
| Namespace | Phalcon\DataMapper\Pdo\Connection | | Uses | BadMethodCallException, Phalcon\DataMapper\Pdo\Exception\CannotBindValue, Phalcon\DataMapper\Pdo\Profiler\ProfilerInterface | | Implements | ConnectionInterface |
Provides array quoting, profiling, a new perform()
method, new fetch*()
methods
@property PDO $pdo @property ProfilerInterface $profiler
Properties¶
Methods¶
Proxies to PDO methods created for specific drivers; in particular,sqlite
and pgsql
. Begins a transaction. If the profiler is enabled, the operation will be recorded. Commits the existing transaction. If the profiler is enabled, the operation will be recorded. Connects to the database. Disconnects from the database. Gets the most recent error code. Gets the most recent error info. Executes an SQL statement and returns the number of affected rows. If the profiler is enabled, the operation will be recorded. Performs a statement and returns the number of affected rows. Fetches a sequential array of rows from the database; the rows are returned as associative arrays. Fetches an associative array of rows from the database; the rows are returned as associative arrays, and the array of rows is keyed on the first column of each row. If multiple rows have the same first column value, the last row with that value will overwrite earlier rows. This method is more resource intensive and should be avoided if possible.
Fetches a column of rows as a sequential array (default first one).public function fetchGroup( string $statement, array $values = [], int $flags = static-constant-access ): array;
public function fetchObject( string $statement, array $values = [], string $className = string, array $arguments = [] ): object;
Since PDO injects property values before invoking the constructor, any initializations for defaults that you potentially have in your object's constructor, will override the values that have been injected by fetchObject
. The default object returned is \stdClass
public function fetchObjects( string $statement, array $values = [], string $className = string, array $arguments = [] ): array;
Since PDO injects property values before invoking the constructor, any initializations for defaults that you potentially have in your object's constructor, will override the values that have been injected by fetchObject
. The default object returned is \stdClass
quote()
and their respective placeholders will be replaced in the query string. If the profiler is enabled, the operation will be recorded. Prepares an SQL statement for execution. Queries the database and returns a PDOStatement. If the profiler is enabled, the operation will be recorded. Quotes a value for use in an SQL statement. This differs from PDO::quote()
in that it will convert an array into a string of comma-separated quoted values. The default type is PDO::PARAM_STR
Rolls back the current transaction, and restores autocommit mode. If the profiler is enabled, the operation will be recorded. Set a database connection attribute Sets the Profiler instance. protected function fetchData( string $method, array $arguments, string $statement, array $values = [] ): array;
Interface Phalcon\DataMapper\Pdo\Connection\ConnectionInterface
| Namespace | Phalcon\DataMapper\Pdo\Connection | | Uses | Phalcon\DataMapper\Pdo\Exception\CannotBindValue, Phalcon\DataMapper\Pdo\Parser\ParserInterface, Phalcon\DataMapper\Pdo\Profiler\ProfilerInterface | | Extends | PdoInterface |
Provides array quoting, profiling, a new perform()
method, new fetch*()
methods
@property array $args @property PDO $pdo @property ProfilerInterface $profiler @property array $quote
Methods¶
Connects to the database. Disconnects from the database. Performs a statement and returns the number of affected rows. Fetches a sequential array of rows from the database; the rows are returned as associative arrays. Fetches an associative array of rows from the database; the rows are returned as associative arrays, and the array of rows is keyed on the first column of each row.If multiple rows have the same first column value, the last row with that value will overwrite earlier rows. This method is more resource intensive and should be avoided if possible.
Fetches a column of rows as a sequential array (default first one).public function fetchGroup( string $statement, array $values = [], int $flags = static-constant-access ): array;
public function fetchObject( string $statement, array $values = [], string $className = string, array $arguments = [] ): object;
Since PDO injects property values before invoking the constructor, any initializations for defaults that you potentially have in your object's constructor, will override the values that have been injected by fetchObject
. The default object returned is \stdClass
public function fetchObjects( string $statement, array $values = [], string $className = string, array $arguments = [] ): array;
Since PDO injects property values before invoking the constructor, any initializations for defaults that you potentially have in your object's constructor, will override the values that have been injected by fetchObject
. The default object returned is \stdClass
quote()
and their respective placeholders will be replaced in the query string. If the profiler is enabled, the operation will be recorded. Sets the Profiler instance. Class Phalcon\DataMapper\Pdo\Connection\Decorated
| Namespace | Phalcon\DataMapper\Pdo\Connection | | Uses | Phalcon\DataMapper\Pdo\Exception\CannotDisconnect, Phalcon\DataMapper\Pdo\Profiler\Profiler, Phalcon\DataMapper\Pdo\Profiler\ProfilerInterface | | Extends | AbstractConnection |
Decorates an existing PDO instance with the extended methods.
Methods¶
Constructor.This overrides the parent so that it can take an existing PDO instance and decorate it with the extended methods.
Connects to the database. Disconnects from the database; disallowed with decorated PDO connections.@throws CannotDisconnect
Interface Phalcon\DataMapper\Pdo\Connection\PdoInterface
| Namespace | Phalcon\DataMapper\Pdo\Connection |
An interface to the native PDO object.
Methods¶
Begins a transaction. If the profiler is enabled, the operation will be recorded. Commits the existing transaction. If the profiler is enabled, the operation will be recorded. Gets the most recent error code. Gets the most recent error info. Executes an SQL statement and returns the number of affected rows. If the profiler is enabled, the operation will be recorded. Retrieve a database connection attribute Return an array of available PDO drivers (empty array if none available) Is a transaction currently active? If the profiler is enabled, the operation will be recorded. If the profiler is enabled, the operation will be recorded. Returns the last inserted autoincrement sequence value. If the profiler is enabled, the operation will be recorded. Prepares an SQL statement for execution. Queries the database and returns a PDOStatement. If the profiler is enabled, the operation will be recorded. Quotes a value for use in an SQL statement. This differs fromPDO::quote()
in that it will convert an array into a string of comma-separated quoted values. The default type is PDO::PARAM_STR
Rolls back the current transaction, and restores autocommit mode. If the profiler is enabled, the operation will be recorded. Set a database connection attribute Class Phalcon\DataMapper\Pdo\ConnectionLocator
| Namespace | Phalcon\DataMapper\Pdo | | Uses | Phalcon\DataMapper\Pdo\Connection\ConnectionInterface, Phalcon\DataMapper\Pdo\Exception\ConnectionNotFound | | Implements | ConnectionLocatorInterface |
Manages Connection instances for default, read, and write connections.
@property callable $master @property array $read @property array $write
Properties¶
/**
* A default Connection connection factory/instance.
*
* @var ConnectionInterface
*/
protected master;
/**
* A registry of Connection "read" factories/instances.
*
* @var array
*/
protected read;
/**
* A registry of Connection "write" factories/instances.
*
* @var array
*/
protected write;
/**
* A collection of resolved instances
*
* @var array
*/
private instances;
Methods¶
Constructor. Returns the default connection object. Returns a read connection by name; if no name is given, picks a random connection; if no read connections are present, returns the default connection. Returns a write connection by name; if no name is given, picks a random connection; if no write connections are present, returns the default connection. Sets the default connection factory. Sets a read connection factory by name. Sets a write connection factory by name. Returns a connection by name.Interface Phalcon\DataMapper\Pdo\ConnectionLocatorInterface
| Namespace | Phalcon\DataMapper\Pdo | | Uses | Phalcon\DataMapper\Pdo\Connection\ConnectionInterface |
Locates PDO connections for default, read, and write databases.
Methods¶
Returns the default connection object. Returns a read connection by name; if no name is given, picks a random connection; if no read connections are present, returns the default connection. Returns a write connection by name; if no name is given, picks a random connection; if no write connections are present, returns the default connection. Sets the default connection registry entry. Sets a read connection registry entry by name. Sets a write connection registry entry by name.Class Phalcon\DataMapper\Pdo\Exception\CannotDisconnect
| Namespace | Phalcon\DataMapper\Pdo\Exception | | Extends | Exception |
ExtendedPdo could not disconnect; e.g., because its PDO connection was created externally and then injected.
Class Phalcon\DataMapper\Pdo\Exception\ConnectionNotFound
| Namespace | Phalcon\DataMapper\Pdo\Exception | | Extends | Exception |
Locator could not find a named connection.
Class Phalcon\DataMapper\Pdo\Exception\Exception
| Namespace | Phalcon\DataMapper\Pdo\Exception | | Extends | \Exception |
Base Exception class
Class Phalcon\DataMapper\Pdo\Profiler\MemoryLogger
| Namespace | Phalcon\DataMapper\Pdo\Profiler | | Uses | Psr\Log\AbstractLogger | | Extends | AbstractLogger |
A naive memory-based logger.
@property array $messages
Properties¶
Methods¶
Returns the logged messages. Logs a message.Class Phalcon\DataMapper\Pdo\Profiler\Profiler
| Namespace | Phalcon\DataMapper\Pdo\Profiler | | Uses | Phalcon\DataMapper\Pdo\Exception\Exception, Phalcon\Helper\Json, Psr\Log\LoggerInterface, Psr\Log\LogLevel | | Implements | ProfilerInterface |
Sends query profiles to a logger.
@property bool $active @property array $context @property string $logFormat @property string $logLevel @property LoggerInterface $logger
Properties¶
/**
* @var bool
*/
protected active = false;
/**
* @var array
*/
protected context;
/**
* @var string
*/
protected logFormat = ;
/**
* @var int
*/
protected logLevel = 0;
/**
* @var LoggerInterface
*/
protected logger;
Methods¶
Constructor. Finishes and logs a profile entry. Returns the log message format string, with placeholders. Returns the level at which to log profile messages. Returns the underlying logger instance. Returns true if logging is active. Enable or disable profiler logging. Sets the log message format string, with placeholders. Level at which to log profile messages. Starts a profile entry.Interface Phalcon\DataMapper\Pdo\Profiler\ProfilerInterface
| Namespace | Phalcon\DataMapper\Pdo\Profiler | | Uses | Psr\Log\LoggerInterface |
Interface to send query profiles to a logger.
Methods¶
Finishes and logs a profile entry. Returns the log message format string, with placeholders. Returns the level at which to log profile messages. Returns the underlying logger instance. Returns true if logging is active. Enable or disable profiler logging. Sets the log message format string, with placeholders. Level at which to log profile messages. Starts a profile entry.Abstract Class Phalcon\DataMapper\Query\AbstractConditions
| Namespace | Phalcon\DataMapper\Query | | Uses | Phalcon\Helper\Arr | | Extends | AbstractQuery |
Class AbstractConditions
Methods¶
public function andWhere( string $condition, mixed $value = null, int $type = int ): AbstractConditions;
AND
for a WHERE
condition public function appendWhere( string $condition, mixed $value = null, int $type = int ): AbstractConditions;
WHERE
clause Sets the LIMIT
clause Sets the OFFSET
clause public function orWhere( string $condition, mixed $value = null, int $type = int ): AbstractConditions;
OR
for a WHERE
condition Sets the ORDER BY
public function where( string $condition, mixed $value = null, int $type = int ): AbstractConditions;
WHERE
condition protected function addCondition( string $store, string $andor, string $condition, mixed $value = null, int $type = int ): void;
protected function appendCondition( string $store, string $condition, mixed $value = null, int $type = int ): void;
BY
list Builds the conditional string Builds the LIMIT
clause Builds the LIMIT
clause for all drivers Builds the early LIMIT
clause - MS SQLServer Builds the LIMIT
clause for MSSQLServer Processes a value (array or string) and merges it with the store Abstract Class Phalcon\DataMapper\Query\AbstractQuery
| Namespace | Phalcon\DataMapper\Query | | Uses | Phalcon\DataMapper\Pdo\Connection |
Class AbstractQuery
@property Bind $bind @property Connection $connection @property array $store
Properties¶
/**
* @var Bind
*/
protected bind;
/**
* @var Connection
*/
protected connection;
/**
* @var array
*/
protected store;
Methods¶
AbstractQuery constructor. Binds a value inline Binds a value - auto-detects the type if necessary Binds an array of values Returns all the bound values Return the generated statement Performs a statement in the connection Quotes the identifier Resets the internal array Sets a flag for the query such as "DISTINCT" Builds the flags statement(s) Builds theRETURNING
clause Indents a collection Class Phalcon\DataMapper\Query\Bind
| Namespace | Phalcon\DataMapper\Query |
Class Bind
@property int $inlineCount @property array $store
Properties¶
Methods¶
Removes a value from the store Sets a value Sets values from an array Returns the internal collection Auto detects the PDO type Processes an array - if passed as aninline
parameter Class Phalcon\DataMapper\Query\Delete
| Namespace | Phalcon\DataMapper\Query | | Uses | Phalcon\DataMapper\Pdo\Connection | | Extends | AbstractConditions |
This file is part of the Phalcon Framework.
(c) Phalcon Team team@phalcon.io
For the full copyright and license information, please view the LICENSE.txt file that was distributed with this source code.
Implementation of this file has been influenced by AtlasPHP
@link https://github.com/atlasphp/Atlas.Query @license https://github.com/atlasphp/Atlas.Qyert/blob/1.x/LICENSE.md
Methods¶
Delete constructor. Adds table(s) in the query Resets the internal store Adds theRETURNING
clause Class Phalcon\DataMapper\Query\Insert
| Namespace | Phalcon\DataMapper\Query | | Uses | Phalcon\DataMapper\Pdo\Connection | | Extends | AbstractQuery |
Class Insert
Methods¶
Insert constructor. Sets a column for theINSERT
query Mass sets columns and values for the INSERT
Returns the id of the last inserted record Adds table(s) in the query Resets the internal store Adds the RETURNING
clause Sets a column = value condition Class Phalcon\DataMapper\Query\QueryFactory
| Namespace | Phalcon\DataMapper\Query | | Uses | Phalcon\DataMapper\Pdo\Connection |
Class QueryFactory
@property string $class
Properties¶
Methods¶
QueryFactory constructor. Create a new Bind object Create a new Delete object Create a new Insert object Create a new Select object Create a new Update objectClass Phalcon\DataMapper\Query\Select
| Namespace | Phalcon\DataMapper\Query | | Uses | BadMethodCallException, Phalcon\Helper\Arr | | Extends | AbstractConditions |
Class Select
@property string $asAlias @property bool $forUpdate
@method int fetchAffected() @method array fetchAll() @method array fetchAssoc() @method array fetchColumn(int $column = 0) @method array fetchGroup(int $flags = PDO::FETCH_ASSOC) @method object fetchObject(string $class = 'stdClass', array $arguments = []) @method array fetchObjects(string $class = 'stdClass', array $arguments = []) @method array fetchOne() @method array fetchPairs() @method mixed fetchValue()
Constants¶
const JOIN_INNER = INNER;
const JOIN_LEFT = LEFT;
const JOIN_NATURAL = NATURAL;
const JOIN_RIGHT = RIGHT;
Properties¶
Methods¶
Proxied methods to the connection Sets aAND
for a HAVING
condition Concatenates to the most recent HAVING
clause Concatenates to the most recent JOIN
clause The AS
statement for the query - useful in sub-queries The columns to select from. If a key is set in an array element, the key will be used as the alias Enable the FOR UPDATE
for the query Adds table(s) in the query Returns the compiled SQL statement Sets the GROUP BY
Whether the query has columns or not Sets a HAVING
condition public function join( string $join, string $table, string $condition, mixed $value = null, int $type = int ): Select;
OR
for a HAVING
condition Resets the internal collections Start a sub-select Start a UNION
Start a UNION ALL
Statement builder Class Phalcon\DataMapper\Query\Update
| Namespace | Phalcon\DataMapper\Query | | Uses | Phalcon\DataMapper\Pdo\Connection | | Extends | AbstractConditions |
Class Update
Methods¶
Update constructor. Sets a column for theUPDATE
query Mass sets columns and values for the UPDATE
Adds table(s) in the query Whether the query has columns or not Resets the internal store Adds the RETURNING
clause Sets a column = value condition