php-crud-api icon indicating copy to clipboard operation
php-crud-api copied to clipboard

Create a record with compressed values

Open coolbq opened this issue 5 years ago • 2 comments

Hi, I used COMPRESS function of MySQL to store compressed strings in mysql db. Is it possible to post a string with "POST /records/posts" command and store some field compressed with MySQL COMPRESS command?

coolbq avatar Oct 21 '20 13:10 coolbq

Hi,

Thank you for creating this issue. Unfortunately there is no support for reading/writing compressed strings in the software.

A workaround: Reading and writing binary data is supported (using base64 strings). The MySQL COMPRESS function uses zlib, so you could compress/decompress outside the API. You could for instance try to write middleware that reads/writes zlib data to specific fields. If you put enough effort in it, this should be possible.

Kind regards, Maurits

mevdschee avatar Oct 21 '20 16:10 mevdschee

Thanks Maurits, your middleware idea is great! I'll try this. Thanks again!

Regards, coolbq

coolbq avatar Oct 23 '20 01:10 coolbq