Skip to content

feat(database/gdb): add Exist support for checking records existance for certain condition #3854

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 24, 2024

Conversation

cyjaysong
Copy link
Contributor

database/gdb: add exist feature #3657 reopen

@cyjaysong cyjaysong changed the title database/gdb: add exist feature #3657 reopen database/gdb: add exist feature Oct 15, 2024
@gqcn
Copy link
Member

gqcn commented Oct 15, 2024

@cyjaysong 你好,我仔细看了一下,这个Exist能力可以通过Count来实现,内部并不需要执行Limit操作,因为Count操作通常都是只有1条记录,也只会取第一条记录的数据值。并且在最新版本中,如果Count查询的字段大于1,会有报错。因此这个Exist功能并不是很需要。

@gqcn gqcn added feature discuss We need discuss to make decision. labels Oct 15, 2024
@Issues-translate-bot
Copy link

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


@cyjaysong Hello, I took a closer look. This Exist capability can be implemented through Count. There is no need to perform the Limit operation internally, because the Count operation usually only has 1 record. Only the data value of the first record will be taken. And in the latest version, if the field queried by Count is greater than 1, an error will be reported. Therefore this Exist function is not really needed.

@cyjaysong
Copy link
Contributor Author

cyjaysong commented Oct 15, 2024

@gqcn 代码已修正, SQL样式:SELECT 1 FROM userWHEREid > 10000 LIMIT 1

@Issues-translate-bot
Copy link

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


@gqcn The code has been corrected

@cyjaysong
Copy link
Contributor Author

cyjaysong commented Oct 16, 2024

@gqcn 再看看

@Issues-translate-bot
Copy link

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


@gqcn

@gqcn gqcn changed the title database/gdb: add exist feature feat(database/gdb): add Exist support for checking records existance for certain condition Oct 16, 2024
@cyjaysong cyjaysong force-pushed the gdb-exist branch 6 times, most recently from 70c94c2 to 6349a12 Compare October 17, 2024 02:32
@cyjaysong cyjaysong force-pushed the gdb-exist branch 2 times, most recently from 2743454 to dfe009c Compare October 23, 2024 07:08
@gqcn gqcn merged commit e4c4fb5 into gogf:master Oct 24, 2024
20 checks passed
@cyjaysong cyjaysong deleted the gdb-exist branch October 24, 2024 08:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
discuss We need discuss to make decision. feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants