All Projects → auraphp → Aura.SqlSchema

auraphp / Aura.SqlSchema

Licence: BSD-2-Clause license
Independent schema discovery tools for MySQL, PostgreSQL, SQLite, and Microsoft SQL Server.

Programming Languages

PHP
23972 projects - #3 most used programming language

Projects that are alternatives of or similar to Aura.SqlSchema

Aura.auth
Provides a unified interface to local and remote authentication systems.
Stars: ✭ 121 (+210.26%)
Mutual labels:  pdo, aura
eslint-plugin-aura
Salesforce Lightning (Aura) specific linting rules for ESLint
Stars: ✭ 24 (-38.46%)
Mutual labels:  aura
Basicdb
PDO ile geliştirilmiş kullanımı kolay veritabanı sınıfıdır.
Stars: ✭ 127 (+225.64%)
Mutual labels:  pdo
Hydrahon
🐉 Fast & standalone PHP MySQL Query Builder library.
Stars: ✭ 194 (+397.44%)
Mutual labels:  pdo
Zebra session
A drop-in replacement for PHP's default session handler which stores session data in a MySQL database, providing both better performance and better security and protection against session fixation and session hijacking
Stars: ✭ 133 (+241.03%)
Mutual labels:  pdo
Database
💾 A database layer with a familiar PDO-like API but much more powerful. Building queries, advanced joins, drivers for MySQL, PostgreSQL, SQLite, MS SQL Server and Oracle.
Stars: ✭ 251 (+543.59%)
Mutual labels:  pdo
Swpdo
Swoole Coroutine SQL component like PDO | 0成本迁移PDO到Swoole高性能协程客户端
Stars: ✭ 64 (+64.1%)
Mutual labels:  pdo
WoWSimpleRegistration
Simple Registration page for TrinityCore/AzerothCore/AshamaneCore/CMangos
Stars: ✭ 121 (+210.26%)
Mutual labels:  pdo
pdo-mysql-login-register
Simple PHP Login & Register using PDO MySQL
Stars: ✭ 37 (-5.13%)
Mutual labels:  pdo
Zend Diagnostics
Universal set of diagnostic tests for PHP applications.
Stars: ✭ 192 (+392.31%)
Mutual labels:  pdo
Pdo
Connecting to MySQL in PHP using PDO.
Stars: ✭ 187 (+379.49%)
Mutual labels:  pdo
Uxdm
🔀 UXDM helps developers migrate data from one system or format to another.
Stars: ✭ 159 (+307.69%)
Mutual labels:  pdo
Aura.Payload Interface
An interface package for Domain Payload implementations.
Stars: ✭ 12 (-69.23%)
Mutual labels:  aura
CircleBilling
Official release of CircleBilling
Stars: ✭ 28 (-28.21%)
Mutual labels:  pdo
Company Website Pro
现代公司企业官网以及电子商务产品网站
Stars: ✭ 172 (+341.03%)
Mutual labels:  pdo
Nukeviet
NukeViet CMS is multi Content Management System. NukeViet CMS is the 1st open source content management system in Vietnam. NukeViet was awarded the Vietnam Talent 2011, the Ministry of Education and Training Vietnam officially encouraged to use.
Stars: ✭ 113 (+189.74%)
Mutual labels:  pdo
Php Pdo Mysql Class
A PHP MySQL PDO class similar to the the Python MySQLdb, which supports iterator and parameter binding when using "WHERE IN" statement.
Stars: ✭ 213 (+446.15%)
Mutual labels:  pdo
apostilas
Apostilas sobre diversos assuntos: PHP, PDO, MySQL, PHPOO, MVC, mobile, scratch, git, github, docker, vps, alpine linux, segurança na wev, servidores, etc
Stars: ✭ 49 (+25.64%)
Mutual labels:  pdo
Flex-AntiCheat
Flex AntiCheat - Optimized Configs For Multiple AntiCheats
Stars: ✭ 37 (-5.13%)
Mutual labels:  aura
mysqly
Full-featured opensource small-overhead PHP data framework for Mysql built for fast and efficient development
Stars: ✭ 18 (-53.85%)
Mutual labels:  pdo

Aura.SqlSchema

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

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.

It is installable and autoloadable via Composer as aura/sqlschema.

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

Quality

Scrutinizer Code Quality Code Coverage Build Status

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

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.

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.

Getting Started

Instantiation

Instantiate a driver-specific schema object with a matching PDO instance:

<?php
use Aura\SqlSchema\ColumnFactory;
use Aura\SqlSchema\MysqlSchema; // for MySQL
use Aura\SqlSchema\PgsqlSchema; // for PostgreSQL
use Aura\SqlSchema\SqliteSchema; // for Sqlite
use Aura\SqlSchema\SqlsrvSchema; // for Microsoft SQL Server
use PDO;

// a PDO connection
$pdo = new PDO(...);

// a column definition factory
$column_factory = new ColumnFactory();

// the schema discovery object
$schema = new MysqlSchema($pdo, $column_factory);
?>

Fetching Table Lists

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

<?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():

<?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:

  • name: (string) The column name

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

  • size: (int) The column size.

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

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

  • 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.

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

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

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].