diff --git a/docs/component/store/mysql/common-query.md b/docs/component/store/mysql/common-query.md index ab583a2f..c909b2eb 100644 --- a/docs/component/store/mysql/common-query.md +++ b/docs/component/store/mysql/common-query.md @@ -7,6 +7,10 @@ $wrapper = \ZM\MySQL\MySQLManager::getWrapper(); ``` +!!! tip "提示" + + 这部分内容部分直接取自 [DBAL - Data Retrieval And Manipulation](https://www.doctrine-project.org/projects/doctrine-dbal/en/2.13/reference/data-retrieval-and-manipulation.html) 原文并直接翻译,如有实际不同请提交 Issue 反馈。 + ## 执行预处理 SQL 语句 预处理查询很巧妙地解决了 SQL 注入问题,并且可以方便地绑定参数进行查询。 diff --git a/docs/component/store/mysql/config.md b/docs/component/store/mysql/config.md index 201502a1..6ef8d150 100644 --- a/docs/component/store/mysql/config.md +++ b/docs/component/store/mysql/config.md @@ -2,6 +2,6 @@ 炸毛框架的数据库组件支持原生 SQL、查询构造器,去掉了复杂的对象模型关联,同时默认为数据库连接池,使开发变得简单。 -数据库的配置位于 `config/global.php` 文件的 `mysql_config` 段。 +数据库的配置位于 `config/global.php` 文件的 `mysql_config` 段,见 [全局配置](../../../../guide/basic-config#mysql_config)。 如果 `mysql_config.host` 字段为空,则不创建数据库连接池,填写后将创建,且默认保持长连接。 \ No newline at end of file diff --git a/docs/guide/basic-config.md b/docs/guide/basic-config.md index 9937035c..b123eaa3 100644 --- a/docs/guide/basic-config.md +++ b/docs/guide/basic-config.md @@ -23,7 +23,7 @@ | `runtime` | 一些框架运行时调整的设置 | 见子表 `runtime` | | `light_cache` | 轻量内置 key-value 缓存 | 见字表 `light_cache` | | `worker_cache` | 跨进程变量级缓存 | 见子表 `worker_cache` | -| `sql_config` | MySQL 数据库连接信息 | 见子表 `sql_config` | +| `mysql_config` | MySQL 数据库连接信息 | 见子表 `mysql_config` | | `redis_config` | Redis 连接信息 | 见子表 `redis_config` | | `access_token` | OneBot 客户端连接约定的token,留空则无,相关设置见 [组件 - Access Token 验证](component/access-token) | 空 | | `http_header` | HTTP 请求自定义返回的header | 见配置文件 | @@ -73,17 +73,18 @@ | -------- | --------------------------- | ------ | | `worker` | 跨进程缓存的存储工作进程 id | 0 | -### 子表 **sql_config** +### 子表 **mysql_config** | 配置名称 | 说明 | 默认值 | | ------------------------ | ------------------------------ | ------------------------------------------------------------ | -| `sql_host` | 数据库地址(留空则不使用数据库) | 空 | -| `sql_port` | 数据库端口 | 3306 | -| `sql_username` | 连接数据库的用户名 | | -| `sql_database` | 要连接的数据库名 | | -| `sql_password` | 数据库连接密码 | | -| `sql_options` | PDO 数据库的 options 参数 | `[PDO::ATTR_STRINGIFY_FETCHES => false,PDO::ATTR_EMULATE_PREPARES => false]` | -| `sql_default_fetch_mode` | PDO 的 fetch 模式 | `PDO::FETCH_ASSOC` | +| `host` | 数据库地址(留空则不使用数据库) | 空 | +| `port` | 数据库端口 | 3306 | +| `username` | 连接数据库的用户名 | | +| `dbname` | 要连接的数据库名 | | +| `password` | 数据库连接密码 | | +| `options` | PDO 数据库的 options 参数 | `[PDO::ATTR_STRINGIFY_FETCHES => false,PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC]` | +| `pool_size` | MySQL 连接池大小 | 64 | +| `charset` | MySQL 字符集 | `utf8mb4` | ### 子表 **redis_config**