SchemaIntrospector
in package
Introspects an existing database table into a {@see FieldSet}.
Supports SQLite (PRAGMA table_info), MySQL and PostgreSQL (information_schema.columns). This is the primary path for generating CRUD against pre-existing tables such as the legacy GroupOffice schema.
Table of Contents
Properties
- $pdo : PDO
Methods
- __construct() : mixed
- introspect() : FieldSet
- Introspect a table and return its FieldSet.
- extractLength() : int|null
- Extract a length specifier from a declared type, e.g. varchar(255) -> 255.
- introspectMysql() : array<string|int, Field>
- introspectPostgres() : array<string|int, Field>
- introspectSqlite() : array<string|int, Field>
- mapSqliteType() : string
- Map a raw SQLite declared type to a logical type.
- quoteIdentifier() : string
- Quote a table identifier for safe interpolation in PRAGMA.
Properties
$pdo
private
PDO
$pdo
Methods
__construct()
public
__construct(PDO $pdo) : mixed
Parameters
- $pdo : PDO
introspect()
Introspect a table and return its FieldSet.
public
introspect(string $table) : FieldSet
Parameters
- $table : string
Tags
Return values
FieldSetextractLength()
Extract a length specifier from a declared type, e.g. varchar(255) -> 255.
private
extractLength(string $rawType) : int|null
Parameters
- $rawType : string
Return values
int|nullintrospectMysql()
private
introspectMysql(string $table) : array<string|int, Field>
Parameters
- $table : string
Return values
array<string|int, Field>introspectPostgres()
private
introspectPostgres(string $table) : array<string|int, Field>
Parameters
- $table : string
Return values
array<string|int, Field>introspectSqlite()
private
introspectSqlite(string $table) : array<string|int, Field>
Parameters
- $table : string
Return values
array<string|int, Field>mapSqliteType()
Map a raw SQLite declared type to a logical type.
private
mapSqliteType(string $rawType) : string
Parameters
- $rawType : string
Return values
stringquoteIdentifier()
Quote a table identifier for safe interpolation in PRAGMA.
private
quoteIdentifier(string $identifier) : string
Parameters
- $identifier : string