Code Monkey home page Code Monkey logo

php-postgresql-database-class's Introduction

PostgresDb Build Status Latest Stable Version Total Downloads License

This project is a PostgreSQL version of ThingEngineer's MysqliDb Class, that supports the basic functionality and syntax provided by said class, tailored specifically to PostgreSQL.

Installation

This class requires PHP 5.4+ or 7+ to work. You can either place the src/PostgresDb.php in your project and require/include it, or use Composer (strongly recommended)

composer require seinopsys/postgresql-database-class:^3.0

Usage

$db = new \SeinopSys\PostgresDb($database_name, $host, $username, $password);

For a more in-depth guide see USAGE.md

Upgrading from 2.x

  1. Removed deprecated methods

    These methods were deprecated in version 2.x and have been removed in 3.x. Use the renamed variants as indicated below:

    2.x 3.x
    $db->rawQuery(…); $db->query(…);
    $db->rawQuerySingle(…); $db->querySingle(…);
    $db->pdo(); $db->getConnection();
  2. Namespace change

    As of 3.x - to comply fully with the PSR-2 coding standard - the class now resides in the SeinopSys namespace. Here's a handy table to show what you need to change and how:

    2.x 3.x
    $db = new PostgresDb(…); $db = new \SeinopSys\PostgresDb(…);
    $db = new \PostgresDb(…); $db = new \SeinopSys\PostgresDb(…);
    use \PostgresDb;

    $db = new PostgresDb(…);
    use \SeinopSys\PostgresDb;

    $db = new PostgresDb(…);
  3. Internal code structure changes

    As of 3.x all private/protected methods and properties have dropped the _ prefix, so be sure to update your wrapper class (if you use one).

php-postgresql-database-class's People

Contributors

seinopsys avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

php-postgresql-database-class's Issues

quoteColumnName incorrectly handles column names containing AS.

Method protected function quoteColumnName incorrectly handles column names containing AS (even if it is allowed).
My guess it should return after doing implode:
protected function quoteColumnName($columnName, $allowAs = false)
{
$columnName = trim($columnName);
$hasAs = preg_match('\S\s+AS\s+\Si', $columnName);
if ($allowAs && $hasAs) {
$columnName = implode(' AS ', $this->quoteColumnNames(preg_split('~\s+AS\s+~i', $columnName)));
return $columnName; // -- Here is my suggested change
}
...

Where to add the DB port?

Hello,

great job :) Is there a way to add the port number without editing the class?

Thanks a lot :)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.