classPgSqlSessionFactory
final class PgSqlSessionFactory
implements SessionFactory
Public API: explicitly declared with
@visibility public.Factory for creating Session instances pre-configured for PostgreSQL.
$statement = new class implements \ZtdQuery\Connection\StatementInterface { public function execute(?array $params = null): bool { return true; } public function fetchAll(): array { return []; } public function resultColumns(\ZtdQuery\Platform\ResultColumnTypeResolver $typeResolver): array { return []; } public function rowCount(): int { return 0; } };
$connection = new class($statement) implements \ZtdQuery\Connection\ConnectionInterface { public function __construct(private \ZtdQuery\Connection\StatementInterface $statement) {} public function query(string $sql): \ZtdQuery\Connection\StatementInterface|false { return $this->statement; } };
$session = (new \ZtdQuery\Platform\Postgres\PgSqlSessionFactory())->create($connection, new \ZtdQuery\Config\ZtdConfig());
$session->isEnabled() // => true
$session->splitStatements('SELECT 1; SELECT 2') // => ['SELECT 1', 'SELECT 2']Methods§
public function create(ConnectionInterface $connection, ZtdConfig $config): SessionPublic API: explicitly declared with
@visibility public.{@inheritDoc}
Parameters
$connection | ConnectionInterface | |
$config | ZtdConfig |
Returns
$statement = new class implements \ZtdQuery\Connection\StatementInterface { public function execute(?array $params = null): bool { return true; } public function fetchAll(): array { return []; } public function resultColumns(\ZtdQuery\Platform\ResultColumnTypeResolver $typeResolver): array { return []; } public function rowCount(): int { return 0; } };
$connection = new class($statement) implements \ZtdQuery\Connection\ConnectionInterface { public function __construct(private \ZtdQuery\Connection\StatementInterface $statement) {} public function query(string $sql): \ZtdQuery\Connection\StatementInterface|false { return $this->statement; } };
$session = (new \ZtdQuery\Platform\Postgres\PgSqlSessionFactory())->create($connection, new \ZtdQuery\Config\ZtdConfig());
$session->isEnabled() // => true
$session->splitStatements('SELECT 1; SELECT 2') // => ['SELECT 1', 'SELECT 2']Test cases 10
PgSqlSessionFactoryTest::testCreatedSessionIsEnabledByDefaultcallsPgSqlSessionFactoryTest::testCreateRegistersReflectedPartialUniqueIndexescallsPgSqlSessionFactoryTest::testCreateRegistersReflectedPartitionMetadatacallsPgSqlSessionFactoryTest::testCreateRegistersReflectedViewscallsPgSqlSessionFactoryTest::testCreateReturnsSessioncallsPgSqlSessionFactoryTest::testCreateWithEmptyDatabaseReturnsSessioncallsPgSqlSessionFactoryTest::testCreateWithNullParseResultStillWorkscallsPgSqlSessionFactoryTest::testCreateWithTableRegistersSchemaInSessioncallsPgSqlSessionFactoryTest::testCreateWithTablesReflectsSchemacallsPgSqlSessionFactoryTest::testSessionCanBeEnabledAfterCreationcalls
Calls 24
- new ShadowStore line 56
- new PgSqlParser line 57
- new PgSqlSchemaParser line 58
- new TableDefinitionRegistry line 59
- new PgSqlSchemaReflector line 61
- method-call SchemaInitializer::populate() line 62
- new SchemaInitializer line 62
- new ViewDefinitionSet line 63
- method-call PgSqlSchemaReflector::reflectViews() line 64
- method-call ViewDefinitionSet::register() line 65
- new PgSqlQueryGuard line 68
- new SelectTransformer line 69
- new InsertTransformer line 70
- new UpdateTransformer line 71
- new DeleteTransformer line 72
- new PgSqlTransformer line 73
- new PgSqlMutationResolver line 74
- new PgSqlRewriter line 75
- new Session line 77
- new ResultSelectRunner line 80
- new ShadowTransactions line 83
- new PgSqlCopySupport line 85
- new PgSqlPdoParameterBindingCompiler line 86
- new PgSqlPdoResultColumnTypeResolver line 87
Test cases 11§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.
Dedicated tests 10
PgSqlSessionFactoryTest::testCreatedSessionIsEnabledByDefaultcallsPgSqlSessionFactoryTest::testCreateRegistersReflectedPartialUniqueIndexescallsPgSqlSessionFactoryTest::testCreateRegistersReflectedPartitionMetadatacallsPgSqlSessionFactoryTest::testCreateRegistersReflectedViewscallsPgSqlSessionFactoryTest::testCreateReturnsSessioncallsPgSqlSessionFactoryTest::testCreateWithEmptyDatabaseReturnsSessioncallsPgSqlSessionFactoryTest::testCreateWithNullParseResultStillWorkscallsPgSqlSessionFactoryTest::testCreateWithTableRegistersSchemaInSessioncallsPgSqlSessionFactoryTest::testCreateWithTablesReflectsSchemacallsPgSqlSessionFactoryTest::testSessionCanBeEnabledAfterCreationcalls