主键搜索无效 #1311
Labels
No Label
backport/done
backport/v1
blocked
db
oracle
db
sqlserver
duplicate
feature
cache
frontport/done
frontport/main
invalid
kind
breaking
kind
bug
kind
build
kind
dependencies
kind
docs
kind
driver
kind
enhancement
kind
feature
kind
performance
kind
proposal
kind
question
kind
refactor
kind
testing
need
feedback
need
test
proposal:accepted
RaspBerry Pi
regression
skip-changelog
upstream
wip
wontfix
No Milestone
No Assignees
1 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: xorm/xorm#1311
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
代码是这样:
engine.Id(core.PK{user.Appid, user.ProviderType, user.UserName}).Get(user)
查看engine的日志发现生成的sql是这样:
[SQL] SELECT
uid
,appid
,provider_type
,create_at
,time_zone
,country
,language
,email
,user_name
,firstname
,lastname
,endpoint_type
,email_login
,facebook_login
,birthdate
,age
,gender
,pwd
,ip
FROMuser_info
WHEREappid
=? ANDprovider_type
=? ANDtime_zone
=? ANDlanguage
=? ANDuser_name
=? ANDendpoint_type
=? ANDip
=? ANDappid
=? ANDprovider_type
=? ANDuser_name
=? LIMIT 1 []interface {}{1231231231, "email", 14, "ms", "XXX@foxmail.com", "web", "1.1.1.1", 1231231231, "email", "XXX@foxmail.com"} - took: 358.62µs实际执行的sql中将所有字段都加了进去,按文档说明应该是只搜索主键,请各位大佬帮忙看下
If your user has non-empty field value, it also will be as conditions. You can use an empty user(just new(User)) or you can be with
NoAutocondition().Get(user)
.