2017 © Pedro Peláez
 

library pgdb

DB class for working with PostgreSQL

image

ikitiki/pgdb

DB class for working with PostgreSQL

  • Saturday, August 6, 2016
  • by ikitiki
  • Repository
  • 1 Watchers
  • 2 Stars
  • 33 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

Pgdb

Travis, (*1)

Class for working with PostgreSQL database, (*2)

Usage

Create db instance:, (*3)

$db = new Ikitiki\DB();

$db->setHost('127.0.0.1');
$db->setUsername('postgres');
$db->setDbName('test');

Make queries:

Single row query:, (*4)

$res = $db->execOne(
    "select id, name from users where email = '%s' and status_id = %d limit 1", 
    Ikitiki\DB::quote('john_doe@company.com'),
    1
);
// Executes "select id, email from users where email = 'john_doe@company.com' and status_id = 1"
// $res = [
//   'id' => 1,
//   'name' => 'John Doe'
// ];

Key-value queries:, (*5)

$res = $db->exec("select id, name from users")->fetchArray('id', 'name');
// $res = [
//   1 => 'John Doe',
//   2 => 'Richard Roe',
//   3 => 'Mark Moe',
//   ...
// ]

or, (*6)

$res = $db->exec("select id, name, department_id from users")->fetchArray('id');
// $res = [
//   1 => ['name' => 'John Doe', 'department_id' => 1],
//   2 => ['name' => 'Richard Roe', 'department_id' => 1],
//   3 => ['name' => 'Mark Moe', 'department_id' => 2]
//   ...
// ];

Use complex types:

```php $res = $db->exec('select \'{"id":1,"name":"John Doe","department":"Sales"}\'::json as j from users')->fetchArray('j'); //$res = [ // 'id' => 1, // 'name' => 'John Doe', // 'department' => 'Sales', //], (*7)

The Versions

06/08 2016

dev-master

9999999-dev http://github.com/ikitiki/pgdb

DB class for working with PostgreSQL

  Sources   Download

MIT

The Requires

  • php >=5.4.0
  • ext-pgsql *
  • ext-json >=1.0.0

 

The Development Requires

by Murat Kabilov

database postgresql db

24/04 2015

1.0.4

1.0.4.0 http://github.com/ikitiki/pgdb

DB class for working with PostgreSQL

  Sources   Download

MIT

The Requires

  • php >=5.4.0
  • ext-pgsql *
  • ext-json >=1.0.0

 

by Murat Kabilov

database postgresql db