Skip to content
Advertisement

How can I pass a parameter in an sql query without making it explicit in the query itself?

I’m testing my ignite cache, inserting a simple User in the cache and then through a query I get the User entered previously returned I have a problem writing the query. I noticed that writing like this:

The test works fine, but if I write the query like this

Now it doesn’t work anymore. This is my first time trying to use queries and caches, but technically, shouldn’t it be the same?Is there a different way to write the query when passing parameters like this?

Advertisement

Answer

The correct way is to use parameter substitution, avoid SQL injection and other troubles:

User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement