2017 © Pedro Peláez
 

library lazypdo

Just a bit of sugar in PDO

image

fterenzani/lazypdo

Just a bit of sugar in PDO

  • Sunday, January 22, 2017
  • by fterenzani
  • Repository
  • 1 Watchers
  • 2 Stars
  • 24 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 6 Versions
  • 0 % Grown

The README.md

// Lazy database connection
$lazyPdo = new \LazyPdo\Lazy('sqlite:::memory:');

// Normal connection
$notLazyPdo = new \LazyPdo\Pdo('sqlite:::memory:');

// It is the equivalent of
// $pdo = new PDO('sqlite:::memory:');
// $pdo->setAttribute(\PDO::ATTR_ERRMODE , \PDO::ERRMODE_EXCEPTION);
// $pdo->setAttribute(\PDO::ATTR_DEFAULT_FETCH_MODE, \PDO::FETCH_OBJ);

$lazyPdo instanceof \LazyPdo\LazyPdo; // true
$notLazyPdo instanceof \LazyPdo\LazyPdo; // true

$lazyPdo instanceof \PDO; // true
$notLazyPdo instanceof \PDO; // true

// Get the instance of \PDO
$pdo = $lazyPdo->getPdo();

// Shorthand method
$results = $lazyPdo->query($sql, array($vars, $to, $bind));

// It is the equivalent of:
// $stmt = $pdo->prepare($sql);
// $stmt->execute(array($vars, $to, $bind));
// $results = $stmt;

// Shorthand method
$affectedRows = $lazyPdo->exec($sql, array($vars, $to, $bind));

// It is the equivalent of:
// $stmt = $pdo->prepare($sql);
// $stmt->execute(array($vars, $to, $bind));
// $affectedRows = $stmt->rowCount();

$stmt = $lazyPdo->query($sql, array($vars, $to, $bind));

$stmt->fetchObjects('\My\CustomClass', array($constructor, $arguments));
// It is the equivalent of:
$stmt->fetchAll(\PDO::FETCH_CLASS, '\My\CustomClass', array($constructor, $arguments));

$stmt->fetchColumns(0);
// It is the equivalent of:
$stmt->fetchAll(\PDO::FETCH_COLUMN);

The Versions

22/01 2017

dev-master

9999999-dev https://github.com/fterenzani/LazyPdo

Just a bit of sugar in PDO

  Sources   Download

LGPL

The Requires

  • php >=5.4

 

database pdo db

22/01 2017

4.0

4.0.0.0 https://github.com/fterenzani/LazyPdo

Just a bit of sugar in PDO

  Sources   Download

LGPL

The Requires

  • php >=5.4

 

database pdo db

19/01 2017

v2.x-dev

2.9999999.9999999.9999999-dev https://github.com/fterenzani/LazyPdo

Just a bit of sugar in PDO

  Sources   Download

LGPL

The Requires

  • php >=5.4

 

database pdo db

19/01 2017

3.0

3.0.0.0 https://github.com/fterenzani/LazyPdo

Just a bit of sugar in PDO

  Sources   Download

LGPL

The Requires

  • php >=5.4

 

database pdo db

15/07 2015

2.0

2.0.0.0 https://github.com/fterenzani/LazyPdo

Just a bit of sugar in PDO

  Sources   Download

LGPL

The Requires

  • php >=5.4

 

database pdo db data base

30/07 2014

1.0.1

1.0.1.0 https://github.com/fterenzani/LazyPdo

Just a bit of sugar in PDO

  Sources   Download

LGPL

The Requires

  • php >=5.3

 

database pdo db data base