programster/query-builder-pgsql-driver

A PostgreSQL driver for the programster/query-builder-parser package.

1.0.0 2021-12-16 20:02 UTC

This package is auto-updated.

Last update: 2022-05-16 21:21:52 UTC


README

A PostgreSQL driver for the query builder parser PHP package. This will result in the parser converting the JSON output into SQL statements appropriate for your PostgreSQL database.

Example Usage

use Programster\QueryBuilderPgsqlDriver\PgSqlDriver;
use Programster\QueryBuilderParser\Parser;

$pgsqlDriver = new PgSqlDriver($conn); // $conn being return from pg_connect()
$parser = new Parser($pgsqlDriver);

// outputs something like: "name" = 'bob' AND "username" LIKE '%yolo%'
$whereCondition = $parser->getSql($jsonString); 

// outputs something like: SELECT * FROM "users" WHERE "name" = 'bob' AND "username" LIKE '%yolo%';
$selectStatement = $parser->getSelectStatement("users", $jsonString);