| View previous topic :: View next topic |
| Author |
Message |
Fire-Fox Master

Joined: 23 Sep 2006 Posts: 270 Location: /dev/null
|
Posted: Tue Mar 06, 2012 5:14 pm Post subject: gzcompress |
|
|
Is there a way of gzcompress stuff before inserting it to database...? _________________ GreatZ
Fire-Fox | Denmark
Scripts: Relay | Store Text | TvMaze |
|
| Back to top |
|
 |
caesar Mint Rubber

Joined: 14 Oct 2001 Posts: 3741 Location: Mint Factory
|
Posted: Wed Mar 07, 2012 1:24 am Post subject: |
|
|
A quote from a user on this topic that is related to gzcompress.
This is a bad idea because:
- theoretically, there might be a sequence of data that, when compressed, leads to a SQL injection or simply breaks the query
- gzcompressed data can't be properly indexed and searched - you'll have a database full of garbled characters
- gzcompression is computationally expensive
Simply always sanitize your data before entering it into a database, using the string escaping method of your library (like mysql(i)_real_escape_string()) or parametrized queries. If you do that reliably, no further protection is necessary.
You will end up getting an error like:
| Quote: |
You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'cUÓyM›û]YûßTS§mÖø_öè|®SÝT?½¥®Ê!y{ëVùÊP†’Â1�'‰;(§�èh$1Cà�b
|
_________________ Once the game is over, the king and the pawn go back in the same box. |
|
| Back to top |
|
 |
Fire-Fox Master

Joined: 23 Sep 2006 Posts: 270 Location: /dev/null
|
Posted: Wed Mar 07, 2012 9:12 am Post subject: |
|
|
Okay, thanks for the reply  _________________ GreatZ
Fire-Fox | Denmark
Scripts: Relay | Store Text | TvMaze |
|
| Back to top |
|
 |
Ofloo Owner
Joined: 13 May 2003 Posts: 953 Location: Belguim
|
Posted: Sat Apr 14, 2012 3:14 am Post subject: |
|
|
look for a way to do it with images cause images like jpeg is basically just compressed data, .. read about "blob" type unless you're inserting text then you might better find something like drive compression never really looked into it but i know it used to be on ntfs, years ago when i still used windows, .. that there was this feature to compress all your data onto fly when you stored it on disk. I never saw much use for it and never really looked for something like that cause most of my files where jpeg or media files and then it's useless to compress them once more, .. it's only a waste of cpu time. I'm pretty sure you can set up some sort of zip drive, or whatever you want to call it in any os. _________________ XplaiN but think of me as stupid |
|
| Back to top |
|
 |
|