Features

An overview of Ivory features is split in two sections: the already implemented ones, and those which are planned for the future. For more detailed description with examples, see the Documentation.

Implemented Features

Complete Data Type Support

SQL Patterns

Transaction Control

<?php
$tx = $conn->startTransaction();
$conn->command('...');
$txName = $tx->prepareTransaction();
// ...
$conn->commitPreparedTransaction($txName); // $conn is not necessarily the same connection
// or
$conn->rollbackPreparedTransaction($txName);

$conn->listPreparedTransactions(); // lists all prepared transactions

Session Control

<?php
$cfg = $conn->getTxConfig();
$cfg->setForSession(ConfigParam::STATEMENT_TIMEOUT, Quantity::fromValue(1, Quantity::MINUTE));
$cfg->setForSession(ConfigParam::SEARCH_PATH, 'public, other');

$timeout = $cfg->get(ConfigParam::STATEMENT_TIMEOUT); // returns a Quantity object
echo $timeout->convert(Quantity::SECOND) . PHP_EOL; // prints "60 s"

User-Definable Exceptions on Certain Database Errors

<?php
class NotNullViolationException extends \Ivory\Exception\StatementException
{
}

$exFactory = $conn->getStatementExceptionFactory();
$exFactory->registerBySqlStateCode(SqlState::NOT_NULL_VIOLATION, NotNullViolationException::class);

try {
    $conn->command('INSERT INTO album (name) VALUES (NULL)');
} catch (NotNullViolationException $e) {
    echo $e->getMessage(); // prints "null value in column "name" violates not-null constraint"
}

Asynchronous Connection

Asynchronous Querying

Customizability

Clean API

Caching

Relation Algebra Operators

Cursors

Inter-Process Control

Features Planned for Further Releases

List Serializers

High-Level Transaction API

BLOBS

Prepared Statements

Database Introspector

Encapsulation of Database Function Calls

Copy Control

Catch All PostgreSQL Notices

IDE Support for SQL Patterns

Suggestions?

Any features missing? Don’t hesitate to suggest some using the GitHub issue tracker!


1 While such operations should usually be performed at the PostgreSQL side, they might be useful at the PHP side, too, especially on small relations or when the same query result is used for multiple purposes.
2 Although arrays are more useful as they do not make a syntax error if empty.