2017 © Pedro Peláez
 

library db

depage-pdo is a small wrapper around the pdo object which allows late/on demand initializition of the database connection.

image

depage/db

depage-pdo is a small wrapper around the pdo object which allows late/on demand initializition of the database connection.

  • Thursday, October 16, 2014
  • by jonasjonas
  • Repository
  • 2 Watchers
  • 1 Stars
  • 586 Installations
  • PHP
  • 6 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 4 Versions
  • 1 % Grown

The README.md

depage-db

PDO Wrapper

A small wrapper around the pdo object which allows late/on demand initialization of the database connection., (*1)

Schema

The Schema class imports or updates SQL database schemata. Schemata are described by common SQL files with update instructions in comments. SQL files can also be templates to allow for prefixing/replacement of table identifiers., (*2)

Instruction tags

  • @@version
    • mandatory, labels the following code with a version identifier
  • @@tablename
    • mandatory, declares database tablename to be updated
    • marks table identifier for replacement function
  • @@connection
    • marks table identifiers for replacement function

Example

SQL schema file (schema.sql), (*3)

# @tablename example
# @version 0.1
CREATE TABLE example (
    uid int(10) unsigned NOT NULL DEFAULT '0',
    pid int(10) unsigned NOT NULL DEFAULT '0'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

# @version 0.2
ALTER TABLE example
ADD COLUMN did int(10) unsigned NOT NULL DEFAULT '0' AFTER pid;

Import/update in PHP

$schema = new Schema($pdo);
$schema->setReplace(
    function ($tableName) {
        return 'prefix_' . $tableName;
    }
);
$schema->loadFile('schema.sql');

License (dual)

The Versions

16/10 2014

dev-master

9999999-dev

depage-pdo is a small wrapper around the pdo object which allows late/on demand initializition of the database connection.

  Sources   Download

MIT GPL-2.0

The Requires

  • php >= 5.3

 

by Sebastian Reinhold

database pdo db

16/10 2014

dev-merge

dev-merge

depage-pdo is a small wrapper around the pdo object which allows late/on demand initializition of the database connection.

  Sources   Download

MIT GPL-2.0

The Requires

  • php >= 5.3

 

by Sebastian Reinhold

database pdo db

24/02 2014

dev-schema

dev-schema

depage-pdo is a small wrapper around the pdo object which allows late/on demand initializition of the database connection.

  Sources   Download

MIT GPL-2.0

The Requires

  • php >= 5.3

 

database pdo db

24/02 2014

1.4.0

1.4.0.0

depage-pdo is a small wrapper around the pdo object which allows late/on demand initializition of the database connection.

  Sources   Download

MIT GPL-2.0

The Requires

  • php >= 5.3

 

database pdo db