top-think / top-think/think-orm
在配置有多个数据库的情况下,model::withCount不能生成正确的sql语句
Open
Nobody has claimed this yet.
- Dominant language
- PHP
- Stars
- 437
- Forks
- 188
- PR merge metrics
- No merged PRs in 30d
Description
在配置有多个数据库的情况下,model::withCount不能生成正确的sql语句,如下
SELECT COUNT(*) AS think_count FROM `xxx_table` `count_table` WHERE ( ( `count_table`.`xxx_field` =xxx ) ) AND `count_table`.`delete_time` = '0'
生成的sql语句不会带上相应的连接信息导致PDO报错。
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at model::withCount and reproduce the query with multiple databases configured. Inspect how the count query chooses its connection, then verify that the generated SQL uses the corresponding connection and no longer causes a PDO error. The issue names no source file or test, so locating the relevant implementation and regression coverage is part of the work.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php
- Domain
- database
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 30/100