gpt4 book ai didi

mysql - 什么是 SELECT 1=1 FROM TABLE?

转载 作者:太空宇宙 更新时间:2023-11-03 11:23:30 25 4
gpt4 key购买 nike

我在 MySql 存储过程中找到了一个查询 where

 SELECT 1=1 FROM ITEM_TABLE WHERE product_code = productCode;

1=1 是什么意思?它是否意味着 boolean true?输出是几行 1。输出是什么意思?我们真的需要执行此类检查吗?

最佳答案

有时他们使用这个短语来破坏 Sql 注入(inject)中的查询本质上,它意味着一个条件永远为真

有时它用于创建多个搜索例如:

 string x ;
x="select * from tbl_test where 1=1";
if(txtId.text != ""){

x += " And id=" + txtId.text + "";

}

祝你好运

关于mysql - 什么是 SELECT 1=1 FROM TABLE?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56982511/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com