zonuexe / tetosql
简单安全的SQL模板
0.5.5
2022-09-02 16:14 UTC
Requires
- php: >=5.4
Requires (Dev)
- php-coveralls/php-coveralls: ^2.1 || ^1.1
- phpunit/phpunit: ^8.5 || ^7.5 || ^4.8
- yoast/phpunit-polyfills: ^1.0
Suggests
- ext-mysql: MySQL support
README
PHP数据对象(PDO)包装器和SQL模板
特性
- PDO包装器
- 查询模板
- 类型安全
- 值序列
手册
日语:为忧郁的SQL准备的,或者和PDO做好朋友,垫高枕头好好睡觉
语法
类型
@int- 整数值(-9223372036854775808 <= n <=9223372036854775807)@int[]- 整数序列@string- 字符串@string[]- 字符串序列@lob- 大对象@ascdesc-"ASC"或"DESC"或"asc"或"desc"
示例
<?php namespace MyApp; use Teto\SQL\Query; $conn = new \PDO('sqlite:/tmp/db.sq3', null, null, [\PDO::ATTR_PERSISTENT => true]); $data = Query::execute( $conn, <<<'SQL' SELECT * FROM `users` WHERE `status` IN (:statuses@int[]) LIMIT :offset@int, :limit@int SQL, [ ':statuses' => [1, 3], ':offset' => 60, ':limit' => 30, ] )->fetch(\PDO::FETCH_ASSOC);
版权
TetoSQL 采用 Mozilla公共许可证版本2.0。
Simple and secure SQL templating
Copyright (c) 2019 USAMI Kenta <tadsan@zonu.me>
PxvSql
TetoSQL 是从 pixiv Inc. 的私有库 PxvSql 分支(并调整)而来的。
PHP手册
PDOInterface.php 和 PDOStatementInterface.php 基于 PHP手册(英文)。
版权 © 1997 - 2016 由PHP文档组所有。此材料只能根据Creative Commons Attribution 3.0许可证或更高版本的条件分发。Creative Commons Attribution 3.0许可证的副本与手册一起分发。最新版本可在» http://creativecommons.org/licenses/by/3.0/找到。