How to handle special chars in Query Parameters
Asked by Lukas Plattner:

In my query I want to request some data from a mysql-database.

The Query is something like the following:

select field1, field2  
from table  
where field3 = :name

The actual query is more complex but that won't change anything for this example.

My Problem is that the name I am search for consits of characters like \&,...

When I add the macro (with active debug) to the page and use 'test1 \& test2' as Value for name, the debug information shows that the vaule is cut at the special char.

```
Debug information.
```

```
Query: test
```

```
Query parameters: [name=test ]
```

```
Query execution time: 49 ms
```

```
Template parameters: []
```

How to handle this?


Answers:
author: Felix Grund (Scandio)
body: Hi Lukas! Can you check if [this version](https://cloud.scandio.de/index.php/s/MscHbNvXxjTOax1) fixes your issue? Is a pre-release of version 2.0.8.

comments: author: Lukas Plattner
body: Hi!

Thanks it is working now with that version.


author: Felix Grund (Scandio)
body: Great! Can you work with this version for a few days and provide feedback if any errors occurred?


author: Lukas Plattner
body: I we see any error, I will report it.


author: Felix Grund (Scandio)
body: Hi Lukas!

Bad news: unfortunately I had to roll-back this solution because it caused serious issues in different cases. I'm still searching for a solution for the issue and I'll try to integrate it in our release 2.1 which will be released soon. I would recommend to switch back to the marketplace version and live with the "\&" issue for some more time, since the version I gave you might cause issues as soon as you update PocketQuery to the next official version.

I'm really sorry for the inconvenience and I promise I will find a solution for this!

Regards, Felix (Scandio)

comments: author: Felix Grund (Scandio)
body: Ok, I think I implemented a good solution. Please install [PocketQuery 2.1-m8](https://cloud.scandio.de/index.php/s/QClcNkXBm5Gkb8i)


author: Lukas Plattner
body: Hi!

ok, we will try to install it within the next days.

Regards Lukas


author: Cuto Calleja
body: Testing 2.1 I have issues with the '\&' character when is included in an item within the IN clause...


author: Felix Grund (Scandio)
body: Can you post your query?


author: Cuto Calleja
body: What is not working is ... WHERE Field1 IN (:Filter) ... being the "Filter" a ListOfStrings in which one of the items is 'Backup \& Restore'...

I found a work around using the replace function in SQL to replace the '\&' by the '-' and then it works!!! but what is stored in the (Oracle) database is the 'Backup \& Resore'...

Thanks Felix!


author: Felix Grund (Scandio)
body: While we're still working on version 2.1, I'm thinking about providing a new minor "hotfix" version for this issue. In that case, you'll have this next week.


author: Lukas Plattner
body: Hi!

Thanks for the Info, when is it planed to be ready?

Ragards


author: Felix Grund (Scandio)
body: Hi Lukas,

You are right, using the "\&" character is currently not possible for query parameters. This is definitely something we need to fix soon. I created an issue internally and I'll let you know as soon as it is fixed.

Regards, Felix (Scandio)


Tags: confluence-administration

pocketquery