top-think / top-think/think-orm

关于orm pdo bigint的问题。

Open
#396 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
PHP
Stars
437
Forks
188
PR merge metrics
No merged PRs in 30d

Description

1 首先我确定这不是pdo的bug.

SELECT COUNT(*) AS think_count FROM `order` WHERE  `team_id` = 1  AND `pay_success_time` BETWEEN '2022-12-03 00:00:00' AND '2022-12-03 23:59:59'   AND `product_id` = '3584058982240785975'

此语句 product_id 在mysql中是bigint类型。直接查询 没有问题。 3584058982240785975 这串值 字符串与int都可以

  1. 直接使用pdo 查询 也能出正确的值
    image

  2. 使用orm的pdo查询
    image
    注意 此处是字符串。无法获取到预期的结果

image
也无法获取到预期的结果
5.
image
可以获取到预期结果
6. 对5的测试进行验证
image
可以获取到预期结果
7. 在看日志文件
image

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the SQL shown in the issue, comparing direct PDO results with the ORM queries and the logged SQL. Trace how the ORM handles the bigint value 3584058982240785975; the work is done when the ORM returns the expected result consistently for this value.

Written by the indexing model from the issue text.

Assessment

Tech stack
mysql, php
Domain
backend, databases
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.