2017 © Pedro Peláez
 

library simplepdo

Simple PDO Wrapper class for MySQL and SQLite

image

dimns/simplepdo

Simple PDO Wrapper class for MySQL and SQLite

  • Tuesday, September 20, 2016
  • by DimNS
  • Repository
  • 0 Watchers
  • 0 Stars
  • 19 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 5 Versions
  • 0 % Grown

The README.md

Project is deprecated.

Simple PDO Wrapper class for MySQL and SQLite

Latest Stable Version Total Downloads License, (*1)

Requirements

  • PHP 5.3 or higher is required.
  • PHP extension MySQL or SQLite.

Composer installation

  1. Get Composer.
  2. Require SimplePDO with php composer.phar require dimns/simplepdo or composer require dimns/simplepdo (if the composer is installed globally).
  3. Add the following to your application's main PHP file: require 'vendor/autoload.php';.

Usage

// Init class for MySQL (default port 3306)
$db = new DimNS\SimplePDO\MySQL('server', 'dbname', 'username', 'password');
// Or init class for MySQL (override port)
$db = new DimNS\SimplePDO\MySQL('server', 'dbname', 'username', 'password', 3307);
// Or init class for SQLite
$db = new DimNS\SimplePDO\SQLite('/path/to/database/file.sqlite');

// Query without prepared variables
$result = $db->query('SELECT `field1`, `field2` FROM `table`');
echo '

';
print_r($result);
echo '
'; // Query with prepared variables $result = $db->query('INSERT INTO `table` SET `field1` = :field1, `field2` = :field2 ', [ 'field1' => 'Simple string', 'field2' => 123, ]); echo $result; // Transaction (only for mysql innodb table) $result = $db->transaction([ [ 'query' => 'INSERT INTO `table` SET `field1` = :field1, `field2` = :field2, `field3` = :field3', 'data' => [ 'field1' => 'val1', 'field2' => 'val2', 'field3' => 'val3', ], ], [ 'query' => 'UPDATE `table` SET `field1` = :field1 WHERE `field2` > :field2', 'data' => [ 'field1' => 'val1', 'field2' => 'val2', ], ], ]); echo '
';
print_r($result);
echo '
';

Return values

  1. For select and show returns an array containing all of the result set rows.
  2. For insert returns the ID of the inserted row.
  3. For all other queries returns the number of rows affected by the SQL statement.

The Versions

20/09 2016

dev-master

9999999-dev http://github.com/dimns/simplepdo

Simple PDO Wrapper class for MySQL and SQLite

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

pdo mysql sqlite

28/06 2016

v1.2.0

1.2.0.0 http://github.com/dimns/simplepdo

Simple PDO Wrapper class for MySQL and SQLite

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

pdo mysql sqlite

07/06 2016

v1.1.1

1.1.1.0 http://github.com/dimns/simplepdo

Simple PDO Wrapper class for MySQL and SQLite

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

pdo mysql sqlite

05/05 2016

1.1.0

1.1.0.0 http://github.com/dimns/simplepdo

Simple PDO Wrapper class for MySQL and SQLite

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

pdo mysql sqlite

26/04 2016

1.0.0

1.0.0.0 http://github.com/dimns/simplepdo

Simple PDO Wrapper class for MySQL and SQLite

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

pdo mysql sqlite