2017 © Pedro Peláez
 

library sqlschema

Provides facilities to read table names and table columns from a database using PDO.

image

aura/sqlschema

Provides facilities to read table names and table columns from a database using PDO.

  • Friday, April 29, 2016
  • by pmjones
  • Repository
  • 9 Watchers
  • 36 Stars
  • 23,647 Installations
  • PHP
  • 8 Dependents
  • 0 Suggesters
  • 13 Forks
  • 3 Open issues
  • 7 Versions
  • 8 % Grown

The README.md

Aura.SqlSchema

Provides facilities to read table names and table columns from a database using a PDO connection., (*1)

Foreword

Installation

This library requires PHP 5.3 or later; we recommend using the latest available version of PHP as a matter of principle. It has no userland dependencies., (*2)

It is installable and autoloadable via Composer as aura/sqlschema., (*3)

Alternatively, download a release or clone this repository, then require or include its autoload.php file., (*4)

Quality

Scrutinizer Code Quality Code Coverage Build Status, (*5)

To run the unit tests at the command line, issue phpunit at the package root. (This requires PHPUnit to be available as phpunit.), (*6)

This library attempts to comply with PSR-1, PSR-2, and PSR-4. If you notice compliance oversights, please send a patch via pull request., (*7)

Community

To ask questions, provide feedback, or otherwise communicate with the Aura community, please join our Google Group, follow @auraphp on Twitter, or chat with us on #auraphp on Freenode., (*8)

Getting Started

Instantiation

Instantiate a driver-specific schema object with a matching PDO instance:, (*9)


Fetching Table Lists

To get a list of tables in the database, issue fetchTableList():, (*10)

<?php
$tables = $schema->fetchTableList();
foreach ($tables as $table) {
    echo $table . PHP_EOL;
}
?>

Fetching Column Information

To get information about the columns in a table, issue fetchTableCols():, (*11)

<?php
$cols = $schema->fetchTableCols('table_name');
foreach ($cols as $name => $col) {
    echo "Column $name is of type "
       . $col->type
       . " with a size of "
       . $col->size
       . PHP_EOL;
}
?>

Each column description is a Column object with the following properties:, (*12)

  • name: (string) The column name, (*13)

  • type: (string) The column data type. Data types are as reported by the database., (*14)

  • size: (int) The column size., (*15)

  • scale: (int) The number of decimal places for the column, if any., (*16)

  • notnull: (bool) Is the column marked as NOT NULL?, (*17)

  • default: (mixed) The default value for the column. Note that sometimes this will be null if the underlying database is going to set a timestamp automatically., (*18)

  • autoinc: (bool) Is the column auto-incremented?, (*19)

  • primary: (bool) Is the column part of the primary key?, (*20)

The Versions

29/04 2016

2.x-dev

2.9999999.9999999.9999999-dev https://github.com/auraphp/Aura.SqlSchema

Provides facilities to read table names and table columns from a database using PDO.

  Sources   Download

BSD-2-Clause

The Requires

  • php >=5.3.0

 

database sql schema postgresql postgres pdo mysql db sqlite sqlserver pgsql sql server sqlsrv ddl

29/04 2016

2.0.3

2.0.3.0 https://github.com/auraphp/Aura.SqlSchema

Provides facilities to read table names and table columns from a database using PDO.

  Sources   Download

BSD-2-Clause

The Requires

  • php >=5.3.0

 

database sql schema postgresql postgres pdo mysql db sqlite sqlserver pgsql sql server sqlsrv ddl

09/02 2016

2.0.2

2.0.2.0 https://github.com/auraphp/Aura.SqlSchema

Provides facilities to read table names and table columns from a database using PDO.

  Sources   Download

BSD-2-Clause

The Requires

  • php >=5.3.0

 

database sql schema postgresql postgres pdo mysql db sqlite sqlserver pgsql sql server sqlsrv ddl

27/03 2015

2.0.1

2.0.1.0 https://github.com/auraphp/Aura.SqlSchema

Provides facilities to read table names and table columns from a database using PDO.

  Sources   Download

BSD-2-Clause

The Requires

  • php >=5.3.0

 

database sql schema postgresql postgres pdo mysql db sqlite sqlserver pgsql sql server sqlsrv ddl

16/03 2015

2.0.0

2.0.0.0 https://github.com/auraphp/Aura.SqlSchema

Provides facilities to read table names and table columns from a database using PDO.

  Sources   Download

BSD-2-Clause

The Requires

  • php >=5.3.0

 

database sql schema postgresql postgres pdo mysql db sqlite sqlserver pgsql sql server sqlsrv ddl

16/03 2015

dev-migration

dev-migration https://github.com/auraphp/Aura.SqlSchema/releases

Provides facilities to read table names and table columns from a database using PDO.

  Sources   Download

BSD-2-Clause

The Requires

  • php >=5.3.0

 

database sql schema postgresql postgres pdo mysql db sqlite sqlserver pgsql sql server sqlsrv ddl

10/01 2014

2.0.0-beta1

2.0.0.0-beta1 https://github.com/auraphp/Aura.Sql_Schema/releases

Provides facilities to read table names and table columns from a database using PDO.

  Sources   Download

BSD-2-Clause

The Requires

  • php >=5.3.0

 

schema postgresql postgres pdo mysql sqlite sqlserver pgsql sql server sqlsrv