ajbassett539/simple-database
Composer 安装命令:
composer require ajbassett539/simple-database
包简介
Simple mysqli database wrapper to retrieve stdClass objects.
README 文档
README
Simple mysqli Database Wrapper to Retrieve stdClass Objects.
Installation
composer require ajbassett539/simple-database
Instantiation
include 'vendor/autoload.php';
$db = new \Database\DB();
Credentials
## .htaccess
SetEnv DATABASE_HOST localhost
SetEnv DATABASE_USER usernaem
SetEnv DATABASE_PASS passwerd
SetEnv DATABASE_NAME fancy_db
SetEnv LOG_SQL_QUERIES 1
Methods
query
public function query($sql = "", $multirow = false, $raw = false)
Takes an SQL string and attempts to execute. You are responsible for sanitization and syntax.
If you anticipate multiple rows, $multirow = true.
If you'd rather have the mysqli result object, $raw = true.
Returns stdClass PHP object(s) for the result or false.
execute
public static function execute($sql = "", $multirow = false, $raw = false)
Does the same exact thing, just called statically.
Creates a new connection for each call, so it's not advisable to use this in a loop.
escape
public function escape($string)
Returns the escaped string.
real_escape
public static function real_escape($string)
Does the same thing, just called statically.
getLastError
public function getLastError()
Returns the last error as string.
affected_rows
public function affected_rows()
Returns the affected rows of the last query.
insert_id
public function insert_id()
Return the insert id of the last query.
ajbassett539/simple-database 适用场景与选型建议
ajbassett539/simple-database 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 17 次下载、GitHub Stars 达 0, 最近一次更新时间为 2021 年 01 月 12 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 ajbassett539/simple-database 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 ajbassett539/simple-database 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 17
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 4
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: Unknown
- 更新时间: 2021-01-12