定制 tox2ik/php-mysqli-aliases 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

tox2ik/php-mysqli-aliases

Composer 安装命令:

composer require tox2ik/php-mysqli-aliases

包简介

fetch-array, insert values, etc

README 文档

README

Not sure what the original authors were thinking in 2004, but I definetly don't want to write something like this just to fill a hash with records.

if ($db->query("INSERT INTO studends ... ;")) {
    if ($res = mysqli_insert_id($db)) {
        if ($qRes = $db->query("SELECT * FROM exam_results WHERE studint_id ...")) {
            while ($rec = mysqli_fetch_assoc($qRes)) {
                $rows[] = $rec
            }
        }
    }
}

This is acceptable:

if (qInsert('insert into students ...;')) {
    $rows = qAssocAll("SELECT * FROM exam_results WHERE studint_id ...");
}

Helpers

qArrayAll()              - get array (hydrate: both)
qAssocAll()              - get array (hydrate: associative)
qArrayColumnAll()        - get all values of a single column
qArrayOne()              - get a single record
qAssocOne()              - get a single record (assoc)
qOne()                   - get a single record (assoc)
qEscape()                - escape ' and "
qExists()                - get a true boolean if a query produces results
qInsert()                - get the last inserted id after inserting
qInsertId()              - get the last inserted id without inserting anything
qLastId()                - get the last inserted id without inserting anything
qResult()                - query and get a result set
qPrep()                  - prepare a statement
qExecutePrepared()       - yep
qUpdate()                - get the number of affected rows    
qVar()                   - get a single value
qError()                 - get last error

Features

  • reduces boilerplate
  • supports mysqli and PDO with the same interface
  • loggs all SQL errors to the error_log without die()
  • returns array instead of false, empty or not.
  • fetch one column as a flat list
  • fetch a single value
  • fetches in bulk (no while-fetch-one)
  • returns the raw result object or resource if you need it

统计信息

  • 总下载量: 538
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: public-domain
  • 更新时间: 2017-07-31

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固