top-think / top-think/think-orm
Model::update() 当MySQL字段类型为bigint整型,更新条件字段值长度大于16的字符串类型,无法更新成功
Nobody has claimed this yet.
- Dominant language
- PHP
- Stars
- 437
- Forks
- 188
- PR merge metrics
- No merged PRs in 30d
Description
CREATE TABLE test (
id int unsigned NOT NULL AUTO_INCREMENT COMMENT '表自增id',
order_no bigint NOT NULL DEFAULT '0' COMMENT '分单编号',
order_sn bigint NOT NULL DEFAULT '0' COMMENT '订单编号',
update_time int unsigned NOT NULL DEFAULT '0' COMMENT '更新时间',
create_time int unsigned NOT NULL DEFAULT '0' COMMENT '创建时间',
PRIMARY KEY (id),
UNIQUE KEY order_no (order_no),
KEY order_sn (order_sn)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='测试';
INSERT INTO test (id, order_no, order_sn, update_time, create_time) VALUES (1, 3021080720351340511, 0, 0, 0);
// $data = ['order_sn'=>'21080715996084293','order_no'=>'3021080720351340511']; //字符串类型长度大于16更新不了
$data = ['order_sn'=>'21080715996084293','order_no'=>3021080720351340511]; //整型这样可以更新
$result = \app\model\Test::update($data,['order_no'=>$data['order_no']]);
return json($result);
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 by reproducing the provided test table and Model::update() calls, comparing the string and integer forms of the bigint order_no value. Trace the Model::update() path and its MySQL value handling; done means a string longer than 16 digits updates the matching row successfully without changing integer behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- mysql, php
- Domain
- backend, database
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100