dabl/query
Composer 安装命令:
composer require dabl/query
包简介
DABL object oriented Query builder
README 文档
README
DABL Query
Lightweight object-oriented SQL query builder
Example
code:
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:
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
统计信息
- 总下载量: 455
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 2
- 依赖项目数: 2
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2016-07-04