Neuron-PHP

SchemaIntrospector

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

Methods

introspect()

Introspect a table and return its FieldSet.

public introspect(string $table) : FieldSet
Parameters
$table : string
Tags
throws
Exception

if the adapter is unsupported or the table has no columns

Return values
FieldSet

extractLength()

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|null

introspectMysql()

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
string

quoteIdentifier()

Quote a table identifier for safe interpolation in PRAGMA.

private quoteIdentifier(string $identifier) : string
Parameters
$identifier : string
Return values
string
On this page

Search results