▲ | ratorx 9 days ago | ||||||||||||||||||||||
Added example to parent comment. This example still works, the entire f-string is sanitised (including whatever the value of name was). Assuming sqlstring is the sanitisation function. The “template” would be a separate function that returns an f-string bound from function arguments. | |||||||||||||||||||||||
▲ | nhumrich 9 days ago | parent [-] | ||||||||||||||||||||||
Yes. Only if your dev remembers to use sanatized all the time. This is how most SQL works today. You could also forget and accidentally write a f-string, or because you dont know. But with t-strings you can actually prevent unsanatized inputs. With your example, you need to intentionally sanitize still. You cant throw an error on unsanitized because the language has no way to know if its sanitized or not. Either way, its just a string. "returning an f-string" is equivalent to returning a normal string at runtime. | |||||||||||||||||||||||
|