Max filter string length


#1

Hi,

I have created a MySQL service and it works well.

In the GET /DBAPI/{table_name} api call, the DSP gives the options of entering a “where” clause. You call it filter.

My question is: how long can the string that defines that filter be? does it have a max length? and if so what is it?

It works well for short filters like: name in (‘john’, ‘Adam’)

but what if that where clause needs to cover 5000 or more names? will it work?

Thanks in advance


#2

The max filter string length is really the maximum string length of the whole request (including URL)
This parameter is controlled by your web server. In Apache this is the LimitRequestLine directive and the default is 8190 bytes.
Given most names are more than 2 characters this would not likely work for you.

What will work is one of 2 things.

  1. Use a stored procedure. The names you want to filter on can be passed to the procedure as parameters. Since those are passed as a POST in the data payload, they do not count toward the limit request line.
  2. You can use verb tunneling (covered here: https://github.com/dreamfactorysoftware/dsp-core/wiki/Common-Headers-Parameters#http-verb-tunnelling.) Essentially you would do a POST with a data payload that included {“filter”: “your filter statement”} but set the method to GET. This allows you to pass large amounts of string data as a payload and then the software reinterprets it because of the GET method indication.