Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/manifestwebdesign/dabl-query
Object oriented query builder
https://github.com/manifestwebdesign/dabl-query
Last synced: 15 days ago
JSON representation
Object oriented query builder
- Host: GitHub
- URL: https://github.com/manifestwebdesign/dabl-query
- Owner: ManifestWebDesign
- License: mit
- Created: 2016-07-03T22:24:38.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2018-01-22T16:30:31.000Z (about 7 years ago)
- Last Synced: 2024-04-27T00:22:57.404Z (9 months ago)
- Language: PHP
- Size: 39.1 KB
- Stars: 0
- Watchers: 3
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[![Build Status](https://travis-ci.org/ManifestWebDesign/dabl-query.svg?branch=master)](https://travis-ci.org/ManifestWebDesign/dabl-query)
# DABL Query
Lightweight object-oriented SQL query builder## Example
code:
```php
use Dabl\Query\Query;
use Dabl\Adapter\DABLPDO;$q = Query::create('my_table')
->leftJoin('my_table.id', 'other_table.my_table_id')
->add('my_column', 'some value')
->orGreater('another_column', 5)
->groupBy('other_table.id')
->orderBy('my_table.name', Query::DESC);echo "$q";
$pdo = DABLPDO::connect(array(
'driver' => 'mysql',
'host' => 'localhost',
'dbname' => 'test',
'user' => 'root',
'password' => ''
));$q->getQuery($pdo)->bindAndExecute();
```output:
```sql
SELECT my_table.*
FROM my_table
LEFT JOIN other_table ON (my_table.id = other_table.my_table_id)
WHERE
my_column = 'some value'
OR another_column > 5
GROUP BY other_table.id
ORDER BY my_table.name DESC
```## Features
* Nested conditions in WHERE and HAVING clauses
* Subqueries
* Joins