Postgres查询ILIKE和“%#{}%” [英] Postgres Querying ILIKE and "%#{}%"

查看:215
本文介绍了Postgres查询ILIKE和“%#{}%”的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我可以向我解释如何吗?防止SQL注入?

Can I get an explanation to me how the "?" prevents sql injection?

Candy.where("taste ILIKE ?", "%#{term}%")

为什么还使用%{term}%而不是#{term}?百分比代表什么?

Also why is "%{term}%" used as opposed to just #{term}? What do the percentages represent?

推荐答案

百分比是通配符,与值的任何部分的字符串匹配

Percentages are wild card characters that matches the string in any part of the value

这篇关于Postgres查询ILIKE和“%#{}%”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆