2017 © Pedro Peláez
 

library mdb

Miniature PHP5 DB library for MySQL.

image

nmenglund/mdb

Miniature PHP5 DB library for MySQL.

  • Monday, July 6, 2015
  • by nmenglund
  • Repository
  • 1 Watchers
  • 0 Stars
  • 58 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

mdb

Miniature PHP5 DB library for MySQL, with a handy Transformer class for performing elementary ETL (extract, transform, load) and batch tasks., (*1)

Installation

Using composer.json:, (*2)

{
    "require": {
        "nmenglund/mdb": "*"
    }
}

Usage

$db = new \Mdb\Db('localhost', 'user', 'pass', 'database', $port);
$users = $db->select('select * from user');
while ($user = $users->fetch())
{
    echo "User: {$user['username']}\n";
}

Transformer usage

$transformer = new \Mdb\Transformer(
                new \Mdb\Db('localhost','usr','pass','source'),
                new \Mdb\Db('localhost','usr','pass','destination'));

$transformer->queryToOne(
    "SELECT option_id, option_name, option_value FROM wp_options",
    "new_option_table",
    function ($src) {
        $newRow = array(
            'name' => $src['option_name'],
            'value' => $src['option_value']);
        return $newRow;
    });

Dumper usage

$connection = new \Mdb\Db('localhost', 'user', 'pass', 'database', $port);

// Dump HTML for all tables in the database
\Mdb\HtmlDumper::dumpAll($connection);

// Dump HTML for tables with a name matching the regex /^wp_/
\Mdb\HtmlDumper::dumpSome($connection, '/^wp_/');

// Dump HTML for specific table or query (assume table if /^[a-z_]+$/)
\Mdb\HtmlDumper::dump($connection, 'wp_options');
\Mdb\HtmlDumper::dump($connection, 'SELECT * FROM wp_options');

The Versions

06/07 2015

dev-master

9999999-dev http://github.com/nmenglund/mdb

Miniature PHP5 DB library for MySQL.

  Sources   Download

MIT

The Requires

  • php >=5.2.0

 

by Nils Magnus Englund

06/07 2015

1.0.0

1.0.0.0 http://github.com/nmenglund/mdb

Miniature PHP5 DB library for MySQL.

  Sources   Download

MIT

The Requires

  • php >=5.2.0

 

by Nils Magnus Englund