programster/query-builder-pgsql-driver

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

1.0.1 2024-03-21 12:16 UTC

This package is auto-updated.

Last update: 2024-12-21 13:56:44 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);