---
title: "Class overview"
manual: "TYPO3 Explained"
version: "12.4"
permalink: "https://docs.typo3.org/permalink/t3coreapi:database-class-overview@12.4"
source: "ApiOverview/Database/ClassOverview/Index.rst"
rendered: "2026-10-21T15:29:37+00:00"
---

> [!WARNING]
> **Attention**
>
> TYPO3 v12 has reached end-of-life as of April 30th 2026 and
> is no longer being maintained. Use the version switcher on the top
> left of this page to select documentation for a supported version of TYPO3.
>
> Need more time before upgrading?
> You can purchase Extended Long Term Support (ELTS) for TYPO3 v12 here:
> [TYPO3 ELTS](https://typo3.com/services/extended-support-elts).

# Class overview {#database-class-overview}

Doctrine DBAL provides a set of PHP objects to represent, create and handle SQL
queries and their results. The basic class structure has been slightly enriched
by TYPO3 to add CMS-specific features. Extension authors will usually interact
with these classes and objects:

-   **`\TYPO3\CMS\Core\Database\Connection`**

    This object represents a specific [connection](https://docs.typo3.org/permalink/t3coreapi:database-connection@12.4) to
    one connected database. It provides "shortcut" methods for simple standard
    queries like `SELECT` or `UPDATE`. To create more complex queries,
    an instance of the [QueryBuilder](https://docs.typo3.org/permalink/t3coreapi:database-query-builder@12.4) can be
    retrieved.

-   **`\TYPO3\CMS\Core\Database\ConnectionPool`**

    The [ConnectionPool](https://docs.typo3.org/permalink/t3coreapi:database-connection-pool@12.4) is the main entry point
    for extensions to retrieve a specific connection over which to execute a
    query. Usually it is used to return a [Connection](https://docs.typo3.org/permalink/t3coreapi:database-connection@12.4) or a [QueryBuilder](https://docs.typo3.org/permalink/t3coreapi:database-query-builder@12.4)
    object.

-   **`\TYPO3\CMS\Core\Database\Query\Expression\ExpressionBuilder`**

    The [ExpressionBuilder](https://docs.typo3.org/permalink/t3coreapi:database-expression-builder@12.4) object is used to
    model complex expressions. It is mainly used for `WHERE` and
    `JOIN` conditions.

-   **`\TYPO3\CMS\Core\Database\Query\QueryBuilder`**

    With the help of the [QueryBuilder](https://docs.typo3.org/permalink/t3coreapi:database-query-builder@12.4) one can
    create all sort of complex queries executed on a specific connection. It
    provides the main CRUD methods for
    `select()`, `delete()` and friends.

-   **`TYPO3\CMS\Core\Database\Query\Restriction\...`**

    [Restrictions](https://docs.typo3.org/permalink/t3coreapi:database-restriction-builder@12.4) are a set of classes that
    add expressions like `deleted=0` to a query, based on the
    [TCA settings of a table](https://docs.typo3.org/m/typo3/reference-tca/12.4/en-us/Ctrl/Index.html#ctrl). They automatically adds
    TYPO3-specific restrictions like start time and end time, as well as deleted
    and hidden flags. Further restrictions for language overlays and workspaces
    are available. In this documentation, these classes are referred as
    `RestrictionBuilder`.

-   **`\Doctrine\DBAL\Driver\Statement`**

    This [result object](https://docs.typo3.org/permalink/t3coreapi:database-statement@12.4) is returned when a
    `SELECT` or `COUNT` query was executed. Single rows are returned
    as an array by calling `->fetchAssociative()` until the method
    returns `false`.
